Compare commits
757 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6d7dbaa685 | |||
| 05d7ba80e0 | |||
| cdd969bc64 | |||
| 4f5ad93e83 | |||
| c8f275ceb0 | |||
| 87bb565607 | |||
| 333811ca7b | |||
| b052925815 | |||
| f29ee3a772 | |||
| a059ee52a4 | |||
| 1e8a05b13a | |||
| 263e28634f | |||
| e40b7928c9 | |||
| f783ae12d9 | |||
| 730e131ad5 | |||
| 951465e810 | |||
| fd9fbe61da | |||
| ed07b798e9 | |||
| d4308f1113 | |||
| a1fa5e7178 | |||
| a484fcb09d | |||
| a17a59c8fe | |||
| cf7429e55e | |||
| 38a6eb9739 | |||
| cdc78a16a5 | |||
| 6a4801b152 | |||
| 4c00836de9 | |||
| e66a822d8a | |||
| 9f905c73fd | |||
| 8a6a7d7e36 | |||
| a2d230777f | |||
| 3fe211d602 | |||
| 865cd7235e | |||
| 2b61c1b77c | |||
| c653a49fe3 | |||
| 15c282d1e5 | |||
| d8ce474882 | |||
| 9fc9168f1c | |||
| bb864ee2e1 | |||
| d96a108ea0 | |||
| 9c6d7dbf7b | |||
| 8c1587e612 | |||
| 3679e8d579 | |||
| e0dcb76a41 | |||
| 90290e5957 | |||
| 64b9992366 | |||
| 3c18fd4e3d | |||
| 523ee08608 | |||
| e650d04b34 | |||
| bb228c82c1 | |||
| cdfae47f94 | |||
| 93052dde8d | |||
| c2e5f45769 | |||
| c6691f7ef7 | |||
| 7139d3404f | |||
| 0cdd0b34f6 | |||
| 1c3084df01 | |||
| 95430c15f9 | |||
| 5d9b0a171b | |||
| 14403a8cb8 | |||
| 5971de4590 | |||
| 950c3a59cc | |||
| 960cfda886 | |||
| eb0c520ad6 | |||
| 646c691107 | |||
| 23fb69bbe3 | |||
| 498c78e23a | |||
| 83b7836068 | |||
| 2cae00d9d3 | |||
| d7de09d272 | |||
| 28761c2eba | |||
| 48a9189c12 | |||
| 5b5c4361ee | |||
| 33b053ede8 | |||
| 5c762b40bf | |||
| ca0bf01e23 | |||
| 1bd98e1641 | |||
| ef132f0ab4 | |||
| 62a90218e1 | |||
| 360b0271a5 | |||
| fe8d169b36 | |||
| b3c3f4e0ba | |||
| 6fc3618bd5 | |||
| 034ffb924b | |||
| 3ee0da8f17 | |||
| a6f5c43c9f | |||
| c2f8050802 | |||
| e3c9bab5e5 | |||
| 383a8f5fc7 | |||
| c1441da84a | |||
| 18eee87ae9 | |||
| cbd3fd7d9c | |||
| 729ca7f2f8 | |||
| 7a87dac5cd | |||
| 0196f5326f | |||
| 2b0be5b36c | |||
| 6513f39863 | |||
| 2407b79b8b | |||
| a77a75fe72 | |||
| ea801b6374 | |||
| 554911ee4e | |||
| 7052e98f2c | |||
| 6701dbec13 | |||
| bd56366374 | |||
| 3310bf9924 | |||
| 21e61a347e | |||
| 134a7ca404 | |||
| 7b519f1c20 | |||
| 65b49f5be6 | |||
| 171c9cc802 | |||
| 4e4f395994 | |||
| 1755da1e81 | |||
| c3facdf7dc | |||
| 0b79f9fdf1 | |||
| 3b2234ee76 | |||
| b57b50cc0c | |||
| 781c3438c2 | |||
| e8721581cd | |||
| ef6a2e594f | |||
| 3b32118506 | |||
| 77857ced5a | |||
| 48a0d87f2f | |||
| d6984b7616 | |||
| ad1c072d04 | |||
| e6aeab1fc0 | |||
| 6994e82281 | |||
| eb5efbd0ca | |||
| d130a9d0b7 | |||
| b9e8a9af10 | |||
| 3bb11e2ab4 | |||
| 9ce0d04ceb | |||
| 75968fb87e | |||
| a268911ffe | |||
| 5707de083a | |||
| 8d97af30c0 | |||
| bcb55ea61a | |||
| 6af84076b0 | |||
| efd150059b | |||
| e91a1432d1 | |||
| 7c9b0751f8 | |||
| 66396cf4a5 | |||
| 0f0b8bbf68 | |||
| 1142892aca | |||
| 1330fadb00 | |||
| 3d7e4f8900 | |||
| 27ec971d45 | |||
| 261f79884f | |||
| 20797726bb | |||
| f92877a5a3 | |||
| 8b5e15ef5b | |||
| 62fe7519b8 | |||
| 579498f9fa | |||
| b447e683f7 | |||
| 4b9d3d514d | |||
| 30aa6960fc | |||
| 072f686193 | |||
| 3e4dd17c54 | |||
| a1059b10c1 | |||
| 19c1c5fea6 | |||
| 29936a7238 | |||
| 8f46c10cb8 | |||
| b9348695f6 | |||
| b2c031f401 | |||
| 071ea825b7 | |||
| 5e8812bfc5 | |||
| 0b00e04cf3 | |||
| a0386b12ad | |||
| 75df86e057 | |||
| 3fc51cf8b4 | |||
| 42bcaa8aa7 | |||
| 46cbfbfb21 | |||
| 26ac673e3e | |||
| fc2020f573 | |||
| 957ac32358 | |||
| 838b33b9ab | |||
| 36b4656906 | |||
| e44f94b493 | |||
| acbfa890f6 | |||
| d9bde2ab22 | |||
| 1dd52d7b47 | |||
| 4eda8d0571 | |||
| 4b919b20bc | |||
| 9835d6920f | |||
| 517e301d5a | |||
| 1bd5d40c8f | |||
| 00ebf601ff | |||
| 8d8b24a320 | |||
| 04c907d433 | |||
| 573de6d923 | |||
| 158518c79e | |||
| 42e9f29f8a | |||
| 4eebc40ec3 | |||
| 32d68836a4 | |||
| ae8b4733fd | |||
| 21865b22e7 | |||
| 1fcccd8722 | |||
| 0f6643a972 | |||
| 6c8fd471b4 | |||
| b5dd9b2e8a | |||
| c95fad5c21 | |||
| 0b73fde437 | |||
| 36100ed441 | |||
| 48fac357b6 | |||
| 76756f1e10 | |||
| f2b9070a2c | |||
| edfcc33471 | |||
| 9d49d402eb | |||
| a59bec2a6f | |||
| f773514761 | |||
| 62f859ed24 | |||
| 4b4508fd8b | |||
| c31822a6b4 | |||
| 8c2057e569 | |||
| f84ab6c2e4 | |||
| 5c42461b50 | |||
| cc4940d794 | |||
| 29bfe17f2c | |||
| 06abb64d09 | |||
| df608012a7 | |||
| 817212be50 | |||
| 04be2d16f7 | |||
| 50c8887deb | |||
| beb47bcab8 | |||
| d240de81d1 | |||
| ff840af0b7 | |||
| d721f94f2b | |||
| cb13d527cd | |||
| d661ace551 | |||
| 6ff9b28f66 | |||
| e414f5b771 | |||
| 7ecb4daee6 | |||
| b3f1550b40 | |||
| 17c70ff8a6 | |||
| eda7d884ba | |||
| b09d50dd4a | |||
| a0b04d09a7 | |||
| bb9cd179ed | |||
| 4cc87b1326 | |||
| f682557e5f | |||
| 1303c0fb82 | |||
| c343287349 | |||
| 7d872ea52a | |||
| 62bb90821e | |||
| 62dc08644a | |||
| 68639cb426 | |||
| d98bf4c5ff | |||
| a35f4515bd | |||
| c261edf5c7 | |||
| 4ce7448979 | |||
| 2e814c9d0a | |||
| 5ef22c2458 | |||
| d6688ad206 | |||
| a569efe93d | |||
| 9393fe3643 | |||
| ca560fd8b5 | |||
| 678c8d5c84 | |||
| 96f7dba2c0 | |||
| c96d32990d | |||
| 9e7a680127 | |||
| 79957c645f | |||
| 42361660e3 | |||
| 54c42455ad | |||
| b5d9af91dc | |||
| 6dd561a11c | |||
| 3105d5bc9f | |||
| e08e3de631 | |||
| 700562d609 | |||
| f97dd08bbc | |||
| 4599bb5251 | |||
| 6f35469598 | |||
| 180389d33f | |||
| 00b78393b3 | |||
| 7cf0235ef7 | |||
| af9f840e8d | |||
| 4e2cfa0fe0 | |||
| 2d05bbbf4c | |||
| 43066fb582 | |||
| 97e28f897e | |||
| 84ea58618b | |||
| 79c65ea145 | |||
| 9697eb3054 | |||
| 5488ffe860 | |||
| 9c501dc357 | |||
| 3e2c0af7ad | |||
| 0020e31d55 | |||
| f04d0ddc8f | |||
| ca8f1866fb | |||
| 4b39124bf8 | |||
| f6f9359c13 | |||
| 529150a7d8 | |||
| 56f79b2da5 | |||
| 9394ec0f27 | |||
| c6f4cac946 | |||
| 21a59229a9 | |||
| 36765f08a9 | |||
| acb63ae043 | |||
| 343d3f42d4 | |||
| 51ebf938b7 | |||
| cf7238ac5e | |||
| 7295679d8f | |||
| f58768ee9e | |||
| 90d21c6351 | |||
| c8da07ae5f | |||
| b8d2dfc18d | |||
| 363cf89cee | |||
| fe8e792113 | |||
| e14c046a17 | |||
| d02364e83b | |||
| ebc715ceb2 | |||
| eac985d755 | |||
| d6e00bc466 | |||
| a8a8555b4f | |||
| fd3e2cd428 | |||
| d71c1a0776 | |||
| 25210e010a | |||
| d332c8e507 | |||
| 4a3290f39d | |||
| 696857a008 | |||
| f6f44d8360 | |||
| cff5ca7c2d | |||
| d494218b19 | |||
| 06eb4fd769 | |||
| 900d4a8039 | |||
| 0773b6d88a | |||
| 94c4ff2443 | |||
| 6a959efde8 | |||
| eee9636851 | |||
| 0ae57526db | |||
| b8335d5474 | |||
| b47dec983c | |||
| e032566df0 | |||
| c9e2652fa7 | |||
| cdf933d5c2 | |||
| f52d41eeef | |||
| a63c76ec70 | |||
| 27f6b7542e | |||
| 935742572d | |||
| 513534f7af | |||
| dba6833aa2 | |||
| 3a08925b79 | |||
| 2c30590d5d | |||
| 059e523871 | |||
| 9da96dbd6a | |||
| 5dc1b69ef7 | |||
| 1d16b4b752 | |||
| 8dd9f8482a | |||
| c27559d6b2 | |||
| ecde575d00 | |||
| edd6f7f401 | |||
| 092cc5ec3f | |||
| 2027f4011a | |||
| 8bd98c3bd8 | |||
| 6cd7435119 | |||
| 98775c265b | |||
| 0ad2a91cdd | |||
| 09b004629f | |||
| 29994e98de | |||
| 0b626ac5e0 | |||
| 5f28929d64 | |||
| a96887e70a | |||
| 24ffb2cf6f | |||
| df0d1ea93a | |||
| 3982b8da9d | |||
| 312c646c48 | |||
| 9097a7f414 | |||
| fda79a220b | |||
| ff396418f7 | |||
| a6e991c75a | |||
| 8c4cf07c54 | |||
| 3e141207a0 | |||
| 28150789b8 | |||
| a71a1a67be | |||
| 0c0feb164f | |||
| bbee1d9e21 | |||
| 248edcf1b0 | |||
| eff3041098 | |||
| ff285b448f | |||
| 4307c81b65 | |||
| 05127e02e7 | |||
| c092ab42af | |||
| 0d99e663aa | |||
| 4f270213e7 | |||
| f1f026cacf | |||
| 2d5cdf107c | |||
| fa8cf48660 | |||
| b005d5d510 | |||
| 4d08b631f7 | |||
| 66c48b3358 | |||
| 228232965b | |||
| 8ed983a254 | |||
| e61a1e9ec3 | |||
| 2fd9b4b822 | |||
| 340196b809 | |||
| 480b9726f6 | |||
| 1ed929a22b | |||
| b1b607f273 | |||
| a00045a050 | |||
| f4985556b3 | |||
| c29478fdc6 | |||
| 250f6a1b0f | |||
| 10eac8c81e | |||
| 9a21803f8f | |||
| 7b3767ec20 | |||
| 258208056c | |||
| d40a865a2b | |||
| 318dbbcb88 | |||
| f94adf67d5 | |||
| 6be3a43c3c | |||
| d31534bb87 | |||
| 42055d95cd | |||
| b6d4db166b | |||
| 6eb8fe2896 | |||
| 7ea7a17fb4 | |||
| 3de2b5527f | |||
| bd9c2a4bc2 | |||
| 8cb8e0d232 | |||
| ed5f906fbb | |||
| bbbfa6457f | |||
| d0aa76458d | |||
| 2f7e8aee5a | |||
| 8770bc0898 | |||
| a4e8329337 | |||
| 0d0833980a | |||
| c3db183b64 | |||
| cc049c74c3 | |||
| 7664fd2dc6 | |||
| 5aedafd786 | |||
| 317c441994 | |||
| 4124e8b4bb | |||
| ba28c8f782 | |||
| dd78b8f983 | |||
| ff274fa59d | |||
| 4203758fa8 | |||
| d0c0a787dd | |||
| b884ed5941 | |||
| bb1be809d1 | |||
| c587c353c5 | |||
| 4e66f86add | |||
| c107be7b61 | |||
| 23b87ccdd7 | |||
| d5038f41fe | |||
| 3c9e9efc97 | |||
| 6eb4b2d437 | |||
| 8bfe7b0759 | |||
| ec0558f5ba | |||
| 0efdee5e6e | |||
| 5d7fa92613 | |||
| fc47a37c54 | |||
| 4d15d33bee | |||
| 8f22de6a46 | |||
| a33234adf2 | |||
| 5186a0bef8 | |||
| c8a93bcabe | |||
| 2a31eb2aba | |||
| 0b18f96813 | |||
| 41624e65d6 | |||
| 34e1739a71 | |||
| 8aab9fc84e | |||
| b68667b9c2 | |||
| b8c4c7694b | |||
| 793359862b | |||
| 55aa143507 | |||
| 5cb47da3f1 | |||
| 528f17d06e | |||
| 7b22dff89a | |||
| da0f55caa1 | |||
| 0de172734c | |||
| e1ad263f90 | |||
| 708c3d4b90 | |||
| 107dc9be23 | |||
| 59f7f1c961 | |||
| 7293a38647 | |||
| 91a51bbf24 | |||
| 05f4ac39fa | |||
| fa9632cb54 | |||
| d905332e97 | |||
| ceba19a45c | |||
| 3dcfe5a4c0 | |||
| ddc368559d | |||
| a7889e19ee | |||
| eaaf4e9486 | |||
| adc358399e | |||
| 55a21bfe31 | |||
| 1cdea1f1ea | |||
| 7909173f5d | |||
| bf711cc097 | |||
| 162751f709 | |||
| 93dc1eb447 | |||
| e2e6731171 | |||
| 8c59e41bfa | |||
| b1f87d5ef0 | |||
| b874c56751 | |||
| 4c4abafedc | |||
| 36e2b9cd95 | |||
| 214c3994df | |||
| 7e69d60652 | |||
| cbc7cdb686 | |||
| f372737b2f | |||
| 41868f952b | |||
| 70bb50e3b7 | |||
| c6f3ea3932 | |||
| d0d82e9f34 | |||
| ced90c8a18 | |||
| 6e5c04f6c5 | |||
| 99c7eacdeb | |||
| 7012c95569 | |||
| cdc80e6bfd | |||
| 294fa223c9 | |||
| f8fed9810a | |||
| d01f8ac051 | |||
| 0316f650ed | |||
| e504d7159c | |||
| 98a784483a | |||
| 72a7266a87 | |||
| 3cb24afce3 | |||
| 7bf69ea780 | |||
| 7552335ccf | |||
| af5e30b2b2 | |||
| 1cdacd7771 | |||
| fa363b52eb | |||
| 2a22a20251 | |||
| 5ce9c733ce | |||
| 8ecf433c53 | |||
| a4aefa9c98 | |||
| 40124ef728 | |||
| 66cf7b94db | |||
| 04e8993910 | |||
| 96ea7a04ed | |||
| 7137b20762 | |||
| 6cb38c56fa | |||
| f619fb8df4 | |||
| 994952712c | |||
| 77a84ad325 | |||
| ea35916f09 | |||
| 380b565487 | |||
| fe7b49250d | |||
| e0077b7175 | |||
| 210c80e48e | |||
| 6f1773b841 | |||
| eb6a7272f9 | |||
| 63f865a594 | |||
| 1808fd1d22 | |||
| 78f2c07d30 | |||
| 521591639c | |||
| 40451d3a90 | |||
| 137a1ef570 | |||
| 29f8071c3b | |||
| 23f8a8b2d5 | |||
| fcbb050b48 | |||
| 3dd0115779 | |||
| b97643453d | |||
| ee1c3d9837 | |||
| f8c673b03c | |||
| acf393873e | |||
| 3cef1996eb | |||
| 3c1f14fb22 | |||
| 82e055104c | |||
| 3fa45f00c6 | |||
| fab5e031f9 | |||
| 9afd3da2b3 | |||
| fb800de092 | |||
| 0a8666b01a | |||
| 48c3f683a6 | |||
| 256242cfd7 | |||
| 8850a21f66 | |||
| 0f6ab8bf12 | |||
| c21d587016 | |||
| 7165c2ac74 | |||
| 0421a9aba5 | |||
| 53a4d06a8d | |||
| 6070bbb37b | |||
| f13e3235c4 | |||
| 20b3b4c38d | |||
| 641b5a27ab | |||
| ea996d378b | |||
| f4f8118ad6 | |||
| dd89bfab41 | |||
| 38882aa139 | |||
| b8e5f7b428 | |||
| bb033deac1 | |||
| 90d04a010b | |||
| 6509786f2b | |||
| 2a6554678e | |||
| 8bd492084d | |||
| ba376027e8 | |||
| f89a6106fa | |||
| fa492071fe | |||
| 6215cbba29 | |||
| 9b67243b6b | |||
| 544ee202ca | |||
| fe3441d95f | |||
| d524f2eadc | |||
| 8159824033 | |||
| babe07eec3 | |||
| e88926fb4f | |||
| 0d6e90470b | |||
| a5c1b7924d | |||
| be58e75573 | |||
| ff37cc27be | |||
| b449a10a09 | |||
| 68cd3002ce | |||
| 261bc97b3e | |||
| 4ef90e61e9 | |||
| b71cc1f99d | |||
| 932c5faef9 | |||
| 49285bf337 | |||
| e8f4b6ff60 | |||
| 8639d45416 | |||
| 800d0e7ad4 | |||
| 81c0b420c6 | |||
| 5d54d89044 | |||
| ed3f7bb078 | |||
| b881fff43f | |||
| ea0487cdef | |||
| 44749626b0 | |||
| 9b83cae1b5 | |||
| cc4e898144 | |||
| 1114a3755a | |||
| 95694f0965 | |||
| 5912b69773 | |||
| de1f45f535 | |||
| 4c3a318ffa | |||
| 65ad94b87c | |||
| 74a41120d6 | |||
| 35ea0a22e3 | |||
| 318637c781 | |||
| 06858a584a | |||
| 6f4d296da2 | |||
| b413ff4684 | |||
| 72b8b2e858 | |||
| c250f825ed | |||
| a2a309f9a0 | |||
| 0850628c6c | |||
| 2082bc6a89 | |||
| 2de9208ce8 | |||
| 31f3479fbf | |||
| 221ed2ac87 | |||
| 2266158778 | |||
| e0c0c1dd17 | |||
| bc7c322c62 | |||
| c44a461146 | |||
| 9a6b0b8c31 | |||
| e0fd61d727 | |||
| 802259a6c8 | |||
| 4ae6235d64 | |||
| 13d8eb3321 | |||
| 3fe1755d5d | |||
| ab7d7d4d57 | |||
| d2c4d59f81 | |||
| 26bcfa6122 | |||
| 1c8e09b4aa | |||
| 2980b46bf8 | |||
| 1bb79a6cb3 | |||
| f91d23a739 | |||
| 2ac4573661 | |||
| c9ff42d096 | |||
| 30830852bf | |||
| 3550f90dad | |||
| 99af155ddd | |||
| 2a0e7b1d8c | |||
| d5e66b50b3 | |||
| 55aa35d9fe | |||
| 59e08ceb6d | |||
| f3a6d622a2 | |||
| 2704764d80 | |||
| 61e68a15a1 | |||
| 5f26d8c331 | |||
| 7c814fa48f | |||
| f603c2c38e | |||
| 207174aa0a | |||
| ced66d9d66 | |||
| d0958a89f9 | |||
| 392e57b6a0 | |||
| 250524cf5b | |||
| dbdc0e44d1 | |||
| 954bc8e887 | |||
| 0e0984010b | |||
| ddff536561 | |||
| f0bf659715 | |||
| 955ea66652 | |||
| d8a1fab050 | |||
| 8e1463334c | |||
| 79aa88fddd | |||
| 88c5228e61 | |||
| e0dbb85732 | |||
| 0c9993773c | |||
| 5b6f95647b | |||
| 8061730d7b | |||
| ea0f449e1b | |||
| 4564ed7412 | |||
| 61339394d7 | |||
| 1a63bccf46 | |||
| fcd3d82558 | |||
| 9063970932 | |||
| a79905af9a | |||
| 58bbab621c | |||
| 29e944addb | |||
| bfec56ac5e | |||
| 86f5f11cf8 | |||
| 497dc38a4b | |||
| dd401b0dfe | |||
| 0170fcddd0 | |||
| fd54c1631f | |||
| f8001bbf14 | |||
| 479d7a42d6 | |||
| 4f4e9b4828 | |||
| 4258188126 | |||
| 78c1ecc30c | |||
| 3e2cc3cc4c | |||
| 9fdaa9daec | |||
| df426e4a12 | |||
| 48e1f7f484 | |||
| 0803f695fa | |||
| 5279102245 | |||
| e10d8c46e2 | |||
| c71b2db9a3 | |||
| c7485d9d5f | |||
| cd6c68cf20 | |||
| 6220e076f4 | |||
| d70cfe4c8c | |||
| 533c6717a2 | |||
| 84d82ce72e | |||
| 773a4d7603 | |||
| 0f82d8c809 | |||
| 030dae8824 | |||
| c47da95926 | |||
| 3ea7982a85 | |||
| 189b888019 | |||
| 5795f1b6b3 | |||
| 7bcf5222e3 | |||
| a40e05798d | |||
| 8d080e0994 | |||
| 3671f1963e | |||
| 452c5815e5 | |||
| b73f9fec06 | |||
| c1f3de62ee | |||
| 0bc281384d | |||
| 7eb9672445 | |||
| c943722407 | |||
| bce29fbd43 | |||
| bbdca02068 | |||
| 6115822226 | |||
| 1209205766 | |||
| 1349e5d2f9 | |||
| 6c578308b0 | |||
| aaa2f20a5f | |||
| bef758bae6 | |||
| 6ba8dbf909 | |||
| 6f25060b32 | |||
| e8b23a3efb | |||
| 13537c6d64 | |||
| 1e67fe7005 | |||
| 094a136394 | |||
| fa1da2e471 | |||
| 63e37835e0 | |||
| 49d1413f72 | |||
| 6fb325de02 |
@@ -2,6 +2,7 @@
|
||||
'plugins': [
|
||||
'babel',
|
||||
'promise',
|
||||
'jsdoc',
|
||||
],
|
||||
'env': {
|
||||
'browser': true,
|
||||
@@ -191,7 +192,6 @@
|
||||
'property': 'str',
|
||||
'message': 'Use AMD module "core/str" or M.util.get_string()'
|
||||
}],
|
||||
|
||||
},
|
||||
overrides: [
|
||||
{
|
||||
@@ -200,7 +200,23 @@
|
||||
rules: {
|
||||
'no-undef': 'off',
|
||||
'no-unused-vars': 'off',
|
||||
'no-unused-expressions': 'off'
|
||||
'no-unused-expressions': 'off',
|
||||
|
||||
// === JSDocs ===
|
||||
"jsdoc/check-access": 'off',
|
||||
"jsdoc/check-alignment": 'off',
|
||||
"jsdoc/check-param-names": 'off',
|
||||
"jsdoc/check-property-names": 'off',
|
||||
"jsdoc/empty-tags": 'off',
|
||||
"jsdoc/implements-on-classes": 'off',
|
||||
"jsdoc/multiline-blocks": 'off',
|
||||
"jsdoc/require-jsdoc": 'off',
|
||||
"jsdoc/require-param": 'off',
|
||||
"jsdoc/require-param-name": 'off',
|
||||
"jsdoc/require-param-type": 'off',
|
||||
"jsdoc/require-property": 'off',
|
||||
"jsdoc/require-property-name": 'off',
|
||||
"jsdoc/require-property-type": 'off',
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -211,7 +227,7 @@
|
||||
},
|
||||
// We're using babel transpiling so use their parser
|
||||
// for linting.
|
||||
parser: 'babel-eslint',
|
||||
parser: '@babel/eslint-parser',
|
||||
// Check AMD with some slightly stricter rules.
|
||||
rules: {
|
||||
'no-unused-vars': 'error',
|
||||
@@ -238,11 +254,54 @@
|
||||
// === Promises ===
|
||||
// We have Promise now that we're using ES6.
|
||||
'promise/no-native': 'off',
|
||||
'promise/avoid-new': 'off'
|
||||
'promise/avoid-new': 'off',
|
||||
|
||||
// === JSDocs ===
|
||||
"jsdoc/check-access": [
|
||||
'error',
|
||||
],
|
||||
"jsdoc/check-alignment": 1, // Recommended.
|
||||
"jsdoc/check-param-names": [
|
||||
'error',
|
||||
],
|
||||
"jsdoc/check-property-names": [
|
||||
'error',
|
||||
],
|
||||
"jsdoc/empty-tags": [
|
||||
'error',
|
||||
],
|
||||
"jsdoc/implements-on-classes": [
|
||||
'error',
|
||||
],
|
||||
"jsdoc/multiline-blocks": [
|
||||
'error',
|
||||
],
|
||||
"jsdoc/require-jsdoc": [
|
||||
'error',
|
||||
],
|
||||
"jsdoc/require-param": [
|
||||
'error',
|
||||
],
|
||||
"jsdoc/require-param-name": [
|
||||
'error',
|
||||
],
|
||||
"jsdoc/require-param-type": [
|
||||
'error',
|
||||
],
|
||||
"jsdoc/require-property": [
|
||||
'error',
|
||||
],
|
||||
"jsdoc/require-property-name": [
|
||||
'error',
|
||||
],
|
||||
"jsdoc/require-property-type": [
|
||||
'error',
|
||||
],
|
||||
},
|
||||
parserOptions: {
|
||||
'ecmaVersion': 9,
|
||||
'sourceType': 'module'
|
||||
'sourceType': 'module',
|
||||
'requireConfigFile': false,
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
@@ -20,8 +20,9 @@ jobs:
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Configuring node & npm
|
||||
shell: bash -l {0}
|
||||
run: nvm install
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
|
||||
- name: Installing node stuff
|
||||
run: npm install
|
||||
|
||||
@@ -111,8 +111,22 @@ module.exports = ({template, types}) => {
|
||||
if (!this.seenDefine && path.get('callee').isIdentifier({name: 'define'})) {
|
||||
// We only want to modify the first instance of define that we find.
|
||||
this.seenDefine = true;
|
||||
|
||||
// Get the Moodle component for the file being processed.
|
||||
var moduleName = getModuleNameFromFileName(this.file.opts.filename);
|
||||
|
||||
// The function signature of `define()` is:
|
||||
// define = function (name, deps, callback) {...}
|
||||
// Ensure that if the moduel supplied its own name that it is replaced.
|
||||
if (path.node.arguments.length > 0) {
|
||||
// Ensure that there is only one name.
|
||||
if (path.node.arguments[0].type === 'StringLiteral') {
|
||||
// eslint-disable-next-line
|
||||
console.log(`Replacing module name '${path.node.arguments[0].extra.rawValue}' with ${moduleName}`);
|
||||
path.node.arguments.shift();
|
||||
}
|
||||
}
|
||||
|
||||
// Add the module name as the first argument to the define function.
|
||||
path.node.arguments.unshift(types.stringLiteral(moduleName));
|
||||
// Add a space after the define function in the built file so that previous versions
|
||||
|
||||
+119
-44
@@ -30,6 +30,7 @@
|
||||
* @param {String} srcPath the matched src path
|
||||
* @return {String} The rewritten destination path.
|
||||
*/
|
||||
|
||||
const babelRename = function(destPath, srcPath) {
|
||||
destPath = srcPath.replace('src', 'build');
|
||||
destPath = destPath.replace('.js', '.min.js');
|
||||
@@ -53,65 +54,139 @@ module.exports = grunt => {
|
||||
|
||||
// Register JS tasks.
|
||||
grunt.registerTask('yui', ['eslint:yui', 'shifter']);
|
||||
grunt.registerTask('amd', ['ignorefiles', 'eslint:amd', 'babel']);
|
||||
grunt.registerTask('amd', ['ignorefiles', 'eslint:amd', 'rollup']);
|
||||
grunt.registerTask('js', ['amd', 'yui']);
|
||||
|
||||
// Register NPM tasks.
|
||||
grunt.loadNpmTasks('grunt-contrib-uglify');
|
||||
grunt.loadNpmTasks('grunt-contrib-watch');
|
||||
grunt.loadNpmTasks('grunt-rollup');
|
||||
|
||||
// Load the Babel tasks and config.
|
||||
grunt.loadNpmTasks('grunt-babel');
|
||||
const babelTransform = require('@babel/core').transform;
|
||||
const babel = (options = {}) => {
|
||||
return {
|
||||
name: 'babel',
|
||||
|
||||
transform: (code, id) => {
|
||||
grunt.log.debug(`Transforming ${id}`);
|
||||
options.filename = id;
|
||||
const transformed = babelTransform(code, options);
|
||||
|
||||
return {
|
||||
code: transformed.code,
|
||||
map: transformed.map
|
||||
};
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
// Note: We have to use a rate limit plugin here because rollup runs all tasks asynchronously and in parallel.
|
||||
// When we kick off a full run, if we kick off a rollup of every file this will fork-bomb the machine.
|
||||
// To work around this we use a concurrent Promise queue based on the number of available processors.
|
||||
const rateLimit = () => {
|
||||
const queue = [];
|
||||
let queueRunner;
|
||||
|
||||
const startQueue = () => {
|
||||
if (queueRunner) {
|
||||
return;
|
||||
}
|
||||
|
||||
queueRunner = setTimeout(() => {
|
||||
const limit = Math.max(1, require('os').cpus().length / 2);
|
||||
grunt.log.debug(`Starting rollup with queue size of ${limit}`);
|
||||
runQueue(limit);
|
||||
}, 100);
|
||||
};
|
||||
|
||||
// The queue runner will run the next `size` items in the queue.
|
||||
const runQueue = (size = 1) => {
|
||||
queue.splice(0, size).forEach(resolve => {
|
||||
resolve();
|
||||
});
|
||||
};
|
||||
|
||||
return {
|
||||
name: 'ratelimit',
|
||||
|
||||
// The options hook is run in parallel.
|
||||
// We can return an unresolved Promise which is queued for later resolution.
|
||||
options: async() => {
|
||||
return new Promise(resolve => {
|
||||
queue.push(resolve);
|
||||
startQueue();
|
||||
});
|
||||
},
|
||||
|
||||
// When an item in the queue completes, start the next item in the queue.
|
||||
buildEnd: () => {
|
||||
runQueue();
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
const terser = require('rollup-plugin-terser').terser;
|
||||
grunt.config.merge({
|
||||
babel: {
|
||||
rollup: {
|
||||
options: {
|
||||
sourceMaps: true,
|
||||
comments: false,
|
||||
format: 'esm',
|
||||
dir: 'output',
|
||||
sourcemap: true,
|
||||
treeshake: false,
|
||||
context: 'window',
|
||||
plugins: [
|
||||
'transform-es2015-modules-amd-lazy',
|
||||
'system-import-transformer',
|
||||
// This plugin modifies the Babel transpiling for "export default"
|
||||
// so that if it's used then only the exported value is returned
|
||||
// by the generated AMD module.
|
||||
//
|
||||
// It also adds the Moodle plugin name to the AMD module definition
|
||||
// so that it can be imported as expected in other modules.
|
||||
path.resolve('.grunt/babel-plugin-add-module-to-define.js'),
|
||||
'@babel/plugin-syntax-dynamic-import',
|
||||
'@babel/plugin-syntax-import-meta',
|
||||
['@babel/plugin-proposal-class-properties', {'loose': false}],
|
||||
'@babel/plugin-proposal-json-strings'
|
||||
rateLimit(),
|
||||
babel({
|
||||
sourceMaps: true,
|
||||
comments: false,
|
||||
compact: false,
|
||||
plugins: [
|
||||
'transform-es2015-modules-amd-lazy',
|
||||
'system-import-transformer',
|
||||
// This plugin modifies the Babel transpiling for "export default"
|
||||
// so that if it's used then only the exported value is returned
|
||||
// by the generated AMD module.
|
||||
//
|
||||
// It also adds the Moodle plugin name to the AMD module definition
|
||||
// so that it can be imported as expected in other modules.
|
||||
path.resolve('.grunt/babel-plugin-add-module-to-define.js'),
|
||||
'@babel/plugin-syntax-dynamic-import',
|
||||
'@babel/plugin-syntax-import-meta',
|
||||
['@babel/plugin-proposal-class-properties', {'loose': false}],
|
||||
'@babel/plugin-proposal-json-strings'
|
||||
],
|
||||
presets: [
|
||||
['@babel/preset-env', {
|
||||
targets: {
|
||||
browsers: [
|
||||
">0.25%",
|
||||
"last 2 versions",
|
||||
"not ie <= 10",
|
||||
"not op_mini all",
|
||||
"not Opera > 0",
|
||||
"not dead"
|
||||
]
|
||||
},
|
||||
modules: false,
|
||||
useBuiltIns: false
|
||||
}]
|
||||
]
|
||||
}),
|
||||
|
||||
terser({
|
||||
// Do not mangle variables.
|
||||
// Makes debugging easier.
|
||||
mangle: false,
|
||||
}),
|
||||
],
|
||||
presets: [
|
||||
['minify', {
|
||||
// This minification plugin needs to be disabled because it breaks the
|
||||
// source map generation and causes invalid source maps to be output.
|
||||
simplify: false,
|
||||
builtIns: false
|
||||
}],
|
||||
['@babel/preset-env', {
|
||||
targets: {
|
||||
browsers: [
|
||||
">0.25%",
|
||||
"last 2 versions",
|
||||
"not ie <= 10",
|
||||
"not op_mini all",
|
||||
"not Opera > 0",
|
||||
"not dead"
|
||||
]
|
||||
},
|
||||
modules: false,
|
||||
useBuiltIns: false
|
||||
}]
|
||||
]
|
||||
},
|
||||
dist: {
|
||||
files: [{
|
||||
expand: true,
|
||||
src: grunt.moodleEnv.files ? grunt.moodleEnv.files : grunt.moodleEnv.amdSrc,
|
||||
rename: babelRename
|
||||
}]
|
||||
}
|
||||
}],
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
@@ -132,7 +207,7 @@ module.exports = grunt => {
|
||||
let changedFiles = Object.create(null);
|
||||
const onChange = grunt.util._.debounce(function() {
|
||||
const files = Object.keys(changedFiles);
|
||||
grunt.config('babel.dist.files', [{expand: true, src: files, rename: babelRename}]);
|
||||
grunt.config('rollup.dist.files', [{expand: true, src: files, rename: babelRename}]);
|
||||
changedFiles = Object.create(null);
|
||||
}, 200);
|
||||
|
||||
|
||||
@@ -3724,6 +3724,11 @@
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_max_input_vars" level="optional">
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_admin_dir_usage" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="iscustomadminwarnings" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
</CUSTOM_CHECKS>
|
||||
</MOODLE>
|
||||
</COMPATIBILITY_MATRIX>
|
||||
|
||||
@@ -38,12 +38,11 @@ $form = new core_admin\form\purge_caches(null, ['returnurl' => $returnurl]);
|
||||
if ($data = $form->get_data()) {
|
||||
|
||||
// Valid request. Purge, and redirect the user back to where they came from.
|
||||
$selected = $data->purgeselectedoptions;
|
||||
purge_caches($selected);
|
||||
|
||||
if (isset($data->all)) {
|
||||
purge_caches();
|
||||
$message = get_string('purgecachesfinished', 'admin');
|
||||
} else {
|
||||
purge_caches($data->purgeselectedoptions);
|
||||
$message = get_string('purgeselectedcachesfinished', 'admin');
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
<?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/>.
|
||||
|
||||
/**
|
||||
* Endpoint to get the Moodle version
|
||||
*
|
||||
* Moodle linkchecker will check this endpoint when it cannot get the Moodle version otherwise.
|
||||
*
|
||||
* @package core
|
||||
* @copyright 2022 Victor Deniz <victor@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
require_once(__DIR__ . '/../../config.php');
|
||||
require_once($CFG->libdir . '/filelib.php');
|
||||
|
||||
// Get public key.
|
||||
$key = download_file_content(HUB_STATSPUBLICKEY);
|
||||
// Check $key is a valid public key.
|
||||
$publickey = openssl_pkey_get_public($key);
|
||||
if ($publickey !== false) {
|
||||
$publickeystr = openssl_pkey_get_details($publickey)['key'];
|
||||
} else {
|
||||
die('Error getting a valid public key');
|
||||
}
|
||||
|
||||
// Encrypt data.
|
||||
$message = $CFG->release;
|
||||
$success = openssl_public_encrypt(utf8_encode($message), $encrypteddata, $publickeystr);
|
||||
|
||||
if ($success) {
|
||||
echo base64_encode($encrypteddata);
|
||||
} else {
|
||||
die ('Error encrypting the data');
|
||||
}
|
||||
+17
-14
@@ -220,7 +220,7 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
$output .= $this->container_end();
|
||||
}
|
||||
|
||||
$button = new single_button($continueurl, get_string('upgradestart', 'admin'), 'get');
|
||||
$button = new single_button($continueurl, get_string('upgradestart', 'admin'), 'get', true);
|
||||
$button->class = 'continuebutton';
|
||||
$output .= $this->render($button);
|
||||
$output .= $this->footer();
|
||||
@@ -1616,12 +1616,18 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
|
||||
$plugininfo = $pluginman->get_plugins();
|
||||
|
||||
$numtotal = $numextension = $numupdatable = 0;
|
||||
$numtotal = $numextension = $numupdatable = $numinstallable = 0;
|
||||
|
||||
foreach ($plugininfo as $type => $plugins) {
|
||||
foreach ($plugins as $name => $plugin) {
|
||||
if ($plugin->available_updates()) {
|
||||
if ($res = $plugin->available_updates()) {
|
||||
$numupdatable++;
|
||||
foreach ($res as $updateinfo) {
|
||||
if ($pluginman->is_remote_plugin_installable($updateinfo->component, $updateinfo->version, $reason, false)) {
|
||||
$numinstallable++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($plugin->get_status() === core_plugin_manager::PLUGIN_STATUS_MISSING) {
|
||||
continue;
|
||||
@@ -1664,16 +1670,13 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
$out .= $this->output->heading(get_string('overviewext', 'core_plugin'), 3);
|
||||
}
|
||||
|
||||
if ($numupdatable) {
|
||||
$installableupdates = $pluginman->filter_installable($pluginman->available_updates());
|
||||
if ($installableupdates) {
|
||||
$out .= $this->output->single_button(
|
||||
new moodle_url($this->page->url, array('installupdatex' => 1)),
|
||||
get_string('updateavailableinstallall', 'core_admin', count($installableupdates)),
|
||||
'post',
|
||||
array('class' => 'singlebutton updateavailableinstallall')
|
||||
);
|
||||
}
|
||||
if ($numinstallable) {
|
||||
$out .= $this->output->single_button(
|
||||
new moodle_url($this->page->url, array('installupdatex' => 1)),
|
||||
get_string('updateavailableinstallall', 'core_admin', $numinstallable),
|
||||
'post',
|
||||
array('class' => 'singlebutton updateavailableinstallall')
|
||||
);
|
||||
}
|
||||
|
||||
$out .= html_writer::div($infoall, 'info info-all').
|
||||
@@ -1907,7 +1910,7 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
'infos'
|
||||
);
|
||||
|
||||
if ($pluginman->is_remote_plugin_installable($updateinfo->component, $updateinfo->version, $reason)) {
|
||||
if ($pluginman->is_remote_plugin_installable($updateinfo->component, $updateinfo->version, $reason, false)) {
|
||||
$box .= $this->output->single_button(
|
||||
new moodle_url($this->page->url, array('installupdate' => $updateinfo->component,
|
||||
'installupdateversion' => $updateinfo->version)),
|
||||
|
||||
@@ -163,7 +163,8 @@ if (!empty($capabilities)) {
|
||||
echo html_writer::start_tag('div', array('class'=>'submit_buttons'));
|
||||
$attrs = array('type'=>'submit', 'name'=>'savechanges', 'value'=>get_string('savechanges'), 'class'=>'btn btn-primary');
|
||||
echo html_writer::empty_tag('input', $attrs);
|
||||
$attrs = array('type'=>'submit', 'name'=>'cancel', 'value'=>get_string('cancel'), 'class' => 'btn btn-secondary');
|
||||
$attrs = array('type' => 'submit', 'name' => 'cancel', 'value' => get_string('cancel'),
|
||||
'class' => 'btn btn-secondary ml-1');
|
||||
echo html_writer::empty_tag('input', $attrs);
|
||||
echo html_writer::end_tag('div');
|
||||
echo html_writer::end_tag('div');
|
||||
|
||||
@@ -22,16 +22,17 @@
|
||||
* @copyright 2018 Carlos Escobedo <carlos@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
namespace core_role\privacy;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
use \core_role\privacy\provider;
|
||||
use \core_privacy\local\request\approved_contextlist;
|
||||
use \core_privacy\local\request\writer;
|
||||
use \core_privacy\tests\provider_testcase;
|
||||
use \core_privacy\local\request\transform;
|
||||
use \tool_cohortroles\api;
|
||||
use \core_privacy\local\request\approved_userlist;
|
||||
use core_role\privacy\provider;
|
||||
use core_privacy\local\request\approved_contextlist;
|
||||
use core_privacy\local\request\writer;
|
||||
use core_privacy\tests\provider_testcase;
|
||||
use core_privacy\local\request\transform;
|
||||
use tool_cohortroles\api;
|
||||
use core_privacy\local\request\approved_userlist;
|
||||
|
||||
/**
|
||||
* Privacy test for core_role
|
||||
@@ -39,7 +40,7 @@ use \core_privacy\local\request\approved_userlist;
|
||||
* @copyright 2018 Carlos Escobedo <carlos@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class core_role_privacy_testcase extends provider_testcase {
|
||||
class provider_test extends provider_testcase {
|
||||
/**
|
||||
* Test to check export_user_preferences.
|
||||
* returns user preferences data.
|
||||
@@ -231,6 +231,9 @@ if ($hassiteconfig) {
|
||||
array('0' => new lang_string('none'), '1' => new lang_string('allfiles'), '2' => new lang_string('htmlfilesonly')));
|
||||
$items[] = new admin_setting_configcheckbox('filtermatchoneperpage', new lang_string('filtermatchoneperpage', 'admin'), new lang_string('configfiltermatchoneperpage', 'admin'), 0);
|
||||
$items[] = new admin_setting_configcheckbox('filtermatchonepertext', new lang_string('filtermatchonepertext', 'admin'), new lang_string('configfiltermatchonepertext', 'admin'), 0);
|
||||
$items[] = new admin_setting_configcheckbox('filternavigationwithsystemcontext',
|
||||
new lang_string('filternavigationwithsystemcontext', 'admin'),
|
||||
new lang_string('configfilternavigationwithsystemcontext', 'admin'), 0);
|
||||
foreach ($items as $item) {
|
||||
$item->set_updatedcallback('reset_text_filters_cache');
|
||||
$temp->add($item);
|
||||
|
||||
@@ -48,6 +48,6 @@
|
||||
</div>
|
||||
<input type="text" name="{{name}}" id="{{id}}" value="{{value}}" size="12" class="form-control text-ltr" {{#readonly}}disabled{{/readonly}}>
|
||||
{{#haspreviewconfig}}
|
||||
<input type="button" id="{{id}}_preview" value={{#quote}}{{#str}}preview{{/str}}{{/quote}} class="admin_colourpicker_preview">
|
||||
<input type="button" id="{{id}}_preview" value="{{#cleanstr}}preview{{/cleanstr}}" class="admin_colourpicker_preview">
|
||||
{{/haspreviewconfig}}
|
||||
</div>
|
||||
|
||||
@@ -30,7 +30,7 @@ Feature: Manage external services tokens
|
||||
And I press "Delete"
|
||||
And "Firstname1 Lastname1" "table_row" should not exist
|
||||
|
||||
@javascript
|
||||
@javascript @skip_chrome_zerosize
|
||||
Scenario: Tokens can be filtered by user and by service
|
||||
Given the following "core_webservice > Service" exists:
|
||||
| name | Site information |
|
||||
|
||||
+10
-2
@@ -1,2 +1,10 @@
|
||||
define ("tool_analytics/log_info",["jquery","core/str","core/modal_factory","core/notification"],function(a,b,c,d){return{loadInfo:function loadInfo(e,f){var g=a("[data-model-log-id=\""+e+"\"]");b.get_string("loginfo","tool_analytics").then(function(b){var d=a("<ul>");f.forEach(function(a){d.append("<li>"+a+"</li>")});d.append("</ul>");return c.create({title:b,body:d.html(),large:!0},g)}).catch(d.exception)}}});
|
||||
//# sourceMappingURL=log_info.min.js.map
|
||||
/**
|
||||
* Shows a dialogue with info about this logs.
|
||||
*
|
||||
* @module tool_analytics/log_info
|
||||
* @copyright 2017 David Monllao {@link http://www.davidmonllao.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
define("tool_analytics/log_info",["jquery","core/str","core/modal_factory","core/notification"],(function($,str,ModalFactory,Notification){return{loadInfo:function(id,info){var link=$('[data-model-log-id="'+id+'"]');str.get_string("loginfo","tool_analytics").then((function(langString){var bodyInfo=$("<ul>");return info.forEach((function(item){bodyInfo.append("<li>"+item+"</li>")})),bodyInfo.append("</ul>"),ModalFactory.create({title:langString,body:bodyInfo.html(),large:!0},link)})).catch(Notification.exception)}}}));
|
||||
|
||||
//# sourceMappingURL=log_info.min.js.map
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"sources":["../src/log_info.js"],"names":["define","$","str","ModalFactory","Notification","loadInfo","id","info","link","get_string","then","langString","bodyInfo","forEach","item","append","create","title","body","html","large","catch","exception"],"mappings":"AAsBAA,OAAM,2BAAC,CAAC,QAAD,CAAW,UAAX,CAAuB,oBAAvB,CAA6C,mBAA7C,CAAD,CAAoE,SAASC,CAAT,CAAYC,CAAZ,CAAiBC,CAAjB,CAA+BC,CAA/B,CAA6C,CAEnH,MAAoD,CAShDC,QAAQ,CAAE,kBAASC,CAAT,CAAaC,CAAb,CAAmB,CAEzB,GAAIC,CAAAA,CAAI,CAAGP,CAAC,CAAC,wBAAyBK,CAAzB,CAA8B,KAA/B,CAAZ,CACAJ,CAAG,CAACO,UAAJ,CAAe,SAAf,CAA0B,gBAA1B,EAA4CC,IAA5C,CAAiD,SAASC,CAAT,CAAqB,CAElE,GAAIC,CAAAA,CAAQ,CAAGX,CAAC,CAAC,MAAD,CAAhB,CACAM,CAAI,CAACM,OAAL,CAAa,SAASC,CAAT,CAAe,CACxBF,CAAQ,CAACG,MAAT,CAAgB,OAASD,CAAT,CAAgB,OAAhC,CACH,CAFD,EAGAF,CAAQ,CAACG,MAAT,CAAgB,OAAhB,EAEA,MAAOZ,CAAAA,CAAY,CAACa,MAAb,CAAoB,CACvBC,KAAK,CAAEN,CADgB,CAEvBO,IAAI,CAAEN,CAAQ,CAACO,IAAT,EAFiB,CAGvBC,KAAK,GAHkB,CAApB,CAIJZ,CAJI,CAMV,CAdD,EAcGa,KAdH,CAcSjB,CAAY,CAACkB,SAdtB,CAeH,CA3B+C,CA6BvD,CA/BK,CAAN","sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Shows a dialogue with info about this logs.\n *\n * @module tool_analytics/log_info\n * @copyright 2017 David Monllao {@link http://www.davidmonllao.com}\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(['jquery', 'core/str', 'core/modal_factory', 'core/notification'], function($, str, ModalFactory, Notification) {\n\n return /** @alias module:tool_analytics/log_info */ {\n\n /**\n * Prepares a modal info for a log's results.\n *\n * @method loadInfo\n * @param {int} id\n * @param {string[]} info\n */\n loadInfo: function(id, info) {\n\n var link = $('[data-model-log-id=\"' + id + '\"]');\n str.get_string('loginfo', 'tool_analytics').then(function(langString) {\n\n var bodyInfo = $(\"<ul>\");\n info.forEach(function(item) {\n bodyInfo.append('<li>' + item + '</li>');\n });\n bodyInfo.append(\"</ul>\");\n\n return ModalFactory.create({\n title: langString,\n body: bodyInfo.html(),\n large: true,\n }, link);\n\n }).catch(Notification.exception);\n }\n };\n});\n"],"file":"log_info.min.js"}
|
||||
{"version":3,"file":"log_info.min.js","sources":["../src/log_info.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Shows a dialogue with info about this logs.\n *\n * @module tool_analytics/log_info\n * @copyright 2017 David Monllao {@link http://www.davidmonllao.com}\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(['jquery', 'core/str', 'core/modal_factory', 'core/notification'], function($, str, ModalFactory, Notification) {\n\n return /** @alias module:tool_analytics/log_info */ {\n\n /**\n * Prepares a modal info for a log's results.\n *\n * @method loadInfo\n * @param {int} id\n * @param {string[]} info\n */\n loadInfo: function(id, info) {\n\n var link = $('[data-model-log-id=\"' + id + '\"]');\n str.get_string('loginfo', 'tool_analytics').then(function(langString) {\n\n var bodyInfo = $(\"<ul>\");\n info.forEach(function(item) {\n bodyInfo.append('<li>' + item + '</li>');\n });\n bodyInfo.append(\"</ul>\");\n\n return ModalFactory.create({\n title: langString,\n body: bodyInfo.html(),\n large: true,\n }, link);\n\n }).catch(Notification.exception);\n }\n };\n});\n"],"names":["define","$","str","ModalFactory","Notification","loadInfo","id","info","link","get_string","then","langString","bodyInfo","forEach","item","append","create","title","body","html","large","catch","exception"],"mappings":";;;;;;;AAsBAA,iCAAO,CAAC,SAAU,WAAY,qBAAsB,sBAAsB,SAASC,EAAGC,IAAKC,aAAcC,oBAEjD,CAShDC,SAAU,SAASC,GAAIC,UAEfC,KAAOP,EAAE,uBAAyBK,GAAK,MAC3CJ,IAAIO,WAAW,UAAW,kBAAkBC,MAAK,SAASC,gBAElDC,SAAWX,EAAE,eACjBM,KAAKM,SAAQ,SAASC,MAClBF,SAASG,OAAO,OAASD,KAAO,YAEpCF,SAASG,OAAO,SAETZ,aAAaa,OAAO,CACvBC,MAAON,WACPO,KAAMN,SAASO,OACfC,OAAO,GACRZ,SAEJa,MAAMjB,aAAakB"}
|
||||
+10
-2
@@ -1,2 +1,10 @@
|
||||
define ("tool_analytics/model",["jquery","core/str","core/log","core/notification","core/modal_factory","core/modal_events","core/templates"],function(b,c,d,e,f,g,h){var i={clear:{title:{key:"clearpredictions",component:"tool_analytics"},body:{key:"clearmodelpredictions",component:"tool_analytics"}},delete:{title:{key:"delete",component:"tool_analytics"},body:{key:"deletemodelconfirmation",component:"tool_analytics"}}},j=function(a){var c=b(a).closest("[data-model-name]");if(c.length){return c.attr("data-model-name")}else{d.error("Unexpected DOM error - unable to obtain the model name");return""}};return{confirmAction:function confirmAction(a,h){b("[data-action-id=\""+a+"\"]").on("click",function(k){k.preventDefault();var l=b(k.currentTarget);if("undefined"==typeof i[h]){d.error("Action \""+h+"\" is not allowed.");return}var a=[i[h].title,i[h].body];a[1].param=j(l);var m=c.get_strings(a),n=f.create({type:f.types.SAVE_CANCEL});b.when(m,n).then(function(a,b){b.setTitle(a[0]);b.setBody(a[1]);b.setSaveButtonText(a[0]);b.getRoot().on(g.save,function(){window.location.href=l.attr("href")});b.show();return b}).fail(e.exception)})},selectEvaluationOptions:function selectEvaluationOptions(a,d){b("[data-action-id=\""+a+"\"]").on("click",function(i){i.preventDefault();var j=b(i.currentTarget),a=b(this).attr("data-timesplitting-methods"),k=c.get_strings([{key:"evaluatemodel",component:"tool_analytics"},{key:"evaluate",component:"tool_analytics"}]),l=f.create({type:f.types.SAVE_CANCEL}),m=h.render("tool_analytics/evaluation_options",{trainedexternally:d,timesplittingmethods:JSON.parse(a)});b.when(k,l).then(function(a,c){c.getRoot().on(g.hidden,c.destroy.bind(c));c.setTitle(a[0]);c.setSaveButtonText(a[1]);c.setBody(m);c.getRoot().on(g.save,function(){var a=b("input[name='evaluationmode']:checked").val();if("trainedmodel"==a){j.attr("href",j.attr("href")+"&mode=trainedmodel")}var c=b("#id-evaluation-timesplitting").val();j.attr("href",j.attr("href")+"×plitting="+c);window.location.href=j.attr("href")});c.show();return c}).fail(e.exception)})},selectExportOptions:function selectExportOptions(a,d){b("[data-action-id=\""+a+"\"]").on("click",function(i){i.preventDefault();var j=b(i.currentTarget);if(!d){j.attr("href",j.attr("href")+"&action=exportmodel&includeweights=0");window.location.href=j.attr("href");return}var a=c.get_strings([{key:"export",component:"tool_analytics"}]),k=f.create({type:f.types.SAVE_CANCEL}),l=h.render("tool_analytics/export_options",{});b.when(a,k).then(function(a,c){c.getRoot().on(g.hidden,c.destroy.bind(c));c.setTitle(a[0]);c.setSaveButtonText(a[0]);c.setBody(l);c.getRoot().on(g.save,function(){var a=b("input[name='exportoption']:checked").val();if("exportdata"==a){j.attr("href",j.attr("href")+"&action=exportdata")}else{j.attr("href",j.attr("href")+"&action=exportmodel");if(b("#id-includeweights").is(":checked")){j.attr("href",j.attr("href")+"&includeweights=1")}else{j.attr("href",j.attr("href")+"&includeweights=0")}}window.location.href=j.attr("href")});c.show();return c}).fail(e.exception)})}}});
|
||||
//# sourceMappingURL=model.min.js.map
|
||||
/**
|
||||
* AMD module for model actions confirmation.
|
||||
*
|
||||
* @module tool_analytics/model
|
||||
* @copyright 2017 David Monllao
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
define("tool_analytics/model",["jquery","core/str","core/log","core/notification","core/modal_factory","core/modal_events","core/templates"],(function($,Str,log,Notification,ModalFactory,ModalEvents,Templates){var actionsList={clear:{title:{key:"clearpredictions",component:"tool_analytics"},body:{key:"clearmodelpredictions",component:"tool_analytics"}},delete:{title:{key:"delete",component:"tool_analytics"},body:{key:"deletemodelconfirmation",component:"tool_analytics"}}};return{confirmAction:function(actionId,actionType){$('[data-action-id="'+actionId+'"]').on("click",(function(ev){ev.preventDefault();var a=$(ev.currentTarget);if(void 0!==actionsList[actionType]){var wrap,reqStrings=[actionsList[actionType].title,actionsList[actionType].body];reqStrings[1].param=(wrap=$(a).closest("[data-model-name]")).length?wrap.attr("data-model-name"):(log.error("Unexpected DOM error - unable to obtain the model name"),"");var stringsPromise=Str.get_strings(reqStrings),modalPromise=ModalFactory.create({type:ModalFactory.types.SAVE_CANCEL});$.when(stringsPromise,modalPromise).then((function(strings,modal){return modal.setTitle(strings[0]),modal.setBody(strings[1]),modal.setSaveButtonText(strings[0]),modal.getRoot().on(ModalEvents.save,(function(){window.location.href=a.attr("href")})),modal.show(),modal})).fail(Notification.exception)}else log.error('Action "'+actionType+'" is not allowed.')}))},selectEvaluationOptions:function(actionId,trainedOnlyExternally){$('[data-action-id="'+actionId+'"]').on("click",(function(ev){ev.preventDefault();var a=$(ev.currentTarget),timeSplittingMethods=$(this).attr("data-timesplitting-methods"),stringsPromise=Str.get_strings([{key:"evaluatemodel",component:"tool_analytics"},{key:"evaluate",component:"tool_analytics"}]),modalPromise=ModalFactory.create({type:ModalFactory.types.SAVE_CANCEL}),bodyPromise=Templates.render("tool_analytics/evaluation_options",{trainedexternally:trainedOnlyExternally,timesplittingmethods:JSON.parse(timeSplittingMethods)});$.when(stringsPromise,modalPromise).then((function(strings,modal){return modal.getRoot().on(ModalEvents.hidden,modal.destroy.bind(modal)),modal.setTitle(strings[0]),modal.setSaveButtonText(strings[1]),modal.setBody(bodyPromise),modal.getRoot().on(ModalEvents.save,(function(){"trainedmodel"==$("input[name='evaluationmode']:checked").val()&&a.attr("href",a.attr("href")+"&mode=trainedmodel");var timeSplittingMethod=$("#id-evaluation-timesplitting").val();a.attr("href",a.attr("href")+"×plitting="+timeSplittingMethod),window.location.href=a.attr("href")})),modal.show(),modal})).fail(Notification.exception)}))},selectExportOptions:function(actionId,isTrained){$('[data-action-id="'+actionId+'"]').on("click",(function(ev){ev.preventDefault();var a=$(ev.currentTarget);if(!isTrained)return a.attr("href",a.attr("href")+"&action=exportmodel&includeweights=0"),void(window.location.href=a.attr("href"));var stringsPromise=Str.get_strings([{key:"export",component:"tool_analytics"}]),modalPromise=ModalFactory.create({type:ModalFactory.types.SAVE_CANCEL}),bodyPromise=Templates.render("tool_analytics/export_options",{});$.when(stringsPromise,modalPromise).then((function(strings,modal){return modal.getRoot().on(ModalEvents.hidden,modal.destroy.bind(modal)),modal.setTitle(strings[0]),modal.setSaveButtonText(strings[0]),modal.setBody(bodyPromise),modal.getRoot().on(ModalEvents.save,(function(){"exportdata"==$("input[name='exportoption']:checked").val()?a.attr("href",a.attr("href")+"&action=exportdata"):(a.attr("href",a.attr("href")+"&action=exportmodel"),$("#id-includeweights").is(":checked")?a.attr("href",a.attr("href")+"&includeweights=1"):a.attr("href",a.attr("href")+"&includeweights=0")),window.location.href=a.attr("href")})),modal.show(),modal})).fail(Notification.exception)}))}}}));
|
||||
|
||||
//# sourceMappingURL=model.min.js.map
|
||||
File diff suppressed because one or more lines are too long
+10
-2
@@ -1,2 +1,10 @@
|
||||
define ("tool_analytics/potential-contexts",["jquery","core/ajax"],function(a,b){return{processResults:function processResults(b,c){var d=[];if(a.isArray(c)){a.each(c,function(a,b){d.push({value:b.id,label:b.name})});return d}else{return c}},transport:function transport(c,d,e,f){var g,h=a(c).attr("modelid")||null;g=b.call([{methodname:"tool_analytics_potential_contexts",args:{query:d,modelid:h}}]);g[0].then(e).fail(f)}}});
|
||||
//# sourceMappingURL=potential-contexts.min.js.map
|
||||
/**
|
||||
* Potential contexts selector module.
|
||||
*
|
||||
* @module tool_analytics/potential-contexts
|
||||
* @copyright 2019 David Monllao
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
define("tool_analytics/potential-contexts",["jquery","core/ajax"],(function($,Ajax){return{processResults:function(selector,results){var contexts=[];return $.isArray(results)?($.each(results,(function(index,context){contexts.push({value:context.id,label:context.name})})),contexts):results},transport:function(selector,query,success,failure){var modelid=$(selector).attr("modelid")||null;Ajax.call([{methodname:"tool_analytics_potential_contexts",args:{query:query,modelid:modelid}}])[0].then(success).fail(failure)}}}));
|
||||
|
||||
//# sourceMappingURL=potential-contexts.min.js.map
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"sources":["../src/potential-contexts.js"],"names":["define","$","Ajax","processResults","selector","results","contexts","isArray","each","index","context","push","value","id","label","name","transport","query","success","failure","promise","modelid","attr","call","methodname","args","then","fail"],"mappings":"AAuBAA,OAAM,qCAAC,CAAC,QAAD,CAAW,WAAX,CAAD,CAA0B,SAASC,CAAT,CAAYC,CAAZ,CAAkB,CAE9C,MAA8D,CAE1DC,cAAc,CAAE,wBAASC,CAAT,CAAmBC,CAAnB,CAA4B,CACxC,GAAIC,CAAAA,CAAQ,CAAG,EAAf,CACA,GAAIL,CAAC,CAACM,OAAF,CAAUF,CAAV,CAAJ,CAAwB,CACpBJ,CAAC,CAACO,IAAF,CAAOH,CAAP,CAAgB,SAASI,CAAT,CAAgBC,CAAhB,CAAyB,CACrCJ,CAAQ,CAACK,IAAT,CAAc,CACVC,KAAK,CAAEF,CAAO,CAACG,EADL,CAEVC,KAAK,CAAEJ,CAAO,CAACK,IAFL,CAAd,CAIH,CALD,EAMA,MAAOT,CAAAA,CAEV,CATD,IASO,CACH,MAAOD,CAAAA,CACV,CACJ,CAhByD,CAkB1DW,SAAS,CAAE,mBAASZ,CAAT,CAAmBa,CAAnB,CAA0BC,CAA1B,CAAmCC,CAAnC,CAA4C,IAC/CC,CAAAA,CAD+C,CAG/CC,CAAO,CAAGpB,CAAC,CAACG,CAAD,CAAD,CAAYkB,IAAZ,CAAiB,SAAjB,GAA+B,IAHM,CAInDF,CAAO,CAAGlB,CAAI,CAACqB,IAAL,CAAU,CAAC,CACjBC,UAAU,CAAE,mCADK,CAEjBC,IAAI,CAAE,CACFR,KAAK,CAAEA,CADL,CAEFI,OAAO,CAAEA,CAFP,CAFW,CAAD,CAAV,CAAV,CAQAD,CAAO,CAAC,CAAD,CAAP,CAAWM,IAAX,CAAgBR,CAAhB,EAAyBS,IAAzB,CAA8BR,CAA9B,CACH,CA/ByD,CAmCjE,CArCK,CAAN","sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Potential contexts selector module.\n *\n * @module tool_analytics/potential-contexts\n * @copyright 2019 David Monllao\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\ndefine(['jquery', 'core/ajax'], function($, Ajax) {\n\n return /** @alias module:tool_analytics/potential-contexts */ {\n\n processResults: function(selector, results) {\n var contexts = [];\n if ($.isArray(results)) {\n $.each(results, function(index, context) {\n contexts.push({\n value: context.id,\n label: context.name\n });\n });\n return contexts;\n\n } else {\n return results;\n }\n },\n\n transport: function(selector, query, success, failure) {\n var promise;\n\n let modelid = $(selector).attr('modelid') || null;\n promise = Ajax.call([{\n methodname: 'tool_analytics_potential_contexts',\n args: {\n query: query,\n modelid: modelid\n }\n }]);\n\n promise[0].then(success).fail(failure);\n }\n\n };\n\n});\n"],"file":"potential-contexts.min.js"}
|
||||
{"version":3,"file":"potential-contexts.min.js","sources":["../src/potential-contexts.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Potential contexts selector module.\n *\n * @module tool_analytics/potential-contexts\n * @copyright 2019 David Monllao\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\ndefine(['jquery', 'core/ajax'], function($, Ajax) {\n\n return /** @alias module:tool_analytics/potential-contexts */ {\n\n processResults: function(selector, results) {\n var contexts = [];\n if ($.isArray(results)) {\n $.each(results, function(index, context) {\n contexts.push({\n value: context.id,\n label: context.name\n });\n });\n return contexts;\n\n } else {\n return results;\n }\n },\n\n transport: function(selector, query, success, failure) {\n var promise;\n\n let modelid = $(selector).attr('modelid') || null;\n promise = Ajax.call([{\n methodname: 'tool_analytics_potential_contexts',\n args: {\n query: query,\n modelid: modelid\n }\n }]);\n\n promise[0].then(success).fail(failure);\n }\n\n };\n\n});\n"],"names":["define","$","Ajax","processResults","selector","results","contexts","isArray","each","index","context","push","value","id","label","name","transport","query","success","failure","modelid","attr","call","methodname","args","then","fail"],"mappings":";;;;;;;AAuBAA,2CAAO,CAAC,SAAU,cAAc,SAASC,EAAGC,YAEsB,CAE1DC,eAAgB,SAASC,SAAUC,aAC3BC,SAAW,UACXL,EAAEM,QAAQF,UACVJ,EAAEO,KAAKH,SAAS,SAASI,MAAOC,SAC5BJ,SAASK,KAAK,CACVC,MAAOF,QAAQG,GACfC,MAAOJ,QAAQK,UAGhBT,UAGAD,SAIfW,UAAW,SAASZ,SAAUa,MAAOC,QAASC,aAGtCC,QAAUnB,EAAEG,UAAUiB,KAAK,YAAc,KACnCnB,KAAKoB,KAAK,CAAC,CACjBC,WAAY,oCACZC,KAAM,CACFP,MAAOA,MACPG,QAASA,YAIT,GAAGK,KAAKP,SAASQ,KAAKP"}
|
||||
admin/tool/analytics/tests/external_test.php → admin/tool/analytics/tests/external/external_test.php
Vendored
+8
-4
@@ -24,13 +24,17 @@
|
||||
* @since Moodle 3.8
|
||||
*/
|
||||
|
||||
namespace tool_analytics\external;
|
||||
|
||||
use externallib_advanced_testcase;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
global $CFG;
|
||||
|
||||
require_once($CFG->dirroot . '/webservice/tests/helpers.php');
|
||||
require_once(__DIR__ . '/../../../../analytics/tests/fixtures/test_indicator_max.php');
|
||||
require_once(__DIR__ . '/../../../../analytics/tests/fixtures/test_target_course_level_shortname.php');
|
||||
require_once($CFG->dirroot . '/analytics/tests/fixtures/test_indicator_max.php');
|
||||
require_once($CFG->dirroot . '/analytics/tests/fixtures/test_target_course_level_shortname.php');
|
||||
|
||||
/**
|
||||
* Tool analytics external functions tests
|
||||
@@ -41,7 +45,7 @@ require_once(__DIR__ . '/../../../../analytics/tests/fixtures/test_target_course
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @since Moodle 3.8
|
||||
*/
|
||||
class tool_analytics_external_testcase extends externallib_advanced_testcase {
|
||||
class external_test extends externallib_advanced_testcase {
|
||||
|
||||
/**
|
||||
* test_potential_contexts description
|
||||
@@ -73,7 +77,7 @@ class tool_analytics_external_testcase extends externallib_advanced_testcase {
|
||||
$user = $this->getDataGenerator()->create_user();
|
||||
$this->setUser($user);
|
||||
|
||||
$this->expectException(required_capability_exception::class);
|
||||
$this->expectException(\required_capability_exception::class);
|
||||
$this->assertCount(2, \tool_analytics\external::potential_contexts());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
@tool_behat
|
||||
Feature: Verify that the behat login and logout steps work as expected
|
||||
In order to use behat login and log out steps
|
||||
As a test writer
|
||||
I need to verify that login and logout happen when the steps are used
|
||||
|
||||
Scenario: Log in as a user using the step
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname |
|
||||
| traverst1 | Thomas | Travers |
|
||||
When I log in as "traverst1"
|
||||
Then I should see "Thomas Travers"
|
||||
|
||||
@javascript
|
||||
Scenario: Log in as a user using the step (javascript)
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname |
|
||||
| traverst1 | Thomas | Travers |
|
||||
When I log in as "traverst1"
|
||||
Then I should see "Thomas Travers"
|
||||
|
||||
Scenario: Log out using the log out step
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname |
|
||||
| traverst1 | Thomas | Travers |
|
||||
And I am logged in as traverst1
|
||||
When I log out
|
||||
Then I should not see "Thomas Travers"
|
||||
And I should see "You are not logged in"
|
||||
|
||||
@javascript
|
||||
Scenario: Log out using the log out step (javascript)
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname |
|
||||
| traverst1 | Thomas | Travers |
|
||||
And I am logged in as traverst1
|
||||
When I log out
|
||||
Then I should not see "Thomas Travers"
|
||||
And I should see "You are not logged in"
|
||||
|
||||
Scenario: Log in step should automatically log user out if already logged in
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname |
|
||||
| traverst1 | Thomas | Travers |
|
||||
| emeryj | Jane | Emery |
|
||||
And I am logged in as traverst1
|
||||
When I log in as "emeryj"
|
||||
Then I should not see "Thomas Travers"
|
||||
And I should see "Jane Emery"
|
||||
|
||||
@javascript
|
||||
Scenario: Log in step should automatically log user out if already logged in (javascript)
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname |
|
||||
| traverst1 | Thomas | Travers |
|
||||
| emeryj | Jane | Emery |
|
||||
And I am logged in as traverst1
|
||||
When I log in as "emeryj"
|
||||
Then I should not see "Thomas Travers"
|
||||
And I should see "Jane Emery"
|
||||
|
||||
Scenario: I am on page logged in as should redirect to correct page
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname |
|
||||
| traverst1 | Thomas | Travers |
|
||||
And the following "course" exists:
|
||||
| fullname | Life, the Universe, and Everything |
|
||||
| shortname | hhgttg |
|
||||
When I am on the hhgttg Course page logged in as traverst1
|
||||
Then I should see "Thomas Travers"
|
||||
And I should see "Life, the Universe, and Everything"
|
||||
|
||||
@javascript
|
||||
Scenario: I am on page logged in as should redirect to correct page (javascript)
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname |
|
||||
| traverst1 | Thomas | Travers |
|
||||
And the following "course" exists:
|
||||
| fullname | Life, the Universe, and Everything |
|
||||
| shortname | hhgttg |
|
||||
When I am on the hhgttg Course page logged in as traverst1
|
||||
Then I should see "Thomas Travers"
|
||||
And I should see "Life, the Universe, and Everything"
|
||||
|
||||
Scenario: I am on page logged in as should redirect to correct page when automatically logging a user out
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname |
|
||||
| traverst1 | Thomas | Travers |
|
||||
| emeryj | Jane | Emery |
|
||||
And the following "course" exists:
|
||||
| fullname | Life, the Universe, and Everything |
|
||||
| shortname | hhgttg |
|
||||
And I am logged in as emeryj
|
||||
When I am on the hhgttg Course page logged in as traverst1
|
||||
Then I should see "Thomas Travers"
|
||||
And I should see "Life, the Universe, and Everything"
|
||||
|
||||
@javascript
|
||||
Scenario: I am on page logged in as should redirect to correct page when automatically logging a user out (javacript)
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname |
|
||||
| traverst1 | Thomas | Travers |
|
||||
| emeryj | Jane | Emery |
|
||||
And the following "course" exists:
|
||||
| fullname | Life, the Universe, and Everything |
|
||||
| shortname | hhgttg |
|
||||
And I am logged in as emeryj
|
||||
When I am on the hhgttg Course page logged in as traverst1
|
||||
Then I should see "Thomas Travers"
|
||||
And I should see "Life, the Universe, and Everything"
|
||||
@@ -0,0 +1,191 @@
|
||||
<?php
|
||||
// This file is part of Moodle - https://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 <https://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Tests for behat_form_text class
|
||||
*
|
||||
* @copyright 2022 onwards Eloy Lafuente (stronk7) {@link https://stronk7.com}
|
||||
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace tool_behat;
|
||||
|
||||
use behat_form_text;
|
||||
use Behat\Mink\Session;
|
||||
use Behat\Mink\Element\NodeElement;
|
||||
use core_string_manager_standard;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die;
|
||||
|
||||
global $CFG;
|
||||
require_once($CFG->libdir . '/behat/classes/behat_session_interface.php');
|
||||
require_once($CFG->libdir . '/behat/classes/behat_session_trait.php');
|
||||
require_once($CFG->libdir . '/behat/form_field/behat_form_text.php');
|
||||
|
||||
/**
|
||||
* Tests for the behat_form_text class
|
||||
*
|
||||
* @package tool_behat
|
||||
* @category test
|
||||
* @copyright 2022 onwards Eloy Lafuente (stronk7) {@link https://stronk7.com}
|
||||
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*
|
||||
* @covers \behat_form_text
|
||||
* @covers \behat_form_field
|
||||
*/
|
||||
class behat_form_text_test extends \basic_testcase {
|
||||
|
||||
/**
|
||||
* Data provider for the test_set_get_value() method.
|
||||
*
|
||||
* @return array of value and expectation pairs to be tested.
|
||||
*/
|
||||
public function provider_test_set_get_value() {
|
||||
return [
|
||||
'null' => [null, null],
|
||||
'int' => [3, 3],
|
||||
'float' => [3.14, 3.14],
|
||||
'string' => ['hello', 'hello'],
|
||||
'utf8' => ['你好', '你好'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the set_value() and get_value() methods.
|
||||
*
|
||||
* @param mixed $value value to be set.
|
||||
* @param mixed $expectation value to be checked.
|
||||
* @dataProvider provider_test_set_get_value()
|
||||
*/
|
||||
public function test_set_get_value($value, $expectation) {
|
||||
$session = $this->createMock(Session::class);
|
||||
$node = $this->createMock(NodeElement::class);
|
||||
$node->method('getValue')->willReturn($value);
|
||||
$field = new behat_form_text($session, $node);
|
||||
|
||||
$field->set_value($value);
|
||||
$this->assertEquals($expectation, $field->get_value());
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for the test_text_matches() method.
|
||||
*
|
||||
* @return array of decsep, value, match and result pairs to be tested.
|
||||
*/
|
||||
public function provider_test_matches() {
|
||||
return [
|
||||
'lazy true' => ['.', 'hello', 'hello', true],
|
||||
'lazy false' => ['.', 'hello', 'bye', false],
|
||||
'float true' => ['.', '3.14', '3.1400', true],
|
||||
'float false' => ['.', '3.14', '3.1401', false],
|
||||
'float and float string true' => ['.', 3.14, '3.1400', true],
|
||||
'float and unrelated string false' => ['.', 3.14, 'hello', false],
|
||||
'float hash decsep true' => ['#', '3#14', '3#1400', true],
|
||||
'float hash decsep false' => ['#', '3#14', '3#1401', false],
|
||||
'float and float string hash decsep true' => ['#', 3.14, '3.1400', true],
|
||||
'float and unrelated string hash decsep false' => ['#', 3.14, 'hello', false],
|
||||
'float custom-default decsep mix1 true' => ['#', '3#14', '3.1400', true],
|
||||
'float custom-default decsep mix2 true' => ['#', '3.14', '3#1400', true],
|
||||
'float 2-custom decsep mix1 false' => ['#', '3#14', '3,1400', false],
|
||||
'float 2-custom decsep mix2 false' => [',', '3#14', '3,1400', false],
|
||||
'float default-custom decsep mix1 false' => ['.', '3#14', '3.1400', false],
|
||||
'float default-custom decsep mix2 false' => ['.', '3.14', '3#1400', false],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the matches() method.
|
||||
*
|
||||
* @param string $decsep decimal separator to use.
|
||||
* @param mixed $value value to be set.
|
||||
* @param mixed $match value to be matched.
|
||||
* @param bool $result expected return status of the function.
|
||||
* @dataProvider provider_test_matches()
|
||||
*/
|
||||
public function test_matches($decsep, $value, $match, $result) {
|
||||
global $CFG;
|
||||
|
||||
// Switch of string manager to avoid having to (slow) customise the lang file.
|
||||
$origcustom = $CFG->config_php_settings['customstringmanager'] ?? null;
|
||||
$CFG->config_php_settings['customstringmanager'] = '\tool_behat\phpunit_string_manager';
|
||||
$manager = get_string_manager(true);
|
||||
$manager->set_string('decsep', 'langconfig', $decsep);
|
||||
|
||||
$session = $this->createMock(Session::class);
|
||||
$node = $this->createMock(NodeElement::class);
|
||||
$node->method('getValue')->willReturn($value);
|
||||
|
||||
$field = new behat_form_text($session, $node);
|
||||
|
||||
$field->set_value($value);
|
||||
$this->assertSame($result, $field->matches($match));
|
||||
|
||||
// Switch back to the original string manager.
|
||||
if (is_null($origcustom)) {
|
||||
unset($CFG->config_php_settings['customstringmanager']);
|
||||
} else {
|
||||
$CFG->config_php_settings['customstringmanager'] = $origcustom;
|
||||
}
|
||||
$manager = get_string_manager(true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Customised values that will be used instead of standard manager one.
|
||||
*
|
||||
* If an existing component/identifier is found, return it instead of the real
|
||||
* one from language files. Note this doesn't support place holders or another niceties.
|
||||
*
|
||||
* @package tool_behat
|
||||
* @category test
|
||||
* @copyright 2022 onwards Eloy Lafuente (stronk7) {@link https://stronk7.com}
|
||||
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class phpunit_string_manager extends core_string_manager_standard {
|
||||
|
||||
/** @var array language customisations provided by the manager without asking for real contents */
|
||||
protected $customstrings = [];
|
||||
|
||||
/**
|
||||
* Get String returns a requested string
|
||||
*
|
||||
* @param string $identifier The identifier of the string to search for
|
||||
* @param string $component The module the string is associated with
|
||||
* @param string|object|array $a An object, string or number that can be used
|
||||
* within translation strings
|
||||
* @param string $lang moodle translation language, null means use current
|
||||
* @return string The String !
|
||||
*/
|
||||
public function get_string($identifier, $component = '', $a = null, $lang = null) {
|
||||
$key = trim($component) . '/' . trim($identifier);
|
||||
if (isset($this->customstrings[$key])) {
|
||||
return $this->customstrings[$key];
|
||||
}
|
||||
return parent::get_string($identifier, $component, $a, $lang);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a custom string to be returned by the string manager instead of the language file one.
|
||||
*
|
||||
* @param string $identifier The identifier of the string to search for
|
||||
* @param string $component The module the string is associated with
|
||||
* @param string $value the contents of the language string to be returned by get_string()
|
||||
*/
|
||||
public function set_string($identifier, $component, $value) {
|
||||
$key = trim($component) . '/' . trim($identifier);
|
||||
$this->customstrings[$key] = $value;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
// @codingStandardsIgnoreFile
|
||||
// phpcs:ignoreFile
|
||||
// @codeCoverageIgnoreStart
|
||||
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<XMLDB PATH="admin/tool/brickfield/db" VERSION="20200215" COMMENT="XMLDB file for Moodle admin/tool/brickfield"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
|
||||
xsi:noNamespaceSchemaLocation="../../../../lib/xmldb/xmldb.xsd"
|
||||
>
|
||||
<TABLES>
|
||||
<TABLE NAME="tool_brickfield_checks" COMMENT="Checks details">
|
||||
|
||||
@@ -16,6 +16,11 @@
|
||||
|
||||
namespace tool_brickfield;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
global $CFG;
|
||||
require_once($CFG->dirroot . '/admin/tool/brickfield/tests/area_test_base.php');
|
||||
|
||||
/**
|
||||
* Class tool_brickfield_area_testcase
|
||||
*
|
||||
@@ -23,8 +28,7 @@ namespace tool_brickfield;
|
||||
* @copyright 2020 onward: Brickfield Education Labs, https://www.brickfield.ie
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class area_test extends \advanced_testcase {
|
||||
|
||||
class area_test extends area_test_base {
|
||||
/**
|
||||
* Test for the area assign intro
|
||||
*/
|
||||
@@ -46,7 +50,7 @@ class area_test extends \advanced_testcase {
|
||||
$resultsrs = $c->find_course_areas($course1->id);
|
||||
$resultsrs2 = $c->find_course_areas($course2->id);
|
||||
// Set up a results array from the recordset for easier testing.
|
||||
$results = array_merge(self::array_from_recordset($resultsrs), self::array_from_recordset($resultsrs2));
|
||||
$results = array_merge($this->array_from_recordset($resultsrs), $this->array_from_recordset($resultsrs2));
|
||||
$this->assertEquals([
|
||||
(object)[
|
||||
'type' => area_base::TYPE_FIELD,
|
||||
@@ -76,7 +80,7 @@ class area_test extends \advanced_testcase {
|
||||
$event = \core\event\course_module_updated::create_from_cm($cm1);
|
||||
$relevantresultsrs = $c->find_relevant_areas($event);
|
||||
// Set up a relevantresults array from the recordset for easier testing.
|
||||
$relevantresults = self::array_from_recordset($relevantresultsrs);
|
||||
$relevantresults = $this->array_from_recordset($relevantresultsrs);
|
||||
$this->assertEquals([$results[0]], $relevantresults);
|
||||
}
|
||||
|
||||
@@ -87,43 +91,57 @@ class area_test extends \advanced_testcase {
|
||||
$this->resetAfterTest();
|
||||
/** @var \core_question_generator $generator */
|
||||
$generator = $this->getDataGenerator()->get_plugin_generator('core_question');
|
||||
$component = 'core_question';
|
||||
|
||||
list($category1, $course1, $qcat1, $questions1) = $generator->setup_course_and_questions('course');
|
||||
list($category2, $course2, $qcat2, $questions2) = $generator->setup_course_and_questions('category');
|
||||
list($category3, $course3, $qcat3, $questions3) = $generator->setup_course_and_questions('system');
|
||||
|
||||
$c = new \tool_brickfield\local\areas\core_question\questiontext();
|
||||
$results1 = self::array_from_recordset($c->find_course_areas($course1->id));
|
||||
$results2 = self::array_from_recordset($c->find_course_areas($course2->id));
|
||||
$results3 = self::array_from_recordset($c->find_course_areas($course3->id));
|
||||
$results4 = self::array_from_recordset($c->find_system_areas());
|
||||
// Set up a results array from the recordset for easier testing.
|
||||
// Set up results arrays from the recordset for easier testing.
|
||||
$course1areas = $this->array_from_recordset($c->find_course_areas($course1->id));
|
||||
$course2areas = $c->find_course_areas($course2->id);
|
||||
$course3areas = $c->find_course_areas($course3->id);
|
||||
$sysareas = $this->array_from_recordset($c->find_system_areas());
|
||||
|
||||
$this->assertCount(2, $results1);
|
||||
$this->assertCount(0, $results2);
|
||||
$this->assertCount(0, $results3);
|
||||
$this->assertCount(4, $results4);
|
||||
|
||||
// Validate the contexts, courseid and categoryid of the returned results.
|
||||
$this->assertEquals(\context_course::instance($course1->id)->id, $results1[0]->contextid);
|
||||
$this->assertEquals($course1->id, $results1[0]->courseid);
|
||||
$this->assertEmpty($results1[0]->categoryid);
|
||||
$this->assertEquals(\context_coursecat::instance($category2->id)->id, $results4[0]->contextid);
|
||||
$this->assertEquals(SITEID, $results4[0]->courseid);
|
||||
$this->assertEquals($category2->id, $results4[0]->categoryid);
|
||||
$this->assertEquals(\context_system::instance()->id, $results4[2]->contextid);
|
||||
$this->assertEmpty($results4[2]->categoryid);
|
||||
$this->assertEquals(SITEID, $results4[2]->courseid);
|
||||
// Results4 should contain id's for questions 1 and 2.
|
||||
$this->assertTrue(($questions3[0]->id == $results4[2]->itemid) || ($questions3[0]->id == $results4[3]->itemid));
|
||||
$this->assertTrue(($questions3[1]->id == $results4[2]->itemid) || ($questions3[1]->id == $results4[3]->itemid));
|
||||
// Assert the core_question area exists for the individual question's context, courseid and categoryid.
|
||||
$this->assert_area_in_array(
|
||||
$course1areas,
|
||||
$component,
|
||||
\context_course::instance($course1->id)->id,
|
||||
$questions1[0]->id,
|
||||
$course1->id,
|
||||
null
|
||||
);
|
||||
$this->assert_area_in_array(
|
||||
$sysareas,
|
||||
$component,
|
||||
\context_coursecat::instance($category2->id)->id,
|
||||
$questions2[0]->id,
|
||||
SITEID,
|
||||
$category2->id
|
||||
);
|
||||
$this->assert_area_in_array(
|
||||
$sysareas,
|
||||
$component,
|
||||
\context_system::instance()->id,
|
||||
$questions3[0]->id,
|
||||
SITEID,
|
||||
null
|
||||
);
|
||||
|
||||
// Emulate the question_created event.
|
||||
$event = \core\event\question_created::create_from_question_instance($questions1[1],
|
||||
\context_course::instance($course1->id));
|
||||
$relevantresultsrs = $c->find_relevant_areas($event);
|
||||
// Set up a relevantresults array from the recordset for easier testing.
|
||||
$relevantresults = self::array_from_recordset($relevantresultsrs);
|
||||
$this->assertEquals([$results1[1]], $relevantresults);
|
||||
$relevantresults = $this->array_from_recordset($c->find_relevant_areas($event));
|
||||
$this->assert_area_in_array(
|
||||
$course1areas,
|
||||
$component,
|
||||
\context_course::instance($relevantresults[0]->courseid)->id,
|
||||
$relevantresults[0]->itemid,
|
||||
$relevantresults[0]->courseid,
|
||||
$relevantresults[0]->categoryid
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -147,7 +165,7 @@ class area_test extends \advanced_testcase {
|
||||
|
||||
$c = new \tool_brickfield\local\areas\core_question\questionanswers();
|
||||
$resultsrs = $c->find_course_areas($course->id);
|
||||
$results = self::array_from_recordset($resultsrs);
|
||||
$results = $this->array_from_recordset($resultsrs);
|
||||
|
||||
// There will be the same number of results as the number of records in the question_answers table.
|
||||
$this->assertEquals(count($dbanswers), count($results));
|
||||
@@ -157,7 +175,7 @@ class area_test extends \advanced_testcase {
|
||||
\context_course::instance($course->id));
|
||||
$relevantresultsrs = $c->find_relevant_areas($event);
|
||||
// Set up a relevantresults array from the recordset for easier testing.
|
||||
$relevantresults = self::array_from_recordset($relevantresultsrs);
|
||||
$relevantresults = $this->array_from_recordset($relevantresultsrs);
|
||||
|
||||
$dbanswers = array_values($DB->get_records('question_answers', ['question' => $question1->id], 'id'));
|
||||
$this->assertEquals(count($dbanswers), count($relevantresults));
|
||||
@@ -190,7 +208,7 @@ class area_test extends \advanced_testcase {
|
||||
$c = new \tool_brickfield\local\areas\mod_choice\intro();
|
||||
$resultsrs = $c->find_course_areas($course->id);
|
||||
// Set up a results array from the recordset for easier testing.
|
||||
$results = self::array_from_recordset($resultsrs);
|
||||
$results = $this->array_from_recordset($resultsrs);
|
||||
|
||||
$this->assertCount(2, $results);
|
||||
$this->assertEquals($cm1->id, $results[0]->cmid);
|
||||
@@ -199,14 +217,14 @@ class area_test extends \advanced_testcase {
|
||||
// Emulate the course_module_created event.
|
||||
$event = \core\event\course_module_created::create_from_cm($cm1);
|
||||
$relevantresultsrs = $c->find_relevant_areas($event);
|
||||
$relevantresults = self::array_from_recordset($relevantresultsrs);
|
||||
$relevantresults = $this->array_from_recordset($relevantresultsrs);
|
||||
$this->assertEquals([$results[0]], $relevantresults);
|
||||
|
||||
// Testing the choice options.
|
||||
$c = new \tool_brickfield\local\areas\mod_choice\option();
|
||||
$resultsrs = $c->find_course_areas($course->id);
|
||||
// Set up a results array from the recordset for easier testing.
|
||||
$results = self::array_from_recordset($resultsrs);
|
||||
$results = $this->array_from_recordset($resultsrs);
|
||||
|
||||
$this->assertCount(5, $results);
|
||||
$this->assertEquals($cm2->id, $results[3]->cmid);
|
||||
@@ -220,21 +238,7 @@ class area_test extends \advanced_testcase {
|
||||
// Emulate the course_module_updated event.
|
||||
$event = \core\event\course_module_updated::create_from_cm($cm2);
|
||||
$relevantresultsrs = $c->find_relevant_areas($event);
|
||||
$relevantresults = self::array_from_recordset($relevantresultsrs);
|
||||
$relevantresults = $this->array_from_recordset($relevantresultsrs);
|
||||
$this->assertEquals([$results[3], $results[4]], $relevantresults);
|
||||
}
|
||||
|
||||
/**
|
||||
* Array from recordset.
|
||||
* @param \moodle_recordset $rs
|
||||
* @return array
|
||||
*/
|
||||
private static function array_from_recordset($rs) {
|
||||
$records = [];
|
||||
foreach ($rs as $record) {
|
||||
$records[] = $record;
|
||||
}
|
||||
$rs->close();
|
||||
return $records;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
<?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/>.
|
||||
|
||||
namespace tool_brickfield;
|
||||
|
||||
/**
|
||||
* Class area_test_base provides some utility functions that can be used by testing.
|
||||
*
|
||||
* @package tool_brickfield
|
||||
* @copyright 2020 onward: Brickfield Education Labs, https://www.brickfield.ie
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
abstract class area_test_base extends \advanced_testcase {
|
||||
/** @var string Message for failed area test. */
|
||||
protected $areatestmessage = 'Expected %component% area not found';
|
||||
|
||||
/**
|
||||
* Create and return an array from a recordset. Recordset is destroyed.
|
||||
* @param \moodle_recordset $rs
|
||||
* @return array
|
||||
*/
|
||||
public function array_from_recordset(\moodle_recordset $rs): array {
|
||||
$records = [];
|
||||
foreach ($rs as $record) {
|
||||
$records[] = $record;
|
||||
}
|
||||
// Can't rewind a recordset, so might as well close it.
|
||||
$rs->close();
|
||||
return $records;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for specified component information present in area recordset. Recordset cannot be reused.
|
||||
* @param \moodle_recordset $areasrs
|
||||
* @param string $component
|
||||
* @param int $contextid
|
||||
* @param int $itemid
|
||||
* @param int|null $courseid
|
||||
* @param int|null $categoryid
|
||||
* @return void
|
||||
*/
|
||||
public function assert_area_in_recordset(\moodle_recordset $areasrs, string $component, int $contextid, int $itemid,
|
||||
?int $courseid, ?int $categoryid): void {
|
||||
$this->assert_area_in_array(
|
||||
$this->array_from_recordset($areasrs),
|
||||
$component,
|
||||
$contextid,
|
||||
$itemid,
|
||||
$courseid,
|
||||
$categoryid
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for specified component information present in area array.
|
||||
* @param array $areas
|
||||
* @param string $component
|
||||
* @param int $contextid
|
||||
* @param int $itemid
|
||||
* @param int|null $courseid
|
||||
* @param int|null $categoryid
|
||||
* @return void
|
||||
*/
|
||||
public function assert_area_in_array(array $areas, string $component, int $contextid, int $itemid,
|
||||
?int $courseid, ?int $categoryid): void {
|
||||
$found = false;
|
||||
$message = str_replace('%component%', $component, $this->areatestmessage);
|
||||
foreach ($areas as $area) {
|
||||
if (($area->component == $component) &&
|
||||
($area->contextid == $contextid) &&
|
||||
((empty($courseid) ? empty($area->courseid) : ($area->courseid == $courseid))) &&
|
||||
((empty($categoryid) ? empty($area->categoryid) : ($area->categoryid == $categoryid))) &&
|
||||
($area->itemid == $itemid)
|
||||
) {
|
||||
$found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$this->assertTrue($found, $message);
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,7 @@ use tool_brickfield\local\tool\filter;
|
||||
* @author Jay Churchward (jay.churchward@poetopensource.org)
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class filter_test extends \advanced_testcase {
|
||||
class filters_test extends \advanced_testcase {
|
||||
public function test_constructor() {
|
||||
$this->resetAfterTest();
|
||||
|
||||
|
||||
@@ -13,9 +13,15 @@
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
namespace tool_brickfield\local\areas\core_question;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
global $CFG;
|
||||
require_once($CFG->dirroot . '/admin/tool/brickfield/tests/area_test_base.php');
|
||||
|
||||
use tool_brickfield\area_test_base;
|
||||
|
||||
/**
|
||||
* Tests for questiontext.
|
||||
*
|
||||
@@ -23,8 +29,7 @@ namespace tool_brickfield\local\areas\core_question;
|
||||
* @copyright 2020 onward: Brickfield Education Labs, https://www.brickfield.ie
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class questiontext_test extends \advanced_testcase {
|
||||
|
||||
class questiontext_test extends area_test_base {
|
||||
/**
|
||||
* Set up before class.
|
||||
*/
|
||||
@@ -158,30 +163,31 @@ class questiontext_test extends \advanced_testcase {
|
||||
$catcontext = \context_coursecat::instance($category->id);
|
||||
$systemcontext = \context_system::instance();
|
||||
$generator = $this->getDataGenerator()->get_plugin_generator('core_question');
|
||||
$component = 'core_question';
|
||||
|
||||
$cat = $generator->create_question_category(['contextid' => $catcontext->id]);
|
||||
$cat2 = $generator->create_question_category(['contextid' => $systemcontext->id]);
|
||||
$question = $generator->create_question('multichoice', null, ['category' => $cat2->id]);
|
||||
$question2 = $generator->create_question('multichoice', null, ['category' => $cat->id]);
|
||||
$questiontext = new questiontext();
|
||||
$rs = $questiontext->find_system_areas();
|
||||
$this->assertNotNull($rs);
|
||||
$areas = $this->array_from_recordset($questiontext->find_system_areas());
|
||||
|
||||
$count = 0;
|
||||
foreach ($rs as $rec) {
|
||||
$count++;
|
||||
if ($count <= 1) {
|
||||
$this->assertEquals($systemcontext->id, $rec->contextid);
|
||||
$this->assertEquals(1, $rec->courseid);
|
||||
$this->assertEquals(0, $rec->categoryid);
|
||||
$this->assertEquals($question->id, $rec->itemid);
|
||||
} else {
|
||||
$this->assertEquals($catcontext->id, $rec->contextid);
|
||||
$this->assertEquals(1, $rec->courseid);
|
||||
$this->assertEquals($category->id, $rec->categoryid);
|
||||
$this->assertEquals($question2->id, $rec->itemid);
|
||||
}
|
||||
}
|
||||
$rs->close();
|
||||
$this->assertEquals(2, $count);
|
||||
// Assert the core_question area exists for the individual question's context, courseid and categoryid.
|
||||
$this->assert_area_in_array(
|
||||
$areas,
|
||||
$component,
|
||||
$systemcontext->id,
|
||||
$question->id,
|
||||
SITEID,
|
||||
null
|
||||
);
|
||||
$this->assert_area_in_array(
|
||||
$areas,
|
||||
$component,
|
||||
$catcontext->id,
|
||||
$question2->id,
|
||||
SITEID,
|
||||
$category->id
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,6 +101,6 @@ class printable_test extends \advanced_testcase {
|
||||
$object->set_filter($filter);
|
||||
$output = $object->get_output();
|
||||
$this->assertStringContainsString('<i class="icon fa fa-tachometer fa-fw " title="Total activities" '.
|
||||
'aria-label="Total activities">', $output);
|
||||
'role="img" aria-label="Total activities">', $output);
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -22,7 +22,7 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
namespace tool_capability\event;
|
||||
|
||||
/**
|
||||
* Class for capability overview events.
|
||||
@@ -31,7 +31,7 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @copyright 2014 Petr Skoda
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
|
||||
*/
|
||||
class tool_capability_events_testcase extends advanced_testcase {
|
||||
class events_test extends \advanced_testcase {
|
||||
|
||||
/**
|
||||
* Setup testcase.
|
||||
@@ -54,11 +54,11 @@ class tool_capability_events_testcase extends advanced_testcase {
|
||||
$event = reset($events);
|
||||
|
||||
$this->assertInstanceOf('\tool_capability\event\report_viewed', $event);
|
||||
$this->assertEquals(context_system::instance(), $event->get_context());
|
||||
$this->assertEquals(\context_system::instance(), $event->get_context());
|
||||
$expected = array(SITEID, "admin", "tool capability", "tool/capability/index.php");
|
||||
$this->assertEventLegacyLogData($expected, $event);
|
||||
$this->assertEventContextNotUsed($event);
|
||||
$url = new moodle_url('/admin/tool/capability/index.php');
|
||||
$url = new \moodle_url('/admin/tool/capability/index.php');
|
||||
$this->assertEquals($url, $event->get_url());
|
||||
$event->get_name();
|
||||
}
|
||||
@@ -21,6 +21,7 @@
|
||||
* @copyright 2021 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
|
||||
*/
|
||||
namespace tool_capability;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
global $CFG;
|
||||
@@ -30,7 +31,7 @@ require_once($CFG->dirroot . '/' . $CFG->admin . '/tool/capability/locallib.php'
|
||||
/**
|
||||
* Tests for the capability overview helper functions.
|
||||
*/
|
||||
class tool_capability_locallib_testcase extends advanced_testcase {
|
||||
class locallib_test extends \advanced_testcase {
|
||||
|
||||
/**
|
||||
* Test the function that gets the data - simple case.
|
||||
@@ -40,7 +41,7 @@ class tool_capability_locallib_testcase extends advanced_testcase {
|
||||
|
||||
$data = tool_capability_calculate_role_data('mod/quiz:attempt', get_all_roles());
|
||||
|
||||
$systcontext = context_system::instance();
|
||||
$systcontext = \context_system::instance();
|
||||
$studentroleid = $DB->get_field('role', 'id', ['shortname' => 'student']);
|
||||
|
||||
$this->assertArrayHasKey($systcontext->id, $data);
|
||||
@@ -63,10 +64,10 @@ class tool_capability_locallib_testcase extends advanced_testcase {
|
||||
|
||||
// This simulates a situation that seems to happen sometimes, where
|
||||
// we end up with contexts with path = NULL in the database.
|
||||
$systcontext = context_system::instance();
|
||||
$systcontext = \context_system::instance();
|
||||
$generator = $this->getDataGenerator();
|
||||
$course = $generator->create_course();
|
||||
$coursecontext = context_course::instance($course->id);
|
||||
$coursecontext = \context_course::instance($course->id);
|
||||
$studentroleid = $DB->get_field('role', 'id', ['shortname' => 'student']);
|
||||
role_change_permission($studentroleid, $coursecontext, 'mod/quiz:attempt', CAP_PREVENT);
|
||||
// This is where we simulate the breakage.
|
||||
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
YUI.add("moodle-tool_capability-search",function(s,t){var e=function(){e.superclass.constructor.apply(this,arguments)};e.prototype={form:null,select:null,selectoptions:{},input:null,button:null,cancel:null,lastsearch:null,initializer:function(){this.form=s.one("#capability-overview-form"),this.select=this.form.one("select[data-search=capability]"),this.select.setStyle("minWidth",this.select.get("offsetWidth")),this.select.get("options").each(function(t){var e=t.get("value");this.selectoptions[e]=t},this),this.button=this.form.all("input[type=submit]"),this.lastsearch=this.form.one("input[name=search]");var t=s.Node.create('<div id="capabilitysearchui" class="input-group simplesearchform mb-2"data-fieldtype="text"></div>'),e=s.Node.create('<label for="capabilitysearch"><span class="sr-only"'+this.get("strsearch")+"</span></label>");this.cancel=s.Node.create('<a class="btn btn-clear d-none icon-no-margin"><i class="icon fa fa-times fa-fw " aria-hidden="true"></i></a>'),this.input=s.Node.create('<input type="text" class="form-control withclear" placeholder="'+this.get("strsearch")+'"id="capabilitysearch" />'),t.append(e).append(this.input).append(this.cancel),this.select.insert(t,"before"),this.input.on("keyup",this.typed,this),this.select.on("change",this.validate,this),this.cancel.on("click",function(){this.input.set("value",""),this.typed()},this),this.lastsearch&&(this.input.set("value",this.lastsearch.get("value")),this.typed(),this.select.one("option[selected]")&&this.select.set("scrollTop",this.select.one("option[selected]").get("getX"))),this.validate()},validate:function(){this.button.set("disabled",""===this.select.get("value"))},typed:function(){var t,e=this.input.get("value"),s=0,i=null;for(t in this.lastsearch&&this.lastsearch.set("value",e),this.select.all("option").remove(),this.selectoptions)0<=t.indexOf(e)&&(s++,i=this.selectoptions[t],this.select.append(this.selectoptions[t]));0===s?this.input.addClass("error"):(this.input.removeClass("error"),1===s&&i.set("selected",!0)),""!==e?this.cancel.removeClass("d-none"):this.cancel.addClass("d-none"),this.validate()}},s.extend(e,s.Base,e.prototype,{NAME:"tool_capability-search",ATTRS:{strsearch:{}}}),M.tool_capability=M.tool_capability||{},M.tool_capability.init_capability_search=function(t){new e(t)}},"@VERSION@",{requires:["base","node"]});
|
||||
YUI.add("moodle-tool_capability-search",function(s,t){var e=function(){e.superclass.constructor.apply(this,arguments)};s.extend(e,s.Base,e.prototype={form:null,select:null,selectoptions:{},input:null,button:null,cancel:null,lastsearch:null,initializer:function(){this.form=s.one("#capability-overview-form"),this.select=this.form.one("select[data-search=capability]"),this.select.setStyle("minWidth",this.select.get("offsetWidth")),this.select.get("options").each(function(t){var e=t.get("value");this.selectoptions[e]=t},this),this.button=this.form.all("input[type=submit]"),this.lastsearch=this.form.one("input[name=search]");var t=s.Node.create('<div id="capabilitysearchui" class="input-group simplesearchform mb-2"data-fieldtype="text"></div>'),e=s.Node.create('<label for="capabilitysearch"><span class="sr-only"'+this.get("strsearch")+"</span></label>");this.cancel=s.Node.create('<a class="btn btn-clear d-none icon-no-margin"><i class="icon fa fa-times fa-fw " aria-hidden="true"></i></a>'),this.input=s.Node.create('<input type="text" class="form-control withclear" placeholder="'+this.get("strsearch")+'"id="capabilitysearch" />'),t.append(e).append(this.input).append(this.cancel),this.select.insert(t,"before"),this.input.on("keyup",this.typed,this),this.select.on("change",this.validate,this),this.cancel.on("click",function(){this.input.set("value",""),this.typed()},this),this.lastsearch&&(this.input.set("value",this.lastsearch.get("value")),this.typed(),this.select.one("option[selected]")&&this.select.set("scrollTop",this.select.one("option[selected]").get("getX"))),this.validate()},validate:function(){this.button.set("disabled",""===this.select.get("value"))},typed:function(){var t,e=this.input.get("value"),s=0,i=null;for(t in this.lastsearch&&this.lastsearch.set("value",e),this.select.all("option").remove(),this.selectoptions)0<=t.indexOf(e)&&(s++,i=this.selectoptions[t],this.select.append(this.selectoptions[t]));0===s?this.input.addClass("error"):(this.input.removeClass("error"),1===s&&i.set("selected",!0)),""!==e?this.cancel.removeClass("d-none"):this.cancel.addClass("d-none"),this.validate()}},{NAME:"tool_capability-search",ATTRS:{strsearch:{}}}),M.tool_capability=M.tool_capability||{},M.tool_capability.init_capability_search=function(t){new e(t)}},"@VERSION@",{requires:["base","node"]});
|
||||
@@ -14,17 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* API tests.
|
||||
*
|
||||
* @package tool_cohortroles
|
||||
* @copyright 2015 Damyon Wiese
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
use tool_cohortroles\api;
|
||||
namespace tool_cohortroles;
|
||||
|
||||
/**
|
||||
* API tests.
|
||||
@@ -33,17 +23,17 @@ use tool_cohortroles\api;
|
||||
* @copyright 2015 Damyon Wiese
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class tool_cohortroles_api_testcase extends advanced_testcase {
|
||||
/** @var stdClass $cohort */
|
||||
class api_test extends \advanced_testcase {
|
||||
/** @var \stdClass $cohort */
|
||||
protected $cohort = null;
|
||||
|
||||
/** @var stdClass $userassignto */
|
||||
/** @var \stdClass $userassignto */
|
||||
protected $userassignto = null;
|
||||
|
||||
/** @var stdClass $userassignover */
|
||||
/** @var \stdClass $userassignover */
|
||||
protected $userassignover = null;
|
||||
|
||||
/** @var stdClass $role */
|
||||
/** @var \stdClass $role */
|
||||
protected $role = null;
|
||||
|
||||
/**
|
||||
@@ -67,7 +57,7 @@ class tool_cohortroles_api_testcase extends advanced_testcase {
|
||||
'roleid' => $this->roleid,
|
||||
'cohortid' => $this->cohort->id
|
||||
);
|
||||
$this->expectException(required_capability_exception::class);
|
||||
$this->expectException(\required_capability_exception::class);
|
||||
api::create_cohort_role_assignment($params);
|
||||
}
|
||||
|
||||
@@ -105,7 +95,7 @@ class tool_cohortroles_api_testcase extends advanced_testcase {
|
||||
);
|
||||
$result = api::create_cohort_role_assignment($params);
|
||||
$this->setUser($this->userassignto);
|
||||
$this->expectException(required_capability_exception::class);
|
||||
$this->expectException(\required_capability_exception::class);
|
||||
api::delete_cohort_role_assignment($result->get('id'));
|
||||
}
|
||||
|
||||
@@ -117,7 +107,7 @@ class tool_cohortroles_api_testcase extends advanced_testcase {
|
||||
'cohortid' => $this->cohort->id
|
||||
);
|
||||
$result = api::create_cohort_role_assignment($params);
|
||||
$this->expectException(dml_missing_record_exception::class);
|
||||
$this->expectException(\dml_missing_record_exception::class);
|
||||
api::delete_cohort_role_assignment($result->get('id') + 1);
|
||||
}
|
||||
|
||||
@@ -274,7 +264,7 @@ class tool_cohortroles_api_testcase extends advanced_testcase {
|
||||
$this->assertEquals($sync, $expected);
|
||||
|
||||
// Verify roles assigned by any other component are not removed.
|
||||
$usercontext = context_user::instance($this->userassignover->id);
|
||||
$usercontext = \context_user::instance($this->userassignover->id);
|
||||
role_assign($this->roleid, $this->userassignto->id, $usercontext->id);
|
||||
$sync = api::sync_all_cohort_roles();
|
||||
|
||||
|
||||
+16
-15
@@ -22,14 +22,15 @@
|
||||
* @copyright 2018 Zig Tan <zig@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
namespace tool_cohortroles\privacy;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
global $CFG;
|
||||
|
||||
use \core_privacy\local\request\writer;
|
||||
use \core_privacy\local\request\approved_contextlist;
|
||||
use \tool_cohortroles\api;
|
||||
use \tool_cohortroles\privacy\provider;
|
||||
use core_privacy\local\request\writer;
|
||||
use core_privacy\local\request\approved_contextlist;
|
||||
use tool_cohortroles\api;
|
||||
use tool_cohortroles\privacy\provider;
|
||||
use core_privacy\local\request\approved_userlist;
|
||||
|
||||
/**
|
||||
@@ -38,7 +39,7 @@ use core_privacy\local\request\approved_userlist;
|
||||
* @copyright 2018 Zig Tan <zig@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class tool_cohortroles_privacy_testcase extends \core_privacy\tests\provider_testcase {
|
||||
class provider_test extends \core_privacy\tests\provider_testcase {
|
||||
|
||||
/**
|
||||
* Overriding setUp() function to always reset after tests.
|
||||
@@ -61,7 +62,7 @@ class tool_cohortroles_privacy_testcase extends \core_privacy\tests\provider_tes
|
||||
// Create course category.
|
||||
$coursecategory = $this->getDataGenerator()->create_category();
|
||||
$coursecategoryctx = \context_coursecat::instance($coursecategory->id);
|
||||
$systemctx = context_system::instance();
|
||||
$systemctx = \context_system::instance();
|
||||
// Create course.
|
||||
$course = $this->getDataGenerator()->create_course();
|
||||
$coursectx = \context_course::instance($course->id);
|
||||
@@ -102,7 +103,7 @@ class tool_cohortroles_privacy_testcase extends \core_privacy\tests\provider_tes
|
||||
// Create course category.
|
||||
$coursecategory = $this->getDataGenerator()->create_category();
|
||||
$coursecategoryctx = \context_coursecat::instance($coursecategory->id);
|
||||
$systemctx = context_system::instance();
|
||||
$systemctx = \context_system::instance();
|
||||
// Create course.
|
||||
$course = $this->getDataGenerator()->create_course();
|
||||
$coursectx = \context_course::instance($course->id);
|
||||
@@ -154,7 +155,7 @@ class tool_cohortroles_privacy_testcase extends \core_privacy\tests\provider_tes
|
||||
// Create course category.
|
||||
$coursecategory = $this->getDataGenerator()->create_category();
|
||||
$coursecategoryctx = \context_coursecat::instance($coursecategory->id);
|
||||
$systemctx = context_system::instance();
|
||||
$systemctx = \context_system::instance();
|
||||
|
||||
$this->setup_test_scenario_data($user->id, $systemctx, 1);
|
||||
$this->setup_test_scenario_data($user->id, $coursecategoryctx, 1, 'Sausage roll 2',
|
||||
@@ -170,7 +171,7 @@ class tool_cohortroles_privacy_testcase extends \core_privacy\tests\provider_tes
|
||||
$this->assertCount(2, $contexts);
|
||||
|
||||
// Make sure the user data is only being deleted in within the system and course category context.
|
||||
$usercontext = context_user::instance($user->id);
|
||||
$usercontext = \context_user::instance($user->id);
|
||||
// Delete all the User's records in mdl_tool_cohortroles table by the user context.
|
||||
provider::delete_data_for_all_users_in_context($usercontext);
|
||||
|
||||
@@ -213,7 +214,7 @@ class tool_cohortroles_privacy_testcase extends \core_privacy\tests\provider_tes
|
||||
// Create course category.
|
||||
$coursecategory = $this->getDataGenerator()->create_category();
|
||||
$coursecategoryctx = \context_coursecat::instance($coursecategory->id);
|
||||
$systemctx = context_system::instance();
|
||||
$systemctx = \context_system::instance();
|
||||
|
||||
$this->setup_test_scenario_data($user->id, $systemctx, 1);
|
||||
$this->setup_test_scenario_data($user->id, $coursecategoryctx, 1, 'Sausage roll 2',
|
||||
@@ -229,7 +230,7 @@ class tool_cohortroles_privacy_testcase extends \core_privacy\tests\provider_tes
|
||||
$this->assertCount(2, $contexts);
|
||||
|
||||
// Make sure the user data is only being deleted in within the system and the course category contexts.
|
||||
$usercontext = context_user::instance($user->id);
|
||||
$usercontext = \context_user::instance($user->id);
|
||||
// Delete all the User's records in mdl_tool_cohortroles table by the specified approved context list.
|
||||
$approvedcontextlist = new approved_contextlist($user, 'tool_cohortroles', [$usercontext->id]);
|
||||
provider::delete_data_for_user($approvedcontextlist);
|
||||
@@ -255,12 +256,12 @@ class tool_cohortroles_privacy_testcase extends \core_privacy\tests\provider_tes
|
||||
|
||||
// Create a user.
|
||||
$user = $this->getDataGenerator()->create_user();
|
||||
$usercontext = context_user::instance($user->id);
|
||||
$usercontext = \context_user::instance($user->id);
|
||||
|
||||
// Create course category.
|
||||
$coursecategory = $this->getDataGenerator()->create_category();
|
||||
$coursecategoryctx = \context_coursecat::instance($coursecategory->id);
|
||||
$systemctx = context_system::instance();
|
||||
$systemctx = \context_system::instance();
|
||||
|
||||
$this->setAdminUser();
|
||||
|
||||
@@ -301,12 +302,12 @@ class tool_cohortroles_privacy_testcase extends \core_privacy\tests\provider_tes
|
||||
$user2 = $this->getDataGenerator()->create_user();
|
||||
// Create user3.
|
||||
$user3 = $this->getDataGenerator()->create_user();
|
||||
$usercontext3 = context_user::instance($user3->id);
|
||||
$usercontext3 = \context_user::instance($user3->id);
|
||||
|
||||
// Create course category.
|
||||
$coursecategory = $this->getDataGenerator()->create_category();
|
||||
$coursecategoryctx = \context_coursecat::instance($coursecategory->id);
|
||||
$systemctx = context_system::instance();
|
||||
$systemctx = \context_system::instance();
|
||||
|
||||
$this->setAdminUser();
|
||||
|
||||
@@ -10,9 +10,9 @@
|
||||
<FIELD NAME="lang" TYPE="char" LENGTH="20" NOTNULL="true" SEQUENCE="false" COMMENT="The code of the language this string belongs to. Like en, cs or es"/>
|
||||
<FIELD NAME="componentid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The id of the component"/>
|
||||
<FIELD NAME="stringid" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" COMMENT="The identifier of the string"/>
|
||||
<FIELD NAME="original" TYPE="text" LENGTH="big" NOTNULL="true" SEQUENCE="false" COMMENT="English original of the string"/>
|
||||
<FIELD NAME="master" TYPE="text" LENGTH="big" NOTNULL="false" SEQUENCE="false" COMMENT="Master translation of the string as is distributed in the official lang pack, null if not translated"/>
|
||||
<FIELD NAME="local" TYPE="text" LENGTH="big" NOTNULL="false" SEQUENCE="false" COMMENT="Local customization of the string, null if not customized"/>
|
||||
<FIELD NAME="original" TYPE="text" NOTNULL="true" SEQUENCE="false" COMMENT="English original of the string"/>
|
||||
<FIELD NAME="master" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="Master translation of the string as is distributed in the official lang pack, null if not translated"/>
|
||||
<FIELD NAME="local" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="Local customization of the string, null if not customized"/>
|
||||
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The timestamp of when the original or master was recently modified"/>
|
||||
<FIELD NAME="timecustomized" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="The timestamp of when the value of the local translation was recently modified, null if not customized yet"/>
|
||||
<FIELD NAME="outdated" TYPE="int" LENGTH="3" NOTNULL="false" DEFAULT="0" SEQUENCE="false" COMMENT="Either the English original or the master translation changed and the customization may be outdated"/>
|
||||
@@ -37,4 +37,4 @@
|
||||
</KEYS>
|
||||
</TABLE>
|
||||
</TABLES>
|
||||
</XMLDB>
|
||||
</XMLDB>
|
||||
|
||||
@@ -36,7 +36,7 @@ use moodle_exception;
|
||||
* @copyright 2020 Ferran Recio <ferran@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class langstring_testcase extends advanced_testcase {
|
||||
class langstring_test extends advanced_testcase {
|
||||
|
||||
/**
|
||||
* Sanity 1.x string
|
||||
|
||||
@@ -34,7 +34,7 @@ use moodle_exception;
|
||||
* @copyright 2015 Damyon Wiese
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class phpparser_testcase extends advanced_testcase {
|
||||
class phpparser_test extends advanced_testcase {
|
||||
|
||||
|
||||
/**
|
||||
|
||||
+10
-2
@@ -1,2 +1,10 @@
|
||||
define ("tool_dataprivacy/add_category",["jquery","core/str","core/ajax","core/notification","core/modal_factory","core/modal_events","core/fragment"],function(a,b,c,d,e,f,g){var h={CATEGORY_LINK:"[data-add-element=\"category\"]"},i=function(a){this.contextId=a;this.strings=b.get_strings([{key:"addcategory",component:"tool_dataprivacy"},{key:"save",component:"admin"}]);this.registerEventListeners()};i.prototype.contextId=0;i.prototype.strings=0;i.prototype.registerEventListeners=function(){var b=a(h.CATEGORY_LINK);b.on("click",function(){return this.strings.then(function(a){e.create({type:e.types.SAVE_CANCEL,title:a[0],body:""},b).done(function(b){this.setupFormModal(b,a[1])}.bind(this))}.bind(this)).fail(d.exception)}.bind(this))};i.prototype.getBody=function(a){var b=null;if("undefined"!=typeof a){b={jsonformdata:JSON.stringify(a)}}return g.loadFragment("tool_dataprivacy","addcategory_form",this.contextId,b)};i.prototype.setupFormModal=function(a,b){a.setLarge();a.setSaveButtonText(b);a.getRoot().on(f.hidden,this.destroy.bind(this));a.setBody(this.getBody());a.getRoot().on(f.save,this.submitForm.bind(this));a.getRoot().on("submit","form",this.submitFormAjax.bind(this));this.modal=a;a.show()};i.prototype.submitForm=function(a){a.preventDefault();this.modal.getRoot().find("form").submit()};i.prototype.submitFormAjax=function(a){a.preventDefault();var b=this.modal.getRoot().find("form").serialize();c.call([{methodname:"tool_dataprivacy_create_category_form",args:{jsonformdata:JSON.stringify(b)},done:function(a){if(a.validationerrors){this.modal.setBody(this.getBody(b))}else{this.close()}}.bind(this),fail:d.exception}])};i.prototype.close=function(){this.destroy();document.location.reload()};i.prototype.destroy=function(){Y.use("moodle-core-formchangechecker",function(){M.core_formchangechecker.reset_form_dirty_state()});this.modal.destroy()};i.prototype.removeListeners=function(){a(h.CATEGORY_LINK).off("click")};return{getInstance:function getInstance(a){return new i(a)}}});
|
||||
//# sourceMappingURL=add_category.min.js.map
|
||||
/**
|
||||
* Module to add categories.
|
||||
*
|
||||
* @module tool_dataprivacy/add_category
|
||||
* @copyright 2018 David Monllao
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
define("tool_dataprivacy/add_category",["jquery","core/str","core/ajax","core/notification","core/modal_factory","core/modal_events","core/fragment"],(function($,Str,Ajax,Notification,ModalFactory,ModalEvents,Fragment){var SELECTORS_CATEGORY_LINK='[data-add-element="category"]',AddCategory=function(contextId){this.contextId=contextId;this.strings=Str.get_strings([{key:"addcategory",component:"tool_dataprivacy"},{key:"save",component:"admin"}]),this.registerEventListeners()};return AddCategory.prototype.contextId=0,AddCategory.prototype.strings=0,AddCategory.prototype.registerEventListeners=function(){var trigger=$(SELECTORS_CATEGORY_LINK);trigger.on("click",function(){return this.strings.then(function(strings){ModalFactory.create({type:ModalFactory.types.SAVE_CANCEL,title:strings[0],body:""},trigger).done(function(modal){this.setupFormModal(modal,strings[1])}.bind(this))}.bind(this)).fail(Notification.exception)}.bind(this))},AddCategory.prototype.getBody=function(formdata){var params=null;return void 0!==formdata&&(params={jsonformdata:JSON.stringify(formdata)}),Fragment.loadFragment("tool_dataprivacy","addcategory_form",this.contextId,params)},AddCategory.prototype.setupFormModal=function(modal,saveText){modal.setLarge(),modal.setSaveButtonText(saveText),modal.getRoot().on(ModalEvents.hidden,this.destroy.bind(this)),modal.setBody(this.getBody()),modal.getRoot().on(ModalEvents.save,this.submitForm.bind(this)),modal.getRoot().on("submit","form",this.submitFormAjax.bind(this)),this.modal=modal,modal.show()},AddCategory.prototype.submitForm=function(e){e.preventDefault(),this.modal.getRoot().find("form").submit()},AddCategory.prototype.submitFormAjax=function(e){e.preventDefault();var formData=this.modal.getRoot().find("form").serialize();Ajax.call([{methodname:"tool_dataprivacy_create_category_form",args:{jsonformdata:JSON.stringify(formData)},done:function(data){data.validationerrors?this.modal.setBody(this.getBody(formData)):this.close()}.bind(this),fail:Notification.exception}])},AddCategory.prototype.close=function(){this.destroy(),document.location.reload()},AddCategory.prototype.destroy=function(){Y.use("moodle-core-formchangechecker",(function(){M.core_formchangechecker.reset_form_dirty_state()})),this.modal.destroy()},AddCategory.prototype.removeListeners=function(){$(SELECTORS_CATEGORY_LINK).off("click")},{getInstance:function(contextId){return new AddCategory(contextId)}}}));
|
||||
|
||||
//# sourceMappingURL=add_category.min.js.map
|
||||
File diff suppressed because one or more lines are too long
+10
-2
@@ -1,2 +1,10 @@
|
||||
define ("tool_dataprivacy/add_purpose",["jquery","core/str","core/ajax","core/notification","core/modal_factory","core/modal_events","core/fragment"],function(a,b,c,d,e,f,g){var h={PURPOSE_LINK:"[data-add-element=\"purpose\"]"},i=function(a){this.contextId=a;this.strings=b.get_strings([{key:"addpurpose",component:"tool_dataprivacy"},{key:"save",component:"admin"}]);this.registerEventListeners()};i.prototype.contextId=0;i.prototype.strings=0;i.prototype.registerEventListeners=function(){var b=a(h.PURPOSE_LINK);b.on("click",function(){return this.strings.then(function(a){e.create({type:e.types.SAVE_CANCEL,title:a[0],body:""},b).done(function(b){this.setupFormModal(b,a[1])}.bind(this))}.bind(this)).fail(d.exception)}.bind(this))};i.prototype.getBody=function(a){var b=null;if("undefined"!=typeof a){b={jsonformdata:JSON.stringify(a)}}return g.loadFragment("tool_dataprivacy","addpurpose_form",this.contextId,b)};i.prototype.setupFormModal=function(a,b){a.setLarge();a.setSaveButtonText(b);a.getRoot().on(f.hidden,this.destroy.bind(this));a.setBody(this.getBody());a.getRoot().on(f.save,this.submitForm.bind(this));a.getRoot().on("submit","form",this.submitFormAjax.bind(this));this.modal=a;a.show()};i.prototype.submitForm=function(a){a.preventDefault();this.modal.getRoot().find("form").submit()};i.prototype.submitFormAjax=function(a){a.preventDefault();var b=this.modal.getRoot().find("form").serialize();c.call([{methodname:"tool_dataprivacy_create_purpose_form",args:{jsonformdata:JSON.stringify(b)},done:function(a){if(a.validationerrors){this.modal.setBody(this.getBody(b))}else{this.close()}}.bind(this),fail:d.exception}])};i.prototype.close=function(){this.destroy();document.location.reload()};i.prototype.destroy=function(){Y.use("moodle-core-formchangechecker",function(){M.core_formchangechecker.reset_form_dirty_state()});this.modal.destroy()};i.prototype.removeListeners=function(){a(h.PURPOSE_LINK).off("click")};return{getInstance:function getInstance(a){return new i(a)}}});
|
||||
//# sourceMappingURL=add_purpose.min.js.map
|
||||
/**
|
||||
* Module to add purposes.
|
||||
*
|
||||
* @module tool_dataprivacy/add_purpose
|
||||
* @copyright 2018 David Monllao
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
define("tool_dataprivacy/add_purpose",["jquery","core/str","core/ajax","core/notification","core/modal_factory","core/modal_events","core/fragment"],(function($,Str,Ajax,Notification,ModalFactory,ModalEvents,Fragment){var SELECTORS_PURPOSE_LINK='[data-add-element="purpose"]',AddPurpose=function(contextId){this.contextId=contextId;this.strings=Str.get_strings([{key:"addpurpose",component:"tool_dataprivacy"},{key:"save",component:"admin"}]),this.registerEventListeners()};return AddPurpose.prototype.contextId=0,AddPurpose.prototype.strings=0,AddPurpose.prototype.registerEventListeners=function(){var trigger=$(SELECTORS_PURPOSE_LINK);trigger.on("click",function(){return this.strings.then(function(strings){ModalFactory.create({type:ModalFactory.types.SAVE_CANCEL,title:strings[0],body:""},trigger).done(function(modal){this.setupFormModal(modal,strings[1])}.bind(this))}.bind(this)).fail(Notification.exception)}.bind(this))},AddPurpose.prototype.getBody=function(formdata){var params=null;return void 0!==formdata&&(params={jsonformdata:JSON.stringify(formdata)}),Fragment.loadFragment("tool_dataprivacy","addpurpose_form",this.contextId,params)},AddPurpose.prototype.setupFormModal=function(modal,saveText){modal.setLarge(),modal.setSaveButtonText(saveText),modal.getRoot().on(ModalEvents.hidden,this.destroy.bind(this)),modal.setBody(this.getBody()),modal.getRoot().on(ModalEvents.save,this.submitForm.bind(this)),modal.getRoot().on("submit","form",this.submitFormAjax.bind(this)),this.modal=modal,modal.show()},AddPurpose.prototype.submitForm=function(e){e.preventDefault(),this.modal.getRoot().find("form").submit()},AddPurpose.prototype.submitFormAjax=function(e){e.preventDefault();var formData=this.modal.getRoot().find("form").serialize();Ajax.call([{methodname:"tool_dataprivacy_create_purpose_form",args:{jsonformdata:JSON.stringify(formData)},done:function(data){data.validationerrors?this.modal.setBody(this.getBody(formData)):this.close()}.bind(this),fail:Notification.exception}])},AddPurpose.prototype.close=function(){this.destroy(),document.location.reload()},AddPurpose.prototype.destroy=function(){Y.use("moodle-core-formchangechecker",(function(){M.core_formchangechecker.reset_form_dirty_state()})),this.modal.destroy()},AddPurpose.prototype.removeListeners=function(){$(SELECTORS_PURPOSE_LINK).off("click")},{getInstance:function(contextId){return new AddPurpose(contextId)}}}));
|
||||
|
||||
//# sourceMappingURL=add_purpose.min.js.map
|
||||
File diff suppressed because one or more lines are too long
+10
-2
@@ -1,2 +1,10 @@
|
||||
define ("tool_dataprivacy/categoriesactions",["jquery","core/ajax","core/notification","core/str","core/modal_factory","core/modal_events"],function(a,b,c,d,e,f){var g={DELETE:"[data-action=\"deletecategory\"]"},h=function(){this.registerEvents()};h.prototype.registerEvents=function(){a(g.DELETE).click(function(g){g.preventDefault();var h=a(this).data("id"),i=a(this).data("name");d.get_strings([{key:"deletecategory",component:"tool_dataprivacy"},{key:"deletecategorytext",component:"tool_dataprivacy",param:i},{key:"delete"}]).then(function(d){var g=d[0],i=d[1],j=d[2];return e.create({title:g,body:i,type:e.types.SAVE_CANCEL}).then(function(d){d.setSaveButtonText(j);d.getRoot().on(f.save,function(){b.call([{methodname:"tool_dataprivacy_delete_category",args:{id:h}}])[0].done(function(b){if(b.result){a("tr[data-categoryid=\""+h+"\"]").remove()}else{c.addNotification({message:b.warnings[0].message,type:"error"})}}).fail(c.exception)});d.getRoot().on(f.hidden,function(){d.destroy()});return d})}).done(function(a){a.show()}).fail(c.exception)})};return{init:function init(){return new h}}});
|
||||
//# sourceMappingURL=categoriesactions.min.js.map
|
||||
/**
|
||||
* AMD module for categories actions.
|
||||
*
|
||||
* @module tool_dataprivacy/categoriesactions
|
||||
* @copyright 2018 David Monllao
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
define("tool_dataprivacy/categoriesactions",["jquery","core/ajax","core/notification","core/str","core/modal_factory","core/modal_events"],(function($,Ajax,Notification,Str,ModalFactory,ModalEvents){var ACTIONS_DELETE='[data-action="deletecategory"]',CategoriesActions=function(){this.registerEvents()};return CategoriesActions.prototype.registerEvents=function(){$(ACTIONS_DELETE).click((function(e){e.preventDefault();var id=$(this).data("id"),stringkeys=[{key:"deletecategory",component:"tool_dataprivacy"},{key:"deletecategorytext",component:"tool_dataprivacy",param:$(this).data("name")},{key:"delete"}];Str.get_strings(stringkeys).then((function(langStrings){var title=langStrings[0],confirmMessage=langStrings[1],buttonText=langStrings[2];return ModalFactory.create({title:title,body:confirmMessage,type:ModalFactory.types.SAVE_CANCEL}).then((function(modal){return modal.setSaveButtonText(buttonText),modal.getRoot().on(ModalEvents.save,(function(){var request={methodname:"tool_dataprivacy_delete_category",args:{id:id}};Ajax.call([request])[0].done((function(data){data.result?$('tr[data-categoryid="'+id+'"]').remove():Notification.addNotification({message:data.warnings[0].message,type:"error"})})).fail(Notification.exception)})),modal.getRoot().on(ModalEvents.hidden,(function(){modal.destroy()})),modal}))})).done((function(modal){modal.show()})).fail(Notification.exception)}))},{init:function(){return new CategoriesActions}}}));
|
||||
|
||||
//# sourceMappingURL=categoriesactions.min.js.map
|
||||
File diff suppressed because one or more lines are too long
+10
-2
@@ -1,2 +1,10 @@
|
||||
define ("tool_dataprivacy/contactdpo",["exports","core_form/modalform","core/notification","core/str","core/toast"],function(a,b,c,d,e){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.init=void 0;b=f(b);c=f(c);function f(a){return a&&a.__esModule?a:{default:a}}var g={CONTACT_DPO:"[data-action=\"contactdpo\"]"};a.init=function init(){var a=document.querySelector(g.CONTACT_DPO);a.addEventListener("click",function(f){f.preventDefault();var g=new b.default({modalConfig:{title:(0,d.get_string)("contactdataprotectionofficer","tool_dataprivacy")},formClass:"tool_dataprivacy\\form\\contactdpo",saveButtonText:(0,d.get_string)("send","tool_dataprivacy"),returnFocus:a});g.addEventListener(g.events.FORM_SUBMITTED,function(a){if(a.detail.result){(0,d.get_string)("requestsubmitted","tool_dataprivacy").then(e.add).catch()}else{var b=a.detail.warnings.map(function(a){return a.message});c.default.addNotification({type:"error",message:b.join("<br>")})}});g.show()})}});
|
||||
//# sourceMappingURL=contactdpo.min.js.map
|
||||
define("tool_dataprivacy/contactdpo",["exports","core_form/modalform","core/notification","core/str","core/toast"],(function(_exports,_modalform,_notification,_str,_toast){function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}
|
||||
/**
|
||||
* Javascript module for contacting the site DPO
|
||||
*
|
||||
* @module tool_dataprivacy/contactdpo
|
||||
* @copyright 2021 Paul Holden <paulh@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.init=void 0,_modalform=_interopRequireDefault(_modalform),_notification=_interopRequireDefault(_notification);var SELECTORS_CONTACT_DPO='[data-action="contactdpo"]';_exports.init=function(){var triggerElement=document.querySelector(SELECTORS_CONTACT_DPO);triggerElement.addEventListener("click",(function(event){event.preventDefault();var modalForm=new _modalform.default({modalConfig:{title:(0,_str.get_string)("contactdataprotectionofficer","tool_dataprivacy")},formClass:"tool_dataprivacy\\form\\contactdpo",saveButtonText:(0,_str.get_string)("send","tool_dataprivacy"),returnFocus:triggerElement});modalForm.addEventListener(modalForm.events.FORM_SUBMITTED,(function(event){if(event.detail.result)(0,_str.get_string)("requestsubmitted","tool_dataprivacy").then(_toast.add).catch();else{var warningMessages=event.detail.warnings.map((function(warning){return warning.message}));_notification.default.addNotification({type:"error",message:warningMessages.join("<br>")})}})),modalForm.show()}))}}));
|
||||
|
||||
//# sourceMappingURL=contactdpo.min.js.map
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"sources":["../src/contactdpo.js"],"names":["SELECTORS","CONTACT_DPO","init","triggerElement","document","querySelector","addEventListener","event","preventDefault","modalForm","ModalForm","modalConfig","title","formClass","saveButtonText","returnFocus","events","FORM_SUBMITTED","detail","result","then","addToast","catch","warningMessages","warnings","map","warning","message","Notification","addNotification","type","join","show"],"mappings":"oNAuBA,OACA,O,sDAIMA,CAAAA,CAAS,CAAG,CACdC,WAAW,CAAE,8BADC,C,QAOE,QAAPC,CAAAA,IAAO,EAAM,CACtB,GAAMC,CAAAA,CAAc,CAAGC,QAAQ,CAACC,aAAT,CAAuBL,CAAS,CAACC,WAAjC,CAAvB,CAEAE,CAAc,CAACG,gBAAf,CAAgC,OAAhC,CAAyC,SAAAC,CAAK,CAAI,CAC9CA,CAAK,CAACC,cAAN,GAEA,GAAMC,CAAAA,CAAS,CAAG,GAAIC,UAAJ,CAAc,CAC5BC,WAAW,CAAE,CACTC,KAAK,CAAE,iBAAU,8BAAV,CAA0C,kBAA1C,CADE,CADe,CAI5BC,SAAS,CAAE,oCAJiB,CAK5BC,cAAc,CAAE,iBAAU,MAAV,CAAkB,kBAAlB,CALY,CAM5BC,WAAW,CAAEZ,CANe,CAAd,CAAlB,CAUAM,CAAS,CAACH,gBAAV,CAA2BG,CAAS,CAACO,MAAV,CAAiBC,cAA5C,CAA4D,SAAAV,CAAK,CAAI,CACjE,GAAIA,CAAK,CAACW,MAAN,CAAaC,MAAjB,CAAyB,CACrB,iBAAU,kBAAV,CAA8B,kBAA9B,EAAkDC,IAAlD,CAAuDC,KAAvD,EAAiEC,KAAjE,EACH,CAFD,IAEO,CACH,GAAMC,CAAAA,CAAe,CAAGhB,CAAK,CAACW,MAAN,CAAaM,QAAb,CAAsBC,GAAtB,CAA0B,SAAAC,CAAO,QAAIA,CAAAA,CAAO,CAACC,OAAZ,CAAjC,CAAxB,CACAC,UAAaC,eAAb,CAA6B,CACzBC,IAAI,CAAE,OADmB,CAEzBH,OAAO,CAAEJ,CAAe,CAACQ,IAAhB,CAAqB,MAArB,CAFgB,CAA7B,CAIH,CACJ,CAVD,EAYAtB,CAAS,CAACuB,IAAV,EACH,CA1BD,CA2BH,C","sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Javascript module for contacting the site DPO\n *\n * @module tool_dataprivacy/contactdpo\n * @copyright 2021 Paul Holden <paulh@moodle.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport ModalForm from 'core_form/modalform';\nimport Notification from 'core/notification';\nimport {get_string as getString} from 'core/str';\nimport {add as addToast} from 'core/toast';\n\nconst SELECTORS = {\n CONTACT_DPO: '[data-action=\"contactdpo\"]',\n};\n\n/**\n * Initialize module\n */\nexport const init = () => {\n const triggerElement = document.querySelector(SELECTORS.CONTACT_DPO);\n\n triggerElement.addEventListener('click', event => {\n event.preventDefault();\n\n const modalForm = new ModalForm({\n modalConfig: {\n title: getString('contactdataprotectionofficer', 'tool_dataprivacy'),\n },\n formClass: 'tool_dataprivacy\\\\form\\\\contactdpo',\n saveButtonText: getString('send', 'tool_dataprivacy'),\n returnFocus: triggerElement,\n });\n\n // Show a toast notification when the form is submitted.\n modalForm.addEventListener(modalForm.events.FORM_SUBMITTED, event => {\n if (event.detail.result) {\n getString('requestsubmitted', 'tool_dataprivacy').then(addToast).catch();\n } else {\n const warningMessages = event.detail.warnings.map(warning => warning.message);\n Notification.addNotification({\n type: 'error',\n message: warningMessages.join('<br>')\n });\n }\n });\n\n modalForm.show();\n });\n};\n"],"file":"contactdpo.min.js"}
|
||||
{"version":3,"file":"contactdpo.min.js","sources":["../src/contactdpo.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Javascript module for contacting the site DPO\n *\n * @module tool_dataprivacy/contactdpo\n * @copyright 2021 Paul Holden <paulh@moodle.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport ModalForm from 'core_form/modalform';\nimport Notification from 'core/notification';\nimport {get_string as getString} from 'core/str';\nimport {add as addToast} from 'core/toast';\n\nconst SELECTORS = {\n CONTACT_DPO: '[data-action=\"contactdpo\"]',\n};\n\n/**\n * Initialize module\n */\nexport const init = () => {\n const triggerElement = document.querySelector(SELECTORS.CONTACT_DPO);\n\n triggerElement.addEventListener('click', event => {\n event.preventDefault();\n\n const modalForm = new ModalForm({\n modalConfig: {\n title: getString('contactdataprotectionofficer', 'tool_dataprivacy'),\n },\n formClass: 'tool_dataprivacy\\\\form\\\\contactdpo',\n saveButtonText: getString('send', 'tool_dataprivacy'),\n returnFocus: triggerElement,\n });\n\n // Show a toast notification when the form is submitted.\n modalForm.addEventListener(modalForm.events.FORM_SUBMITTED, event => {\n if (event.detail.result) {\n getString('requestsubmitted', 'tool_dataprivacy').then(addToast).catch();\n } else {\n const warningMessages = event.detail.warnings.map(warning => warning.message);\n Notification.addNotification({\n type: 'error',\n message: warningMessages.join('<br>')\n });\n }\n });\n\n modalForm.show();\n });\n};\n"],"names":["SELECTORS","triggerElement","document","querySelector","addEventListener","event","preventDefault","modalForm","ModalForm","modalConfig","title","formClass","saveButtonText","returnFocus","events","FORM_SUBMITTED","detail","result","then","addToast","catch","warningMessages","warnings","map","warning","message","addNotification","type","join","show"],"mappings":";;;;;;;wLA4BMA,sBACW,2CAMG,eACVC,eAAiBC,SAASC,cAAcH,uBAE9CC,eAAeG,iBAAiB,SAAS,SAAAC,OACrCA,MAAMC,qBAEAC,UAAY,IAAIC,mBAAU,CAC5BC,YAAa,CACTC,OAAO,mBAAU,+BAAgC,qBAErDC,UAAW,qCACXC,gBAAgB,mBAAU,OAAQ,oBAClCC,YAAaZ,iBAIjBM,UAAUH,iBAAiBG,UAAUO,OAAOC,gBAAgB,SAAAV,UACpDA,MAAMW,OAAOC,2BACH,mBAAoB,oBAAoBC,KAAKC,YAAUC,YAC9D,KACGC,gBAAkBhB,MAAMW,OAAOM,SAASC,KAAI,SAAAC,gBAAWA,QAAQC,iCACxDC,gBAAgB,CACzBC,KAAM,QACNF,QAASJ,gBAAgBO,KAAK,cAK1CrB,UAAUsB"}
|
||||
+10
-2
@@ -1,2 +1,10 @@
|
||||
define ("tool_dataprivacy/data_deletion",["jquery","core/ajax","core/notification","core/str","core/modal_factory","core/modal_events"],function(a,b,c,d,e,f){var h={MARK_FOR_DELETION:"[data-action=\"markfordeletion\"]",SELECT_ALL:"[data-action=\"selectall\"]"},i={SELECTCONTEXT:".selectcontext"},j=function(){this.registerEvents()};j.prototype.registerEvents=function(){a(h.MARK_FOR_DELETION).click(function(b){b.preventDefault();var c=[];a(i.SELECTCONTEXT).each(function(){var b=a(this);if(b.is(":checked")){c.push(b.val())}});g(c)});a(h.SELECT_ALL).change(function(b){b.preventDefault();var c=a(this);if(c.is(":checked")){a(i.SELECTCONTEXT).attr("checked","checked")}else{a(i.SELECTCONTEXT).removeAttr("checked")}})};function g(a){var g="";d.get_strings([{key:"confirm",component:"moodle"},{key:"confirmcontextdeletion",component:"tool_dataprivacy"}]).then(function(a){g=a[0];var b=a[1];return e.create({title:g,body:b,type:e.types.SAVE_CANCEL})}).then(function(d){d.setSaveButtonText(g);d.getRoot().on(f.save,function(){b.call([{methodname:"tool_dataprivacy_confirm_contexts_for_deletion",args:{ids:a}}])[0].done(function(a){if(a.result){window.location.reload()}else{c.addNotification({message:a.warnings[0].message,type:"error"})}}).fail(c.exception)});d.getRoot().on(f.hidden,function(){d.destroy()});return d}).done(function(a){a.show()}).fail(c.exception)}return j});
|
||||
//# sourceMappingURL=data_deletion.min.js.map
|
||||
/**
|
||||
* Request actions.
|
||||
*
|
||||
* @module tool_dataprivacy/data_deletion
|
||||
* @copyright 2018 Jun Pataleta
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
define("tool_dataprivacy/data_deletion",["jquery","core/ajax","core/notification","core/str","core/modal_factory","core/modal_events"],(function($,Ajax,Notification,Str,ModalFactory,ModalEvents){var ACTIONS_MARK_FOR_DELETION='[data-action="markfordeletion"]',ACTIONS_SELECT_ALL='[data-action="selectall"]',SELECTORS_SELECTCONTEXT=".selectcontext",DataDeletionActions=function(){this.registerEvents()};return DataDeletionActions.prototype.registerEvents=function(){$(ACTIONS_MARK_FOR_DELETION).click((function(e){e.preventDefault();var ids,keys,wsfunction,modalTitle,selectedIds=[];$(SELECTORS_SELECTCONTEXT).each((function(){var checkbox=$(this);checkbox.is(":checked")&&selectedIds.push(checkbox.val())})),ids=selectedIds,keys=[{key:"confirm",component:"moodle"},{key:"confirmcontextdeletion",component:"tool_dataprivacy"}],wsfunction="tool_dataprivacy_confirm_contexts_for_deletion",modalTitle="",Str.get_strings(keys).then((function(langStrings){modalTitle=langStrings[0];var confirmMessage=langStrings[1];return ModalFactory.create({title:modalTitle,body:confirmMessage,type:ModalFactory.types.SAVE_CANCEL})})).then((function(modal){return modal.setSaveButtonText(modalTitle),modal.getRoot().on(ModalEvents.save,(function(){var request={methodname:wsfunction,args:{ids:ids}};Ajax.call([request])[0].done((function(data){data.result?window.location.reload():Notification.addNotification({message:data.warnings[0].message,type:"error"})})).fail(Notification.exception)})),modal.getRoot().on(ModalEvents.hidden,(function(){modal.destroy()})),modal})).done((function(modal){modal.show()})).fail(Notification.exception)})),$(ACTIONS_SELECT_ALL).change((function(e){e.preventDefault(),$(this).is(":checked")?$(SELECTORS_SELECTCONTEXT).attr("checked","checked"):$(SELECTORS_SELECTCONTEXT).removeAttr("checked")}))},DataDeletionActions}));
|
||||
|
||||
//# sourceMappingURL=data_deletion.min.js.map
|
||||
File diff suppressed because one or more lines are too long
+10
-2
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+10
-2
@@ -1,2 +1,10 @@
|
||||
define ("tool_dataprivacy/data_request_modal",["jquery","core/notification","core/custom_interaction_events","core/modal","core/modal_registry","tool_dataprivacy/events"],function(a,b,c,d,e,f){var g=!1,h={APPROVE_BUTTON:"[data-action=\"approve\"]",DENY_BUTTON:"[data-action=\"deny\"]",COMPLETE_BUTTON:"[data-action=\"complete\"]"},i=function(a){d.call(this,a)};i.TYPE="tool_dataprivacy-data_request";i.prototype=Object.create(d.prototype);i.prototype.constructor=i;i.prototype.registerEventListeners=function(){d.prototype.registerEventListeners.call(this);this.getModal().on(c.events.activate,h.APPROVE_BUTTON,function(b,c){var d=a.Event(f.approve);this.getRoot().trigger(d,this);if(!d.isDefaultPrevented()){this.hide();c.originalEvent.preventDefault()}}.bind(this));this.getModal().on(c.events.activate,h.DENY_BUTTON,function(b,c){var d=a.Event(f.deny);this.getRoot().trigger(d,this);if(!d.isDefaultPrevented()){this.hide();c.originalEvent.preventDefault()}}.bind(this));this.getModal().on(c.events.activate,h.COMPLETE_BUTTON,function(b,c){var d=a.Event(f.complete);this.getRoot().trigger(d,this);if(!d.isDefaultPrevented()){this.hide();c.originalEvent.preventDefault()}}.bind(this))};if(!g){e.register(i.TYPE,i,"tool_dataprivacy/data_request_modal");g=!0}return i});
|
||||
//# sourceMappingURL=data_request_modal.min.js.map
|
||||
/**
|
||||
* Request actions.
|
||||
*
|
||||
* @module tool_dataprivacy/data_request_modal
|
||||
* @copyright 2018 Jun Pataleta
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
define("tool_dataprivacy/data_request_modal",["jquery","core/notification","core/custom_interaction_events","core/modal","core/modal_registry","tool_dataprivacy/events"],(function($,Notification,CustomEvents,Modal,ModalRegistry,DataPrivacyEvents){var registered=!1,SELECTORS_APPROVE_BUTTON='[data-action="approve"]',SELECTORS_DENY_BUTTON='[data-action="deny"]',SELECTORS_COMPLETE_BUTTON='[data-action="complete"]',ModalDataRequest=function(root){Modal.call(this,root)};return ModalDataRequest.TYPE="tool_dataprivacy-data_request",(ModalDataRequest.prototype=Object.create(Modal.prototype)).constructor=ModalDataRequest,ModalDataRequest.prototype.registerEventListeners=function(){Modal.prototype.registerEventListeners.call(this),this.getModal().on(CustomEvents.events.activate,SELECTORS_APPROVE_BUTTON,function(e,data){var approveEvent=$.Event(DataPrivacyEvents.approve);this.getRoot().trigger(approveEvent,this),approveEvent.isDefaultPrevented()||(this.hide(),data.originalEvent.preventDefault())}.bind(this)),this.getModal().on(CustomEvents.events.activate,SELECTORS_DENY_BUTTON,function(e,data){var denyEvent=$.Event(DataPrivacyEvents.deny);this.getRoot().trigger(denyEvent,this),denyEvent.isDefaultPrevented()||(this.hide(),data.originalEvent.preventDefault())}.bind(this)),this.getModal().on(CustomEvents.events.activate,SELECTORS_COMPLETE_BUTTON,function(e,data){var completeEvent=$.Event(DataPrivacyEvents.complete);this.getRoot().trigger(completeEvent,this),completeEvent.isDefaultPrevented()||(this.hide(),data.originalEvent.preventDefault())}.bind(this))},registered||(ModalRegistry.register(ModalDataRequest.TYPE,ModalDataRequest,"tool_dataprivacy/data_request_modal"),registered=!0),ModalDataRequest}));
|
||||
|
||||
//# sourceMappingURL=data_request_modal.min.js.map
|
||||
File diff suppressed because one or more lines are too long
+10
-2
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,2 +1,10 @@
|
||||
define ("tool_dataprivacy/effective_retention_period",["jquery"],function(a){var b={PURPOSE_SELECT:"#id_purposeid",RETENTION_FIELD:"#fitem_id_retention_current [data-fieldtype=static]"},c=function(a){this.purposeRetentionPeriods=a;this.registerEventListeners()},d=function(){a(b.PURPOSE_SELECT).off("change")};c.prototype.purposeRetentionPeriods=[];c.prototype.registerEventListeners=function(){a(b.PURPOSE_SELECT).on("change",function(c){var d=a(c.currentTarget).val(),e=this.purposeRetentionPeriods[d];a(b.RETENTION_FIELD).text(e)}.bind(this))};return{init:function init(a){d();return new c(a)}}});
|
||||
//# sourceMappingURL=effective_retention_period.min.js.map
|
||||
/**
|
||||
* Module to update the displayed retention period.
|
||||
*
|
||||
* @module tool_dataprivacy/effective_retention_period
|
||||
* @copyright 2018 David Monllao
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
define("tool_dataprivacy/effective_retention_period",["jquery"],(function($){var SELECTORS_PURPOSE_SELECT="#id_purposeid",SELECTORS_RETENTION_FIELD="#fitem_id_retention_current [data-fieldtype=static]",EffectiveRetentionPeriod=function(purposeRetentionPeriods){this.purposeRetentionPeriods=purposeRetentionPeriods,this.registerEventListeners()};return EffectiveRetentionPeriod.prototype.purposeRetentionPeriods=[],EffectiveRetentionPeriod.prototype.registerEventListeners=function(){$(SELECTORS_PURPOSE_SELECT).on("change",function(ev){var selected=$(ev.currentTarget).val(),selectedPurpose=this.purposeRetentionPeriods[selected];$(SELECTORS_RETENTION_FIELD).text(selectedPurpose)}.bind(this))},{init:function(purposeRetentionPeriods){return $(SELECTORS_PURPOSE_SELECT).off("change"),new EffectiveRetentionPeriod(purposeRetentionPeriods)}}}));
|
||||
|
||||
//# sourceMappingURL=effective_retention_period.min.js.map
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"sources":["../src/effective_retention_period.js"],"names":["define","$","SELECTORS","PURPOSE_SELECT","RETENTION_FIELD","EffectiveRetentionPeriod","purposeRetentionPeriods","registerEventListeners","removeListeners","off","prototype","on","ev","selected","currentTarget","val","selectedPurpose","text","bind","init"],"mappings":"AAsBAA,OAAM,+CAAC,CAAC,QAAD,CAAD,CACF,SAASC,CAAT,CAAY,IAEJC,CAAAA,CAAS,CAAG,CACZC,cAAc,CAAE,eADJ,CAEZC,eAAe,CAAE,qDAFL,CAFR,CAYJC,CAAwB,CAAG,SAASC,CAAT,CAAkC,CAC7D,KAAKA,uBAAL,CAA+BA,CAA/B,CACA,KAAKC,sBAAL,EACH,CAfO,CAsBJC,CAAe,CAAG,UAAW,CAC7BP,CAAC,CAACC,CAAS,CAACC,cAAX,CAAD,CAA4BM,GAA5B,CAAgC,QAAhC,CACH,CAxBO,CA8BRJ,CAAwB,CAACK,SAAzB,CAAmCJ,uBAAnC,CAA6D,EAA7D,CAOAD,CAAwB,CAACK,SAAzB,CAAmCH,sBAAnC,CAA4D,UAAW,CAEnEN,CAAC,CAACC,CAAS,CAACC,cAAX,CAAD,CAA4BQ,EAA5B,CAA+B,QAA/B,CAAyC,SAASC,CAAT,CAAa,IAC9CC,CAAAA,CAAQ,CAAGZ,CAAC,CAACW,CAAE,CAACE,aAAJ,CAAD,CAAoBC,GAApB,EADmC,CAE9CC,CAAe,CAAG,KAAKV,uBAAL,CAA6BO,CAA7B,CAF4B,CAGlDZ,CAAC,CAACC,CAAS,CAACE,eAAX,CAAD,CAA6Ba,IAA7B,CAAkCD,CAAlC,CACH,CAJwC,CAIvCE,IAJuC,CAIlC,IAJkC,CAAzC,CAKH,CAPD,CASA,MAAwE,CACpEC,IAAI,CAAE,cAASb,CAAT,CAAkC,CAEpCE,CAAe,GACf,MAAO,IAAIH,CAAAA,CAAJ,CAA6BC,CAA7B,CACV,CALmE,CAO3E,CAtDC,CAAN","sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Module to update the displayed retention period.\n *\n * @module tool_dataprivacy/effective_retention_period\n * @copyright 2018 David Monllao\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(['jquery'],\n function($) {\n\n var SELECTORS = {\n PURPOSE_SELECT: '#id_purposeid',\n RETENTION_FIELD: '#fitem_id_retention_current [data-fieldtype=static]',\n };\n\n /**\n * Constructor for the retention period display.\n *\n * @param {Array} purposeRetentionPeriods Associative array of purposeids with effective retention period at this context\n */\n var EffectiveRetentionPeriod = function(purposeRetentionPeriods) {\n this.purposeRetentionPeriods = purposeRetentionPeriods;\n this.registerEventListeners();\n };\n\n /**\n * Removes the current 'change' listeners.\n *\n * Useful when a new form is loaded.\n */\n var removeListeners = function() {\n $(SELECTORS.PURPOSE_SELECT).off('change');\n };\n\n /**\n * @var {Array} purposeRetentionPeriods\n * @private\n */\n EffectiveRetentionPeriod.prototype.purposeRetentionPeriods = [];\n\n /**\n * Add purpose change listeners.\n *\n * @method registerEventListeners\n */\n EffectiveRetentionPeriod.prototype.registerEventListeners = function() {\n\n $(SELECTORS.PURPOSE_SELECT).on('change', function(ev) {\n var selected = $(ev.currentTarget).val();\n var selectedPurpose = this.purposeRetentionPeriods[selected];\n $(SELECTORS.RETENTION_FIELD).text(selectedPurpose);\n }.bind(this));\n };\n\n return /** @alias module:tool_dataprivacy/effective_retention_period */ {\n init: function(purposeRetentionPeriods) {\n // Remove previously attached listeners.\n removeListeners();\n return new EffectiveRetentionPeriod(purposeRetentionPeriods);\n }\n };\n }\n);\n\n"],"file":"effective_retention_period.min.js"}
|
||||
{"version":3,"file":"effective_retention_period.min.js","sources":["../src/effective_retention_period.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Module to update the displayed retention period.\n *\n * @module tool_dataprivacy/effective_retention_period\n * @copyright 2018 David Monllao\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(['jquery'],\n function($) {\n\n var SELECTORS = {\n PURPOSE_SELECT: '#id_purposeid',\n RETENTION_FIELD: '#fitem_id_retention_current [data-fieldtype=static]',\n };\n\n /**\n * Constructor for the retention period display.\n *\n * @param {Array} purposeRetentionPeriods Associative array of purposeids with effective retention period at this context\n */\n var EffectiveRetentionPeriod = function(purposeRetentionPeriods) {\n this.purposeRetentionPeriods = purposeRetentionPeriods;\n this.registerEventListeners();\n };\n\n /**\n * Removes the current 'change' listeners.\n *\n * Useful when a new form is loaded.\n */\n var removeListeners = function() {\n $(SELECTORS.PURPOSE_SELECT).off('change');\n };\n\n /**\n * @var {Array} purposeRetentionPeriods\n * @private\n */\n EffectiveRetentionPeriod.prototype.purposeRetentionPeriods = [];\n\n /**\n * Add purpose change listeners.\n *\n * @method registerEventListeners\n */\n EffectiveRetentionPeriod.prototype.registerEventListeners = function() {\n\n $(SELECTORS.PURPOSE_SELECT).on('change', function(ev) {\n var selected = $(ev.currentTarget).val();\n var selectedPurpose = this.purposeRetentionPeriods[selected];\n $(SELECTORS.RETENTION_FIELD).text(selectedPurpose);\n }.bind(this));\n };\n\n return /** @alias module:tool_dataprivacy/effective_retention_period */ {\n init: function(purposeRetentionPeriods) {\n // Remove previously attached listeners.\n removeListeners();\n return new EffectiveRetentionPeriod(purposeRetentionPeriods);\n }\n };\n }\n);\n\n"],"names":["define","$","SELECTORS","EffectiveRetentionPeriod","purposeRetentionPeriods","registerEventListeners","prototype","on","ev","selected","currentTarget","val","selectedPurpose","this","text","bind","init","off"],"mappings":";;;;;;;AAsBAA,qDAAO,CAAC,WACJ,SAASC,OAEDC,yBACgB,gBADhBA,0BAEiB,sDAQjBC,yBAA2B,SAASC,8BAC/BA,wBAA0BA,6BAC1BC,iCAgBTF,yBAAyBG,UAAUF,wBAA0B,GAO7DD,yBAAyBG,UAAUD,uBAAyB,WAExDJ,EAAEC,0BAA0BK,GAAG,SAAU,SAASC,QAC1CC,SAAWR,EAAEO,GAAGE,eAAeC,MAC/BC,gBAAkBC,KAAKT,wBAAwBK,UACnDR,EAAEC,2BAA2BY,KAAKF,kBACpCG,KAAKF,QAG6D,CACpEG,KAAM,SAASZ,gCAxBfH,EAAEC,0BAA0Be,IAAI,UA2BrB,IAAId,yBAAyBC"}
|
||||
+10
-2
@@ -1,2 +1,10 @@
|
||||
define ("tool_dataprivacy/events",[],function(){return{approve:"tool_dataprivacy-data_request:approve",bulkApprove:"tool_dataprivacy-data_request:bulk_approve",deny:"tool_dataprivacy-data_request:deny",bulkDeny:"tool_dataprivacy-data_request:bulk_deny",complete:"tool_dataprivacy-data_request:complete"}});
|
||||
//# sourceMappingURL=events.min.js.map
|
||||
/**
|
||||
* Contain the events the data privacy tool can fire.
|
||||
*
|
||||
* @module tool_dataprivacy/events
|
||||
* @copyright 2018 Jun Pataleta
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
define("tool_dataprivacy/events",[],(function(){return{approve:"tool_dataprivacy-data_request:approve",bulkApprove:"tool_dataprivacy-data_request:bulk_approve",deny:"tool_dataprivacy-data_request:deny",bulkDeny:"tool_dataprivacy-data_request:bulk_deny",complete:"tool_dataprivacy-data_request:complete"}}));
|
||||
|
||||
//# sourceMappingURL=events.min.js.map
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"sources":["../src/events.js"],"names":["define","approve","bulkApprove","deny","bulkDeny","complete"],"mappings":"AAsBAA,OAAM,2BAAC,EAAD,CAAK,UAAW,CAClB,MAAO,CACHC,OAAO,CAAE,uCADN,CAEHC,WAAW,CAAE,4CAFV,CAGHC,IAAI,CAAE,oCAHH,CAIHC,QAAQ,CAAE,yCAJP,CAKHC,QAAQ,CAAE,wCALP,CAOV,CARK,CAAN","sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Contain the events the data privacy tool can fire.\n *\n * @module tool_dataprivacy/events\n * @copyright 2018 Jun Pataleta\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine([], function() {\n return {\n approve: 'tool_dataprivacy-data_request:approve',\n bulkApprove: 'tool_dataprivacy-data_request:bulk_approve',\n deny: 'tool_dataprivacy-data_request:deny',\n bulkDeny: 'tool_dataprivacy-data_request:bulk_deny',\n complete: 'tool_dataprivacy-data_request:complete'\n };\n});\n"],"file":"events.min.js"}
|
||||
{"version":3,"file":"events.min.js","sources":["../src/events.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Contain the events the data privacy tool can fire.\n *\n * @module tool_dataprivacy/events\n * @copyright 2018 Jun Pataleta\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine([], function() {\n return {\n approve: 'tool_dataprivacy-data_request:approve',\n bulkApprove: 'tool_dataprivacy-data_request:bulk_approve',\n deny: 'tool_dataprivacy-data_request:deny',\n bulkDeny: 'tool_dataprivacy-data_request:bulk_deny',\n complete: 'tool_dataprivacy-data_request:complete'\n };\n});\n"],"names":["define","approve","bulkApprove","deny","bulkDeny","complete"],"mappings":";;;;;;;AAsBAA,iCAAO,IAAI,iBACA,CACHC,QAAS,wCACTC,YAAa,6CACbC,KAAM,qCACNC,SAAU,0CACVC,SAAU"}
|
||||
+10
-2
@@ -1,2 +1,10 @@
|
||||
define ("tool_dataprivacy/expand_contract",["jquery","core/url","core/str"],function(a,b,c){var d=a("<img alt=\"\" src=\""+b.imageUrl("t/expanded")+"\"/>"),e=a("<img alt=\"\" src=\""+b.imageUrl("t/collapsed")+"\"/>"),f={EXPAND:"fa-caret-right",COLLAPSE:"fa-caret-down"};return{expandCollapse:function expandCollapse(a,b){if(a.hasClass("hide")){a.removeClass("hide");a.addClass("visible");a.attr("aria-expanded",!0);b.find(":header i.fa").removeClass(f.EXPAND);b.find(":header i.fa").addClass(f.COLLAPSE);b.find(":header img.icon").attr("src",d.attr("src"))}else{a.removeClass("visible");a.addClass("hide");a.attr("aria-expanded",!1);b.find(":header i.fa").removeClass(f.COLLAPSE);b.find(":header i.fa").addClass(f.EXPAND);b.find(":header img.icon").attr("src",e.attr("src"))}},expandCollapseAll:function expandCollapseAll(b){var g="visible"==b?"hide":"visible",h="visible"==b?!0:!1,i="visible"==b?f.EXPAND:f.COLLAPSE,j="visible"==b?f.COLLAPSE:f.EXPAND,k="visible"==b?d.attr("src"):e.attr("src");a("."+g).each(function(){a(this).removeClass(g);a(this).addClass(b);a(this).attr("aria-expanded",h)});a(".tool_dataprivacy-expand-all").data("visibilityState",g);c.get_string(g,"tool_dataprivacy").then(function(b){a(".tool_dataprivacy-expand-all").html(b)}).catch(Notification.exception);a(":header i.fa").each(function(){a(this).removeClass(i);a(this).addClass(j)});a(":header img.icon").each(function(){a(this).attr("src",k)})}}});
|
||||
//# sourceMappingURL=expand_contract.min.js.map
|
||||
/**
|
||||
* Potential user selector module.
|
||||
*
|
||||
* @module tool_dataprivacy/expand_contract
|
||||
* @copyright 2018 Adrian Greeve
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
define("tool_dataprivacy/expand_contract",["jquery","core/url","core/str"],(function($,url,str){var expandedImage=$('<img alt="" src="'+url.imageUrl("t/expanded")+'"/>'),collapsedImage=$('<img alt="" src="'+url.imageUrl("t/collapsed")+'"/>'),CLASSES_EXPAND="fa-caret-right",CLASSES_COLLAPSE="fa-caret-down";return{expandCollapse:function(targetnode,thisnode){targetnode.hasClass("hide")?(targetnode.removeClass("hide"),targetnode.addClass("visible"),targetnode.attr("aria-expanded",!0),thisnode.find(":header i.fa").removeClass(CLASSES_EXPAND),thisnode.find(":header i.fa").addClass(CLASSES_COLLAPSE),thisnode.find(":header img.icon").attr("src",expandedImage.attr("src"))):(targetnode.removeClass("visible"),targetnode.addClass("hide"),targetnode.attr("aria-expanded",!1),thisnode.find(":header i.fa").removeClass(CLASSES_COLLAPSE),thisnode.find(":header i.fa").addClass(CLASSES_EXPAND),thisnode.find(":header img.icon").attr("src",collapsedImage.attr("src")))},expandCollapseAll:function(nextstate){var currentstate="visible"==nextstate?"hide":"visible",ariaexpandedstate="visible"==nextstate,iconclassnow="visible"==nextstate?CLASSES_EXPAND:CLASSES_COLLAPSE,iconclassnext="visible"==nextstate?CLASSES_COLLAPSE:CLASSES_EXPAND,imagenow="visible"==nextstate?expandedImage.attr("src"):collapsedImage.attr("src");$("."+currentstate).each((function(){$(this).removeClass(currentstate),$(this).addClass(nextstate),$(this).attr("aria-expanded",ariaexpandedstate)})),$(".tool_dataprivacy-expand-all").data("visibilityState",currentstate),str.get_string(currentstate,"tool_dataprivacy").then((function(langString){$(".tool_dataprivacy-expand-all").html(langString)})).catch(Notification.exception),$(":header i.fa").each((function(){$(this).removeClass(iconclassnow),$(this).addClass(iconclassnext)})),$(":header img.icon").each((function(){$(this).attr("src",imagenow)}))}}}));
|
||||
|
||||
//# sourceMappingURL=expand_contract.min.js.map
|
||||
File diff suppressed because one or more lines are too long
+10
-2
@@ -1,2 +1,10 @@
|
||||
define ("tool_dataprivacy/form-user-selector",["jquery","core/ajax","core/templates"],function(a,b,c){return{processResults:function processResults(b,c){var d=[];a.each(c,function(a,b){d.push({value:b.id,label:b._label})});return d},transport:function transport(d,e,f,g){var h=b.call([{methodname:"tool_dataprivacy_get_users",args:{query:e}}]);h[0].then(function(b){var d=[],e=0;a.each(b,function(a,b){d.push(c.render("tool_dataprivacy/form-user-selector-suggestion",b))});return a.when.apply(a.when,d).then(function(){var c=arguments;a.each(b,function(a,b){b._label=c[e];e++});f(b)})}).fail(g)}}});
|
||||
//# sourceMappingURL=form-user-selector.min.js.map
|
||||
/**
|
||||
* Potential user selector module.
|
||||
*
|
||||
* @module tool_dataprivacy/form-user-selector
|
||||
* @copyright 2018 Jun Pataleta
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
define("tool_dataprivacy/form-user-selector",["jquery","core/ajax","core/templates"],(function($,Ajax,Templates){return{processResults:function(selector,results){var users=[];return $.each(results,(function(index,user){users.push({value:user.id,label:user._label})})),users},transport:function(selector,query,success,failure){Ajax.call([{methodname:"tool_dataprivacy_get_users",args:{query:query}}])[0].then((function(results){var promises=[],i=0;return $.each(results,(function(index,user){promises.push(Templates.render("tool_dataprivacy/form-user-selector-suggestion",user))})),$.when.apply($.when,promises).then((function(){var args=arguments;$.each(results,(function(index,user){user._label=args[i],i++})),success(results)}))})).fail(failure)}}}));
|
||||
|
||||
//# sourceMappingURL=form-user-selector.min.js.map
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"sources":["../src/form-user-selector.js"],"names":["define","$","Ajax","Templates","processResults","selector","results","users","each","index","user","push","value","id","label","_label","transport","query","success","failure","promise","call","methodname","args","then","promises","i","render","when","apply","arguments","fail"],"mappings":"AAuBAA,OAAM,uCAAC,CAAC,QAAD,CAAW,WAAX,CAAwB,gBAAxB,CAAD,CAA4C,SAASC,CAAT,CAAYC,CAAZ,CAAkBC,CAAlB,CAA6B,CAE3E,MAAgE,CAE5DC,cAAc,CAAE,wBAASC,CAAT,CAAmBC,CAAnB,CAA4B,CACxC,GAAIC,CAAAA,CAAK,CAAG,EAAZ,CACAN,CAAC,CAACO,IAAF,CAAOF,CAAP,CAAgB,SAASG,CAAT,CAAgBC,CAAhB,CAAsB,CAClCH,CAAK,CAACI,IAAN,CAAW,CACPC,KAAK,CAAEF,CAAI,CAACG,EADL,CAEPC,KAAK,CAAEJ,CAAI,CAACK,MAFL,CAAX,CAIH,CALD,EAMA,MAAOR,CAAAA,CACV,CAX2D,CAa5DS,SAAS,CAAE,mBAASX,CAAT,CAAmBY,CAAnB,CAA0BC,CAA1B,CAAmCC,CAAnC,CAA4C,CACnD,GAAIC,CAAAA,CAAO,CAEDlB,CAAI,CAACmB,IAAL,CAAU,CAAC,CACjBC,UAAU,CAAE,4BADK,CAEjBC,IAAI,CAAE,CACFN,KAAK,CAAEA,CADL,CAFW,CAAD,CAAV,CAFV,CASAG,CAAO,CAAC,CAAD,CAAP,CAAWI,IAAX,CAAgB,SAASlB,CAAT,CAAkB,CAC9B,GAAImB,CAAAA,CAAQ,CAAG,EAAf,CACIC,CAAC,CAAG,CADR,CAIAzB,CAAC,CAACO,IAAF,CAAOF,CAAP,CAAgB,SAASG,CAAT,CAAgBC,CAAhB,CAAsB,CAClCe,CAAQ,CAACd,IAAT,CAAcR,CAAS,CAACwB,MAAV,CAAiB,gDAAjB,CAAmEjB,CAAnE,CAAd,CACH,CAFD,EAKA,MAAOT,CAAAA,CAAC,CAAC2B,IAAF,CAAOC,KAAP,CAAa5B,CAAC,CAAC2B,IAAf,CAAqBH,CAArB,EAA+BD,IAA/B,CAAoC,UAAW,CAClD,GAAID,CAAAA,CAAI,CAAGO,SAAX,CACA7B,CAAC,CAACO,IAAF,CAAOF,CAAP,CAAgB,SAASG,CAAT,CAAgBC,CAAhB,CAAsB,CAClCA,CAAI,CAACK,MAAL,CAAcQ,CAAI,CAACG,CAAD,CAAlB,CACAA,CAAC,EACJ,CAHD,EAIAR,CAAO,CAACZ,CAAD,CAEV,CARM,CAUV,CApBD,EAoBGyB,IApBH,CAoBQZ,CApBR,CAqBH,CA5C2D,CAgDnE,CAlDK,CAAN","sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Potential user selector module.\n *\n * @module tool_dataprivacy/form-user-selector\n * @copyright 2018 Jun Pataleta\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\ndefine(['jquery', 'core/ajax', 'core/templates'], function($, Ajax, Templates) {\n\n return /** @alias module:tool_dataprivacy/form-user-selector */ {\n\n processResults: function(selector, results) {\n var users = [];\n $.each(results, function(index, user) {\n users.push({\n value: user.id,\n label: user._label\n });\n });\n return users;\n },\n\n transport: function(selector, query, success, failure) {\n var promise;\n\n promise = Ajax.call([{\n methodname: 'tool_dataprivacy_get_users',\n args: {\n query: query\n }\n }]);\n\n promise[0].then(function(results) {\n var promises = [],\n i = 0;\n\n // Render the label.\n $.each(results, function(index, user) {\n promises.push(Templates.render('tool_dataprivacy/form-user-selector-suggestion', user));\n });\n\n // Apply the label to the results.\n return $.when.apply($.when, promises).then(function() {\n var args = arguments;\n $.each(results, function(index, user) {\n user._label = args[i];\n i++;\n });\n success(results);\n return;\n });\n\n }).fail(failure);\n }\n\n };\n\n});\n"],"file":"form-user-selector.min.js"}
|
||||
{"version":3,"file":"form-user-selector.min.js","sources":["../src/form-user-selector.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Potential user selector module.\n *\n * @module tool_dataprivacy/form-user-selector\n * @copyright 2018 Jun Pataleta\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\ndefine(['jquery', 'core/ajax', 'core/templates'], function($, Ajax, Templates) {\n\n return /** @alias module:tool_dataprivacy/form-user-selector */ {\n\n processResults: function(selector, results) {\n var users = [];\n $.each(results, function(index, user) {\n users.push({\n value: user.id,\n label: user._label\n });\n });\n return users;\n },\n\n transport: function(selector, query, success, failure) {\n var promise;\n\n promise = Ajax.call([{\n methodname: 'tool_dataprivacy_get_users',\n args: {\n query: query\n }\n }]);\n\n promise[0].then(function(results) {\n var promises = [],\n i = 0;\n\n // Render the label.\n $.each(results, function(index, user) {\n promises.push(Templates.render('tool_dataprivacy/form-user-selector-suggestion', user));\n });\n\n // Apply the label to the results.\n return $.when.apply($.when, promises).then(function() {\n var args = arguments;\n $.each(results, function(index, user) {\n user._label = args[i];\n i++;\n });\n success(results);\n return;\n });\n\n }).fail(failure);\n }\n\n };\n\n});\n"],"names":["define","$","Ajax","Templates","processResults","selector","results","users","each","index","user","push","value","id","label","_label","transport","query","success","failure","call","methodname","args","then","promises","i","render","when","apply","arguments","fail"],"mappings":";;;;;;;AAuBAA,6CAAO,CAAC,SAAU,YAAa,mBAAmB,SAASC,EAAGC,KAAMC,iBAEA,CAE5DC,eAAgB,SAASC,SAAUC,aAC3BC,MAAQ,UACZN,EAAEO,KAAKF,SAAS,SAASG,MAAOC,MAC5BH,MAAMI,KAAK,CACPC,MAAOF,KAAKG,GACZC,MAAOJ,KAAKK,YAGbR,OAGXS,UAAW,SAASX,SAAUY,MAAOC,QAASC,SAGhCjB,KAAKkB,KAAK,CAAC,CACjBC,WAAY,6BACZC,KAAM,CACFL,MAAOA,UAIP,GAAGM,MAAK,SAASjB,aACjBkB,SAAW,GACXC,EAAI,SAGRxB,EAAEO,KAAKF,SAAS,SAASG,MAAOC,MAC5Bc,SAASb,KAAKR,UAAUuB,OAAO,iDAAkDhB,UAI9ET,EAAE0B,KAAKC,MAAM3B,EAAE0B,KAAMH,UAAUD,MAAK,eACnCD,KAAOO,UACX5B,EAAEO,KAAKF,SAAS,SAASG,MAAOC,MAC5BA,KAAKK,OAASO,KAAKG,GACnBA,OAEJP,QAAQZ,eAIbwB,KAAKX"}
|
||||
@@ -1,2 +1,3 @@
|
||||
define ("tool_dataprivacy/myrequestactions",["exports","core/ajax","core/notification","core/pending","core/str"],function(a,b,c,d,e){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.init=void 0;b=f(b);c=f(c);d=f(d);function f(a){return a&&a.__esModule?a:{default:a}}function g(a,b){return m(a)||l(a,b)||j(a,b)||h()}function h(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function j(a,b){if(!a)return;if("string"==typeof a)return k(a,b);var c=Object.prototype.toString.call(a).slice(8,-1);if("Object"===c&&a.constructor)c=a.constructor.name;if("Map"===c||"Set"===c)return Array.from(c);if("Arguments"===c||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c))return k(a,b)}function k(a,b){if(null==b||b>a.length)b=a.length;for(var c=0,d=Array(b);c<b;c++){d[c]=a[c]}return d}function l(a,b){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(a)))return;var c=[],d=!0,e=!1,f=void 0;try{for(var g=a[Symbol.iterator](),h;!(d=(h=g.next()).done);d=!0){c.push(h.value);if(b&&c.length===b)break}}catch(a){e=!0;f=a}finally{try{if(!d&&null!=g["return"])g["return"]()}finally{if(e)throw f}}return c}function m(a){if(Array.isArray(a))return a}var n={CANCEL_REQUEST:"[data-action=\"cancel\"][data-requestid]"};a.init=function init(){document.addEventListener("click",function(a){var f=a.target.closest(n.CANCEL_REQUEST);if(null===f){return}a.preventDefault();(0,e.get_strings)([{key:"cancelrequest",component:"tool_dataprivacy"},{key:"cancelrequestconfirmation",component:"tool_dataprivacy"}]).then(function(a){var e=g(a,2),h=e[0],i=e[1];return c.default.confirm(h,i,h,null,function(){var a=new d.default("tool/dataprivacy:cancelRequest"),e={methodname:"tool_dataprivacy_cancel_data_request",args:{requestid:f.dataset.requestid}};b.default.call([e])[0].then(function(b){if(b.result){window.location.reload()}else{c.default.addNotification({type:"error",message:b.warnings[0].message})}return a.resolve()}).catch(c.default.exception)})}).catch()})}});
|
||||
//# sourceMappingURL=myrequestactions.min.js.map
|
||||
define("tool_dataprivacy/myrequestactions",["exports","core/ajax","core/notification","core/pending","core/str"],(function(_exports,_ajax,_notification,_pending,_str){function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _slicedToArray(arr,i){return function(arr){if(Array.isArray(arr))return arr}(arr)||function(arr,i){var _i=null==arr?null:"undefined"!=typeof Symbol&&arr[Symbol.iterator]||arr["@@iterator"];if(null==_i)return;var _s,_e,_arr=[],_n=!0,_d=!1;try{for(_i=_i.call(arr);!(_n=(_s=_i.next()).done)&&(_arr.push(_s.value),!i||_arr.length!==i);_n=!0);}catch(err){_d=!0,_e=err}finally{try{_n||null==_i.return||_i.return()}finally{if(_d)throw _e}}return _arr}(arr,i)||function(o,minLen){if(!o)return;if("string"==typeof o)return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);"Object"===n&&o.constructor&&(n=o.constructor.name);if("Map"===n||"Set"===n)return Array.from(o);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen)}(arr,i)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _arrayLikeToArray(arr,len){(null==len||len>arr.length)&&(len=arr.length);for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.init=void 0,_ajax=_interopRequireDefault(_ajax),_notification=_interopRequireDefault(_notification),_pending=_interopRequireDefault(_pending);var SELECTORS_CANCEL_REQUEST='[data-action="cancel"][data-requestid]';_exports.init=function(){document.addEventListener("click",(function(event){var triggerElement=event.target.closest(SELECTORS_CANCEL_REQUEST);if(null!==triggerElement){event.preventDefault();(0,_str.get_strings)([{key:"cancelrequest",component:"tool_dataprivacy"},{key:"cancelrequestconfirmation",component:"tool_dataprivacy"}]).then((function(_ref){var _ref2=_slicedToArray(_ref,2),cancelRequest=_ref2[0],cancelConfirm=_ref2[1];return _notification.default.confirm(cancelRequest,cancelConfirm,cancelRequest,null,(function(){var pendingPromise=new _pending.default("tool/dataprivacy:cancelRequest"),request={methodname:"tool_dataprivacy_cancel_data_request",args:{requestid:triggerElement.dataset.requestid}};_ajax.default.call([request])[0].then((function(response){return response.result?window.location.reload():_notification.default.addNotification({type:"error",message:response.warnings[0].message}),pendingPromise.resolve()})).catch(_notification.default.exception)}))})).catch()}}))}}));
|
||||
|
||||
//# sourceMappingURL=myrequestactions.min.js.map
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"sources":["../src/myrequestactions.js"],"names":["SELECTORS","CANCEL_REQUEST","init","document","addEventListener","event","triggerElement","target","closest","preventDefault","key","component","then","cancelRequest","cancelConfirm","Notification","confirm","pendingPromise","Pending","request","methodname","args","requestid","dataset","Ajax","call","response","result","window","location","reload","addNotification","type","message","warnings","resolve","catch","exception"],"mappings":"kNAuBA,OACA,OACA,O,khCAGMA,CAAAA,CAAS,CAAG,CACdC,cAAc,CAAE,0CADF,C,QAOE,QAAPC,CAAAA,IAAO,EAAM,CACtBC,QAAQ,CAACC,gBAAT,CAA0B,OAA1B,CAAmC,SAAAC,CAAK,CAAI,CACxC,GAAMC,CAAAA,CAAc,CAAGD,CAAK,CAACE,MAAN,CAAaC,OAAb,CAAqBR,CAAS,CAACC,cAA/B,CAAvB,CACA,GAAuB,IAAnB,GAAAK,CAAJ,CAA6B,CACzB,MACH,CAEDD,CAAK,CAACI,cAAN,GAOA,kBALwB,CACpB,CAACC,GAAG,CAAE,eAAN,CAAuBC,SAAS,CAAE,kBAAlC,CADoB,CAEpB,CAACD,GAAG,CAAE,2BAAN,CAAmCC,SAAS,CAAE,kBAA9C,CAFoB,CAKxB,EAA4BC,IAA5B,CAAiC,WAAoC,cAAlCC,CAAkC,MAAnBC,CAAmB,MACjE,MAAOC,WAAaC,OAAb,CAAqBH,CAArB,CAAoCC,CAApC,CAAmDD,CAAnD,CAAkE,IAAlE,CAAwE,UAAM,IAC3EI,CAAAA,CAAc,CAAG,GAAIC,UAAJ,CAAY,gCAAZ,CAD0D,CAE3EC,CAAO,CAAG,CACZC,UAAU,CAAE,sCADA,CAEZC,IAAI,CAAE,CAACC,SAAS,CAAEhB,CAAc,CAACiB,OAAf,CAAuBD,SAAnC,CAFM,CAFiE,CAOjFE,UAAKC,IAAL,CAAU,CAACN,CAAD,CAAV,EAAqB,CAArB,EAAwBP,IAAxB,CAA6B,SAAAc,CAAQ,CAAI,CACrC,GAAIA,CAAQ,CAACC,MAAb,CAAqB,CACjBC,MAAM,CAACC,QAAP,CAAgBC,MAAhB,EACH,CAFD,IAEO,CACHf,UAAagB,eAAb,CAA6B,CACzBC,IAAI,CAAE,OADmB,CAEzBC,OAAO,CAAEP,CAAQ,CAACQ,QAAT,CAAkB,CAAlB,EAAqBD,OAFL,CAA7B,CAIH,CACD,MAAOhB,CAAAA,CAAc,CAACkB,OAAf,EACV,CAVD,EAUGC,KAVH,CAUSrB,UAAasB,SAVtB,CAWH,CAlBM,CAmBV,CApBD,EAoBGD,KApBH,EAqBH,CAlCD,CAmCH,C","sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * AMD module to enable users to manage their own data requests.\n *\n * @module tool_dataprivacy/myrequestactions\n * @copyright 2018 Jun Pataleta\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport Ajax from 'core/ajax';\nimport Notification from 'core/notification';\nimport Pending from 'core/pending';\nimport {get_strings as getStrings} from 'core/str';\n\nconst SELECTORS = {\n CANCEL_REQUEST: '[data-action=\"cancel\"][data-requestid]',\n};\n\n/**\n * Initialize module\n */\nexport const init = () => {\n document.addEventListener('click', event => {\n const triggerElement = event.target.closest(SELECTORS.CANCEL_REQUEST);\n if (triggerElement === null) {\n return;\n }\n\n event.preventDefault();\n\n const requiredStrings = [\n {key: 'cancelrequest', component: 'tool_dataprivacy'},\n {key: 'cancelrequestconfirmation', component: 'tool_dataprivacy'},\n ];\n\n getStrings(requiredStrings).then(([cancelRequest, cancelConfirm]) => {\n return Notification.confirm(cancelRequest, cancelConfirm, cancelRequest, null, () => {\n const pendingPromise = new Pending('tool/dataprivacy:cancelRequest');\n const request = {\n methodname: 'tool_dataprivacy_cancel_data_request',\n args: {requestid: triggerElement.dataset.requestid}\n };\n\n Ajax.call([request])[0].then(response => {\n if (response.result) {\n window.location.reload();\n } else {\n Notification.addNotification({\n type: 'error',\n message: response.warnings[0].message\n });\n }\n return pendingPromise.resolve();\n }).catch(Notification.exception);\n });\n }).catch();\n });\n};\n"],"file":"myrequestactions.min.js"}
|
||||
{"version":3,"file":"myrequestactions.min.js","sources":["../src/myrequestactions.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * AMD module to enable users to manage their own data requests.\n *\n * @module tool_dataprivacy/myrequestactions\n * @copyright 2018 Jun Pataleta\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport Ajax from 'core/ajax';\nimport Notification from 'core/notification';\nimport Pending from 'core/pending';\nimport {get_strings as getStrings} from 'core/str';\n\nconst SELECTORS = {\n CANCEL_REQUEST: '[data-action=\"cancel\"][data-requestid]',\n};\n\n/**\n * Initialize module\n */\nexport const init = () => {\n document.addEventListener('click', event => {\n const triggerElement = event.target.closest(SELECTORS.CANCEL_REQUEST);\n if (triggerElement === null) {\n return;\n }\n\n event.preventDefault();\n\n const requiredStrings = [\n {key: 'cancelrequest', component: 'tool_dataprivacy'},\n {key: 'cancelrequestconfirmation', component: 'tool_dataprivacy'},\n ];\n\n getStrings(requiredStrings).then(([cancelRequest, cancelConfirm]) => {\n return Notification.confirm(cancelRequest, cancelConfirm, cancelRequest, null, () => {\n const pendingPromise = new Pending('tool/dataprivacy:cancelRequest');\n const request = {\n methodname: 'tool_dataprivacy_cancel_data_request',\n args: {requestid: triggerElement.dataset.requestid}\n };\n\n Ajax.call([request])[0].then(response => {\n if (response.result) {\n window.location.reload();\n } else {\n Notification.addNotification({\n type: 'error',\n message: response.warnings[0].message\n });\n }\n return pendingPromise.resolve();\n }).catch(Notification.exception);\n });\n }).catch();\n });\n};\n"],"names":["SELECTORS","document","addEventListener","event","triggerElement","target","closest","preventDefault","key","component","then","cancelRequest","cancelConfirm","Notification","confirm","pendingPromise","Pending","request","methodname","args","requestid","dataset","call","response","result","window","location","reload","addNotification","type","message","warnings","resolve","catch","exception"],"mappings":"ikDA4BMA,yBACc,uDAMA,WAChBC,SAASC,iBAAiB,SAAS,SAAAC,WACzBC,eAAiBD,MAAME,OAAOC,QAAQN,6BACrB,OAAnBI,gBAIJD,MAAMI,sCAEkB,CACpB,CAACC,IAAK,gBAAiBC,UAAW,oBAClC,CAACD,IAAK,4BAA6BC,UAAW,sBAGtBC,MAAK,gDAAEC,uBAAeC,8BACvCC,sBAAaC,QAAQH,cAAeC,cAAeD,cAAe,MAAM,eACrEI,eAAiB,IAAIC,iBAAQ,kCAC7BC,QAAU,CACZC,WAAY,uCACZC,KAAM,CAACC,UAAWhB,eAAeiB,QAAQD,0BAGxCE,KAAK,CAACL,UAAU,GAAGP,MAAK,SAAAa,iBACrBA,SAASC,OACTC,OAAOC,SAASC,+BAEHC,gBAAgB,CACzBC,KAAM,QACNC,QAASP,SAASQ,SAAS,GAAGD,UAG/Bf,eAAeiB,aACvBC,MAAMpB,sBAAaqB,iBAE3BD"}
|
||||
+10
-2
@@ -1,2 +1,10 @@
|
||||
define ("tool_dataprivacy/purposesactions",["jquery","core/ajax","core/notification","core/str","core/modal_factory","core/modal_events"],function(a,b,c,d,e,f){var g={DELETE:"[data-action=\"deletepurpose\"]"},h=function(){this.registerEvents()};h.prototype.registerEvents=function(){a(g.DELETE).click(function(g){g.preventDefault();var h=a(this).data("id"),i=a(this).data("name");d.get_strings([{key:"deletepurpose",component:"tool_dataprivacy"},{key:"deletepurposetext",component:"tool_dataprivacy",param:i},{key:"delete"}]).then(function(d){var g=d[0],i=d[1],j=d[2];return e.create({title:g,body:i,type:e.types.SAVE_CANCEL}).then(function(d){d.setSaveButtonText(j);d.getRoot().on(f.save,function(){b.call([{methodname:"tool_dataprivacy_delete_purpose",args:{id:h}}])[0].done(function(b){if(b.result){a("tr[data-purposeid=\""+h+"\"]").remove()}else{c.addNotification({message:b.warnings[0].message,type:"error"})}}).fail(c.exception)});d.getRoot().on(f.hidden,function(){d.destroy()});return d})}).done(function(a){a.show()}).fail(c.exception)})};return{init:function init(){return new h}}});
|
||||
//# sourceMappingURL=purposesactions.min.js.map
|
||||
/**
|
||||
* AMD module for purposes actions.
|
||||
*
|
||||
* @module tool_dataprivacy/purposesactions
|
||||
* @copyright 2018 David Monllao
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
define("tool_dataprivacy/purposesactions",["jquery","core/ajax","core/notification","core/str","core/modal_factory","core/modal_events"],(function($,Ajax,Notification,Str,ModalFactory,ModalEvents){var ACTIONS_DELETE='[data-action="deletepurpose"]',PurposesActions=function(){this.registerEvents()};return PurposesActions.prototype.registerEvents=function(){$(ACTIONS_DELETE).click((function(e){e.preventDefault();var id=$(this).data("id"),stringkeys=[{key:"deletepurpose",component:"tool_dataprivacy"},{key:"deletepurposetext",component:"tool_dataprivacy",param:$(this).data("name")},{key:"delete"}];Str.get_strings(stringkeys).then((function(langStrings){var title=langStrings[0],confirmMessage=langStrings[1],buttonText=langStrings[2];return ModalFactory.create({title:title,body:confirmMessage,type:ModalFactory.types.SAVE_CANCEL}).then((function(modal){return modal.setSaveButtonText(buttonText),modal.getRoot().on(ModalEvents.save,(function(){var request={methodname:"tool_dataprivacy_delete_purpose",args:{id:id}};Ajax.call([request])[0].done((function(data){data.result?$('tr[data-purposeid="'+id+'"]').remove():Notification.addNotification({message:data.warnings[0].message,type:"error"})})).fail(Notification.exception)})),modal.getRoot().on(ModalEvents.hidden,(function(){modal.destroy()})),modal}))})).done((function(modal){modal.show()})).fail(Notification.exception)}))},{init:function(){return new PurposesActions}}}));
|
||||
|
||||
//# sourceMappingURL=purposesactions.min.js.map
|
||||
File diff suppressed because one or more lines are too long
+10
-2
@@ -1,2 +1,10 @@
|
||||
define ("tool_dataprivacy/request_filter",["jquery","core/form-autocomplete","core/str","core/notification"],function(a,b,c,d){var e={REQUEST_FILTERS:"#request-filters"},f=function init(){c.get_strings([{key:"filter",component:"moodle"},{key:"nofiltersapplied",component:"moodle"}]).then(function(a){var c=a[0],d=a[1];return b.enhance(e.REQUEST_FILTERS,!1,"",c,!1,!0,d,!0)}).fail(d.exception);var f=a(e.REQUEST_FILTERS).val();a(e.REQUEST_FILTERS).on("change",function(){var b=a(this).val();if(f.join(",")!==b.join(",")){if(0===b.length){a("#filters-cleared").val(1)}a(this.form).submit()}})};return{init:function init(){f()}}});
|
||||
//# sourceMappingURL=request_filter.min.js.map
|
||||
/**
|
||||
* JS module for the data requests filter.
|
||||
*
|
||||
* @module tool_dataprivacy/request_filter
|
||||
* @copyright 2018 Jun Pataleta
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
define("tool_dataprivacy/request_filter",["jquery","core/form-autocomplete","core/str","core/notification"],(function($,Autocomplete,Str,Notification){var SELECTORS_REQUEST_FILTERS="#request-filters";return{init:function(){!function(){Str.get_strings([{key:"filter",component:"moodle"},{key:"nofiltersapplied",component:"moodle"}]).then((function(langstrings){var placeholder=langstrings[0],noSelectionString=langstrings[1];return Autocomplete.enhance(SELECTORS_REQUEST_FILTERS,!1,"",placeholder,!1,!0,noSelectionString,!0)})).fail(Notification.exception);var last=$(SELECTORS_REQUEST_FILTERS).val();$(SELECTORS_REQUEST_FILTERS).on("change",(function(){var current=$(this).val();last.join(",")!==current.join(",")&&(0===current.length&&$("#filters-cleared").val(1),$(this.form).submit())}))}()}}}));
|
||||
|
||||
//# sourceMappingURL=request_filter.min.js.map
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"sources":["../src/request_filter.js"],"names":["define","$","Autocomplete","Str","Notification","SELECTORS","REQUEST_FILTERS","init","get_strings","key","component","then","langstrings","placeholder","noSelectionString","enhance","fail","exception","last","val","on","current","join","length","form","submit"],"mappings":"AAsBAA,OAAM,mCAAC,CAAC,QAAD,CAAW,wBAAX,CAAqC,UAArC,CAAiD,mBAAjD,CAAD,CAAwE,SAASC,CAAT,CAAYC,CAAZ,CAA0BC,CAA1B,CAA+BC,CAA/B,CAA6C,IAQnHC,CAAAA,CAAS,CAAG,CACZC,eAAe,CAAE,kBADL,CARuG,CAkBnHC,CAAI,CAAG,QAAPA,CAAAA,IAAO,EAAW,CAYlBJ,CAAG,CAACK,WAAJ,CAXiB,CACb,CACIC,GAAG,CAAE,QADT,CAEIC,SAAS,CAAE,QAFf,CADa,CAKb,CACID,GAAG,CAAE,kBADT,CAEIC,SAAS,CAAE,QAFf,CALa,CAWjB,EAA4BC,IAA5B,CAAiC,SAASC,CAAT,CAAsB,IAC/CC,CAAAA,CAAW,CAAGD,CAAW,CAAC,CAAD,CADsB,CAE/CE,CAAiB,CAAGF,CAAW,CAAC,CAAD,CAFgB,CAGnD,MAAOV,CAAAA,CAAY,CAACa,OAAb,CAAqBV,CAAS,CAACC,eAA/B,IAAuD,EAAvD,CAA2DO,CAA3D,OAAqFC,CAArF,IACV,CAJD,EAIGE,IAJH,CAIQZ,CAAY,CAACa,SAJrB,EAMA,GAAIC,CAAAA,CAAI,CAAGjB,CAAC,CAACI,CAAS,CAACC,eAAX,CAAD,CAA6Ba,GAA7B,EAAX,CACAlB,CAAC,CAACI,CAAS,CAACC,eAAX,CAAD,CAA6Bc,EAA7B,CAAgC,QAAhC,CAA0C,UAAW,CACjD,GAAIC,CAAAA,CAAO,CAAGpB,CAAC,CAAC,IAAD,CAAD,CAAQkB,GAAR,EAAd,CAEA,GAAID,CAAI,CAACI,IAAL,CAAU,GAAV,IAAmBD,CAAO,CAACC,IAAR,CAAa,GAAb,CAAvB,CAA0C,CAEtC,GAAuB,CAAnB,GAAAD,CAAO,CAACE,MAAZ,CAA0B,CACtBtB,CAAC,CAAC,kBAAD,CAAD,CAAsBkB,GAAtB,CAA0B,CAA1B,CACH,CACDlB,CAAC,CAAC,KAAKuB,IAAN,CAAD,CAAaC,MAAb,EACH,CACJ,CAVD,CAWH,CAhDsH,CAkDvH,MAAmD,CAM/ClB,IAAI,CAAE,eAAW,CACbA,CAAI,EACP,CAR8C,CAUtD,CA5DK,CAAN","sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * JS module for the data requests filter.\n *\n * @module tool_dataprivacy/request_filter\n * @copyright 2018 Jun Pataleta\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(['jquery', 'core/form-autocomplete', 'core/str', 'core/notification'], function($, Autocomplete, Str, Notification) {\n\n /**\n * Selectors.\n *\n * @access private\n * @type {{REQUEST_FILTERS: string}}\n */\n var SELECTORS = {\n REQUEST_FILTERS: '#request-filters'\n };\n\n /**\n * Init function.\n *\n * @method init\n * @private\n */\n var init = function() {\n var stringkeys = [\n {\n key: 'filter',\n component: 'moodle'\n },\n {\n key: 'nofiltersapplied',\n component: 'moodle'\n }\n ];\n\n Str.get_strings(stringkeys).then(function(langstrings) {\n var placeholder = langstrings[0];\n var noSelectionString = langstrings[1];\n return Autocomplete.enhance(SELECTORS.REQUEST_FILTERS, false, '', placeholder, false, true, noSelectionString, true);\n }).fail(Notification.exception);\n\n var last = $(SELECTORS.REQUEST_FILTERS).val();\n $(SELECTORS.REQUEST_FILTERS).on('change', function() {\n var current = $(this).val();\n // Prevent form from submitting unnecessarily, eg. on blur when no filter is selected.\n if (last.join(',') !== current.join(',')) {\n // If we're submitting without filters, set the hidden input 'filters-cleared' to 1.\n if (current.length === 0) {\n $('#filters-cleared').val(1);\n }\n $(this.form).submit();\n }\n });\n };\n\n return /** @alias module:core/form-autocomplete */ {\n /**\n * Initialise the unified user filter.\n *\n * @method init\n */\n init: function() {\n init();\n }\n };\n});\n"],"file":"request_filter.min.js"}
|
||||
{"version":3,"file":"request_filter.min.js","sources":["../src/request_filter.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * JS module for the data requests filter.\n *\n * @module tool_dataprivacy/request_filter\n * @copyright 2018 Jun Pataleta\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(['jquery', 'core/form-autocomplete', 'core/str', 'core/notification'], function($, Autocomplete, Str, Notification) {\n\n /**\n * Selectors.\n *\n * @access private\n * @type {{REQUEST_FILTERS: string}}\n */\n var SELECTORS = {\n REQUEST_FILTERS: '#request-filters'\n };\n\n /**\n * Init function.\n *\n * @method init\n * @private\n */\n var init = function() {\n var stringkeys = [\n {\n key: 'filter',\n component: 'moodle'\n },\n {\n key: 'nofiltersapplied',\n component: 'moodle'\n }\n ];\n\n Str.get_strings(stringkeys).then(function(langstrings) {\n var placeholder = langstrings[0];\n var noSelectionString = langstrings[1];\n return Autocomplete.enhance(SELECTORS.REQUEST_FILTERS, false, '', placeholder, false, true, noSelectionString, true);\n }).fail(Notification.exception);\n\n var last = $(SELECTORS.REQUEST_FILTERS).val();\n $(SELECTORS.REQUEST_FILTERS).on('change', function() {\n var current = $(this).val();\n // Prevent form from submitting unnecessarily, eg. on blur when no filter is selected.\n if (last.join(',') !== current.join(',')) {\n // If we're submitting without filters, set the hidden input 'filters-cleared' to 1.\n if (current.length === 0) {\n $('#filters-cleared').val(1);\n }\n $(this.form).submit();\n }\n });\n };\n\n return /** @alias module:core/form-autocomplete */ {\n /**\n * Initialise the unified user filter.\n *\n * @method init\n */\n init: function() {\n init();\n }\n };\n});\n"],"names":["define","$","Autocomplete","Str","Notification","SELECTORS","init","get_strings","key","component","then","langstrings","placeholder","noSelectionString","enhance","fail","exception","last","val","on","current","this","join","length","form","submit"],"mappings":";;;;;;;AAsBAA,yCAAO,CAAC,SAAU,yBAA0B,WAAY,sBAAsB,SAASC,EAAGC,aAAcC,IAAKC,kBAQrGC,0BACiB,yBAyC8B,CAM/CC,KAAM,YAtCC,WAYPH,IAAII,YAXa,CACb,CACIC,IAAK,SACLC,UAAW,UAEf,CACID,IAAK,mBACLC,UAAW,YAISC,MAAK,SAASC,iBAClCC,YAAcD,YAAY,GAC1BE,kBAAoBF,YAAY,UAC7BT,aAAaY,QAAQT,2BAA2B,EAAO,GAAIO,aAAa,GAAO,EAAMC,mBAAmB,MAChHE,KAAKX,aAAaY,eAEjBC,KAAOhB,EAAEI,2BAA2Ba,MACxCjB,EAAEI,2BAA2Bc,GAAG,UAAU,eAClCC,QAAUnB,EAAEoB,MAAMH,MAElBD,KAAKK,KAAK,OAASF,QAAQE,KAAK,OAET,IAAnBF,QAAQG,QACRtB,EAAE,oBAAoBiB,IAAI,GAE9BjB,EAAEoB,KAAKG,MAAMC,aAYjBnB"}
|
||||
+10
-2
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -136,4 +136,4 @@
|
||||
</INDEXES>
|
||||
</TABLE>
|
||||
</TABLES>
|
||||
</XMLDB>
|
||||
</XMLDB>
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<style>
|
||||
table, th, td {
|
||||
table.dataprivacy_email_table, .dataprivacy_email_table th, .dataprivacy_email_table td {
|
||||
border: 1px solid black;
|
||||
padding: 0.5em;
|
||||
}
|
||||
@@ -67,7 +67,7 @@
|
||||
<div>
|
||||
<p>{{#str}}emailsalutation, tool_dataprivacy, {{dponame}}{{/str}}</p>
|
||||
<p>{{#str}}requestemailintro, tool_dataprivacy{{/str}}</p>
|
||||
<table>
|
||||
<table class="dataprivacy_email_table">
|
||||
<tr>
|
||||
<th scope="row">
|
||||
{{#str}}requesttype, tool_dataprivacy{{/str}}
|
||||
|
||||
@@ -14,29 +14,14 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* API tests.
|
||||
*
|
||||
* @package tool_dataprivacy
|
||||
* @copyright 2018 Jun Pataleta
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
namespace tool_dataprivacy;
|
||||
|
||||
use core\invalid_persistent_exception;
|
||||
use core\task\manager;
|
||||
use tool_dataprivacy\context_instance;
|
||||
use tool_dataprivacy\api;
|
||||
use tool_dataprivacy\data_registry;
|
||||
use tool_dataprivacy\expired_context;
|
||||
use tool_dataprivacy\data_request;
|
||||
use tool_dataprivacy\purpose;
|
||||
use tool_dataprivacy\category;
|
||||
use testing_data_generator;
|
||||
use tool_dataprivacy\local\helper;
|
||||
use tool_dataprivacy\task\process_data_request_task;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
global $CFG;
|
||||
|
||||
/**
|
||||
* API tests.
|
||||
*
|
||||
@@ -44,7 +29,7 @@ global $CFG;
|
||||
* @copyright 2018 Jun Pataleta
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class tool_dataprivacy_api_testcase extends advanced_testcase {
|
||||
class api_test extends \advanced_testcase {
|
||||
|
||||
/**
|
||||
* Ensure that the check_can_manage_data_registry function fails cap testing when a user without capabilities is
|
||||
@@ -68,7 +53,7 @@ class tool_dataprivacy_api_testcase extends advanced_testcase {
|
||||
$user = $this->getDataGenerator()->create_user();
|
||||
$this->setUser($user);
|
||||
|
||||
$this->expectException(required_capability_exception::class);
|
||||
$this->expectException(\required_capability_exception::class);
|
||||
api::check_can_manage_data_registry();
|
||||
}
|
||||
|
||||
@@ -82,7 +67,7 @@ class tool_dataprivacy_api_testcase extends advanced_testcase {
|
||||
$user = $this->getDataGenerator()->create_user();
|
||||
$this->setUser($user);
|
||||
|
||||
$this->expectException(required_capability_exception::class);
|
||||
$this->expectException(\required_capability_exception::class);
|
||||
api::check_can_manage_data_registry(\context_system::instance()->id);
|
||||
}
|
||||
|
||||
@@ -96,7 +81,7 @@ class tool_dataprivacy_api_testcase extends advanced_testcase {
|
||||
$user = $this->getDataGenerator()->create_user();
|
||||
$this->setUser($user);
|
||||
|
||||
$this->expectException(required_capability_exception::class);
|
||||
$this->expectException(\required_capability_exception::class);
|
||||
api::check_can_manage_data_registry(\context_user::instance($user->id)->id);
|
||||
}
|
||||
|
||||
@@ -174,7 +159,7 @@ class tool_dataprivacy_api_testcase extends advanced_testcase {
|
||||
$u1 = $generator->create_user();
|
||||
$u2 = $generator->create_user();
|
||||
|
||||
$context = context_system::instance();
|
||||
$context = \context_system::instance();
|
||||
|
||||
// Give the manager role with the capability to manage data requests.
|
||||
$managerroleid = $DB->get_field('role', 'id', array('shortname' => 'manager'));
|
||||
@@ -215,7 +200,7 @@ class tool_dataprivacy_api_testcase extends advanced_testcase {
|
||||
// Confirm that the returned list is empty.
|
||||
$this->assertEmpty($roleids);
|
||||
|
||||
$context = context_system::instance();
|
||||
$context = \context_system::instance();
|
||||
|
||||
// Give the manager role with the capability to manage data requests.
|
||||
assign_capability('tool/dataprivacy:managedatarequests', CAP_ALLOW, $managerroleid, $context->id, true);
|
||||
@@ -254,7 +239,7 @@ class tool_dataprivacy_api_testcase extends advanced_testcase {
|
||||
$s1 = $generator->create_user();
|
||||
$u1 = $generator->create_user();
|
||||
|
||||
$context = context_system::instance();
|
||||
$context = \context_system::instance();
|
||||
|
||||
// Manager role.
|
||||
$managerroleid = $DB->get_field('role', 'id', array('shortname' => 'manager'));
|
||||
@@ -304,7 +289,7 @@ class tool_dataprivacy_api_testcase extends advanced_testcase {
|
||||
|
||||
// Login as a user without DPO role.
|
||||
$this->setUser($teacher);
|
||||
$this->expectException(required_capability_exception::class);
|
||||
$this->expectException(\required_capability_exception::class);
|
||||
api::approve_data_request($requestid);
|
||||
}
|
||||
|
||||
@@ -327,8 +312,8 @@ class tool_dataprivacy_api_testcase extends advanced_testcase {
|
||||
$this->assertEquals(api::DATAREQUEST_STATUS_REJECTED, $request->get('status'));
|
||||
|
||||
// Confirm they weren't deleted.
|
||||
$user = core_user::get_user($request->get('userid'));
|
||||
core_user::require_active_user($user);
|
||||
$user = \core_user::get_user($request->get('userid'));
|
||||
\core_user::require_active_user($user);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -366,7 +351,7 @@ class tool_dataprivacy_api_testcase extends advanced_testcase {
|
||||
$nondpocapable = $generator->create_user();
|
||||
$nondpoincapable = $generator->create_user();
|
||||
|
||||
$context = context_system::instance();
|
||||
$context = \context_system::instance();
|
||||
|
||||
// Manager role.
|
||||
$managerroleid = $DB->get_field('role', 'id', array('shortname' => 'manager'));
|
||||
@@ -666,8 +651,8 @@ class tool_dataprivacy_api_testcase extends advanced_testcase {
|
||||
$comment = 'sample comment';
|
||||
|
||||
// Get the teacher role pretend it's the parent roles ;).
|
||||
$systemcontext = context_system::instance();
|
||||
$usercontext = context_user::instance($user->id);
|
||||
$systemcontext = \context_system::instance();
|
||||
$usercontext = \context_user::instance($user->id);
|
||||
$parentroleid = $DB->get_field('role', 'id', array('shortname' => 'teacher'));
|
||||
// Give the manager role with the capability to manage data requests.
|
||||
assign_capability('tool/dataprivacy:makedatarequestsforchildren', CAP_ALLOW, $parentroleid, $systemcontext->id, true);
|
||||
@@ -923,7 +908,7 @@ class tool_dataprivacy_api_testcase extends advanced_testcase {
|
||||
$dpo = $generator->create_user();
|
||||
$nondpo = $generator->create_user();
|
||||
|
||||
$context = context_system::instance();
|
||||
$context = \context_system::instance();
|
||||
|
||||
// Manager role.
|
||||
$managerroleid = $DB->get_field('role', 'id', array('shortname' => 'manager'));
|
||||
@@ -1222,7 +1207,7 @@ class tool_dataprivacy_api_testcase extends advanced_testcase {
|
||||
*/
|
||||
public function test_set_contextlevel_invalid_contextlevels($contextlevel) {
|
||||
|
||||
$this->expectException(coding_exception::class);
|
||||
$this->expectException(\coding_exception::class);
|
||||
api::set_contextlevel((object) [
|
||||
'contextlevel' => $contextlevel,
|
||||
]);
|
||||
@@ -1291,7 +1276,7 @@ class tool_dataprivacy_api_testcase extends advanced_testcase {
|
||||
'categoryid' => $category1->get('id'),
|
||||
]);
|
||||
|
||||
$this->expectException(coding_exception::class);
|
||||
$this->expectException(\coding_exception::class);
|
||||
api::get_effective_contextlevel_purpose($contextlevel);
|
||||
}
|
||||
|
||||
@@ -1908,14 +1893,14 @@ class tool_dataprivacy_api_testcase extends advanced_testcase {
|
||||
$assign = $generator->create_module('assign', ['course' => $course->id]);
|
||||
$forum = $generator->create_module('forum', ['course' => $course->id]);
|
||||
|
||||
$coursecatcontext = context_coursecat::instance($coursecat->id);
|
||||
$coursecontext = context_course::instance($course->id);
|
||||
$blockcontext = context_block::instance($block->id);
|
||||
$coursecatcontext = \context_coursecat::instance($coursecat->id);
|
||||
$coursecontext = \context_course::instance($course->id);
|
||||
$blockcontext = \context_block::instance($block->id);
|
||||
|
||||
list($course, $assigncm) = get_course_and_cm_from_instance($assign->id, 'assign');
|
||||
list($course, $forumcm) = get_course_and_cm_from_instance($forum->id, 'forum');
|
||||
$assigncontext = context_module::instance($assigncm->id);
|
||||
$forumcontext = context_module::instance($forumcm->id);
|
||||
$assigncontext = \context_module::instance($assigncm->id);
|
||||
$forumcontext = \context_module::instance($forumcm->id);
|
||||
|
||||
// Generate purposes and categories.
|
||||
$category1 = api::create_category((object)['name' => 'Test category 1']);
|
||||
@@ -2199,8 +2184,8 @@ class tool_dataprivacy_api_testcase extends advanced_testcase {
|
||||
$this->resetAfterTest();
|
||||
$userid = $this->getDataGenerator()->create_user()->id;
|
||||
$roleid = $this->getDataGenerator()->create_role();
|
||||
assign_capability('tool/dataprivacy:requestdelete', CAP_PROHIBIT, $roleid, context_user::instance($userid));
|
||||
role_assign($roleid, $userid, context_user::instance($userid));
|
||||
assign_capability('tool/dataprivacy:requestdelete', CAP_PROHIBIT, $roleid, \context_user::instance($userid));
|
||||
role_assign($roleid, $userid, \context_user::instance($userid));
|
||||
$this->setUser($userid);
|
||||
$this->assertFalse(api::can_create_data_deletion_request_for_self());
|
||||
}
|
||||
@@ -2269,7 +2254,7 @@ class tool_dataprivacy_api_testcase extends advanced_testcase {
|
||||
$this->resetAfterTest();
|
||||
$userid = $this->getDataGenerator()->create_user()->id;
|
||||
$roleid = $this->getDataGenerator()->create_role();
|
||||
$contextsystem = context_system::instance();
|
||||
$contextsystem = \context_system::instance();
|
||||
assign_capability('tool/dataprivacy:requestdeleteforotheruser', CAP_ALLOW, $roleid, $contextsystem);
|
||||
role_assign($roleid, $userid, $contextsystem);
|
||||
$this->setUser($userid);
|
||||
|
||||
+66
-63
@@ -22,15 +22,18 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace tool_dataprivacy\external;
|
||||
|
||||
use externallib_advanced_testcase;
|
||||
use tool_dataprivacy\api;
|
||||
use tool_dataprivacy\context_instance;
|
||||
use tool_dataprivacy\external;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
global $CFG;
|
||||
|
||||
require_once($CFG->dirroot . '/webservice/tests/helpers.php');
|
||||
|
||||
use tool_dataprivacy\api;
|
||||
use tool_dataprivacy\context_instance;
|
||||
use tool_dataprivacy\external;
|
||||
|
||||
/**
|
||||
* External testcase.
|
||||
*
|
||||
@@ -38,7 +41,7 @@ use tool_dataprivacy\external;
|
||||
* @copyright 2018 Jun Pataleta
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
class external_test extends externallib_advanced_testcase {
|
||||
|
||||
/**
|
||||
* Test for external::approve_data_request() with the user not logged in.
|
||||
@@ -46,7 +49,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
public function test_approve_data_request_not_logged_in() {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$generator = new testing_data_generator();
|
||||
$generator = new \testing_data_generator();
|
||||
$requester = $generator->create_user();
|
||||
$comment = 'sample comment';
|
||||
|
||||
@@ -57,7 +60,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
// Log out the user and set force login to true.
|
||||
$this->setUser();
|
||||
|
||||
$this->expectException(require_login_exception::class);
|
||||
$this->expectException(\require_login_exception::class);
|
||||
external::approve_data_request($datarequest->get('id'));
|
||||
}
|
||||
|
||||
@@ -67,7 +70,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
public function test_approve_data_request_not_dpo() {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$generator = new testing_data_generator();
|
||||
$generator = new \testing_data_generator();
|
||||
$requester = $generator->create_user();
|
||||
$comment = 'sample comment';
|
||||
|
||||
@@ -77,7 +80,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
|
||||
// Login as the requester.
|
||||
$this->setUser($requester);
|
||||
$this->expectException(required_capability_exception::class);
|
||||
$this->expectException(\required_capability_exception::class);
|
||||
external::approve_data_request($datarequest->get('id'));
|
||||
}
|
||||
|
||||
@@ -87,7 +90,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
public function test_approve_data_request_not_waiting_for_approval() {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$generator = new testing_data_generator();
|
||||
$generator = new \testing_data_generator();
|
||||
$requester = $generator->create_user();
|
||||
$comment = 'sample comment';
|
||||
|
||||
@@ -98,7 +101,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
|
||||
// Admin as DPO. (The default when no one's assigned as a DPO in the site).
|
||||
$this->setAdminUser();
|
||||
$this->expectException(moodle_exception::class);
|
||||
$this->expectException(\moodle_exception::class);
|
||||
external::approve_data_request($datarequest->get('id'));
|
||||
}
|
||||
|
||||
@@ -108,7 +111,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
public function test_approve_data_request() {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$generator = new testing_data_generator();
|
||||
$generator = new \testing_data_generator();
|
||||
$requester = $generator->create_user();
|
||||
$comment = 'sample comment';
|
||||
|
||||
@@ -120,7 +123,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
$this->setAdminUser();
|
||||
api::update_request_status($datarequest->get('id'), api::DATAREQUEST_STATUS_AWAITING_APPROVAL);
|
||||
$result = external::approve_data_request($datarequest->get('id'));
|
||||
$return = (object) external_api::clean_returnvalue(external::approve_data_request_returns(), $result);
|
||||
$return = (object) \external_api::clean_returnvalue(external::approve_data_request_returns(), $result);
|
||||
$this->assertTrue($return->result);
|
||||
$this->assertEmpty($return->warnings);
|
||||
}
|
||||
@@ -136,7 +139,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
|
||||
$result = external::approve_data_request(1);
|
||||
|
||||
$return = (object) external_api::clean_returnvalue(external::approve_data_request_returns(), $result);
|
||||
$return = (object) \external_api::clean_returnvalue(external::approve_data_request_returns(), $result);
|
||||
$this->assertFalse($return->result);
|
||||
$this->assertCount(1, $return->warnings);
|
||||
$warning = reset($return->warnings);
|
||||
@@ -149,7 +152,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
public function test_cancel_data_request_other_user() {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$generator = new testing_data_generator();
|
||||
$generator = new \testing_data_generator();
|
||||
$requester = $generator->create_user();
|
||||
$otheruser = $generator->create_user();
|
||||
$comment = 'sample comment';
|
||||
@@ -162,7 +165,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
$this->setUser($otheruser);
|
||||
|
||||
$result = external::cancel_data_request($datarequest->get('id'));
|
||||
$return = (object) external_api::clean_returnvalue(external::approve_data_request_returns(), $result);
|
||||
$return = (object) \external_api::clean_returnvalue(external::approve_data_request_returns(), $result);
|
||||
$this->assertFalse($return->result);
|
||||
$this->assertCount(1, $return->warnings);
|
||||
$warning = reset($return->warnings);
|
||||
@@ -175,7 +178,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
public function test_cancel_data_request_other_user_as_requester() {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$generator = new testing_data_generator();
|
||||
$generator = new \testing_data_generator();
|
||||
$requester = $generator->create_user();
|
||||
$otheruser = $generator->create_user();
|
||||
$comment = 'sample comment';
|
||||
@@ -191,7 +194,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
$datarequest = api::create_data_request($otheruser->id, api::DATAREQUEST_TYPE_EXPORT, $comment);
|
||||
|
||||
$result = external::cancel_data_request($datarequest->get('id'));
|
||||
$return = (object) external_api::clean_returnvalue(external::approve_data_request_returns(), $result);
|
||||
$return = (object) \external_api::clean_returnvalue(external::approve_data_request_returns(), $result);
|
||||
$this->assertTrue($return->result);
|
||||
$this->assertEmpty($return->warnings);
|
||||
}
|
||||
@@ -202,7 +205,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
public function test_cancel_data_request_requester_lost_permissions() {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$generator = new testing_data_generator();
|
||||
$generator = new \testing_data_generator();
|
||||
$requester = $generator->create_user();
|
||||
$otheruser = $generator->create_user();
|
||||
$comment = 'sample comment';
|
||||
@@ -220,7 +223,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
role_unassign($parentrole, $requester->id, \context_user::instance($otheruser->id)->id);
|
||||
|
||||
// This user can no longer make the request.
|
||||
$this->expectException(required_capability_exception::class);
|
||||
$this->expectException(\required_capability_exception::class);
|
||||
|
||||
$result = external::cancel_data_request($datarequest->get('id'));
|
||||
}
|
||||
@@ -231,7 +234,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
public function test_cancel_data_request_other_user_as_child() {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$generator = new testing_data_generator();
|
||||
$generator = new \testing_data_generator();
|
||||
$requester = $generator->create_user();
|
||||
$otheruser = $generator->create_user();
|
||||
$comment = 'sample comment';
|
||||
@@ -247,7 +250,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
$datarequest = api::create_data_request($otheruser->id, api::DATAREQUEST_TYPE_EXPORT, $comment);
|
||||
|
||||
$result = external::cancel_data_request($datarequest->get('id'));
|
||||
$return = (object) external_api::clean_returnvalue(external::approve_data_request_returns(), $result);
|
||||
$return = (object) \external_api::clean_returnvalue(external::approve_data_request_returns(), $result);
|
||||
$this->assertTrue($return->result);
|
||||
$this->assertEmpty($return->warnings);
|
||||
}
|
||||
@@ -258,7 +261,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
public function test_cancel_data_request() {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$generator = new testing_data_generator();
|
||||
$generator = new \testing_data_generator();
|
||||
$requester = $generator->create_user();
|
||||
$comment = 'sample comment';
|
||||
|
||||
@@ -270,7 +273,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
$this->setUser($requester);
|
||||
$result = external::cancel_data_request($datarequest->get('id'));
|
||||
|
||||
$return = (object) external_api::clean_returnvalue(external::approve_data_request_returns(), $result);
|
||||
$return = (object) \external_api::clean_returnvalue(external::approve_data_request_returns(), $result);
|
||||
$this->assertTrue($return->result);
|
||||
$this->assertEmpty($return->warnings);
|
||||
}
|
||||
@@ -281,13 +284,13 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
public function test_contact_dpo() {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$generator = new testing_data_generator();
|
||||
$generator = new \testing_data_generator();
|
||||
$user = $generator->create_user();
|
||||
|
||||
$this->setUser($user);
|
||||
$message = 'Hello world!';
|
||||
$result = external::contact_dpo($message);
|
||||
$return = (object) external_api::clean_returnvalue(external::contact_dpo_returns(), $result);
|
||||
$return = (object) \external_api::clean_returnvalue(external::contact_dpo_returns(), $result);
|
||||
$this->assertTrue($return->result);
|
||||
$this->assertEmpty($return->warnings);
|
||||
}
|
||||
@@ -298,7 +301,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
public function test_contact_dpo_with_nasty_input() {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$generator = new testing_data_generator();
|
||||
$generator = new \testing_data_generator();
|
||||
$user = $generator->create_user();
|
||||
|
||||
$this->setUser($user);
|
||||
@@ -312,7 +315,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
public function test_deny_data_request_not_logged_in() {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$generator = new testing_data_generator();
|
||||
$generator = new \testing_data_generator();
|
||||
$requester = $generator->create_user();
|
||||
$comment = 'sample comment';
|
||||
|
||||
@@ -322,7 +325,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
|
||||
// Log out.
|
||||
$this->setUser();
|
||||
$this->expectException(require_login_exception::class);
|
||||
$this->expectException(\require_login_exception::class);
|
||||
external::deny_data_request($datarequest->get('id'));
|
||||
}
|
||||
|
||||
@@ -332,7 +335,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
public function test_deny_data_request_not_dpo() {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$generator = new testing_data_generator();
|
||||
$generator = new \testing_data_generator();
|
||||
$requester = $generator->create_user();
|
||||
$comment = 'sample comment';
|
||||
|
||||
@@ -341,7 +344,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
|
||||
// Login as the requester.
|
||||
$this->setUser($requester);
|
||||
$this->expectException(required_capability_exception::class);
|
||||
$this->expectException(\required_capability_exception::class);
|
||||
external::deny_data_request($datarequest->get('id'));
|
||||
}
|
||||
|
||||
@@ -351,7 +354,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
public function test_deny_data_request_not_waiting_for_approval() {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$generator = new testing_data_generator();
|
||||
$generator = new \testing_data_generator();
|
||||
$requester = $generator->create_user();
|
||||
$comment = 'sample comment';
|
||||
|
||||
@@ -361,7 +364,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
|
||||
// Admin as DPO. (The default when no one's assigned as a DPO in the site).
|
||||
$this->setAdminUser();
|
||||
$this->expectException(moodle_exception::class);
|
||||
$this->expectException(\moodle_exception::class);
|
||||
external::deny_data_request($datarequest->get('id'));
|
||||
}
|
||||
|
||||
@@ -371,7 +374,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
public function test_deny_data_request() {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$generator = new testing_data_generator();
|
||||
$generator = new \testing_data_generator();
|
||||
$requester = $generator->create_user();
|
||||
$comment = 'sample comment';
|
||||
|
||||
@@ -382,7 +385,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
$this->setAdminUser();
|
||||
api::update_request_status($datarequest->get('id'), api::DATAREQUEST_STATUS_AWAITING_APPROVAL);
|
||||
$result = external::approve_data_request($datarequest->get('id'));
|
||||
$return = (object) external_api::clean_returnvalue(external::deny_data_request_returns(), $result);
|
||||
$return = (object) \external_api::clean_returnvalue(external::deny_data_request_returns(), $result);
|
||||
$this->assertTrue($return->result);
|
||||
$this->assertEmpty($return->warnings);
|
||||
}
|
||||
@@ -397,7 +400,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
$this->setAdminUser();
|
||||
$result = external::deny_data_request(1);
|
||||
|
||||
$return = (object) external_api::clean_returnvalue(external::deny_data_request_returns(), $result);
|
||||
$return = (object) \external_api::clean_returnvalue(external::deny_data_request_returns(), $result);
|
||||
$this->assertFalse($return->result);
|
||||
$this->assertCount(1, $return->warnings);
|
||||
$warning = reset($return->warnings);
|
||||
@@ -410,7 +413,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
public function test_get_data_request_not_logged_in() {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$generator = new testing_data_generator();
|
||||
$generator = new \testing_data_generator();
|
||||
$requester = $generator->create_user();
|
||||
$comment = 'sample comment';
|
||||
|
||||
@@ -418,7 +421,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
$datarequest = api::create_data_request($requester->id, api::DATAREQUEST_TYPE_EXPORT, $comment);
|
||||
|
||||
$this->setUser();
|
||||
$this->expectException(require_login_exception::class);
|
||||
$this->expectException(\require_login_exception::class);
|
||||
external::get_data_request($datarequest->get('id'));
|
||||
}
|
||||
|
||||
@@ -428,7 +431,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
public function test_get_data_request_not_dpo() {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$generator = new testing_data_generator();
|
||||
$generator = new \testing_data_generator();
|
||||
$requester = $generator->create_user();
|
||||
$otheruser = $generator->create_user();
|
||||
$comment = 'sample comment';
|
||||
@@ -438,7 +441,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
|
||||
// Login as the otheruser.
|
||||
$this->setUser($otheruser);
|
||||
$this->expectException(required_capability_exception::class);
|
||||
$this->expectException(\required_capability_exception::class);
|
||||
external::get_data_request($datarequest->get('id'));
|
||||
}
|
||||
|
||||
@@ -448,7 +451,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
public function test_get_data_request() {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$generator = new testing_data_generator();
|
||||
$generator = new \testing_data_generator();
|
||||
$requester = $generator->create_user();
|
||||
$comment = 'sample comment';
|
||||
|
||||
@@ -459,7 +462,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
$this->setAdminUser();
|
||||
$result = external::get_data_request($datarequest->get('id'));
|
||||
|
||||
$return = (object) external_api::clean_returnvalue(external::get_data_request_returns(), $result);
|
||||
$return = (object) \external_api::clean_returnvalue(external::get_data_request_returns(), $result);
|
||||
$this->assertEquals(api::DATAREQUEST_TYPE_EXPORT, $return->result['type']);
|
||||
$this->assertEquals('sample comment', $return->result['comments']);
|
||||
$this->assertEquals($requester->id, $return->result['userid']);
|
||||
@@ -475,7 +478,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
|
||||
// Admin as DPO. (The default when no one's assigned as a DPO in the site).
|
||||
$this->setAdminUser();
|
||||
$this->expectException(dml_missing_record_exception::class);
|
||||
$this->expectException(\dml_missing_record_exception::class);
|
||||
external::get_data_request(1);
|
||||
}
|
||||
|
||||
@@ -489,7 +492,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
$generator = $this->getDataGenerator();
|
||||
$user = $generator->create_user();
|
||||
$this->setUser($user);
|
||||
$this->expectException(required_capability_exception::class);
|
||||
$this->expectException(\required_capability_exception::class);
|
||||
external::set_context_defaults(CONTEXT_COURSECAT, context_instance::INHERIT, context_instance::INHERIT, '', false);
|
||||
}
|
||||
|
||||
@@ -514,7 +517,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
$course = $generator->create_course(['category' => $coursecat->id]);
|
||||
$assign = $generator->create_module('assign', ['course' => $course->id]);
|
||||
list($course, $assigncm) = get_course_and_cm_from_instance($assign->id, 'assign');
|
||||
$assigncontext = context_module::instance($assigncm->id);
|
||||
$assigncontext = \context_module::instance($assigncm->id);
|
||||
|
||||
// Generate purpose and category.
|
||||
$category1 = api::create_category((object)['name' => 'Test category 1']);
|
||||
@@ -539,7 +542,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
$result = external::set_context_defaults(CONTEXT_MODULE, $categoryid, $purposeid, $modulename, $override);
|
||||
|
||||
// Extract the result.
|
||||
$return = external_api::clean_returnvalue(external::set_context_defaults_returns(), $result);
|
||||
$return = \external_api::clean_returnvalue(external::set_context_defaults_returns(), $result);
|
||||
$this->assertTrue($return['result']);
|
||||
|
||||
// Check the assignment context instance.
|
||||
@@ -568,7 +571,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
$user = $this->getDataGenerator()->create_user();
|
||||
$this->setUser($user);
|
||||
|
||||
$this->expectException(required_capability_exception::class);
|
||||
$this->expectException(\required_capability_exception::class);
|
||||
external::get_category_options(true, true);
|
||||
}
|
||||
|
||||
@@ -623,7 +626,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
$result = external::get_category_options($includeinherit, $includenotset);
|
||||
|
||||
// Extract the options.
|
||||
$return = (object) external_api::clean_returnvalue(external::get_category_options_returns(), $result);
|
||||
$return = (object) \external_api::clean_returnvalue(external::get_category_options_returns(), $result);
|
||||
$options = $return->options;
|
||||
|
||||
// Make sure everything checks out.
|
||||
@@ -642,7 +645,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
$generator = $this->getDataGenerator();
|
||||
$user = $generator->create_user();
|
||||
$this->setUser($user);
|
||||
$this->expectException(required_capability_exception::class);
|
||||
$this->expectException(\required_capability_exception::class);
|
||||
external::get_category_options(true, true);
|
||||
}
|
||||
|
||||
@@ -687,7 +690,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
$result = external::get_purpose_options($includeinherit, $includenotset);
|
||||
|
||||
// Extract the options.
|
||||
$return = (object) external_api::clean_returnvalue(external::get_purpose_options_returns(), $result);
|
||||
$return = (object) \external_api::clean_returnvalue(external::get_purpose_options_returns(), $result);
|
||||
$options = $return->options;
|
||||
|
||||
// Make sure everything checks out.
|
||||
@@ -746,7 +749,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
$result = external::get_activity_options($nodefaults);
|
||||
|
||||
// Extract the options.
|
||||
$return = (object) external_api::clean_returnvalue(external::get_activity_options_returns(), $result);
|
||||
$return = (object) \external_api::clean_returnvalue(external::get_activity_options_returns(), $result);
|
||||
$options = $return->options;
|
||||
|
||||
// Make sure the options list is not empty.
|
||||
@@ -789,7 +792,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
api::update_request_status($requestid2, api::DATAREQUEST_STATUS_AWAITING_APPROVAL);
|
||||
$result = external::bulk_approve_data_requests([$requestid1, $requestid2]);
|
||||
|
||||
$return = (object) external_api::clean_returnvalue(external::bulk_approve_data_requests_returns(), $result);
|
||||
$return = (object) \external_api::clean_returnvalue(external::bulk_approve_data_requests_returns(), $result);
|
||||
$this->assertTrue($return->result);
|
||||
$this->assertEmpty($return->warnings);
|
||||
}
|
||||
@@ -804,7 +807,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
|
||||
$result = external::bulk_approve_data_requests([42]);
|
||||
|
||||
$return = (object) external_api::clean_returnvalue(external::bulk_approve_data_requests_returns(), $result);
|
||||
$return = (object) \external_api::clean_returnvalue(external::bulk_approve_data_requests_returns(), $result);
|
||||
$this->assertFalse($return->result);
|
||||
$this->assertCount(1, $return->warnings);
|
||||
$warning = reset($return->warnings);
|
||||
@@ -837,7 +840,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
$uut = $this->getDataGenerator()->create_user();
|
||||
$this->setUser($uut);
|
||||
|
||||
$this->expectException(required_capability_exception::class);
|
||||
$this->expectException(\required_capability_exception::class);
|
||||
$result = external::bulk_approve_data_requests([$requestid1, $requestid2]);
|
||||
}
|
||||
|
||||
@@ -865,7 +868,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
// Deny the requests.
|
||||
$this->setUser($requester1);
|
||||
|
||||
$this->expectException(required_capability_exception::class);
|
||||
$this->expectException(\required_capability_exception::class);
|
||||
$result = external::bulk_approve_data_requests([$requestid1]);
|
||||
}
|
||||
|
||||
@@ -892,7 +895,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
api::update_request_status($requestid2, api::DATAREQUEST_STATUS_AWAITING_APPROVAL);
|
||||
$result = external::bulk_deny_data_requests([$requestid1, $requestid2]);
|
||||
|
||||
$return = (object) external_api::clean_returnvalue(external::bulk_approve_data_requests_returns(), $result);
|
||||
$return = (object) \external_api::clean_returnvalue(external::bulk_approve_data_requests_returns(), $result);
|
||||
$this->assertTrue($return->result);
|
||||
$this->assertEmpty($return->warnings);
|
||||
}
|
||||
@@ -905,7 +908,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
|
||||
$this->setAdminUser();
|
||||
$result = external::bulk_deny_data_requests([42]);
|
||||
$return = (object) external_api::clean_returnvalue(external::bulk_approve_data_requests_returns(), $result);
|
||||
$return = (object) \external_api::clean_returnvalue(external::bulk_approve_data_requests_returns(), $result);
|
||||
|
||||
$this->assertFalse($return->result);
|
||||
$this->assertCount(1, $return->warnings);
|
||||
@@ -939,7 +942,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
$uut = $this->getDataGenerator()->create_user();
|
||||
$this->setUser($uut);
|
||||
|
||||
$this->expectException(required_capability_exception::class);
|
||||
$this->expectException(\required_capability_exception::class);
|
||||
$result = external::bulk_deny_data_requests([$requestid1, $requestid2]);
|
||||
}
|
||||
|
||||
@@ -967,7 +970,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
// Deny the requests.
|
||||
$this->setUser($requester1);
|
||||
|
||||
$this->expectException(required_capability_exception::class);
|
||||
$this->expectException(\required_capability_exception::class);
|
||||
$result = external::bulk_deny_data_requests([$requestid1]);
|
||||
}
|
||||
|
||||
@@ -983,7 +986,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
*/
|
||||
public function test_get_users_using_using_non_identity() {
|
||||
$this->resetAfterTest();
|
||||
$context = context_system::instance();
|
||||
$context = \context_system::instance();
|
||||
$requester = $this->getDataGenerator()->create_user();
|
||||
$role = $this->getDataGenerator()->create_role();
|
||||
role_assign($role, $requester->id, $context);
|
||||
@@ -1023,7 +1026,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
$CFG->showuseridentity = 'institution';
|
||||
|
||||
// Create requester user and assign correct capability.
|
||||
$context = context_system::instance();
|
||||
$context = \context_system::instance();
|
||||
$requester = $this->getDataGenerator()->create_user();
|
||||
$role = $this->getDataGenerator()->create_role();
|
||||
role_assign($role, $requester->id, $context);
|
||||
@@ -1051,7 +1054,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
public function test_get_users_using_field_not_in_identity() {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$context = context_system::instance();
|
||||
$context = \context_system::instance();
|
||||
$requester = $this->getDataGenerator()->create_user();
|
||||
$role = $this->getDataGenerator()->create_role();
|
||||
role_assign($role, $requester->id, $context);
|
||||
@@ -1081,7 +1084,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
global $CFG;
|
||||
$this->resetAfterTest();
|
||||
$CFG->showuseridentity = 'institution';
|
||||
$context = context_system::instance();
|
||||
$context = \context_system::instance();
|
||||
$requester = $this->getDataGenerator()->create_user();
|
||||
$role = $this->getDataGenerator()->create_role();
|
||||
role_assign($role, $requester->id, $context);
|
||||
+7
-6
@@ -21,6 +21,7 @@
|
||||
* @copyright 2020 Paul Holden <paulh@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
namespace tool_dataprivacy\privacy;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
@@ -38,7 +39,7 @@ use tool_dataprivacy\privacy\provider;
|
||||
* @copyright 2020 Paul Holden <paulh@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class tool_dataprivacy_privacy_provider_testcase extends provider_testcase {
|
||||
class provider_test extends provider_testcase {
|
||||
|
||||
/**
|
||||
* Test provider get_contexts_for_userid method
|
||||
@@ -49,7 +50,7 @@ class tool_dataprivacy_privacy_provider_testcase extends provider_testcase {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$user = $this->getDataGenerator()->create_user();
|
||||
$context = context_user::instance($user->id);
|
||||
$context = \context_user::instance($user->id);
|
||||
|
||||
// Returned context list should contain a single item.
|
||||
$contextlist = $this->get_contexts_for_userid($user->id, 'tool_dataprivacy');
|
||||
@@ -68,7 +69,7 @@ class tool_dataprivacy_privacy_provider_testcase extends provider_testcase {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$user = $this->getDataGenerator()->create_user();
|
||||
$context = context_user::instance($user->id);
|
||||
$context = \context_user::instance($user->id);
|
||||
|
||||
$userlist = new userlist($context, 'tool_dataprivacy');
|
||||
provider::get_users_in_context($userlist);
|
||||
@@ -82,7 +83,7 @@ class tool_dataprivacy_privacy_provider_testcase extends provider_testcase {
|
||||
* @return void
|
||||
*/
|
||||
public function test_get_users_in_context_non_user_context() {
|
||||
$context = context_system::instance();
|
||||
$context = \context_system::instance();
|
||||
|
||||
$userlist = new userlist($context, 'tool_dataprivacy');
|
||||
provider::get_users_in_context($userlist);
|
||||
@@ -99,7 +100,7 @@ class tool_dataprivacy_privacy_provider_testcase extends provider_testcase {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$user = $this->getDataGenerator()->create_user();
|
||||
$context = context_user::instance($user->id);
|
||||
$context = \context_user::instance($user->id);
|
||||
|
||||
$this->setUser($user);
|
||||
|
||||
@@ -170,7 +171,7 @@ class tool_dataprivacy_privacy_provider_testcase extends provider_testcase {
|
||||
provider::export_user_preferences($user->id);
|
||||
|
||||
/** @var \core_privacy\tests\request\content_writer $writer */
|
||||
$writer = writer::with_context(context_system::instance());
|
||||
$writer = writer::with_context(\context_system::instance());
|
||||
$this->assertTrue($writer->has_any_data());
|
||||
|
||||
/** @var stdClass[] $preferences */
|
||||
+5
-11
@@ -14,19 +14,13 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Tests for scheduled tasks.
|
||||
*
|
||||
* @package tool_dataprivacy
|
||||
* @copyright 2018 Mihail Geshoski <mihail@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
require_once('data_privacy_testcase.php');
|
||||
namespace tool_dataprivacy\task;
|
||||
|
||||
use tool_dataprivacy\api;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
require_once(__DIR__ . '/../data_privacy_testcase.php');
|
||||
|
||||
/**
|
||||
* Tests for scheduled tasks.
|
||||
*
|
||||
@@ -34,7 +28,7 @@ use tool_dataprivacy\api;
|
||||
* @copyright 2018 Mihail Geshoski <mihail@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class tool_dataprivacy_task_testcase extends data_privacy_testcase {
|
||||
class task_test extends \data_privacy_testcase {
|
||||
|
||||
/**
|
||||
* Test tearDown.
|
||||
@@ -27,7 +27,7 @@ require_once($CFG->libdir . '/adminlib.php');
|
||||
|
||||
admin_externalpage_setup('tool_filetypes');
|
||||
|
||||
$extension = required_param('extension', PARAM_RAW);
|
||||
$extension = required_param('extension', PARAM_ALPHANUMEXT);
|
||||
$redirecturl = new \moodle_url('/admin/tool/filetypes/index.php');
|
||||
|
||||
if (optional_param('revert', 0, PARAM_INT)) {
|
||||
|
||||
@@ -100,10 +100,12 @@ class tool_generator_testplan_backend extends tool_generator_backend {
|
||||
*
|
||||
* @param int $courseid The target course id
|
||||
* @param bool $updateuserspassword Updates the course users password to $CFG->tool_generator_users_password
|
||||
* @param int|null $size of the test plan. Used to limit the number of users exported
|
||||
* to match the threads in the plan. For BC, defaults to null that means all enrolled users.
|
||||
* @return stored_file
|
||||
*/
|
||||
public static function create_users_file($courseid, $updateuserspassword) {
|
||||
$csvcontents = self::generate_users_file($courseid, $updateuserspassword);
|
||||
public static function create_users_file($courseid, $updateuserspassword, ?int $size = null) {
|
||||
$csvcontents = self::generate_users_file($courseid, $updateuserspassword, $size);
|
||||
|
||||
$fs = get_file_storage();
|
||||
$filerecord = self::get_file_record('users', 'csv');
|
||||
@@ -171,14 +173,18 @@ class tool_generator_testplan_backend extends tool_generator_backend {
|
||||
*
|
||||
* @param int $targetcourseid
|
||||
* @param bool $updateuserspassword Updates the course users password to $CFG->tool_generator_users_password
|
||||
* @param int|null $size of the test plan. Used to limit the number of users exported
|
||||
* to match the threads in the plan. For BC, defaults to null that means all enrolled users.
|
||||
* @return string The users csv file contents.
|
||||
*/
|
||||
protected static function generate_users_file($targetcourseid, $updateuserspassword) {
|
||||
protected static function generate_users_file($targetcourseid, $updateuserspassword, ?int $size = null) {
|
||||
global $CFG;
|
||||
|
||||
$coursecontext = context_course::instance($targetcourseid);
|
||||
|
||||
$users = get_enrolled_users($coursecontext, '', 0, 'u.id, u.username, u.auth', 'u.username ASC');
|
||||
// If requested, get the number of users (threads) to use in the plan. We only need those in the exported file.
|
||||
$planusers = self::$users[$size] ?? 0;
|
||||
$users = get_enrolled_users($coursecontext, '', 0, 'u.id, u.username, u.auth', 'u.username ASC', 0, $planusers);
|
||||
if (!$users) {
|
||||
print_error('coursewithoutusers', 'tool_generator');
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ if (empty($CFG->tool_generator_users_password) || is_bool($CFG->tool_generator_u
|
||||
|
||||
// Create files.
|
||||
$courseid = $DB->get_field('course', 'id', array('shortname' => $shortname));
|
||||
$usersfile = tool_generator_testplan_backend::create_users_file($courseid, !empty($options['updateuserspassword']));
|
||||
$usersfile = tool_generator_testplan_backend::create_users_file($courseid, !empty($options['updateuserspassword']), $size);
|
||||
$testplanfile = tool_generator_testplan_backend::create_testplan_file($courseid, $size);
|
||||
|
||||
// One file path per line so other CLI scripts can easily parse the output.
|
||||
|
||||
@@ -51,7 +51,7 @@ if ($data = $mform->get_data()) {
|
||||
|
||||
// Creating both test plan and users files.
|
||||
$testplanfile = tool_generator_testplan_backend::create_testplan_file($data->courseid, $data->size);
|
||||
$usersfile = tool_generator_testplan_backend::create_users_file($data->courseid, $data->updateuserspassword);
|
||||
$usersfile = tool_generator_testplan_backend::create_users_file($data->courseid, $data->updateuserspassword, $data->size);
|
||||
|
||||
// Test plan link.
|
||||
$testplanurl = moodle_url::make_pluginfile_url(
|
||||
|
||||
@@ -1,6 +1,13 @@
|
||||
This files describes API changes in core libraries and APIs,
|
||||
information provided here is intended especially for developers.
|
||||
|
||||
=== 3.11.4 ===
|
||||
|
||||
* Function tool_generator_testplan_backend::create_users_file() now supports to pass the size of the testing plan,
|
||||
that needs to be equal or smaller than the size of the generated site. That's used to effectively restrict the
|
||||
exported number of users to the number of threads the jmeter plan will have (previously all the enrolled users
|
||||
were being exported, with that leading to "false" loops (users not really looping X times).
|
||||
|
||||
=== 3.7 ===
|
||||
|
||||
* Function tool_generator_testplan_backend::get_course_options() is removed, the 'course' form element is used instead.
|
||||
|
||||
+3
-2
@@ -1,2 +1,3 @@
|
||||
define ("tool_langimport/search",["exports","core/pending","core/utils"],function(a,b,c){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.default=void 0;b=function(a){return a&&a.__esModule?a:{default:a}}(b);function d(a,b){return j(a)||h(a,b)||f(a,b)||e()}function e(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function f(a,b){if(!a)return;if("string"==typeof a)return g(a,b);var c=Object.prototype.toString.call(a).slice(8,-1);if("Object"===c&&a.constructor)c=a.constructor.name;if("Map"===c||"Set"===c)return Array.from(c);if("Arguments"===c||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c))return g(a,b)}function g(a,b){if(null==b||b>a.length)b=a.length;for(var c=0,d=Array(b);c<b;c++){d[c]=a[c]}return d}function h(a,b){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(a)))return;var c=[],d=!0,e=!1,f=void 0;try{for(var g=a[Symbol.iterator](),h;!(d=(h=g.next()).done);d=!0){c.push(h.value);if(b&&c.length===b)break}}catch(a){e=!0;f=a}finally{try{if(!d&&null!=g["return"])g["return"]()}finally{if(e)throw f}}return c}function j(a){if(Array.isArray(a))return a}var k={AVAILABLE_LANG_SELECT:"select",AVAILABLE_LANG_SEARCH:"[data-action=\"search\"]"},l=250;a.default={init:function init(a){var e=a.querySelector(k.AVAILABLE_LANG_SELECT),f=function(a){var c=new b.default("tool_langimport/search:filter");e.querySelectorAll("option").forEach(function(a){a.remove()});var f=a.target.value.toLowerCase(),g=JSON.parse(e.dataset.availableLanguages),h=Object.keys(g).reduce(function(a,b){if(g[b].toLowerCase().includes(f)){a[b]=g[b]}return a},[]);Object.entries(h).forEach(function(a){var b=d(a,2),c=b[0],f=b[1],g=document.createElement("option");g.value=c;g.innerText=f;e.append(g)});c.resolve()},g={};e.querySelectorAll("option").forEach(function(a){g[a.value]=a.text});e.dataset.availableLanguages=JSON.stringify(g);var h=a.querySelector(k.AVAILABLE_LANG_SEARCH);h.addEventListener("keydown",function(a){if("Enter"===a.key){a.preventDefault()}});h.addEventListener("keyup",function(a){var d=new b.default("tool_langimport/search:keyup");(0,c.debounce)(f,l)(a);setTimeout(function(){d.resolve()},l)})}};return a.default});
|
||||
//# sourceMappingURL=search.min.js.map
|
||||
define("tool_langimport/search",["exports","core/pending","core/utils"],(function(_exports,_pending,_utils){var obj;function _slicedToArray(arr,i){return function(arr){if(Array.isArray(arr))return arr}(arr)||function(arr,i){var _i=null==arr?null:"undefined"!=typeof Symbol&&arr[Symbol.iterator]||arr["@@iterator"];if(null==_i)return;var _s,_e,_arr=[],_n=!0,_d=!1;try{for(_i=_i.call(arr);!(_n=(_s=_i.next()).done)&&(_arr.push(_s.value),!i||_arr.length!==i);_n=!0);}catch(err){_d=!0,_e=err}finally{try{_n||null==_i.return||_i.return()}finally{if(_d)throw _e}}return _arr}(arr,i)||function(o,minLen){if(!o)return;if("string"==typeof o)return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);"Object"===n&&o.constructor&&(n=o.constructor.name);if("Map"===n||"Set"===n)return Array.from(o);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen)}(arr,i)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _arrayLikeToArray(arr,len){(null==len||len>arr.length)&&(len=arr.length);for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,_pending=(obj=_pending)&&obj.__esModule?obj:{default:obj};var SELECTORS_AVAILABLE_LANG_SELECT="select",SELECTORS_AVAILABLE_LANG_SEARCH='[data-action="search"]',_default={init:function(form){var availableLangsElement=form.querySelector(SELECTORS_AVAILABLE_LANG_SELECT),availableLangsFilter=function(event){var pendingPromise=new _pending.default("tool_langimport/search:filter");availableLangsElement.querySelectorAll("option").forEach((function(option){option.remove()}));var searchTerm=event.target.value.toLowerCase(),availableLanguages=JSON.parse(availableLangsElement.dataset.availableLanguages),filteredLanguages=Object.keys(availableLanguages).reduce((function(matches,langcode){return availableLanguages[langcode].toLowerCase().includes(searchTerm)&&(matches[langcode]=availableLanguages[langcode]),matches}),[]);Object.entries(filteredLanguages).forEach((function(_ref){var _ref2=_slicedToArray(_ref,2),langcode=_ref2[0],langname=_ref2[1],option=document.createElement("option");option.value=langcode,option.innerText=langname,availableLangsElement.append(option)})),pendingPromise.resolve()},availableLanguages={};availableLangsElement.querySelectorAll("option").forEach((function(option){availableLanguages[option.value]=option.text})),availableLangsElement.dataset.availableLanguages=JSON.stringify(availableLanguages);var availableLangsSearch=form.querySelector(SELECTORS_AVAILABLE_LANG_SEARCH);availableLangsSearch.addEventListener("keydown",(function(event){"Enter"===event.key&&event.preventDefault()})),availableLangsSearch.addEventListener("keyup",(function(event){var pendingPromise=new _pending.default("tool_langimport/search:keyup");(0,_utils.debounce)(availableLangsFilter,250)(event),setTimeout((function(){pendingPromise.resolve()}),250)}))}};return _exports.default=_default,_exports.default}));
|
||||
|
||||
//# sourceMappingURL=search.min.js.map
|
||||
File diff suppressed because one or more lines are too long
+5
-5
@@ -22,7 +22,7 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
namespace tool_langimport\event;
|
||||
|
||||
/**
|
||||
* Test class for langimport events.
|
||||
@@ -31,7 +31,7 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @copyright 2014 Dan Poltawski
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
|
||||
*/
|
||||
class tool_langimport_events_testcase extends advanced_testcase {
|
||||
class events_test extends \advanced_testcase {
|
||||
|
||||
/**
|
||||
* Setup testcase.
|
||||
@@ -53,7 +53,7 @@ class tool_langimport_events_testcase extends advanced_testcase {
|
||||
$event = reset($events);
|
||||
|
||||
$this->assertInstanceOf('\tool_langimport\event\langpack_updated', $event);
|
||||
$this->assertEquals(context_system::instance(), $event->get_context());
|
||||
$this->assertEquals(\context_system::instance(), $event->get_context());
|
||||
}
|
||||
|
||||
public function test_langpack_updated_validation() {
|
||||
@@ -73,7 +73,7 @@ class tool_langimport_events_testcase extends advanced_testcase {
|
||||
$event = reset($events);
|
||||
|
||||
$this->assertInstanceOf('\tool_langimport\event\langpack_imported', $event);
|
||||
$this->assertEquals(context_system::instance(), $event->get_context());
|
||||
$this->assertEquals(\context_system::instance(), $event->get_context());
|
||||
}
|
||||
|
||||
public function test_langpack_installed_validation() {
|
||||
@@ -93,7 +93,7 @@ class tool_langimport_events_testcase extends advanced_testcase {
|
||||
$event = reset($events);
|
||||
|
||||
$this->assertInstanceOf('\tool_langimport\event\langpack_removed', $event);
|
||||
$this->assertEquals(context_system::instance(), $event->get_context());
|
||||
$this->assertEquals(\context_system::instance(), $event->get_context());
|
||||
}
|
||||
|
||||
public function test_langpack_removed_validation() {
|
||||
+10
-2
@@ -1,2 +1,10 @@
|
||||
define ("tool_licensemanager/delete_license",["jquery","core/modal_factory","core/modal_events","core/url","core/str"],function(a,b,c,d,e){var f=a(".delete-license");b.create({type:b.types.SAVE_CANCEL,title:e.get_string("deletelicense","tool_licensemanager"),body:e.get_string("deletelicenseconfirmmessage","tool_licensemanager"),preShowCallback:function preShowCallback(b,c){b=a(b);var e={action:"delete",license:b.data("license")};c.deleteURL=d.relativeUrl("/admin/tool/licensemanager/index.php",e,!0)},large:!0},f).done(function(a){a.getRoot().on(c.save,function(b){b.preventDefault();window.location.href=a.deleteURL})})});
|
||||
//# sourceMappingURL=delete_license.min.js.map
|
||||
/**
|
||||
* Modal for confirming deletion of a custom license.
|
||||
*
|
||||
* @module tool_licensemanager/delete_license
|
||||
* @copyright 2019 Tom Dickman <tomdickman@catalyst-au.net>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
define("tool_licensemanager/delete_license",["jquery","core/modal_factory","core/modal_events","core/url","core/str"],(function($,ModalFactory,ModalEvents,Url,String){var trigger=$(".delete-license");ModalFactory.create({type:ModalFactory.types.SAVE_CANCEL,title:String.get_string("deletelicense","tool_licensemanager"),body:String.get_string("deletelicenseconfirmmessage","tool_licensemanager"),preShowCallback:function(triggerElement,modal){var params={action:"delete",license:(triggerElement=$(triggerElement)).data("license")};modal.deleteURL=Url.relativeUrl("/admin/tool/licensemanager/index.php",params,!0)},large:!0},trigger).done((function(modal){modal.getRoot().on(ModalEvents.save,(function(e){e.preventDefault(),window.location.href=modal.deleteURL}))}))}));
|
||||
|
||||
//# sourceMappingURL=delete_license.min.js.map
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"sources":["../src/delete_license.js"],"names":["define","$","ModalFactory","ModalEvents","Url","String","trigger","create","type","types","SAVE_CANCEL","title","get_string","body","preShowCallback","triggerElement","modal","params","data","deleteURL","relativeUrl","large","done","getRoot","on","save","e","preventDefault","window","location","href"],"mappings":"AAsBAA,OAAM,sCAAC,CAAC,QAAD,CAAW,oBAAX,CAAiC,mBAAjC,CAAsD,UAAtD,CAAkE,UAAlE,CAAD,CACF,SAASC,CAAT,CAAYC,CAAZ,CAA0BC,CAA1B,CAAuCC,CAAvC,CAA4CC,CAA5C,CAAoD,CAEhD,GAAIC,CAAAA,CAAO,CAAGL,CAAC,CAAC,iBAAD,CAAf,CACAC,CAAY,CAACK,MAAb,CAAoB,CAChBC,IAAI,CAAEN,CAAY,CAACO,KAAb,CAAmBC,WADT,CAEhBC,KAAK,CAAEN,CAAM,CAACO,UAAP,CAAkB,eAAlB,CAAmC,qBAAnC,CAFS,CAGhBC,IAAI,CAAER,CAAM,CAACO,UAAP,CAAkB,6BAAlB,CAAiD,qBAAjD,CAHU,CAIhBE,eAAe,CAAE,yBAASC,CAAT,CAAyBC,CAAzB,CAAgC,CAC7CD,CAAc,CAAGd,CAAC,CAACc,CAAD,CAAlB,CACA,GAAIE,CAAAA,CAAM,CAAG,CACT,OAAU,QADD,CAET,QAAWF,CAAc,CAACG,IAAf,CAAoB,SAApB,CAFF,CAAb,CAIAF,CAAK,CAACG,SAAN,CAAkBf,CAAG,CAACgB,WAAJ,CAAgB,sCAAhB,CAAwDH,CAAxD,IACrB,CAXe,CAYhBI,KAAK,GAZW,CAApB,CAaGf,CAbH,EAcKgB,IAdL,CAcU,SAASN,CAAT,CAAgB,CAClBA,CAAK,CAACO,OAAN,GAAgBC,EAAhB,CAAmBrB,CAAW,CAACsB,IAA/B,CAAqC,SAASC,CAAT,CAAY,CAE7CA,CAAC,CAACC,cAAF,GAEAC,MAAM,CAACC,QAAP,CAAgBC,IAAhB,CAAuBd,CAAK,CAACG,SAChC,CALD,CAMH,CArBL,CAsBH,CA1BC,CAAN","sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Modal for confirming deletion of a custom license.\n *\n * @module tool_licensemanager/delete_license\n * @copyright 2019 Tom Dickman <tomdickman@catalyst-au.net>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(['jquery', 'core/modal_factory', 'core/modal_events', 'core/url', 'core/str'],\n function($, ModalFactory, ModalEvents, Url, String) {\n\n var trigger = $('.delete-license');\n ModalFactory.create({\n type: ModalFactory.types.SAVE_CANCEL,\n title: String.get_string('deletelicense', 'tool_licensemanager'),\n body: String.get_string('deletelicenseconfirmmessage', 'tool_licensemanager'),\n preShowCallback: function(triggerElement, modal) {\n triggerElement = $(triggerElement);\n let params = {\n 'action': 'delete',\n 'license': triggerElement.data('license')\n };\n modal.deleteURL = Url.relativeUrl('/admin/tool/licensemanager/index.php', params, true);\n },\n large: true,\n }, trigger)\n .done(function(modal) {\n modal.getRoot().on(ModalEvents.save, function(e) {\n // Stop the default save button behaviour which is to close the modal.\n e.preventDefault();\n // Redirect to delete url.\n window.location.href = modal.deleteURL;\n });\n });\n });\n"],"file":"delete_license.min.js"}
|
||||
{"version":3,"file":"delete_license.min.js","sources":["../src/delete_license.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Modal for confirming deletion of a custom license.\n *\n * @module tool_licensemanager/delete_license\n * @copyright 2019 Tom Dickman <tomdickman@catalyst-au.net>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(['jquery', 'core/modal_factory', 'core/modal_events', 'core/url', 'core/str'],\n function($, ModalFactory, ModalEvents, Url, String) {\n\n var trigger = $('.delete-license');\n ModalFactory.create({\n type: ModalFactory.types.SAVE_CANCEL,\n title: String.get_string('deletelicense', 'tool_licensemanager'),\n body: String.get_string('deletelicenseconfirmmessage', 'tool_licensemanager'),\n preShowCallback: function(triggerElement, modal) {\n triggerElement = $(triggerElement);\n let params = {\n 'action': 'delete',\n 'license': triggerElement.data('license')\n };\n modal.deleteURL = Url.relativeUrl('/admin/tool/licensemanager/index.php', params, true);\n },\n large: true,\n }, trigger)\n .done(function(modal) {\n modal.getRoot().on(ModalEvents.save, function(e) {\n // Stop the default save button behaviour which is to close the modal.\n e.preventDefault();\n // Redirect to delete url.\n window.location.href = modal.deleteURL;\n });\n });\n });\n"],"names":["define","$","ModalFactory","ModalEvents","Url","String","trigger","create","type","types","SAVE_CANCEL","title","get_string","body","preShowCallback","triggerElement","modal","params","data","deleteURL","relativeUrl","large","done","getRoot","on","save","e","preventDefault","window","location","href"],"mappings":";;;;;;;AAsBAA,4CAAO,CAAC,SAAU,qBAAsB,oBAAqB,WAAY,aACrE,SAASC,EAAGC,aAAcC,YAAaC,IAAKC,YAEpCC,QAAUL,EAAE,mBAChBC,aAAaK,OAAO,CAChBC,KAAMN,aAAaO,MAAMC,YACzBC,MAAON,OAAOO,WAAW,gBAAiB,uBAC1CC,KAAMR,OAAOO,WAAW,8BAA+B,uBACvDE,gBAAiB,SAASC,eAAgBC,WAElCC,OAAS,QACC,kBAFdF,eAAiBd,EAAEc,iBAGWG,KAAK,YAEnCF,MAAMG,UAAYf,IAAIgB,YAAY,uCAAwCH,QAAQ,IAEtFI,OAAO,GACRf,SACEgB,MAAK,SAASN,OACXA,MAAMO,UAAUC,GAAGrB,YAAYsB,MAAM,SAASC,GAE1CA,EAAEC,iBAEFC,OAAOC,SAASC,KAAOd,MAAMG"}
|
||||
+25
-24
@@ -23,6 +23,7 @@
|
||||
* @author Frédéric Massart <fred@branchup.tech>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
namespace logstore_database\privacy;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
global $CFG;
|
||||
@@ -34,7 +35,7 @@ use core_privacy\local\request\transform;
|
||||
use core_privacy\local\request\writer;
|
||||
use logstore_database\privacy\provider;
|
||||
|
||||
require_once(__DIR__ . '/fixtures/event.php');
|
||||
require_once(__DIR__ . '/../fixtures/event.php');
|
||||
|
||||
/**
|
||||
* Data provider testcase class.
|
||||
@@ -48,7 +49,7 @@ require_once(__DIR__ . '/fixtures/event.php');
|
||||
* @author Frédéric Massart <fred@branchup.tech>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class logstore_database_privacy_testcase extends provider_testcase {
|
||||
class provider_test extends provider_testcase {
|
||||
|
||||
public function setUp(): void {
|
||||
global $CFG;
|
||||
@@ -105,11 +106,11 @@ class logstore_database_privacy_testcase extends provider_testcase {
|
||||
$c2 = $this->getDataGenerator()->create_course();
|
||||
$cm2 = $this->getDataGenerator()->create_module('url', ['course' => $c2]);
|
||||
|
||||
$sysctx = context_system::instance();
|
||||
$c1ctx = context_course::instance($c1->id);
|
||||
$c2ctx = context_course::instance($c2->id);
|
||||
$cm1ctx = context_module::instance($cm1->cmid);
|
||||
$cm2ctx = context_module::instance($cm2->cmid);
|
||||
$sysctx = \context_system::instance();
|
||||
$c1ctx = \context_course::instance($c1->id);
|
||||
$c2ctx = \context_course::instance($c2->id);
|
||||
$cm1ctx = \context_module::instance($cm1->cmid);
|
||||
$cm2ctx = \context_module::instance($cm2->cmid);
|
||||
|
||||
$this->enable_logging();
|
||||
$manager = get_log_manager(true);
|
||||
@@ -143,7 +144,7 @@ class logstore_database_privacy_testcase extends provider_testcase {
|
||||
$this->assert_contextlist_equals($this->get_contextlist_for_user($u3), [$sysctx, $c1ctx]);
|
||||
$this->assert_contextlist_equals($this->get_contextlist_for_user($admin), [$sysctx, $c1ctx]);
|
||||
$this->setAdminUser();
|
||||
\core\session\manager::loginas($u1->id, context_system::instance());
|
||||
\core\session\manager::loginas($u1->id, \context_system::instance());
|
||||
$e = \logstore_database\event\unittest_executed::create(['context' => $c2ctx, 'relateduserid' => $u3->id]);
|
||||
$e->trigger();
|
||||
$this->assert_contextlist_equals($this->get_contextlist_for_user($u1), [$sysctx, $cm1ctx, $c2ctx]);
|
||||
@@ -163,8 +164,8 @@ class logstore_database_privacy_testcase extends provider_testcase {
|
||||
|
||||
$c1 = $this->getDataGenerator()->create_course();
|
||||
|
||||
$sysctx = context_system::instance();
|
||||
$c1ctx = context_course::instance($c1->id);
|
||||
$sysctx = \context_system::instance();
|
||||
$c1ctx = \context_course::instance($c1->id);
|
||||
|
||||
$this->enable_logging();
|
||||
$manager = get_log_manager(true);
|
||||
@@ -185,7 +186,7 @@ class logstore_database_privacy_testcase extends provider_testcase {
|
||||
$e->trigger();
|
||||
// The admin user should be added (realuserid).
|
||||
$this->setAdminUser();
|
||||
\core\session\manager::loginas($u2->id, context_system::instance());
|
||||
\core\session\manager::loginas($u2->id, \context_system::instance());
|
||||
$e = \logstore_database\event\unittest_executed::create(['context' => $sysctx]);
|
||||
$e->trigger();
|
||||
// Set off an event in a different context. User 4 should not be returned below.
|
||||
@@ -206,9 +207,9 @@ class logstore_database_privacy_testcase extends provider_testcase {
|
||||
$u2 = $this->getDataGenerator()->create_user();
|
||||
$c1 = $this->getDataGenerator()->create_course();
|
||||
$c2 = $this->getDataGenerator()->create_course();
|
||||
$sysctx = context_system::instance();
|
||||
$c1ctx = context_course::instance($c1->id);
|
||||
$c2ctx = context_course::instance($c2->id);
|
||||
$sysctx = \context_system::instance();
|
||||
$c1ctx = \context_course::instance($c1->id);
|
||||
$c2ctx = \context_course::instance($c2->id);
|
||||
|
||||
$this->enable_logging();
|
||||
$manager = get_log_manager(true);
|
||||
@@ -247,9 +248,9 @@ class logstore_database_privacy_testcase extends provider_testcase {
|
||||
$u2 = $this->getDataGenerator()->create_user();
|
||||
$c1 = $this->getDataGenerator()->create_course();
|
||||
$c2 = $this->getDataGenerator()->create_course();
|
||||
$sysctx = context_system::instance();
|
||||
$c1ctx = context_course::instance($c1->id);
|
||||
$c2ctx = context_course::instance($c2->id);
|
||||
$sysctx = \context_system::instance();
|
||||
$c1ctx = \context_course::instance($c1->id);
|
||||
$c2ctx = \context_course::instance($c2->id);
|
||||
|
||||
$this->enable_logging();
|
||||
$manager = get_log_manager(true);
|
||||
@@ -294,8 +295,8 @@ class logstore_database_privacy_testcase extends provider_testcase {
|
||||
$u4 = $this->getDataGenerator()->create_user();
|
||||
|
||||
$course = $this->getDataGenerator()->create_course();
|
||||
$sysctx = context_system::instance();
|
||||
$c1ctx = context_course::instance($course->id);
|
||||
$sysctx = \context_system::instance();
|
||||
$c1ctx = \context_course::instance($course->id);
|
||||
|
||||
$this->enable_logging();
|
||||
$manager = get_log_manager(true);
|
||||
@@ -337,11 +338,11 @@ class logstore_database_privacy_testcase extends provider_testcase {
|
||||
$cm1 = $this->getDataGenerator()->create_module('url', ['course' => $c1]);
|
||||
$c2 = $this->getDataGenerator()->create_course();
|
||||
$cm2 = $this->getDataGenerator()->create_module('url', ['course' => $c2]);
|
||||
$sysctx = context_system::instance();
|
||||
$c1ctx = context_course::instance($c1->id);
|
||||
$c2ctx = context_course::instance($c2->id);
|
||||
$cm1ctx = context_module::instance($cm1->cmid);
|
||||
$cm2ctx = context_module::instance($cm2->cmid);
|
||||
$sysctx = \context_system::instance();
|
||||
$c1ctx = \context_course::instance($c1->id);
|
||||
$c2ctx = \context_course::instance($c2->id);
|
||||
$cm1ctx = \context_module::instance($cm1->cmid);
|
||||
$cm2ctx = \context_module::instance($cm2->cmid);
|
||||
|
||||
$path = [get_string('privacy:path:logs', 'tool_log'), get_string('pluginname', 'logstore_database')];
|
||||
$this->enable_logging();
|
||||
@@ -14,6 +14,13 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
namespace logstore_database;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
require_once(__DIR__ . '/fixtures/event.php');
|
||||
require_once(__DIR__ . '/fixtures/store.php');
|
||||
|
||||
/**
|
||||
* External database log store tests.
|
||||
*
|
||||
@@ -21,13 +28,7 @@
|
||||
* @copyright 2014 Petr Skoda {@link http://skodak.org/}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
require_once(__DIR__ . '/fixtures/event.php');
|
||||
require_once(__DIR__ . '/fixtures/store.php');
|
||||
|
||||
class logstore_database_store_testcase extends advanced_testcase {
|
||||
class store_test extends \advanced_testcase {
|
||||
/**
|
||||
* Tests log writing.
|
||||
*
|
||||
@@ -120,7 +121,7 @@ class logstore_database_store_testcase extends advanced_testcase {
|
||||
|
||||
$this->setUser(0);
|
||||
$event1 = \logstore_database\event\unittest_executed::create(
|
||||
array('context' => context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)));
|
||||
array('context' => \context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)));
|
||||
$event1->trigger();
|
||||
|
||||
$logs = $DB->get_records('logstore_standard_log', array(), 'id ASC');
|
||||
@@ -141,11 +142,11 @@ class logstore_database_store_testcase extends advanced_testcase {
|
||||
$this->assertEquals($data, $log1);
|
||||
|
||||
$this->setAdminUser();
|
||||
\core\session\manager::loginas($user1->id, context_system::instance());
|
||||
\core\session\manager::loginas($user1->id, \context_system::instance());
|
||||
$this->assertEquals(2, $DB->count_records('logstore_standard_log'));
|
||||
|
||||
$event2 = \logstore_database\event\unittest_executed::create(
|
||||
array('context' => context_module::instance($module2->cmid), 'other' => array('sample' => 6, 'xx' => 9)));
|
||||
array('context' => \context_module::instance($module2->cmid), 'other' => array('sample' => 6, 'xx' => 9)));
|
||||
$event2->trigger();
|
||||
|
||||
\core\session\manager::init_empty_session();
|
||||
@@ -190,30 +191,30 @@ class logstore_database_store_testcase extends advanced_testcase {
|
||||
$DB->delete_records('logstore_standard_log');
|
||||
|
||||
\logstore_database\event\unittest_executed::create(
|
||||
array('context' => context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
array('context' => \context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
$this->assertEquals(0, $DB->count_records('logstore_standard_log'));
|
||||
\logstore_database\event\unittest_executed::create(
|
||||
array('context' => context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
array('context' => \context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
$this->assertEquals(0, $DB->count_records('logstore_standard_log'));
|
||||
$store->flush();
|
||||
$this->assertEquals(2, $DB->count_records('logstore_standard_log'));
|
||||
\logstore_database\event\unittest_executed::create(
|
||||
array('context' => context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
array('context' => \context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
$this->assertEquals(2, $DB->count_records('logstore_standard_log'));
|
||||
\logstore_database\event\unittest_executed::create(
|
||||
array('context' => context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
array('context' => \context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
$this->assertEquals(2, $DB->count_records('logstore_standard_log'));
|
||||
\logstore_database\event\unittest_executed::create(
|
||||
array('context' => context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
array('context' => \context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
$this->assertEquals(5, $DB->count_records('logstore_standard_log'));
|
||||
\logstore_database\event\unittest_executed::create(
|
||||
array('context' => context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
array('context' => \context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
$this->assertEquals(5, $DB->count_records('logstore_standard_log'));
|
||||
\logstore_database\event\unittest_executed::create(
|
||||
array('context' => context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
array('context' => \context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
$this->assertEquals(5, $DB->count_records('logstore_standard_log'));
|
||||
\logstore_database\event\unittest_executed::create(
|
||||
array('context' => context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
array('context' => \context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
$this->assertEquals(8, $DB->count_records('logstore_standard_log'));
|
||||
|
||||
// Test guest logging setting.
|
||||
@@ -225,22 +226,22 @@ class logstore_database_store_testcase extends advanced_testcase {
|
||||
|
||||
$this->setUser(null);
|
||||
\logstore_database\event\unittest_executed::create(
|
||||
array('context' => context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
array('context' => \context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
$this->assertEquals(0, $DB->count_records('logstore_standard_log'));
|
||||
|
||||
$this->setGuestUser();
|
||||
\logstore_database\event\unittest_executed::create(
|
||||
array('context' => context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
array('context' => \context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
$this->assertEquals(0, $DB->count_records('logstore_standard_log'));
|
||||
|
||||
$this->setUser($user1);
|
||||
\logstore_database\event\unittest_executed::create(
|
||||
array('context' => context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
array('context' => \context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
$this->assertEquals(1, $DB->count_records('logstore_standard_log'));
|
||||
|
||||
$this->setUser($user2);
|
||||
\logstore_database\event\unittest_executed::create(
|
||||
array('context' => context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
array('context' => \context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
$this->assertEquals(2, $DB->count_records('logstore_standard_log'));
|
||||
|
||||
set_config('enabled_stores', '', 'tool_log');
|
||||
@@ -270,7 +271,7 @@ class logstore_database_store_testcase extends advanced_testcase {
|
||||
set_config('logguests', 0, 'logstore_database');
|
||||
$this->setGuestUser();
|
||||
$event = \logstore_database\event\unittest_executed::create(
|
||||
array('context' => context_system::instance(), 'other' => array('sample' => 5, 'xx' => 10)));
|
||||
array('context' => \context_system::instance(), 'other' => array('sample' => 5, 'xx' => 10)));
|
||||
$logmanager = get_log_manager();
|
||||
$store = new \logstore_database\test\store($logmanager);
|
||||
$this->assertTrue($store->is_event_ignored($event));
|
||||
|
||||
+26
-25
@@ -23,6 +23,7 @@
|
||||
* @author Frédéric Massart <fred@branchup.tech>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
namespace logstore_legacy\privacy;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
global $CFG;
|
||||
@@ -35,7 +36,7 @@ use core_privacy\local\request\writer;
|
||||
use logstore_legacy\privacy\provider;
|
||||
use logstore_legacy\event\unittest_executed;
|
||||
|
||||
require_once(__DIR__ . '/fixtures/event.php');
|
||||
require_once(__DIR__ . '/../fixtures/event.php');
|
||||
|
||||
/**
|
||||
* Data provider testcase class.
|
||||
@@ -46,7 +47,7 @@ require_once(__DIR__ . '/fixtures/event.php');
|
||||
* @author Frédéric Massart <fred@branchup.tech>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class logstore_legacy_privacy_testcase extends provider_testcase {
|
||||
class provider_test extends provider_testcase {
|
||||
|
||||
public function setUp(): void {
|
||||
$this->resetAfterTest();
|
||||
@@ -58,9 +59,9 @@ class logstore_legacy_privacy_testcase extends provider_testcase {
|
||||
$u3 = $this->getDataGenerator()->create_user();
|
||||
$c1 = $this->getDataGenerator()->create_course();
|
||||
$cm1 = $this->getDataGenerator()->create_module('url', ['course' => $c1]);
|
||||
$sysctx = context_system::instance();
|
||||
$c1ctx = context_course::instance($c1->id);
|
||||
$cm1ctx = context_module::instance($cm1->cmid);
|
||||
$sysctx = \context_system::instance();
|
||||
$c1ctx = \context_course::instance($c1->id);
|
||||
$cm1ctx = \context_module::instance($cm1->cmid);
|
||||
|
||||
$this->enable_logging();
|
||||
$manager = get_log_manager(true);
|
||||
@@ -96,11 +97,11 @@ class logstore_legacy_privacy_testcase extends provider_testcase {
|
||||
$u3 = $this->getDataGenerator()->create_user();
|
||||
$course = $this->getDataGenerator()->create_course();
|
||||
$module = $this->getDataGenerator()->create_module('url', ['course' => $course]);
|
||||
$sysctx = context_system::instance();
|
||||
$c1ctx = context_course::instance($course->id);
|
||||
$cm1ctx = context_module::instance($module->cmid);
|
||||
$sysctx = \context_system::instance();
|
||||
$c1ctx = \context_course::instance($course->id);
|
||||
$cm1ctx = \context_module::instance($module->cmid);
|
||||
|
||||
$userctx = context_user::instance($u1->id);
|
||||
$userctx = \context_user::instance($u1->id);
|
||||
|
||||
$this->enable_logging();
|
||||
$manager = get_log_manager(true);
|
||||
@@ -161,10 +162,10 @@ class logstore_legacy_privacy_testcase extends provider_testcase {
|
||||
$c1 = $this->getDataGenerator()->create_course();
|
||||
$c2 = $this->getDataGenerator()->create_course();
|
||||
$cm1 = $this->getDataGenerator()->create_module('url', ['course' => $c1]);
|
||||
$sysctx = context_system::instance();
|
||||
$c1ctx = context_course::instance($c1->id);
|
||||
$c2ctx = context_course::instance($c2->id);
|
||||
$cm1ctx = context_module::instance($cm1->cmid);
|
||||
$sysctx = \context_system::instance();
|
||||
$c1ctx = \context_course::instance($c1->id);
|
||||
$c2ctx = \context_course::instance($c2->id);
|
||||
$cm1ctx = \context_module::instance($cm1->cmid);
|
||||
|
||||
$this->enable_logging();
|
||||
$manager = get_log_manager(true);
|
||||
@@ -238,10 +239,10 @@ class logstore_legacy_privacy_testcase extends provider_testcase {
|
||||
$c1 = $this->getDataGenerator()->create_course();
|
||||
$c2 = $this->getDataGenerator()->create_course();
|
||||
$cm1 = $this->getDataGenerator()->create_module('url', ['course' => $c1]);
|
||||
$sysctx = context_system::instance();
|
||||
$c1ctx = context_course::instance($c1->id);
|
||||
$c2ctx = context_course::instance($c2->id);
|
||||
$cm1ctx = context_module::instance($cm1->cmid);
|
||||
$sysctx = \context_system::instance();
|
||||
$c1ctx = \context_course::instance($c1->id);
|
||||
$c2ctx = \context_course::instance($c2->id);
|
||||
$cm1ctx = \context_module::instance($cm1->cmid);
|
||||
|
||||
$this->enable_logging();
|
||||
$manager = get_log_manager(true);
|
||||
@@ -317,11 +318,11 @@ class logstore_legacy_privacy_testcase extends provider_testcase {
|
||||
$u3 = $this->getDataGenerator()->create_user();
|
||||
$course = $this->getDataGenerator()->create_course();
|
||||
$module = $this->getDataGenerator()->create_module('url', ['course' => $course]);
|
||||
$sysctx = context_system::instance();
|
||||
$c1ctx = context_course::instance($course->id);
|
||||
$cm1ctx = context_module::instance($module->cmid);
|
||||
$sysctx = \context_system::instance();
|
||||
$c1ctx = \context_course::instance($course->id);
|
||||
$cm1ctx = \context_module::instance($module->cmid);
|
||||
|
||||
$userctx = context_user::instance($u1->id);
|
||||
$userctx = \context_user::instance($u1->id);
|
||||
|
||||
$this->enable_logging();
|
||||
$manager = get_log_manager(true);
|
||||
@@ -377,10 +378,10 @@ class logstore_legacy_privacy_testcase extends provider_testcase {
|
||||
$c1 = $this->getDataGenerator()->create_course();
|
||||
$c2 = $this->getDataGenerator()->create_course();
|
||||
$cm1 = $this->getDataGenerator()->create_module('url', ['course' => $c1]);
|
||||
$sysctx = context_system::instance();
|
||||
$c1ctx = context_course::instance($c1->id);
|
||||
$c2ctx = context_course::instance($c2->id);
|
||||
$cm1ctx = context_module::instance($cm1->cmid);
|
||||
$sysctx = \context_system::instance();
|
||||
$c1ctx = \context_course::instance($c1->id);
|
||||
$c2ctx = \context_course::instance($c2->id);
|
||||
$cm1ctx = \context_module::instance($cm1->cmid);
|
||||
|
||||
$this->enable_logging();
|
||||
$manager = get_log_manager(true);
|
||||
@@ -14,6 +14,13 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
namespace logstore_legacy;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
require_once(__DIR__ . '/fixtures/event.php');
|
||||
require_once(__DIR__ . '/fixtures/store.php');
|
||||
|
||||
/**
|
||||
* Legacy log store tests.
|
||||
*
|
||||
@@ -21,13 +28,7 @@
|
||||
* @copyright 2014 Petr Skoda {@link http://skodak.org/}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
require_once(__DIR__ . '/fixtures/event.php');
|
||||
require_once(__DIR__ . '/fixtures/store.php');
|
||||
|
||||
class logstore_legacy_store_testcase extends advanced_testcase {
|
||||
class store_test extends \advanced_testcase {
|
||||
public function test_log_writing() {
|
||||
global $DB;
|
||||
$this->resetAfterTest();
|
||||
@@ -58,12 +59,12 @@ class logstore_legacy_store_testcase extends advanced_testcase {
|
||||
|
||||
$this->setUser(0);
|
||||
$event1 = \logstore_legacy\event\unittest_executed::create(
|
||||
array('context' => context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)));
|
||||
array('context' => \context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)));
|
||||
$event1->trigger();
|
||||
|
||||
$this->setUser($user1);
|
||||
$event2 = \logstore_legacy\event\unittest_executed::create(
|
||||
array('context' => context_course::instance($course2->id), 'other' => array('sample' => 6, 'xx' => 11)));
|
||||
array('context' => \context_course::instance($course2->id), 'other' => array('sample' => 6, 'xx' => 11)));
|
||||
$event2->trigger();
|
||||
|
||||
$logs = $DB->get_records('log', array(), 'id ASC');
|
||||
|
||||
@@ -39,4 +39,4 @@
|
||||
</INDEXES>
|
||||
</TABLE>
|
||||
</TABLES>
|
||||
</XMLDB>
|
||||
</XMLDB>
|
||||
|
||||
+25
-24
@@ -23,6 +23,7 @@
|
||||
* @author Frédéric Massart <fred@branchup.tech>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
namespace logstore_standard\privacy;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
global $CFG;
|
||||
@@ -34,7 +35,7 @@ use core_privacy\local\request\transform;
|
||||
use core_privacy\local\request\writer;
|
||||
use logstore_standard\privacy\provider;
|
||||
|
||||
require_once(__DIR__ . '/fixtures/event.php');
|
||||
require_once(__DIR__ . '/../fixtures/event.php');
|
||||
|
||||
/**
|
||||
* Data provider testcase class.
|
||||
@@ -45,7 +46,7 @@ require_once(__DIR__ . '/fixtures/event.php');
|
||||
* @author Frédéric Massart <fred@branchup.tech>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class logstore_standard_privacy_testcase extends provider_testcase {
|
||||
class provider_test extends provider_testcase {
|
||||
|
||||
public function setUp(): void {
|
||||
$this->resetAfterTest();
|
||||
@@ -63,11 +64,11 @@ class logstore_standard_privacy_testcase extends provider_testcase {
|
||||
$c2 = $this->getDataGenerator()->create_course();
|
||||
$cm2 = $this->getDataGenerator()->create_module('url', ['course' => $c2]);
|
||||
|
||||
$sysctx = context_system::instance();
|
||||
$c1ctx = context_course::instance($c1->id);
|
||||
$c2ctx = context_course::instance($c2->id);
|
||||
$cm1ctx = context_module::instance($cm1->cmid);
|
||||
$cm2ctx = context_module::instance($cm2->cmid);
|
||||
$sysctx = \context_system::instance();
|
||||
$c1ctx = \context_course::instance($c1->id);
|
||||
$c2ctx = \context_course::instance($c2->id);
|
||||
$cm1ctx = \context_module::instance($cm1->cmid);
|
||||
$cm2ctx = \context_module::instance($cm2->cmid);
|
||||
|
||||
$this->enable_logging();
|
||||
$manager = get_log_manager(true);
|
||||
@@ -101,7 +102,7 @@ class logstore_standard_privacy_testcase extends provider_testcase {
|
||||
$this->assert_contextlist_equals($this->get_contextlist_for_user($u3), [$sysctx, $c1ctx]);
|
||||
$this->assert_contextlist_equals($this->get_contextlist_for_user($admin), [$sysctx, $c1ctx]);
|
||||
$this->setAdminUser();
|
||||
\core\session\manager::loginas($u1->id, context_system::instance());
|
||||
\core\session\manager::loginas($u1->id, \context_system::instance());
|
||||
$e = \logstore_standard\event\unittest_executed::create(['context' => $c2ctx, 'relateduserid' => $u3->id]);
|
||||
$e->trigger();
|
||||
$this->assert_contextlist_equals($this->get_contextlist_for_user($u1), [$sysctx, $cm1ctx, $c2ctx]);
|
||||
@@ -118,8 +119,8 @@ class logstore_standard_privacy_testcase extends provider_testcase {
|
||||
|
||||
$c1 = $this->getDataGenerator()->create_course();
|
||||
|
||||
$sysctx = context_system::instance();
|
||||
$c1ctx = context_course::instance($c1->id);
|
||||
$sysctx = \context_system::instance();
|
||||
$c1ctx = \context_course::instance($c1->id);
|
||||
|
||||
$this->enable_logging();
|
||||
$manager = get_log_manager(true);
|
||||
@@ -140,7 +141,7 @@ class logstore_standard_privacy_testcase extends provider_testcase {
|
||||
$e->trigger();
|
||||
// The admin user should be added (realuserid).
|
||||
$this->setAdminUser();
|
||||
\core\session\manager::loginas($u2->id, context_system::instance());
|
||||
\core\session\manager::loginas($u2->id, \context_system::instance());
|
||||
$e = \logstore_standard\event\unittest_executed::create(['context' => $sysctx]);
|
||||
$e->trigger();
|
||||
// Set off an event in a different context. User 4 should not be returned below.
|
||||
@@ -161,9 +162,9 @@ class logstore_standard_privacy_testcase extends provider_testcase {
|
||||
$u2 = $this->getDataGenerator()->create_user();
|
||||
$c1 = $this->getDataGenerator()->create_course();
|
||||
$c2 = $this->getDataGenerator()->create_course();
|
||||
$sysctx = context_system::instance();
|
||||
$c1ctx = context_course::instance($c1->id);
|
||||
$c2ctx = context_course::instance($c2->id);
|
||||
$sysctx = \context_system::instance();
|
||||
$c1ctx = \context_course::instance($c1->id);
|
||||
$c2ctx = \context_course::instance($c2->id);
|
||||
|
||||
$this->enable_logging();
|
||||
$manager = get_log_manager(true);
|
||||
@@ -202,9 +203,9 @@ class logstore_standard_privacy_testcase extends provider_testcase {
|
||||
$u2 = $this->getDataGenerator()->create_user();
|
||||
$c1 = $this->getDataGenerator()->create_course();
|
||||
$c2 = $this->getDataGenerator()->create_course();
|
||||
$sysctx = context_system::instance();
|
||||
$c1ctx = context_course::instance($c1->id);
|
||||
$c2ctx = context_course::instance($c2->id);
|
||||
$sysctx = \context_system::instance();
|
||||
$c1ctx = \context_course::instance($c1->id);
|
||||
$c2ctx = \context_course::instance($c2->id);
|
||||
|
||||
$this->enable_logging();
|
||||
$manager = get_log_manager(true);
|
||||
@@ -246,8 +247,8 @@ class logstore_standard_privacy_testcase extends provider_testcase {
|
||||
$u4 = $this->getDataGenerator()->create_user();
|
||||
|
||||
$course = $this->getDataGenerator()->create_course();
|
||||
$sysctx = context_system::instance();
|
||||
$c1ctx = context_course::instance($course->id);
|
||||
$sysctx = \context_system::instance();
|
||||
$c1ctx = \context_course::instance($course->id);
|
||||
|
||||
$this->enable_logging();
|
||||
$manager = get_log_manager(true);
|
||||
@@ -289,11 +290,11 @@ class logstore_standard_privacy_testcase extends provider_testcase {
|
||||
$cm1 = $this->getDataGenerator()->create_module('url', ['course' => $c1]);
|
||||
$c2 = $this->getDataGenerator()->create_course();
|
||||
$cm2 = $this->getDataGenerator()->create_module('url', ['course' => $c2]);
|
||||
$sysctx = context_system::instance();
|
||||
$c1ctx = context_course::instance($c1->id);
|
||||
$c2ctx = context_course::instance($c2->id);
|
||||
$cm1ctx = context_module::instance($cm1->cmid);
|
||||
$cm2ctx = context_module::instance($cm2->cmid);
|
||||
$sysctx = \context_system::instance();
|
||||
$c1ctx = \context_course::instance($c1->id);
|
||||
$c2ctx = \context_course::instance($c2->id);
|
||||
$cm1ctx = \context_module::instance($cm1->cmid);
|
||||
$cm2ctx = \context_module::instance($cm2->cmid);
|
||||
|
||||
$path = [get_string('privacy:path:logs', 'tool_log'), get_string('pluginname', 'logstore_standard')];
|
||||
$this->enable_logging();
|
||||
@@ -14,6 +14,13 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
namespace logstore_standard;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
require_once(__DIR__ . '/fixtures/event.php');
|
||||
require_once(__DIR__ . '/fixtures/restore_hack.php');
|
||||
|
||||
/**
|
||||
* Standard log store tests.
|
||||
*
|
||||
@@ -21,13 +28,7 @@
|
||||
* @copyright 2014 Petr Skoda {@link http://skodak.org/}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
require_once(__DIR__ . '/fixtures/event.php');
|
||||
require_once(__DIR__ . '/fixtures/restore_hack.php');
|
||||
|
||||
class logstore_standard_store_testcase extends advanced_testcase {
|
||||
class store_test extends \advanced_testcase {
|
||||
/**
|
||||
* @var bool Determine if we disabled the GC, so it can be re-enabled in tearDown.
|
||||
*/
|
||||
@@ -84,7 +85,7 @@ class logstore_standard_store_testcase extends advanced_testcase {
|
||||
|
||||
$this->setUser(0);
|
||||
$event1 = \logstore_standard\event\unittest_executed::create(
|
||||
array('context' => context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)));
|
||||
array('context' => \context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)));
|
||||
$event1->trigger();
|
||||
|
||||
$logs = $DB->get_records('logstore_standard_log', array(), 'id ASC');
|
||||
@@ -105,14 +106,14 @@ class logstore_standard_store_testcase extends advanced_testcase {
|
||||
$this->assertEquals($data, $log1);
|
||||
|
||||
$this->setAdminUser();
|
||||
\core\session\manager::loginas($user1->id, context_system::instance());
|
||||
\core\session\manager::loginas($user1->id, \context_system::instance());
|
||||
$this->assertEquals(2, $DB->count_records('logstore_standard_log'));
|
||||
|
||||
logstore_standard_restore::hack_executing(1);
|
||||
\logstore_standard_restore::hack_executing(1);
|
||||
$event2 = \logstore_standard\event\unittest_executed::create(
|
||||
array('context' => context_module::instance($module2->cmid), 'other' => array('sample' => 6, 'xx' => 9)));
|
||||
array('context' => \context_module::instance($module2->cmid), 'other' => array('sample' => 6, 'xx' => 9)));
|
||||
$event2->trigger();
|
||||
logstore_standard_restore::hack_executing(0);
|
||||
\logstore_standard_restore::hack_executing(0);
|
||||
|
||||
\core\session\manager::init_empty_session();
|
||||
$this->assertFalse(\core\session\manager::is_loggedinas());
|
||||
@@ -161,30 +162,30 @@ class logstore_standard_store_testcase extends advanced_testcase {
|
||||
$DB->delete_records('logstore_standard_log');
|
||||
|
||||
\logstore_standard\event\unittest_executed::create(
|
||||
array('context' => context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
array('context' => \context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
$this->assertEquals(0, $DB->count_records('logstore_standard_log'));
|
||||
\logstore_standard\event\unittest_executed::create(
|
||||
array('context' => context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
array('context' => \context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
$this->assertEquals(0, $DB->count_records('logstore_standard_log'));
|
||||
$store->flush();
|
||||
$this->assertEquals(2, $DB->count_records('logstore_standard_log'));
|
||||
\logstore_standard\event\unittest_executed::create(
|
||||
array('context' => context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
array('context' => \context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
$this->assertEquals(2, $DB->count_records('logstore_standard_log'));
|
||||
\logstore_standard\event\unittest_executed::create(
|
||||
array('context' => context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
array('context' => \context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
$this->assertEquals(2, $DB->count_records('logstore_standard_log'));
|
||||
\logstore_standard\event\unittest_executed::create(
|
||||
array('context' => context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
array('context' => \context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
$this->assertEquals(5, $DB->count_records('logstore_standard_log'));
|
||||
\logstore_standard\event\unittest_executed::create(
|
||||
array('context' => context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
array('context' => \context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
$this->assertEquals(5, $DB->count_records('logstore_standard_log'));
|
||||
\logstore_standard\event\unittest_executed::create(
|
||||
array('context' => context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
array('context' => \context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
$this->assertEquals(5, $DB->count_records('logstore_standard_log'));
|
||||
\logstore_standard\event\unittest_executed::create(
|
||||
array('context' => context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
array('context' => \context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
$this->assertEquals(8, $DB->count_records('logstore_standard_log'));
|
||||
|
||||
// Test guest logging setting.
|
||||
@@ -196,22 +197,22 @@ class logstore_standard_store_testcase extends advanced_testcase {
|
||||
|
||||
$this->setUser(null);
|
||||
\logstore_standard\event\unittest_executed::create(
|
||||
array('context' => context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
array('context' => \context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
$this->assertEquals(0, $DB->count_records('logstore_standard_log'));
|
||||
|
||||
$this->setGuestUser();
|
||||
\logstore_standard\event\unittest_executed::create(
|
||||
array('context' => context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
array('context' => \context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
$this->assertEquals(0, $DB->count_records('logstore_standard_log'));
|
||||
|
||||
$this->setUser($user1);
|
||||
\logstore_standard\event\unittest_executed::create(
|
||||
array('context' => context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
array('context' => \context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
$this->assertEquals(1, $DB->count_records('logstore_standard_log'));
|
||||
|
||||
$this->setUser($user2);
|
||||
\logstore_standard\event\unittest_executed::create(
|
||||
array('context' => context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
array('context' => \context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
$this->assertEquals(2, $DB->count_records('logstore_standard_log'));
|
||||
|
||||
set_config('enabled_stores', '', 'tool_log');
|
||||
@@ -335,7 +336,7 @@ class logstore_standard_store_testcase extends advanced_testcase {
|
||||
$this->resetAfterTest();
|
||||
|
||||
// Create some records spread over various days; test multiple iterations in cleanup.
|
||||
$ctx = context_course::instance(1);
|
||||
$ctx = \context_course::instance(1);
|
||||
$record = (object) array(
|
||||
'edulevel' => 0,
|
||||
'contextid' => $ctx->id,
|
||||
@@ -424,11 +425,11 @@ class logstore_standard_store_testcase extends advanced_testcase {
|
||||
|
||||
// Create some log data in a course - one with other data, one without.
|
||||
\logstore_standard\event\unittest_executed::create([
|
||||
'context' => context_course::instance($course->id),
|
||||
'context' => \context_course::instance($course->id),
|
||||
'other' => ['sample' => 5, 'xx' => 10]])->trigger();
|
||||
$this->waitForSecond();
|
||||
\logstore_standard\event\unittest_executed::create([
|
||||
'context' => context_course::instance($course->id)])->trigger();
|
||||
'context' => \context_course::instance($course->id)])->trigger();
|
||||
|
||||
$records = array_values($DB->get_records('logstore_standard_log',
|
||||
['courseid' => $course->id, 'target' => 'unittest'], 'timecreated'));
|
||||
@@ -473,7 +474,7 @@ class logstore_standard_store_testcase extends advanced_testcase {
|
||||
/**
|
||||
* Backs a course up to temp directory.
|
||||
*
|
||||
* @param stdClass $course Course object to backup
|
||||
* @param \stdClass $course Course object to backup
|
||||
* @return string ID of backup
|
||||
*/
|
||||
protected function backup($course): string {
|
||||
@@ -481,14 +482,14 @@ class logstore_standard_store_testcase extends advanced_testcase {
|
||||
require_once($CFG->dirroot . '/backup/util/includes/backup_includes.php');
|
||||
|
||||
// Turn off file logging, otherwise it can't delete the file (Windows).
|
||||
$CFG->backup_file_logger_level = backup::LOG_NONE;
|
||||
$CFG->backup_file_logger_level = \backup::LOG_NONE;
|
||||
|
||||
// Do backup with default settings. MODE_IMPORT means it will just
|
||||
// create the directory and not zip it.
|
||||
$bc = new backup_controller(backup::TYPE_1COURSE, $course->id,
|
||||
backup::FORMAT_MOODLE, backup::INTERACTIVE_NO, backup::MODE_IMPORT,
|
||||
$bc = new \backup_controller(\backup::TYPE_1COURSE, $course->id,
|
||||
\backup::FORMAT_MOODLE, \backup::INTERACTIVE_NO, \backup::MODE_IMPORT,
|
||||
$USER->id);
|
||||
$bc->get_plan()->get_setting('users')->set_status(backup_setting::NOT_LOCKED);
|
||||
$bc->get_plan()->get_setting('users')->set_status(\backup_setting::NOT_LOCKED);
|
||||
$bc->get_plan()->get_setting('users')->set_value(true);
|
||||
$bc->get_plan()->get_setting('logs')->set_value(true);
|
||||
$backupid = $bc->get_backupid();
|
||||
@@ -505,18 +506,18 @@ class logstore_standard_store_testcase extends advanced_testcase {
|
||||
* @param \stdClass $course Original course object
|
||||
* @param string $suffix Suffix to add after original course shortname and fullname
|
||||
* @return int New course id
|
||||
* @throws restore_controller_exception
|
||||
* @throws \restore_controller_exception
|
||||
*/
|
||||
protected function restore(string $backupid, $course, string $suffix): int {
|
||||
global $USER, $CFG;
|
||||
require_once($CFG->dirroot . '/backup/util/includes/restore_includes.php');
|
||||
|
||||
// Do restore to new course with default settings.
|
||||
$newcourseid = restore_dbops::create_new_course(
|
||||
$newcourseid = \restore_dbops::create_new_course(
|
||||
$course->fullname . $suffix, $course->shortname . $suffix, $course->category);
|
||||
$rc = new restore_controller($backupid, $newcourseid,
|
||||
backup::INTERACTIVE_NO, backup::MODE_GENERAL, $USER->id,
|
||||
backup::TARGET_NEW_COURSE);
|
||||
$rc = new \restore_controller($backupid, $newcourseid,
|
||||
\backup::INTERACTIVE_NO, \backup::MODE_GENERAL, $USER->id,
|
||||
\backup::TARGET_NEW_COURSE);
|
||||
$rc->get_plan()->get_setting('logs')->set_value(true);
|
||||
$rc->get_plan()->get_setting('users')->set_value(true);
|
||||
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
namespace tool_log;
|
||||
|
||||
/**
|
||||
* Log manager and log API tests.
|
||||
*
|
||||
@@ -21,10 +23,7 @@
|
||||
* @copyright 2014 Petr Skoda {@link http://skodak.org/}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die;
|
||||
|
||||
class tool_log_manager_testcase extends advanced_testcase {
|
||||
class manager_test extends \advanced_testcase {
|
||||
public function test_get_log_manager() {
|
||||
global $CFG;
|
||||
$this->resetAfterTest();
|
||||
|
||||
+6
-5
@@ -23,6 +23,7 @@
|
||||
* @author Frédéric Massart <fred@branchup.tech>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
namespace tool_log\privacy;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
global $CFG;
|
||||
@@ -49,7 +50,7 @@ require_once($CFG->dirroot . '/admin/tool/log/store/standard/tests/fixtures/even
|
||||
* @author Frédéric Massart <fred@branchup.tech>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class tool_log_privacy_testcase extends provider_testcase {
|
||||
class provider_test extends provider_testcase {
|
||||
|
||||
public function setUp(): void {
|
||||
$this->resetAfterTest();
|
||||
@@ -60,7 +61,7 @@ class tool_log_privacy_testcase extends provider_testcase {
|
||||
$admin = \core_user::get_user(2);
|
||||
$u1 = $this->getDataGenerator()->create_user();
|
||||
$c1 = $this->getDataGenerator()->create_course();
|
||||
$c1ctx = context_course::instance($c1->id);
|
||||
$c1ctx = \context_course::instance($c1->id);
|
||||
|
||||
$this->enable_logging();
|
||||
$manager = get_log_manager(true);
|
||||
@@ -77,7 +78,7 @@ class tool_log_privacy_testcase extends provider_testcase {
|
||||
$u1 = $this->getDataGenerator()->create_user();
|
||||
$u2 = $this->getDataGenerator()->create_user();
|
||||
$c1 = $this->getDataGenerator()->create_course();
|
||||
$c1ctx = context_course::instance($c1->id);
|
||||
$c1ctx = \context_course::instance($c1->id);
|
||||
|
||||
$this->enable_logging();
|
||||
$manager = get_log_manager(true);
|
||||
@@ -111,7 +112,7 @@ class tool_log_privacy_testcase extends provider_testcase {
|
||||
$u1 = $this->getDataGenerator()->create_user();
|
||||
$u2 = $this->getDataGenerator()->create_user();
|
||||
$c1 = $this->getDataGenerator()->create_course();
|
||||
$c1ctx = context_course::instance($c1->id);
|
||||
$c1ctx = \context_course::instance($c1->id);
|
||||
|
||||
$this->enable_logging();
|
||||
$manager = get_log_manager(true);
|
||||
@@ -144,7 +145,7 @@ class tool_log_privacy_testcase extends provider_testcase {
|
||||
$admin = \core_user::get_user(2);
|
||||
$u1 = $this->getDataGenerator()->create_user();
|
||||
$c1 = $this->getDataGenerator()->create_course();
|
||||
$c1ctx = context_course::instance($c1->id);
|
||||
$c1ctx = \context_course::instance($c1->id);
|
||||
|
||||
$path = [get_string('privacy:path:logs', 'tool_log'), get_string('pluginname', 'logstore_standard')];
|
||||
$this->enable_logging();
|
||||
+14
-2
@@ -1,2 +1,14 @@
|
||||
define ("tool_lp/actionselector",["jquery","core/notification","core/ajax","core/templates","tool_lp/dialogue","tool_lp/event_base"],function(a,b,c,d,e,f){var g=function(a,b,c,d,e){var g=this;f.prototype.constructor.apply(this,[]);g._title=a;g._message=b;g._actions=c;g._confirm=d;g._cancel=e;g._selectedValue=null;g._reset()};g.prototype=Object.create(f.prototype);g.prototype._selectedValue=null;g.prototype._popup=null;g.prototype._title=null;g.prototype._message=null;g.prototype._actions=null;g.prototype._confirm=null;g.prototype._cancel=null;g.prototype._afterRender=function(){var b=this;b._find("[data-action=\"action-selector-confirm\"]").attr("disabled","disabled");b._find("[data-region=\"action-selector-radio-buttons\"]").change(function(){b._selectedValue=a("input[type='radio']:checked").val();b._find("[data-action=\"action-selector-confirm\"]").removeAttr("disabled");b._refresh.bind(b)});b._find("[data-action=\"action-selector-cancel\"]").click(function(a){a.preventDefault();b.close()});b._find("[data-action=\"action-selector-confirm\"]").click(function(a){a.preventDefault();if(!b._selectedValue.length){return}b._trigger("save",{action:b._selectedValue});b.close()})};g.prototype.close=function(){var a=this;a._popup.close();a._reset()};g.prototype.display=function(){var a=this;return a._render().then(function(b){a._popup=new e(a._title,b,a._afterRender.bind(a))}).fail(b.exception)};g.prototype._find=function(b){return a(this._popup.getContent()).find(b)};g.prototype._refresh=function(){var a=this;return a._render().then(function(b){a._find("[data-region=\"action-selector\"]").replaceWith(b);a._afterRender()})};g.prototype._render=function(){var a=this,b=[];for(var c in a._actions){b.push(a._actions[c])}var e={message:a._message,choices:b,confirm:a._confirm,cancel:a._cancel};return d.render("tool_lp/action_selector",e)};g.prototype._reset=function(){this._popup=null;this._selectedValue=""};return g});
|
||||
//# sourceMappingURL=actionselector.min.js.map
|
||||
/**
|
||||
* Action selector.
|
||||
*
|
||||
* To handle 'save' events use: actionselector.on('save')
|
||||
* This will receive the information to display in popup.
|
||||
* The actions have the format [{'text': sometext, 'value' : somevalue}].
|
||||
*
|
||||
* @module tool_lp/actionselector
|
||||
* @copyright 2016 Serge Gauthier - <serge.gauthier.2@umontreal.ca>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
define("tool_lp/actionselector",["jquery","core/notification","core/ajax","core/templates","tool_lp/dialogue","tool_lp/event_base"],(function($,Notification,Ajax,Templates,Dialogue,EventBase){var ActionSelector=function(title,message,actions,confirm,cancel){EventBase.prototype.constructor.apply(this,[]),this._title=title,this._message=message,this._actions=actions,this._confirm=confirm,this._cancel=cancel,this._selectedValue=null,this._reset()};return(ActionSelector.prototype=Object.create(EventBase.prototype))._selectedValue=null,ActionSelector.prototype._popup=null,ActionSelector.prototype._title=null,ActionSelector.prototype._message=null,ActionSelector.prototype._actions=null,ActionSelector.prototype._confirm=null,ActionSelector.prototype._cancel=null,ActionSelector.prototype._afterRender=function(){var self=this;self._find('[data-action="action-selector-confirm"]').attr("disabled","disabled"),self._find('[data-region="action-selector-radio-buttons"]').change((function(){self._selectedValue=$("input[type='radio']:checked").val(),self._find('[data-action="action-selector-confirm"]').removeAttr("disabled"),self._refresh.bind(self)})),self._find('[data-action="action-selector-cancel"]').click((function(e){e.preventDefault(),self.close()})),self._find('[data-action="action-selector-confirm"]').click((function(e){e.preventDefault(),self._selectedValue.length&&(self._trigger("save",{action:self._selectedValue}),self.close())}))},ActionSelector.prototype.close=function(){this._popup.close(),this._reset()},ActionSelector.prototype.display=function(){var self=this;return self._render().then((function(html){self._popup=new Dialogue(self._title,html,self._afterRender.bind(self))})).fail(Notification.exception)},ActionSelector.prototype._find=function(selector){return $(this._popup.getContent()).find(selector)},ActionSelector.prototype._refresh=function(){var self=this;return self._render().then((function(html){self._find('[data-region="action-selector"]').replaceWith(html),self._afterRender()}))},ActionSelector.prototype._render=function(){var choices=[];for(var i in this._actions)choices.push(this._actions[i]);var content={message:this._message,choices:choices,confirm:this._confirm,cancel:this._cancel};return Templates.render("tool_lp/action_selector",content)},ActionSelector.prototype._reset=function(){this._popup=null,this._selectedValue=""},ActionSelector}));
|
||||
|
||||
//# sourceMappingURL=actionselector.min.js.map
|
||||
File diff suppressed because one or more lines are too long
+10
-2
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+10
-2
@@ -1,2 +1,10 @@
|
||||
define ("tool_lp/competency_outcomes",["jquery","core/str"],function(a,b){return{NONE:0,EVIDENCE:1,COMPLETE:2,RECOMMEND:3,getAll:function getAll(){var a=this;return b.get_strings([{key:"competencyoutcome_none",component:"tool_lp"},{key:"competencyoutcome_evidence",component:"tool_lp"},{key:"competencyoutcome_recommend",component:"tool_lp"},{key:"competencyoutcome_complete",component:"tool_lp"}]).then(function(b){var c={};c[a.NONE]={code:a.NONE,name:b[0]};c[a.EVIDENCE]={code:a.EVIDENCE,name:b[1]};c[a.RECOMMEND]={code:a.RECOMMEND,name:b[2]};c[a.COMPLETE]={code:a.COMPLETE,name:b[3]};return c})},getString:function getString(b){var c=this,d=c.getAll();return d.then(function(c){if("undefined"==typeof c[b]){return a.Deferred().reject().promise()}return c[b].name})}}});
|
||||
//# sourceMappingURL=competency_outcomes.min.js.map
|
||||
/**
|
||||
* Competency rule config.
|
||||
*
|
||||
* @module tool_lp/competency_outcomes
|
||||
* @copyright 2015 Frédéric Massart - FMCorz.net
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
define("tool_lp/competency_outcomes",["jquery","core/str"],(function($,Str){return{NONE:0,EVIDENCE:1,COMPLETE:2,RECOMMEND:3,getAll:function(){var self=this;return Str.get_strings([{key:"competencyoutcome_none",component:"tool_lp"},{key:"competencyoutcome_evidence",component:"tool_lp"},{key:"competencyoutcome_recommend",component:"tool_lp"},{key:"competencyoutcome_complete",component:"tool_lp"}]).then((function(strings){var outcomes={};return outcomes[self.NONE]={code:self.NONE,name:strings[0]},outcomes[self.EVIDENCE]={code:self.EVIDENCE,name:strings[1]},outcomes[self.RECOMMEND]={code:self.RECOMMEND,name:strings[2]},outcomes[self.COMPLETE]={code:self.COMPLETE,name:strings[3]},outcomes}))},getString:function(id){return this.getAll().then((function(outcomes){return void 0===outcomes[id]?$.Deferred().reject().promise():outcomes[id].name}))}}}));
|
||||
|
||||
//# sourceMappingURL=competency_outcomes.min.js.map
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user