From 5a2b689265654f704d06eb2ea9ee1b21078edcfc Mon Sep 17 00:00:00 2001 From: Yaco Date: Sat, 12 Mar 2022 03:48:42 +0000 Subject: add plugins: wrap, bureaucracy, phpwikify --- .../bureaucracy/.github/workflows/phpTestLinux.yml | 52 ++ platform/www/lib/plugins/bureaucracy/README | 25 + .../plugins/bureaucracy/_test/BureaucracyTest.php | 69 ++ .../bureaucracy/_test/actions_template.test.php | 88 +++ .../_test/actions_template_noreplace.test.php | 113 +++ .../plugins/bureaucracy/_test/field_date.test.php | 97 +++ .../plugins/bureaucracy/_test/field_email.test.php | 92 +++ .../plugins/bureaucracy/_test/field_file.test.php | 137 ++++ .../bureaucracy/_test/field_hidden.test.php | 77 ++ .../bureaucracy/_test/field_multiselect.test.php | 81 +++ .../plugins/bureaucracy/_test/field_radio.test.php | 74 ++ .../plugins/bureaucracy/_test/field_time.test.php | 86 +++ .../plugins/bureaucracy/_test/field_user.test.php | 209 ++++++ .../plugins/bureaucracy/_test/field_users.test.php | 168 +++++ .../plugins/bureaucracy/_test/field_yesno.test.php | 70 ++ .../lib/plugins/bureaucracy/_test/general.test.php | 61 ++ .../www/lib/plugins/bureaucracy/_test/input.txt | 38 + .../bureaucracy/_test/replace_functions.test.php | 142 ++++ .../lib/plugins/bureaucracy/_test/syntax.test.php | 138 ++++ platform/www/lib/plugins/bureaucracy/action.php | 60 ++ .../www/lib/plugins/bureaucracy/conf/default.php | 4 + .../www/lib/plugins/bureaucracy/conf/metadata.php | 5 + .../www/lib/plugins/bureaucracy/helper/action.php | 136 ++++ .../lib/plugins/bureaucracy/helper/actionmail.php | 212 ++++++ .../plugins/bureaucracy/helper/actionscript.php | 62 ++ .../plugins/bureaucracy/helper/actiontemplate.php | 459 ++++++++++++ .../www/lib/plugins/bureaucracy/helper/field.php | 508 +++++++++++++ .../plugins/bureaucracy/helper/fieldaddpage.php | 63 ++ .../lib/plugins/bureaucracy/helper/fielddate.php | 42 ++ .../lib/plugins/bureaucracy/helper/fieldemail.php | 30 + .../plugins/bureaucracy/helper/fieldfieldset.php | 114 +++ .../lib/plugins/bureaucracy/helper/fieldfile.php | 75 ++ .../lib/plugins/bureaucracy/helper/fieldhidden.php | 47 ++ .../bureaucracy/helper/fieldhiddenautoinc.php | 35 + .../bureaucracy/helper/fieldmultiselect.php | 62 ++ .../lib/plugins/bureaucracy/helper/fieldnumber.php | 119 ++++ .../lib/plugins/bureaucracy/helper/fieldonoff.php | 16 + .../plugins/bureaucracy/helper/fieldpassword.php | 29 + .../lib/plugins/bureaucracy/helper/fieldradio.php | 82 +++ .../lib/plugins/bureaucracy/helper/fieldselect.php | 61 ++ .../lib/plugins/bureaucracy/helper/fieldstatic.php | 60 ++ .../plugins/bureaucracy/helper/fieldsubject.php | 37 + .../lib/plugins/bureaucracy/helper/fieldsubmit.php | 89 +++ .../plugins/bureaucracy/helper/fieldtextarea.php | 29 + .../plugins/bureaucracy/helper/fieldtextbox.php | 34 + .../lib/plugins/bureaucracy/helper/fieldtime.php | 42 ++ .../bureaucracy/helper/fieldusemailtemplate.php | 62 ++ .../lib/plugins/bureaucracy/helper/fielduser.php | 99 +++ .../lib/plugins/bureaucracy/helper/fieldusers.php | 96 +++ .../lib/plugins/bureaucracy/helper/fieldwiki.php | 70 ++ .../lib/plugins/bureaucracy/helper/fieldyesno.php | 98 +++ .../interfaces/bureaucracy_handler_interface.php | 19 + .../www/lib/plugins/bureaucracy/lang/cs/lang.php | 27 + .../lib/plugins/bureaucracy/lang/cs/settings.php | 4 + .../www/lib/plugins/bureaucracy/lang/de/lang.php | 38 + .../lib/plugins/bureaucracy/lang/de/settings.php | 8 + .../www/lib/plugins/bureaucracy/lang/en/lang.php | 40 ++ .../lib/plugins/bureaucracy/lang/en/settings.php | 5 + .../www/lib/plugins/bureaucracy/lang/es/lang.php | 38 + .../lib/plugins/bureaucracy/lang/es/settings.php | 9 + .../www/lib/plugins/bureaucracy/lang/fa/lang.php | 38 + .../lib/plugins/bureaucracy/lang/fa/settings.php | 9 + .../www/lib/plugins/bureaucracy/lang/fr/lang.php | 38 + .../lib/plugins/bureaucracy/lang/fr/settings.php | 9 + .../www/lib/plugins/bureaucracy/lang/hr/lang.php | 38 + .../lib/plugins/bureaucracy/lang/hr/settings.php | 9 + .../www/lib/plugins/bureaucracy/lang/it/lang.php | 19 + .../www/lib/plugins/bureaucracy/lang/ja/lang.php | 38 + .../lib/plugins/bureaucracy/lang/ja/settings.php | 9 + .../www/lib/plugins/bureaucracy/lang/lv/lang.php | 30 + .../www/lib/plugins/bureaucracy/lang/nl/lang.php | 38 + .../lib/plugins/bureaucracy/lang/nl/settings.php | 9 + .../www/lib/plugins/bureaucracy/lang/no/lang.php | 39 + .../lib/plugins/bureaucracy/lang/no/settings.php | 5 + .../lib/plugins/bureaucracy/lang/pt-br/lang.php | 34 + .../www/lib/plugins/bureaucracy/lang/pt/lang.php | 37 + .../lib/plugins/bureaucracy/lang/pt/settings.php | 9 + .../www/lib/plugins/bureaucracy/lang/ru/lang.php | 38 + .../lib/plugins/bureaucracy/lang/ru/settings.php | 9 + .../www/lib/plugins/bureaucracy/lang/zh/lang.php | 39 + .../lib/plugins/bureaucracy/lang/zh/settings.php | 5 + .../www/lib/plugins/bureaucracy/plugin.info.txt | 8 + platform/www/lib/plugins/bureaucracy/script.js | 3 + .../lib/plugins/bureaucracy/script/datepicker.js | 11 + .../lib/plugins/bureaucracy/script/fieldsets.js | 84 +++ .../www/lib/plugins/bureaucracy/script/user.js | 90 +++ platform/www/lib/plugins/bureaucracy/style.css | 101 +++ platform/www/lib/plugins/bureaucracy/syntax.php | 623 ++++++++++++++++ platform/www/lib/plugins/master.zip | Bin 139966 -> 0 bytes platform/www/lib/plugins/phpwikify/LICENSE | 339 +++++++++ platform/www/lib/plugins/phpwikify/README.md | 2 + platform/www/lib/plugins/phpwikify/manager.dat | 2 + platform/www/lib/plugins/phpwikify/plugin.info.txt | 8 + platform/www/lib/plugins/phpwikify/syntax.php | 53 ++ platform/www/lib/plugins/wrap/.travis.yml | 18 + platform/www/lib/plugins/wrap/COPYING | 340 +++++++++ platform/www/lib/plugins/wrap/README | 1 + .../lib/plugins/wrap/_test/wrap_syntax.test.php | 243 +++++++ platform/www/lib/plugins/wrap/action.php | 152 ++++ platform/www/lib/plugins/wrap/all.less | 352 +++++++++ platform/www/lib/plugins/wrap/conf/default.php | 13 + platform/www/lib/plugins/wrap/conf/lang2dir.conf | 249 +++++++ platform/www/lib/plugins/wrap/conf/metadata.php | 13 + platform/www/lib/plugins/wrap/example.txt | 455 ++++++++++++ platform/www/lib/plugins/wrap/helper.php | 788 +++++++++++++++++++++ platform/www/lib/plugins/wrap/images/README | 18 + .../www/lib/plugins/wrap/images/note/16/alert.png | Bin 0 -> 883 bytes .../lib/plugins/wrap/images/note/16/download.png | Bin 0 -> 683 bytes .../www/lib/plugins/wrap/images/note/16/help.png | Bin 0 -> 929 bytes .../lib/plugins/wrap/images/note/16/important.png | Bin 0 -> 574 bytes .../www/lib/plugins/wrap/images/note/16/info.png | Bin 0 -> 796 bytes .../www/lib/plugins/wrap/images/note/16/tip.png | Bin 0 -> 841 bytes .../www/lib/plugins/wrap/images/note/16/todo.png | Bin 0 -> 692 bytes .../www/lib/plugins/wrap/images/note/48/alert.png | Bin 0 -> 3654 bytes .../lib/plugins/wrap/images/note/48/download.png | Bin 0 -> 2801 bytes .../www/lib/plugins/wrap/images/note/48/help.png | Bin 0 -> 3283 bytes .../lib/plugins/wrap/images/note/48/important.png | Bin 0 -> 3029 bytes .../www/lib/plugins/wrap/images/note/48/info.png | Bin 0 -> 3315 bytes .../www/lib/plugins/wrap/images/note/48/tip.png | Bin 0 -> 4232 bytes .../www/lib/plugins/wrap/images/note/48/todo.png | Bin 0 -> 3176 bytes .../www/lib/plugins/wrap/images/toolbar/box.png | Bin 0 -> 353 bytes .../www/lib/plugins/wrap/images/toolbar/clear.png | Bin 0 -> 797 bytes .../www/lib/plugins/wrap/images/toolbar/column.png | Bin 0 -> 246 bytes .../www/lib/plugins/wrap/images/toolbar/em.png | Bin 0 -> 235 bytes .../www/lib/plugins/wrap/images/toolbar/hi.png | Bin 0 -> 259 bytes .../www/lib/plugins/wrap/images/toolbar/lo.png | Bin 0 -> 211 bytes .../www/lib/plugins/wrap/images/toolbar/picker.png | Bin 0 -> 870 bytes platform/www/lib/plugins/wrap/lang/ar/lang.php | 16 + platform/www/lib/plugins/wrap/lang/ar/settings.php | 11 + platform/www/lib/plugins/wrap/lang/bg/lang.php | 21 + platform/www/lib/plugins/wrap/lang/bg/settings.php | 16 + platform/www/lib/plugins/wrap/lang/bn/lang.php | 21 + platform/www/lib/plugins/wrap/lang/bn/settings.php | 14 + platform/www/lib/plugins/wrap/lang/cs/lang.php | 21 + platform/www/lib/plugins/wrap/lang/cs/settings.php | 15 + platform/www/lib/plugins/wrap/lang/cy/lang.php | 22 + platform/www/lib/plugins/wrap/lang/cy/settings.php | 15 + platform/www/lib/plugins/wrap/lang/da/lang.php | 21 + platform/www/lib/plugins/wrap/lang/da/settings.php | 12 + .../www/lib/plugins/wrap/lang/de-informal/lang.php | 19 + .../lib/plugins/wrap/lang/de-informal/settings.php | 15 + platform/www/lib/plugins/wrap/lang/de/lang.php | 19 + platform/www/lib/plugins/wrap/lang/de/settings.php | 15 + platform/www/lib/plugins/wrap/lang/en/lang.php | 19 + platform/www/lib/plugins/wrap/lang/en/settings.php | 15 + platform/www/lib/plugins/wrap/lang/eo/lang.php | 21 + platform/www/lib/plugins/wrap/lang/eo/settings.php | 14 + platform/www/lib/plugins/wrap/lang/es/lang.php | 21 + platform/www/lib/plugins/wrap/lang/es/settings.php | 18 + platform/www/lib/plugins/wrap/lang/fa/lang.php | 22 + platform/www/lib/plugins/wrap/lang/fa/settings.php | 15 + platform/www/lib/plugins/wrap/lang/fr/lang.php | 22 + platform/www/lib/plugins/wrap/lang/fr/settings.php | 18 + platform/www/lib/plugins/wrap/lang/hr/lang.php | 21 + platform/www/lib/plugins/wrap/lang/hr/settings.php | 16 + platform/www/lib/plugins/wrap/lang/hu/lang.php | 21 + platform/www/lib/plugins/wrap/lang/hu/settings.php | 16 + platform/www/lib/plugins/wrap/lang/it/lang.php | 23 + platform/www/lib/plugins/wrap/lang/it/settings.php | 16 + platform/www/lib/plugins/wrap/lang/ja/lang.php | 21 + platform/www/lib/plugins/wrap/lang/ja/settings.php | 16 + platform/www/lib/plugins/wrap/lang/ko/lang.php | 21 + platform/www/lib/plugins/wrap/lang/ko/settings.php | 15 + platform/www/lib/plugins/wrap/lang/nl/lang.php | 21 + platform/www/lib/plugins/wrap/lang/nl/settings.php | 16 + platform/www/lib/plugins/wrap/lang/no/lang.php | 24 + platform/www/lib/plugins/wrap/lang/no/settings.php | 15 + platform/www/lib/plugins/wrap/lang/pt-br/lang.php | 22 + .../www/lib/plugins/wrap/lang/pt-br/settings.php | 18 + platform/www/lib/plugins/wrap/lang/ru/lang.php | 22 + platform/www/lib/plugins/wrap/lang/ru/settings.php | 18 + platform/www/lib/plugins/wrap/lang/sk/lang.php | 12 + platform/www/lib/plugins/wrap/lang/sk/settings.php | 12 + platform/www/lib/plugins/wrap/lang/sr/lang.php | 21 + platform/www/lib/plugins/wrap/lang/sr/settings.php | 15 + platform/www/lib/plugins/wrap/lang/sv/lang.php | 17 + platform/www/lib/plugins/wrap/lang/sv/settings.php | 10 + platform/www/lib/plugins/wrap/lang/tr/lang.php | 22 + platform/www/lib/plugins/wrap/lang/tr/settings.php | 15 + platform/www/lib/plugins/wrap/lang/zh-tw/lang.php | 19 + .../www/lib/plugins/wrap/lang/zh-tw/settings.php | 11 + platform/www/lib/plugins/wrap/lang/zh/lang.php | 20 + platform/www/lib/plugins/wrap/lang/zh/settings.php | 16 + platform/www/lib/plugins/wrap/manager.dat | 2 + platform/www/lib/plugins/wrap/pdf.less | 20 + platform/www/lib/plugins/wrap/plugin.info.txt | 8 + platform/www/lib/plugins/wrap/print.less | 45 ++ platform/www/lib/plugins/wrap/print_or_pdf.less | 31 + platform/www/lib/plugins/wrap/style.less | 215 ++++++ .../www/lib/plugins/wrap/syntax/closesection.php | 40 ++ platform/www/lib/plugins/wrap/syntax/div.php | 139 ++++ platform/www/lib/plugins/wrap/syntax/divblock.php | 21 + platform/www/lib/plugins/wrap/syntax/divwrap.php | 20 + platform/www/lib/plugins/wrap/syntax/span.php | 105 +++ .../www/lib/plugins/wrap/syntax/spaninline.php | 20 + platform/www/lib/plugins/wrap/syntax/spanwrap.php | 21 + 196 files changed, 11084 insertions(+) create mode 100644 platform/www/lib/plugins/bureaucracy/.github/workflows/phpTestLinux.yml create mode 100644 platform/www/lib/plugins/bureaucracy/README create mode 100644 platform/www/lib/plugins/bureaucracy/_test/BureaucracyTest.php create mode 100644 platform/www/lib/plugins/bureaucracy/_test/actions_template.test.php create mode 100644 platform/www/lib/plugins/bureaucracy/_test/actions_template_noreplace.test.php create mode 100644 platform/www/lib/plugins/bureaucracy/_test/field_date.test.php create mode 100644 platform/www/lib/plugins/bureaucracy/_test/field_email.test.php create mode 100644 platform/www/lib/plugins/bureaucracy/_test/field_file.test.php create mode 100644 platform/www/lib/plugins/bureaucracy/_test/field_hidden.test.php create mode 100644 platform/www/lib/plugins/bureaucracy/_test/field_multiselect.test.php create mode 100644 platform/www/lib/plugins/bureaucracy/_test/field_radio.test.php create mode 100644 platform/www/lib/plugins/bureaucracy/_test/field_time.test.php create mode 100644 platform/www/lib/plugins/bureaucracy/_test/field_user.test.php create mode 100644 platform/www/lib/plugins/bureaucracy/_test/field_users.test.php create mode 100644 platform/www/lib/plugins/bureaucracy/_test/field_yesno.test.php create mode 100644 platform/www/lib/plugins/bureaucracy/_test/general.test.php create mode 100644 platform/www/lib/plugins/bureaucracy/_test/input.txt create mode 100644 platform/www/lib/plugins/bureaucracy/_test/replace_functions.test.php create mode 100644 platform/www/lib/plugins/bureaucracy/_test/syntax.test.php create mode 100644 platform/www/lib/plugins/bureaucracy/action.php create mode 100644 platform/www/lib/plugins/bureaucracy/conf/default.php create mode 100644 platform/www/lib/plugins/bureaucracy/conf/metadata.php create mode 100644 platform/www/lib/plugins/bureaucracy/helper/action.php create mode 100644 platform/www/lib/plugins/bureaucracy/helper/actionmail.php create mode 100644 platform/www/lib/plugins/bureaucracy/helper/actionscript.php create mode 100644 platform/www/lib/plugins/bureaucracy/helper/actiontemplate.php create mode 100644 platform/www/lib/plugins/bureaucracy/helper/field.php create mode 100644 platform/www/lib/plugins/bureaucracy/helper/fieldaddpage.php create mode 100644 platform/www/lib/plugins/bureaucracy/helper/fielddate.php create mode 100644 platform/www/lib/plugins/bureaucracy/helper/fieldemail.php create mode 100644 platform/www/lib/plugins/bureaucracy/helper/fieldfieldset.php create mode 100644 platform/www/lib/plugins/bureaucracy/helper/fieldfile.php create mode 100644 platform/www/lib/plugins/bureaucracy/helper/fieldhidden.php create mode 100644 platform/www/lib/plugins/bureaucracy/helper/fieldhiddenautoinc.php create mode 100644 platform/www/lib/plugins/bureaucracy/helper/fieldmultiselect.php create mode 100644 platform/www/lib/plugins/bureaucracy/helper/fieldnumber.php create mode 100644 platform/www/lib/plugins/bureaucracy/helper/fieldonoff.php create mode 100644 platform/www/lib/plugins/bureaucracy/helper/fieldpassword.php create mode 100644 platform/www/lib/plugins/bureaucracy/helper/fieldradio.php create mode 100644 platform/www/lib/plugins/bureaucracy/helper/fieldselect.php create mode 100644 platform/www/lib/plugins/bureaucracy/helper/fieldstatic.php create mode 100644 platform/www/lib/plugins/bureaucracy/helper/fieldsubject.php create mode 100644 platform/www/lib/plugins/bureaucracy/helper/fieldsubmit.php create mode 100644 platform/www/lib/plugins/bureaucracy/helper/fieldtextarea.php create mode 100644 platform/www/lib/plugins/bureaucracy/helper/fieldtextbox.php create mode 100644 platform/www/lib/plugins/bureaucracy/helper/fieldtime.php create mode 100644 platform/www/lib/plugins/bureaucracy/helper/fieldusemailtemplate.php create mode 100644 platform/www/lib/plugins/bureaucracy/helper/fielduser.php create mode 100644 platform/www/lib/plugins/bureaucracy/helper/fieldusers.php create mode 100644 platform/www/lib/plugins/bureaucracy/helper/fieldwiki.php create mode 100644 platform/www/lib/plugins/bureaucracy/helper/fieldyesno.php create mode 100644 platform/www/lib/plugins/bureaucracy/interfaces/bureaucracy_handler_interface.php create mode 100644 platform/www/lib/plugins/bureaucracy/lang/cs/lang.php create mode 100644 platform/www/lib/plugins/bureaucracy/lang/cs/settings.php create mode 100644 platform/www/lib/plugins/bureaucracy/lang/de/lang.php create mode 100644 platform/www/lib/plugins/bureaucracy/lang/de/settings.php create mode 100644 platform/www/lib/plugins/bureaucracy/lang/en/lang.php create mode 100644 platform/www/lib/plugins/bureaucracy/lang/en/settings.php create mode 100644 platform/www/lib/plugins/bureaucracy/lang/es/lang.php create mode 100644 platform/www/lib/plugins/bureaucracy/lang/es/settings.php create mode 100644 platform/www/lib/plugins/bureaucracy/lang/fa/lang.php create mode 100644 platform/www/lib/plugins/bureaucracy/lang/fa/settings.php create mode 100644 platform/www/lib/plugins/bureaucracy/lang/fr/lang.php create mode 100644 platform/www/lib/plugins/bureaucracy/lang/fr/settings.php create mode 100644 platform/www/lib/plugins/bureaucracy/lang/hr/lang.php create mode 100644 platform/www/lib/plugins/bureaucracy/lang/hr/settings.php create mode 100644 platform/www/lib/plugins/bureaucracy/lang/it/lang.php create mode 100644 platform/www/lib/plugins/bureaucracy/lang/ja/lang.php create mode 100644 platform/www/lib/plugins/bureaucracy/lang/ja/settings.php create mode 100644 platform/www/lib/plugins/bureaucracy/lang/lv/lang.php create mode 100644 platform/www/lib/plugins/bureaucracy/lang/nl/lang.php create mode 100644 platform/www/lib/plugins/bureaucracy/lang/nl/settings.php create mode 100644 platform/www/lib/plugins/bureaucracy/lang/no/lang.php create mode 100644 platform/www/lib/plugins/bureaucracy/lang/no/settings.php create mode 100644 platform/www/lib/plugins/bureaucracy/lang/pt-br/lang.php create mode 100644 platform/www/lib/plugins/bureaucracy/lang/pt/lang.php create mode 100644 platform/www/lib/plugins/bureaucracy/lang/pt/settings.php create mode 100644 platform/www/lib/plugins/bureaucracy/lang/ru/lang.php create mode 100644 platform/www/lib/plugins/bureaucracy/lang/ru/settings.php create mode 100644 platform/www/lib/plugins/bureaucracy/lang/zh/lang.php create mode 100644 platform/www/lib/plugins/bureaucracy/lang/zh/settings.php create mode 100644 platform/www/lib/plugins/bureaucracy/plugin.info.txt create mode 100644 platform/www/lib/plugins/bureaucracy/script.js create mode 100755 platform/www/lib/plugins/bureaucracy/script/datepicker.js create mode 100644 platform/www/lib/plugins/bureaucracy/script/fieldsets.js create mode 100755 platform/www/lib/plugins/bureaucracy/script/user.js create mode 100644 platform/www/lib/plugins/bureaucracy/style.css create mode 100644 platform/www/lib/plugins/bureaucracy/syntax.php delete mode 100644 platform/www/lib/plugins/master.zip create mode 100644 platform/www/lib/plugins/phpwikify/LICENSE create mode 100644 platform/www/lib/plugins/phpwikify/README.md create mode 100644 platform/www/lib/plugins/phpwikify/manager.dat create mode 100644 platform/www/lib/plugins/phpwikify/plugin.info.txt create mode 100644 platform/www/lib/plugins/phpwikify/syntax.php create mode 100644 platform/www/lib/plugins/wrap/.travis.yml create mode 100644 platform/www/lib/plugins/wrap/COPYING create mode 100644 platform/www/lib/plugins/wrap/README create mode 100644 platform/www/lib/plugins/wrap/_test/wrap_syntax.test.php create mode 100644 platform/www/lib/plugins/wrap/action.php create mode 100644 platform/www/lib/plugins/wrap/all.less create mode 100644 platform/www/lib/plugins/wrap/conf/default.php create mode 100644 platform/www/lib/plugins/wrap/conf/lang2dir.conf create mode 100644 platform/www/lib/plugins/wrap/conf/metadata.php create mode 100644 platform/www/lib/plugins/wrap/example.txt create mode 100644 platform/www/lib/plugins/wrap/helper.php create mode 100644 platform/www/lib/plugins/wrap/images/README create mode 100644 platform/www/lib/plugins/wrap/images/note/16/alert.png create mode 100644 platform/www/lib/plugins/wrap/images/note/16/download.png create mode 100644 platform/www/lib/plugins/wrap/images/note/16/help.png create mode 100644 platform/www/lib/plugins/wrap/images/note/16/important.png create mode 100644 platform/www/lib/plugins/wrap/images/note/16/info.png create mode 100644 platform/www/lib/plugins/wrap/images/note/16/tip.png create mode 100644 platform/www/lib/plugins/wrap/images/note/16/todo.png create mode 100644 platform/www/lib/plugins/wrap/images/note/48/alert.png create mode 100644 platform/www/lib/plugins/wrap/images/note/48/download.png create mode 100644 platform/www/lib/plugins/wrap/images/note/48/help.png create mode 100644 platform/www/lib/plugins/wrap/images/note/48/important.png create mode 100644 platform/www/lib/plugins/wrap/images/note/48/info.png create mode 100644 platform/www/lib/plugins/wrap/images/note/48/tip.png create mode 100644 platform/www/lib/plugins/wrap/images/note/48/todo.png create mode 100644 platform/www/lib/plugins/wrap/images/toolbar/box.png create mode 100644 platform/www/lib/plugins/wrap/images/toolbar/clear.png create mode 100644 platform/www/lib/plugins/wrap/images/toolbar/column.png create mode 100644 platform/www/lib/plugins/wrap/images/toolbar/em.png create mode 100644 platform/www/lib/plugins/wrap/images/toolbar/hi.png create mode 100644 platform/www/lib/plugins/wrap/images/toolbar/lo.png create mode 100644 platform/www/lib/plugins/wrap/images/toolbar/picker.png create mode 100644 platform/www/lib/plugins/wrap/lang/ar/lang.php create mode 100644 platform/www/lib/plugins/wrap/lang/ar/settings.php create mode 100644 platform/www/lib/plugins/wrap/lang/bg/lang.php create mode 100644 platform/www/lib/plugins/wrap/lang/bg/settings.php create mode 100644 platform/www/lib/plugins/wrap/lang/bn/lang.php create mode 100644 platform/www/lib/plugins/wrap/lang/bn/settings.php create mode 100644 platform/www/lib/plugins/wrap/lang/cs/lang.php create mode 100644 platform/www/lib/plugins/wrap/lang/cs/settings.php create mode 100644 platform/www/lib/plugins/wrap/lang/cy/lang.php create mode 100644 platform/www/lib/plugins/wrap/lang/cy/settings.php create mode 100644 platform/www/lib/plugins/wrap/lang/da/lang.php create mode 100644 platform/www/lib/plugins/wrap/lang/da/settings.php create mode 100644 platform/www/lib/plugins/wrap/lang/de-informal/lang.php create mode 100644 platform/www/lib/plugins/wrap/lang/de-informal/settings.php create mode 100644 platform/www/lib/plugins/wrap/lang/de/lang.php create mode 100644 platform/www/lib/plugins/wrap/lang/de/settings.php create mode 100644 platform/www/lib/plugins/wrap/lang/en/lang.php create mode 100644 platform/www/lib/plugins/wrap/lang/en/settings.php create mode 100644 platform/www/lib/plugins/wrap/lang/eo/lang.php create mode 100644 platform/www/lib/plugins/wrap/lang/eo/settings.php create mode 100644 platform/www/lib/plugins/wrap/lang/es/lang.php create mode 100644 platform/www/lib/plugins/wrap/lang/es/settings.php create mode 100644 platform/www/lib/plugins/wrap/lang/fa/lang.php create mode 100644 platform/www/lib/plugins/wrap/lang/fa/settings.php create mode 100644 platform/www/lib/plugins/wrap/lang/fr/lang.php create mode 100644 platform/www/lib/plugins/wrap/lang/fr/settings.php create mode 100644 platform/www/lib/plugins/wrap/lang/hr/lang.php create mode 100644 platform/www/lib/plugins/wrap/lang/hr/settings.php create mode 100644 platform/www/lib/plugins/wrap/lang/hu/lang.php create mode 100644 platform/www/lib/plugins/wrap/lang/hu/settings.php create mode 100644 platform/www/lib/plugins/wrap/lang/it/lang.php create mode 100644 platform/www/lib/plugins/wrap/lang/it/settings.php create mode 100644 platform/www/lib/plugins/wrap/lang/ja/lang.php create mode 100644 platform/www/lib/plugins/wrap/lang/ja/settings.php create mode 100644 platform/www/lib/plugins/wrap/lang/ko/lang.php create mode 100644 platform/www/lib/plugins/wrap/lang/ko/settings.php create mode 100644 platform/www/lib/plugins/wrap/lang/nl/lang.php create mode 100644 platform/www/lib/plugins/wrap/lang/nl/settings.php create mode 100644 platform/www/lib/plugins/wrap/lang/no/lang.php create mode 100644 platform/www/lib/plugins/wrap/lang/no/settings.php create mode 100644 platform/www/lib/plugins/wrap/lang/pt-br/lang.php create mode 100644 platform/www/lib/plugins/wrap/lang/pt-br/settings.php create mode 100644 platform/www/lib/plugins/wrap/lang/ru/lang.php create mode 100644 platform/www/lib/plugins/wrap/lang/ru/settings.php create mode 100644 platform/www/lib/plugins/wrap/lang/sk/lang.php create mode 100644 platform/www/lib/plugins/wrap/lang/sk/settings.php create mode 100644 platform/www/lib/plugins/wrap/lang/sr/lang.php create mode 100644 platform/www/lib/plugins/wrap/lang/sr/settings.php create mode 100644 platform/www/lib/plugins/wrap/lang/sv/lang.php create mode 100644 platform/www/lib/plugins/wrap/lang/sv/settings.php create mode 100644 platform/www/lib/plugins/wrap/lang/tr/lang.php create mode 100644 platform/www/lib/plugins/wrap/lang/tr/settings.php create mode 100644 platform/www/lib/plugins/wrap/lang/zh-tw/lang.php create mode 100644 platform/www/lib/plugins/wrap/lang/zh-tw/settings.php create mode 100644 platform/www/lib/plugins/wrap/lang/zh/lang.php create mode 100644 platform/www/lib/plugins/wrap/lang/zh/settings.php create mode 100644 platform/www/lib/plugins/wrap/manager.dat create mode 100644 platform/www/lib/plugins/wrap/pdf.less create mode 100644 platform/www/lib/plugins/wrap/plugin.info.txt create mode 100644 platform/www/lib/plugins/wrap/print.less create mode 100644 platform/www/lib/plugins/wrap/print_or_pdf.less create mode 100644 platform/www/lib/plugins/wrap/style.less create mode 100644 platform/www/lib/plugins/wrap/syntax/closesection.php create mode 100644 platform/www/lib/plugins/wrap/syntax/div.php create mode 100644 platform/www/lib/plugins/wrap/syntax/divblock.php create mode 100644 platform/www/lib/plugins/wrap/syntax/divwrap.php create mode 100644 platform/www/lib/plugins/wrap/syntax/span.php create mode 100644 platform/www/lib/plugins/wrap/syntax/spaninline.php create mode 100644 platform/www/lib/plugins/wrap/syntax/spanwrap.php diff --git a/platform/www/lib/plugins/bureaucracy/.github/workflows/phpTestLinux.yml b/platform/www/lib/plugins/bureaucracy/.github/workflows/phpTestLinux.yml new file mode 100644 index 0000000..194e707 --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/.github/workflows/phpTestLinux.yml @@ -0,0 +1,52 @@ +name: PHP Tests on Linux + +on: [push, pull_request] + +jobs: + run: + name: PHP ${{ matrix.php-versions }} DokuWiki ${{ matrix.dokuwiki-branch }} + runs-on: ubuntu-latest + if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository + + strategy: + matrix: + php-versions: ['7.2', '7.3', '7.4', '8.0'] + dokuwiki-branch: [ 'master', 'stable'] + exclude: + - dokuwiki-branch: 'stable' + php-versions: '8.0' + fail-fast: true + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-versions }} + extensions: mbstring, intl, PDO, pdo_sqlite, bz2 + + - name: Setup problem matchers + run: | + echo ::add-matcher::${{ runner.tool_cache }}/php.json + echo ::add-matcher::${{ runner.tool_cache }}/phpunit.json + + - name: Download DokuWiki Test-setup + run: wget https://raw.github.com/splitbrain/dokuwiki-travis/master/travis.sh + + - name: Run DokuWiki Test-setup + env: + CI_SERVER: 1 + DOKUWIKI: ${{ matrix.dokuwiki-branch }} + run: sh travis.sh + + - name: Setup PHPUnit + run: | + php _test/fetchphpunit.php + cd _test + + - name: Run PHPUnit + run: | + cd _test + php phpunit.phar --verbose --stderr --group plugin_bureaucracy diff --git a/platform/www/lib/plugins/bureaucracy/README b/platform/www/lib/plugins/bureaucracy/README new file mode 100644 index 0000000..ca2bef7 --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/README @@ -0,0 +1,25 @@ +bureaucracy Plugin for DokuWiki + +All documentation for this plugin can be found at +http://www.dokuwiki.org/plugin:bureaucracy + +If you install this plugin manually, make sure it is installed in +lib/plugins/bureaucracy/ - if the folder is called different it +will not work! + +Please refer to http://www.dokuwiki.org/plugins for additional info +on how to install plugins in DokuWiki. + +---- +Copyright (C) Andreas Gohr + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 of the License + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +See the COPYING file in your DokuWiki folder for details diff --git a/platform/www/lib/plugins/bureaucracy/_test/BureaucracyTest.php b/platform/www/lib/plugins/bureaucracy/_test/BureaucracyTest.php new file mode 100644 index 0000000..5a381e6 --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/_test/BureaucracyTest.php @@ -0,0 +1,69 @@ +
+
'; + const FORM_SUFFIX_HTML = '
+
'; + + protected $pluginsEnabled = ['bureaucracy']; + + /** + * Simulate sending of bureaucracy form + * + * @param string|array $form_syntax syntax to build a bureaucracy form + * @param string $template_syntax syntax used as a page template for the "action template" + * @param array & $validation_errors field labels that were invalid + * @param string|array ...$values values passed to form handler + * + * @return string content of newly created page + */ + protected function send_form_action_template($form_syntax, $template_syntax, &$validation_errors, ...$values) + { + $id = uniqid('page', true); + $template_id = uniqid('template', true); + + //create full form syntax + if (is_array($form_syntax)) { + $form_syntax = implode("\n", $form_syntax); + } + $form_syntax = "
\naction template $template_id $id\n$form_syntax\n
"; + + saveWikiText($template_id, $template_syntax, 'summary'); + + /** @var \syntax_plugin_bureaucracy $syntax_plugin */ + $syntax_plugin = plugin_load('syntax', 'bureaucracy'); + $data = $syntax_plugin->handle($form_syntax, 0, 0, new \Doku_Handler()); + + $actionData = $data['actions'][0]; + /** @var \helper_plugin_bureaucracy_action $action */ + $action = plugin_load('helper', $actionData['actionname']); + //this is the only form + $form_id = 0; + + /** @var \helper_plugin_bureaucracy_field $field */ + foreach ($data['fields'] as $i => $field) { + if (!isset($values[$i])) { + $values[$i] = null; + } + + $isValid = $field->handle_post($values[$i], $data['fields'], $i, $form_id); + if (!$isValid) { + $validation_errors[] = $field->getParam('label'); + } + } + + $action->run( + $data['fields'], + $data['thanks'], + $actionData['argv'] + ); + + return rawWiki($id); + } +} diff --git a/platform/www/lib/plugins/bureaucracy/_test/actions_template.test.php b/platform/www/lib/plugins/bureaucracy/_test/actions_template.test.php new file mode 100644 index 0000000..befefc3 --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/_test/actions_template.test.php @@ -0,0 +1,88 @@ +getTemplateClass(); + $action->prepareLanguagePlaceholder(); + + $this->assertEquals('en', $action->values['__lang__']); + $this->assertEquals('/@LANG@/', $action->patterns['__lang__']); + $this->assertEquals('', $action->values['__trans__']); + $this->assertEquals('/@TRANS@/', $action->patterns['__trans__']); + } + + public function testPrepareLanguagePlaceholderTranslateDefaultNS() { + global $conf; + global $ID; + + $conf['plugin']['translation']['translations'] = 'de'; + $ID = 'bla'; + + plugin_enable('translation'); + if (null === plugin_load('helper', 'translation')) return; + + $action = $this->getTemplateClass(); + $action->prepareLanguagePlaceholder(); + + $this->assertEquals('en', $action->values['__lang__']); + $this->assertEquals('/@LANG@/', $action->patterns['__lang__']); + $this->assertEquals('', $action->values['__trans__']); + $this->assertEquals('/@TRANS@/', $action->patterns['__trans__']); + } + + public function testPrepareLanguagePlaceholderTranslateLanguageNS() { + global $conf; + global $ID; + + $conf['plugin']['translation']['translations'] = 'de'; + $ID = 'de:bla'; + + plugin_enable('translation'); + $translation = plugin_load('helper', 'translation'); + if (null === $translation) return; + + $action = $this->getTemplateClass(); + $action->prepareLanguagePlaceholder(); + + $this->assertEquals('en', $action->values['__lang__']); + $this->assertEquals('/@LANG@/', $action->patterns['__lang__']); + $this->assertEquals('de', $action->values['__trans__']); + $this->assertEquals('/@TRANS@/', $action->patterns['__trans__']); + } + + public function testProcessFields() { + $data = array(); + /** @var helper_plugin_bureaucracy_fieldstatic $staticfield */ + $staticfield = plugin_load('helper', 'bureaucracy_fieldstatic'); + $staticfield->initialize(array('text', 'text1')); + $data[] = $staticfield; + + $action = $this->getTemplateClass(); + $action->prepareFieldReplacements($data, '_', ''); + + $this->assertEquals('/(@@|##)text1(?:\|(.*?))\1/si', $action->patterns['text1']); + $this->assertEquals('$2', $action->values['text1']); + $this->assertEmpty($action->targetpages); + } + + /** + * @return helper_plugin_bureaucracy_actiontemplate + */ + private function getTemplateClass() { + /** @var helper_plugin_bureaucracy_actiontemplate $templateaction */ + $templateaction = plugin_load('helper', 'bureaucracy_actiontemplate'); + $templateaction->patterns = array(); + $templateaction->values = array(); + $templateaction->targetpages = array(); + $templateaction->pagename = array(); + return $templateaction; + } + + +} diff --git a/platform/www/lib/plugins/bureaucracy/_test/actions_template_noreplace.test.php b/platform/www/lib/plugins/bureaucracy/_test/actions_template_noreplace.test.php new file mode 100644 index 0000000..dc54878 --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/_test/actions_template_noreplace.test.php @@ -0,0 +1,113 @@ +test.', + '', + '', + 'This is test.', + [], + ' not removed.', + ], + [ + '%Y-%m-%d %Y-%m-%d.', + '', + '', + date('Y-m-d') . ' %Y-%m-%d.', + [], + 'Date replaced inside .', + ], + [ + '@@test@@ @@test@@.', + 'textbox test', + 'something', + 'something @@test@@.', + [], + 'Field value replaced inside .', + ], + [ + '@ID@ @USER@ @MAIL@', + '', + '', + '@ID@ @USER@ @MAIL@', + [], + 'DokuWiki replacement paterns for templates replaced inside .', + ], + [ + '@FORMPAGE_ID@ @FORMPAGE_NS@ @FORMPAGE_CURNS@', + '', + '', + '@FORMPAGE_ID@ @FORMPAGE_NS@ @FORMPAGE_CURNS@', + [], + '@FORMPAGE_*@ replacement paterns replaced inside .', + ], + [ + 'TEST', + '', + '', + 'TEST', + [], + 'noinclude tag inside .', + ], + [ + '@NSBASE@', + '', + '', + '@NSBASE@', + [], + '"@NSBASE@" replaced inside .', + ], + [ + '%%', + '', + '', + '%%', + [], + '"%%" replaced inside .', + ] + ]; + } + + /** + * @dataProvider dataProvider + * + * @param string $templateSyntax + * @param string $formSyntax + * @param string $postedValue + * @param string $expectedWikiText + * @param string $msg + * + */ + public function test_noreplace_tag( + $templateSyntax, + $formSyntax, + $postedValue, + $expectedWikiText, + $expectedValidationErrors, + $msg + ) { + $actualValidationErrors = []; + + $actualWikiText = parent::send_form_action_template( + $formSyntax, + $templateSyntax, + $actualValidationErrors, + $postedValue + ); + + if (empty($expectedValidationErrors)) { + $this->assertEquals($expectedWikiText, $actualWikiText, $msg); + } + $this->assertEquals($expectedValidationErrors, $actualValidationErrors, $msg); + } +} diff --git a/platform/www/lib/plugins/bureaucracy/_test/field_date.test.php b/platform/www/lib/plugins/bureaucracy/_test/field_date.test.php new file mode 100644 index 0000000..3164630 --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/_test/field_date.test.php @@ -0,0 +1,97 @@ +assertEquals($expectedWikiText, $actualWikiText, $msg); + } + $this->assertEquals($expectedValidationErrors, $actualValidationErrors, $msg); + } + + public function test_field_date_render() + { + $formSyntax = 'date "dateLabel"'; + $instr = p_get_instructions("
\n$formSyntax\n
"); + + $actualHTML = p_render('xhtml', $instr, $info); + + $expectedFieldHTML = ''; + $expectedHTML = self::FORM_PREFIX_HTML . "\n$expectedFieldHTML\n" . self::FORM_SUFFIX_HTML; + $this->assertEquals(trim($expectedHTML), trim($actualHTML)); + } +} diff --git a/platform/www/lib/plugins/bureaucracy/_test/field_email.test.php b/platform/www/lib/plugins/bureaucracy/_test/field_email.test.php new file mode 100644 index 0000000..c3c522a --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/_test/field_email.test.php @@ -0,0 +1,92 @@ +assertEquals($expectedWikiText, $actualWikiText, $msg); + } + $this->assertEquals($expectedValidationErrors, $actualValidationErrors, $msg); + } + + public function test_field_email_render() + { + $formSyntax = 'email emailLabel'; + $instr = p_get_instructions("
\n$formSyntax\n
"); + + $actualHTML = p_render('xhtml', $instr, $info); + + $expectedFieldHTML = ''; + $expectedHTML = self::FORM_PREFIX_HTML . "\n$expectedFieldHTML\n" . self::FORM_SUFFIX_HTML; + $this->assertEquals(trim($expectedHTML), trim($actualHTML)); + } +} diff --git a/platform/www/lib/plugins/bureaucracy/_test/field_file.test.php b/platform/www/lib/plugins/bureaucracy/_test/field_file.test.php new file mode 100644 index 0000000..628bff4 --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/_test/field_file.test.php @@ -0,0 +1,137 @@ +assertEquals(1, $result->length, "selector: \"$pqSelector\" not found in\n$xhtml\n"); + } + + /** + * Chceck if defined namespace doesn't violate $standardArgs + */ + function test_syntax() { + $standardArgs = array( + '!' => 'input[type=file].edit', + '^' => 'input[type=file][required].edit.required', + '@' => 'input[type=file][required].edit.required', + '! /regex/' => 'input[type=file].edit', + '@ /regex/ "**Example error"' => 'input[type=file][required].edit.required' + ); + + //upload namespace not defined + foreach ($standardArgs as $arg => $pqSelector) { + $input = "
\nfile \"Some label\" $arg\n
"; + $this->assertPqSelector($input, $pqSelector); + } + + //upload namespace defined, nothing shoud change in syntax + foreach ($standardArgs as $arg => $pqSelector) { + $input = "
\nfile \"Some label\" upload:here $arg\n
"; + $this->assertPqSelector($input, $pqSelector); + } + + //upload namespace in "" + foreach ($standardArgs as $arg => $pqSelector) { + $input = "
\nfile \"Some label\" \"upload:here\" $arg\n
"; + $this->assertPqSelector($input, $pqSelector); + } + } + + /** + * Parse the bureaucracy form syntax and simulate a file upload + * + * @param $form_syntax bureaucracy form syntax containg only one file field + * @return string a name of the uploaded file + */ + protected function simulate_file_upload($form_syntax) { + $media = 'img.png'; + $media_src = mediaFN('wiki:dokuwiki-128.png'); + + $syntax_plugin = new syntax_plugin_bureaucracy(); + $data = $syntax_plugin->handle($form_syntax, 0, 0, new Doku_Handler()); + + $actionData = $data['actions'][0]; + $action = plugin_load('helper', $actionData['actionname']); + + $fileField = $data['fields'][0]; + + //mock file upload + $file = array( + 'name' => $media, + 'type' => 'image/png', + 'size' => filesize($media_src), + 'tmp_name' => $media_src + ); + //this is the only field + $index = 0; + //this is the only form + $form_id = 0; + $fileField->handle_post($file, $data['fields'], $index, $form_id); + + //upload file + $action->run( + $data['fields'], + $data['thanks'], + $actionData['argv'] + ); + + return $media; + } + + function test_action_template_upload_default() { + $template_id = 'template_upload_default'; + $id = 'upload_default'; + + saveWikiText($template_id, 'Value:@@Some label@@', 'summary'); + + $form_syntax = "
action template $template_id $id\nfile \"Some label\"\n
"; + $media = $this->simulate_file_upload($form_syntax); + + //check if file exists where we suspect it to be + $this->assertTrue(file_exists(mediaFN("$id:$media"))); + } + + function test_action_template_upload_absolute() { + $template_id = 'template_upload_absolute'; + $id = 'upload_absolute'; + $upload_ns = 'upload:ns'; + + saveWikiText($template_id, 'Value:@@Some label@@', 'summary'); + + $form_syntax = "
action template $template_id $id\nfile \"Some label\" $upload_ns\n
"; + $media = $this->simulate_file_upload($form_syntax); + + //check if file exists where we suspect it to be + $this->assertTrue(file_exists(mediaFN("$upload_ns:$media"))); + } + + function test_action_template_upload_relative() { + $template_id = 'template_upload_relative'; + $id = 'upload_relative'; + $upload_ns_rel = 'upload:ns'; + $upload_ns = ".:$upload_ns_rel"; + + saveWikiText($template_id, 'Value:@@Some label@@', 'summary'); + + $form_syntax = "
action template $template_id $id\nfile \"Some label\" \"$upload_ns\"\n
"; + $media = $this->simulate_file_upload($form_syntax); + + //check if file exists where we suspect it to be + $this->assertTrue(file_exists(mediaFN("$id:$upload_ns:$media"))); + } + +} diff --git a/platform/www/lib/plugins/bureaucracy/_test/field_hidden.test.php b/platform/www/lib/plugins/bureaucracy/_test/field_hidden.test.php new file mode 100644 index 0000000..386b28b --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/_test/field_hidden.test.php @@ -0,0 +1,77 @@ +assertEquals($expectedWikiText, $actualWikiText, $msg); + } + $this->assertEquals($expectedValidationErrors, $actualValidationErrors, $msg); + } + + public function test_field_time_render() + { + $formSyntax = 'hidden hiddenLabel "=default value of the hidden field"'; + $instr = p_get_instructions("
\n$formSyntax\n
"); + + $actualHTML = p_render('xhtml', $instr, $info); + + $hiddenFormPrefix = '
+'; + $expectedFieldHTML = ''; + $hiddenFormSuffix = '
'; + $expectedHTML = "$hiddenFormPrefix$expectedFieldHTML$hiddenFormSuffix"; + + $this->assertEquals(trim($expectedHTML), trim($actualHTML)); + } +} diff --git a/platform/www/lib/plugins/bureaucracy/_test/field_multiselect.test.php b/platform/www/lib/plugins/bureaucracy/_test/field_multiselect.test.php new file mode 100644 index 0000000..9445dc2 --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/_test/field_multiselect.test.php @@ -0,0 +1,81 @@ +assertEquals($expectedWikiText, $actualWikiText, $msg); + $this->assertEquals($expectedValidationErrors, $actualValidationErrors, $msg); + } + + public function test_field_multiselect_render() + { + $formSyntax = 'multiselect "multiSelectLabel" "Peaches|Apples|Oranges" =Peaches,Oranges'; + $instr = p_get_instructions("
\n$formSyntax\n
"); + + $actualHTML = p_render('xhtml', $instr, $info); + + $expectedFieldHTML = ''; + $expectedHTML = self::FORM_PREFIX_HTML . "\n$expectedFieldHTML\n" . self::FORM_SUFFIX_HTML; + $this->assertEquals(trim($expectedHTML), trim($actualHTML)); + } +} diff --git a/platform/www/lib/plugins/bureaucracy/_test/field_radio.test.php b/platform/www/lib/plugins/bureaucracy/_test/field_radio.test.php new file mode 100644 index 0000000..34839f6 --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/_test/field_radio.test.php @@ -0,0 +1,74 @@ +assertEquals($expectedWikiText, $actualWikiText, $msg); + $this->assertEquals($expectedValidationErrors, $actualValidationErrors, $msg); + } + + public function test_field_date_render() + { + $formSyntax = 'radio "radioLabel" "Peaches|Apples|Oranges"'; + $instr = p_get_instructions("
\n$formSyntax\n
"); + + $actualHTML = p_render('xhtml', $instr, $info); + + $expectedFieldHTML = ' + +'; + $expectedHTML = self::FORM_PREFIX_HTML . "\n$expectedFieldHTML\n" . self::FORM_SUFFIX_HTML; + $this->assertEquals(trim($expectedHTML), trim($actualHTML)); + } +} diff --git a/platform/www/lib/plugins/bureaucracy/_test/field_time.test.php b/platform/www/lib/plugins/bureaucracy/_test/field_time.test.php new file mode 100644 index 0000000..b027d8c --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/_test/field_time.test.php @@ -0,0 +1,86 @@ +assertEquals($expectedWikiText, $actualWikiText, $msg); + } + $this->assertEquals($expectedValidationErrors, $actualValidationErrors, $msg); + } + + public function test_field_time_render() + { + $formSyntax = 'time "timeLabel"'; + $instr = p_get_instructions("
\n$formSyntax\n
"); + + $actualHTML = p_render('xhtml', $instr, $info); + + $expectedFieldHTML = ''; + $expectedHTML = self::FORM_PREFIX_HTML . "\n$expectedFieldHTML\n" . self::FORM_SUFFIX_HTML; + $this->assertEquals(trim($expectedHTML), trim($actualHTML)); + } +} diff --git a/platform/www/lib/plugins/bureaucracy/_test/field_user.test.php b/platform/www/lib/plugins/bureaucracy/_test/field_user.test.php new file mode 100644 index 0000000..a7ade9b --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/_test/field_user.test.php @@ -0,0 +1,209 @@ +createUser("user1", "54321", "user1Name", "user1@example.com"); + $auth->createUser("user2", "543210", "user2Name", "user2@example.com"); + $auth->createUser("mwuser", "12345", "Wiki User", "wikiuser@example.com", ['group1', 'group2']); + } + + public function dataProvider() + { + return [ + [ + 'user:@@user@@', + 'user user', + 'mwuser', + 'user:mwuser', + [], + 'default substitution', + ], + [ + 'user:@@user@@', + 'user user', + '', + 'user:', + ['user'], + 'error for empty substitution', + ], + [ + 'user:@@user@@', + 'user user !', + '', + 'user:', + [], + 'ok for empty substitution in optional field', + ], + [ + 'user:@@user.name@@', + 'user user', + 'mwuser', + 'user:Wiki User', + [], + 'name substitution', + ], + [ + 'user:@@user.mail@@', + 'user user', + 'mwuser', + 'user:wikiuser@example.com', + [], + 'mail substitution', + ], + [ + 'user:@@user.grps@@', + 'user user', + 'mwuser', + 'user:group1, group2', + [], + 'groups substitution', + ], + [ + 'user:@@user.grps(;)@@', + 'user user', + 'mwuser', + 'user:group1;group2', + [], + 'groups substitution custom delimiter', + ], + [ + 'user:@@user.grps())@@', + 'user user', + 'mwuser', + 'user:group1)group2', + [], + 'groups substitution custom delimiter with brackets', + ], + [ + 'user:@@user.no_sutch_attribute@@', + 'user user', + 'mwuser', + 'user:@@user.no_sutch_attribute@@', + [], + 'template unknown attribute substitution', + ], + [ + 'user:##user##', + 'user user', + 'mwuser', + 'user:mwuser', + [], + 'hash substitution', + ], + [ + 'user:##user.mail##', + 'user user', + 'mwuser', + 'user:wikiuser@example.com', + [], + 'hash substitution with attribute', + ], + [ + 'user:##user@@', + 'user user', + 'mwuser', + 'user:##user@@', + [], + 'hash substitution sign mismatch', + ], + [ + "user:@@user@@\n\nmail:@@user.mail@@\n\ngrps:@@user.grps(\n)@@", + 'user user', + 'mwuser', + "user:mwuser\n\nmail:wikiuser@example.com\n\ngrps:group1\ngroup2", + [], + 'multiple replacements', + ], + [ + "grps1:@@user.grps(\n)@@\n\ngrps2:@@user.grps(())@@", + 'user user', + 'mwuser', + "grps1:group1\ngroup2\n\ngrps2:group1()group2", + [], + 'groups twice', + ], + [ + 'grps:@@user.grps(end))@@', + 'user user', + 'mwuser', + 'grps:group1end)group2', + [], + 'groups special glue', + ], + [ + 'grps:@@user.grps()@@', + 'user user', + 'mwuser', + 'grps:group1group2', + [], + 'groups with empty delimiter', + ], + [ + 'user:@@user@@', + 'user user', + 'non_existant_user', + 'user:non_existant_user', + ['user'], + 'error for non existant user', + ], + [ + 'user:@@user.name@@', + 'user user', + 'non_existant_user', + 'user:@@user.name@@', + ['user'], + 'error for non existant user with attribute', + ], + ]; + } + + + /** + * @dataProvider dataProvider + * + * @param string $templateSyntax + * @param string $formSyntax + * @param string $postedValue value of 'user' field + * @param string $expectedWikiText + * @param string $expectedValidationErrors + * @param string $msg + * + */ + public function test_field_user( + $templateSyntax, + $formSyntax, + $postedValue, + $expectedWikiText, + $expectedValidationErrors, + $msg + ) { + $actualValidationErrors = []; + + $actualWikiText = parent::send_form_action_template( + $formSyntax, + $templateSyntax, + $actualValidationErrors, + $postedValue + ); + + $this->assertEquals($expectedValidationErrors, $actualValidationErrors, $msg); + $this->assertEquals($expectedWikiText, $actualWikiText, $msg); + } +} diff --git a/platform/www/lib/plugins/bureaucracy/_test/field_users.test.php b/platform/www/lib/plugins/bureaucracy/_test/field_users.test.php new file mode 100644 index 0000000..633be20 --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/_test/field_users.test.php @@ -0,0 +1,168 @@ +createUser('user1', '54321', 'user1Name', 'user1@example.com'); + $auth->createUser('user2', '543210', 'user2Name', 'user2@example.com'); + $auth->createUser('mwuser', '12345', 'Wiki User', 'me@example.com', ['group1', 'group2']); + } + + public function dataProvider() + { + return [ + [ + 'users:@@users@@', + 'users users', + 'user1, user2', + 'users:user1, user2', + [], + 'default substitution', + ], + [ + 'users:@@users@@', + 'users users', + '', + 'users:', + ['users'], + 'error for empty substitution', + ], + [ + 'users:@@users(;)@@', + 'users users', + 'user1, user2', + 'users:user1;user2', + [], + 'custom delimiter', + ], + [ + "users:@@users(\n)@@", + 'users users', + 'user1, user2', + "users:user1\nuser2", + [], + 'newline delimiter', + ], + [ + 'users:@@users()@@', + 'users users', + 'user1, user2', + 'users:user1user2', + [], + 'empty delimiter', + ], + [ + 'users:@@users.name@@', + 'users users', + 'user1, user2', + 'users:user1Name, user2Name', + [], + 'names substitution default delitmiter', + ], + [ + 'users:@@users(;).name@@', + 'users users', + 'user1, user2', + 'users:user1Name;user2Name', + [], + 'names substitution custom delitmiter', + ], + [ + 'users:@@users.mail@@', + 'users users', + 'user1, user2', + 'users:user1@example.com, user2@example.com', + [], + 'mail substitution default delitmiter', + ], + [ + "mails:@@users.mail@@\n\nnames:@@users(\n).name@@", + 'users users', + 'user1, user2', + "mails:user1@example.com, user2@example.com\n\nnames:user1Name\nuser2Name", + [], + 'multiple replacements', + ], + [ + 'users:@@users@@', + 'users users', + 'not_existing1, not_existing2', + 'users:not_existing1, not_existing2', + ['users'], + 'unknown users should cause errors', + ], + [ + 'users:@@users.unknown_attribute@@', + 'users users', + 'user1, user2', + 'users:@@users.unknown_attribute@@', + [], + 'non existant attribute is not replaced', + ], + [ + 'users:@@*]]@@', // the label must be something to break a regex when not properly quoted + 'users "*]]"', + 'user1, user2', + 'users:user1, user2', + [], + 'ensure label desn\'t break regex', + ], + [ + 'users:@@tHis Is UsEr@@', + 'users "tHis Is UsEr"', + 'user1, user2', + 'users:user1, user2', + [], + 'label with spaces and mixed case', + ], + ]; + } + + /** + * @dataProvider dataProvider + * + * @param string $templateSyntax + * @param string $formSyntax + * @param string $postedValue value of 'users' field + * @param string $expectedWikiText + * @param string $expectedValidationErrors + * @param string $msg + * + */ + public function test_field_users( + $templateSyntax, + $formSyntax, + $postedValue, + $expectedWikiText, + $expectedValidationErrors, + $msg + ) { + $actualValidationErrors = []; + + $actualWikiText = parent::send_form_action_template( + $formSyntax, + $templateSyntax, + $actualValidationErrors, + $postedValue + ); + + $this->assertEquals($expectedWikiText, $actualWikiText, $msg); + $this->assertEquals($expectedValidationErrors, $actualValidationErrors, $msg); + } +} diff --git a/platform/www/lib/plugins/bureaucracy/_test/field_yesno.test.php b/platform/www/lib/plugins/bureaucracy/_test/field_yesno.test.php new file mode 100644 index 0000000..26bd785 --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/_test/field_yesno.test.php @@ -0,0 +1,70 @@ +assertEquals($expectedWikiText, $actualWikiText, $msg); + $this->assertEquals($expectedValidationErrors, $actualValidationErrors, $msg); + } +} \ No newline at end of file diff --git a/platform/www/lib/plugins/bureaucracy/_test/general.test.php b/platform/www/lib/plugins/bureaucracy/_test/general.test.php new file mode 100644 index 0000000..0b3e0cf --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/_test/general.test.php @@ -0,0 +1,61 @@ +assertFileExists($file); + + $info = confToHash($file); + + $this->assertArrayHasKey('base', $info); + $this->assertArrayHasKey('author', $info); + $this->assertArrayHasKey('email', $info); + $this->assertArrayHasKey('date', $info); + $this->assertArrayHasKey('name', $info); + $this->assertArrayHasKey('desc', $info); + $this->assertArrayHasKey('url', $info); + + $this->assertEquals('bureaucracy', $info['base']); + $this->assertRegExp('/^https?:\/\//', $info['url']); + $this->assertTrue(mail_isvalid($info['email'])); + $this->assertRegExp('/^\d\d\d\d-\d\d-\d\d$/', $info['date']); + $this->assertTrue(false !== strtotime($info['date'])); + } + + /** + * Test to ensure that every conf['...'] entry in conf/default.php has a corresponding meta['...'] entry in + * conf/metadata.php. + */ + public function test_plugin_conf() { + $conf_file = __DIR__.'/../conf/default.php'; + if (file_exists($conf_file)){ + include($conf_file); + } + $meta_file = __DIR__.'/../conf/metadata.php'; + if (file_exists($meta_file)) { + include($meta_file); + } + + $this->assertEquals(gettype($conf), gettype($meta),'Both ' . DOKU_PLUGIN . 'bureaucracy/conf/default.php and ' . DOKU_PLUGIN . 'bureaucracy/conf/metadata.php have to exist and contain the same keys.'); + + if (gettype($conf) != 'NULL' && gettype($meta) != 'NULL') { + foreach($conf as $key => $value) { + $this->assertArrayHasKey($key, $meta, 'Key $meta[\'' . $key . '\'] missing in ' . DOKU_PLUGIN . 'bureaucracy/conf/metadata.php'); + } + + foreach($meta as $key => $value) { + $this->assertArrayHasKey($key, $conf, 'Key $conf[\'' . $key . '\'] missing in ' . DOKU_PLUGIN . 'bureaucracy/conf/default.php'); + } + } + + } +} diff --git a/platform/www/lib/plugins/bureaucracy/_test/input.txt b/platform/www/lib/plugins/bureaucracy/_test/input.txt new file mode 100644 index 0000000..6b395ed --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/_test/input.txt @@ -0,0 +1,38 @@ +
+action template userstpl users:%Y:@@What's your Name?@@:start + +Fieldset "A set of fields" +Textbox "Employee Name" "=Your Name" +number "Your Age" >13 <99 +email "Your E-Mail Address" +textbox "Occupation (optional)" ! +password "Some password" +file "File1" + +fieldset "HTML Checks bang" "bang" "bang" +textbox "HTML check 1 bang" "=bang" +password "HTML check 2 bang" "=bang" +textarea "HTML check 3 bang" "=bang" +static "HTML check 4 bang" +wiki "HTML check 5 bang" + +fieldset "even more fields" +select "Please select an option" "Peaches|Apples|Oranges" +static "Some static text that could be an agreement" +yesno "Read the agreement?" +textarea "Tell me about your self" +textbox "You need to write 'agree' here" /^agree$/ + +fieldset "Create Your User Page" +select "What's your Continent?" "Europe|N. America|S. America|Asia|Australia" +textbox "What's your Name?" +textarea "Enter a short bio" ! +yesno "Do have publication?" + +fieldset "Add your publications" "Do have publication?" +textarea "Publications:" +addpage users:publicationtemplate publications + +fieldset "Finish" +submit "Submit Query" +
\ No newline at end of file diff --git a/platform/www/lib/plugins/bureaucracy/_test/replace_functions.test.php b/platform/www/lib/plugins/bureaucracy/_test/replace_functions.test.php new file mode 100644 index 0000000..d4104de --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/_test/replace_functions.test.php @@ -0,0 +1,142 @@ +assertEquals($expectedWikiText, $actualWikiText, $msg); + } + $this->assertEquals($expectedValidationErrors, $actualValidationErrors, $msg); + } + + public function test_p_get_first_heading_function() { + //create page with heading + $wikitext = "====== Header 1 ======\n"; + $page = 'some:test:page'; + saveWikiText($page, $wikitext, 'summary'); + + $actualValidationErrors = []; + $actualWikiText = parent::send_form_action_template( + 'textbox page', + '@p_get_first_heading(@@page@@)@', + $actualValidationErrors, + $page + ); + + $this->assertEquals('Header 1', $actualWikiText); + } +} diff --git a/platform/www/lib/plugins/bureaucracy/_test/syntax.test.php b/platform/www/lib/plugins/bureaucracy/_test/syntax.test.php new file mode 100644 index 0000000..9b552e0 --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/_test/syntax.test.php @@ -0,0 +1,138 @@ +assertEquals(1, pq('form.bureaucracy__plugin', $doc)->length); + $this->assertEquals(6, pq('form.bureaucracy__plugin fieldset', $doc)->length); + + // standard input types + $this->checkField($doc, 'Employee Name', 'input[type=text][value=Your Name].edit', true); + $this->checkField($doc, 'Your Age', 'input[type=text].edit', true); + $this->checkField($doc, 'Your E-Mail Address', 'input[type=text].edit', true); + $this->checkField($doc, 'Occupation (optional)', 'input[type=text].edit'); + $this->checkField($doc, 'Some password', 'input[type=password].edit', true); + + // select field + $select = $this->checkField($doc, 'Please select an option', 'select'); + $this->assertEquals(3, pq('option', $select)->length); + $this->assertEquals(1, pq('option:selected', $select)->length); + $this->assertEquals('Peaches', pq('option:selected', $select)->val()); + + // static text + $this->assertEquals(1, pq('p:contains(Some static text)', $doc)->length); + + // checkbox + $cb = $this->checkField($doc, 'Read the agreement?', 'input[type=checkbox][value=1]'); + $this->assertEquals('1', pq('input[type=hidden][value=0]', $cb->parent())->length); + + // text area + $this->checkField($doc, 'Tell me about your self', 'textarea.edit', true); + + // file field + $this->checkField($doc, 'File1', 'input[type=file].edit', true); + + // submit button + $this->assertEquals(1, pq('button[type=submit]:contains(Submit Query)')->length); + + } + + public function test_HTMLinclusion() { + $input = file_get_contents(dirname(__FILE__) . '/input.txt'); + $xhtml = p_render('xhtml', p_get_instructions($input), $info); + + $doc = phpQuery::newDocument($xhtml); + + // HTML Check - there should be no bold tag anywhere + $this->assertEquals(0, pq('bold', $doc)->length); + } + + private function checkField($doc, $name, $check, $required=false) { + + $field = pq('form.bureaucracy__plugin label span:contains(' . $name . ')', $doc); + $this->assertEquals(1, $field->length, "find span of $name"); + + if($required){ + $this->assertEquals(1, pq('sup', $field)->length, "is mandatory of $name"); + } + + $label = $field->parent(); + $this->assertTrue($label->is('label'), "find label of $name"); + + $input = pq($check, $label); + $this->assertEquals(1, $input->length, "find check of $name"); + + return $input; + } + + public function test_parseline() { + $match = 'textbox label0 "Test with spaces" +textbox LabelWithoutSpaces +textbox Label Without Spaces +textbox "Label with spaces" "Text with a quote""in text" +textbox Label2 " " +textbox Label3 """" +textbox Label4 " """ " """ " """ +textbox Label5 """ " +textbox Label6 "" " " +textbox Label7 " "" " +textbox Label7 " "" + "" ss" +textbox Label8'; + + $expected = array( + array('textbox', 'label0', 'Test with spaces'), + array('textbox', 'LabelWithoutSpaces'), + array('textbox', 'Label', 'Without', 'Spaces'), + array('textbox', 'Label with spaces', 'Text with a quote"in text'), + array('textbox', 'Label2', ' '), + array('textbox', 'Label3', '"'), + array('textbox', 'Label4', ' "', ' "', ' "'), + array('textbox', 'Label5', '" '), + array('textbox', 'Label6', '', ' '), + array('textbox', 'Label7', ' " '), + array('textbox', 'Label7', ' " + " ss'), + array('textbox', 'Label8') + ); + + $lines = explode("\n", $match); + $i = 0; + while(count($lines) > 0) { + $line = trim(array_shift($lines)); + + $syntaxcomponent = new syntax_plugin_bureaucracy(); + $actual = $this->callNonaccessibleMethod($syntaxcomponent, '_parse_line', array($line, &$lines)); + + $this->assertEquals($expected[$i], $actual); + $i++; + } + + } + + /** + * Test not accessible methods.. + * + * @param string|object $obj + * @param string $name + * @param array $args + * @return mixed + */ + protected function callNonaccessibleMethod($obj, $name, array $args) { + $class = new ReflectionClass($obj); + $method = $class->getMethod($name); + $method->setAccessible(true); + return $method->invokeArgs($obj, $args); + } + +} diff --git a/platform/www/lib/plugins/bureaucracy/action.php b/platform/www/lib/plugins/bureaucracy/action.php new file mode 100644 index 0000000..a4a7a4e --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/action.php @@ -0,0 +1,60 @@ + + * @author Adrian Lang + */ +// must be run within Dokuwiki +if (!defined('DOKU_INC')) die(); + +/** + * Class action_plugin_bureaucracy + */ +class action_plugin_bureaucracy extends DokuWiki_Action_Plugin { + + /** + * Registers a callback function for a given event + */ + public function register(Doku_Event_Handler $controller) { + $controller->register_hook('AJAX_CALL_UNKNOWN', 'BEFORE', $this, 'ajax'); + } + + /** + * @param Doku_Event$event + * @param $param + */ + public function ajax(Doku_Event $event, $param) { + if ($event->data !== 'bureaucracy_user_field') { + return; + } + $event->stopPropagation(); + $event->preventDefault(); + + $search = $_REQUEST['search']; + + /** @var DokuWiki_Auth_Plugin $auth */ + global $auth; + $users = array(); + foreach($auth->retrieveUsers() as $username => $data) { + if ($search === '' || // No search + stripos($username, $search) === 0 || // Username (prefix) + stripos($data['name'], $search) !== false) { // Full name + $users[$username] = $data['name']; + } + if (count($users) === 10) { + break; + } + } + + if (count($users) === 1 && key($users) === $search) { + $users = array(); + } + + echo json_encode($users); + } +} diff --git a/platform/www/lib/plugins/bureaucracy/conf/default.php b/platform/www/lib/plugins/bureaucracy/conf/default.php new file mode 100644 index 0000000..ed0463f --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/conf/default.php @@ -0,0 +1,4 @@ + + */ +class helper_plugin_bureaucracy_action extends syntax_plugin_bureaucracy { + + /** + * Return false to prevent DokuWiki reusing instances of the plugin + * + * @return bool + */ + public function isSingleton() { + return false; + } + + /** + * Handle the user input [required] + * + * This function needs to be implemented to accept the user data collected + * from the form. Data has to be grabbed from $_POST['bureaucracy'] using + * the indicies in the 'idx' members of the $data items. + * + * @param helper_plugin_bureaucracy_field[] $fields the list of fields in the form + * @param string $thanks the thank you message as defined in the form + * or default one. Might be modified by the action + * before returned + * @param array $argv additional arguments passed to the action + * @return bool|string false on error, $thanks on success + */ + public function run($fields, $thanks, $argv){ + msg('ERROR: called action %s did not implement a run() function'); + return false; + } + + /** + * Adds some language related replacement patterns + */ + function prepareLanguagePlaceholder() { + global $ID; + global $conf; + + $this->patterns['__lang__'] = '/@LANG@/'; + $this->values['__lang__'] = $conf['lang']; + + $this->patterns['__trans__'] = '/@TRANS@/'; + $this->values['__trans__'] = ''; + + /** @var helper_plugin_translation $trans */ + $trans = plugin_load('helper', 'translation'); + if (!$trans) return; + + $this->values['__trans__'] = $trans->getLangPart($ID); + $this->values['__lang__'] = $trans->realLC(''); + } + + /** + * Adds replacement pattern for fieldlabels (e.g @@Label@@) + * + * @param helper_plugin_bureaucracy_field $field + */ + function prepareFieldReplacement($field) { + $label = $field->getParam('label'); + + if(!is_null($label)) { + $this->patterns[$label] = $field->getReplacementPattern(); + $this->values[$label] = $field->getReplacementValue(); + } + } + + /** + * Adds to replacement patterns + */ + function prepareNoincludeReplacement() { + $this->patterns['__noinclude__'] = '/(.*?)<\/noinclude>/is'; + $this->values['__noinclude__'] = ''; + } + + /** + * Generate field replacements + * + * @param helper_plugin_bureaucracy_field[] $fields List of field objects + * @return array + */ + function prepareFieldReplacements($fields) { + foreach ($fields as $field) { + //field replacements + $this->prepareFieldReplacement($field); + } + } + + /** + * Returns ACL access level of the user or the (virtual) 'runas' user + * + * @param string $id pageid + * @return int + */ + protected function aclcheck($id) { + $runas = $this->getConf('runas'); + + if($runas) { + $auth = auth_aclcheck($id, $runas, array()); + } else { + $auth = auth_quickaclcheck($id); + } + return $auth; + + } + + /** + * Available methods + * + * @return array + */ + public function getMethods() { + $result = array(); + $result[] = array( + 'name' => 'run', + 'desc' => 'Handle the user input', + 'params' => array( + 'fields' => 'helper_plugin_bureaucracy_field[]', + 'thanks' => 'string', + 'argv' => 'array' + ), + 'return' => array('false on error, thanks message on success' => 'bool|string') + ); + return $result; + } + +} diff --git a/platform/www/lib/plugins/bureaucracy/helper/actionmail.php b/platform/www/lib/plugins/bureaucracy/helper/actionmail.php new file mode 100644 index 0000000..698e6c0 --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/helper/actionmail.php @@ -0,0 +1,212 @@ +prepareNamespacetemplateReplacements(); + $this->prepareDateTimereplacements(); + $this->prepareLanguagePlaceholder(); + $this->prepareNoincludeReplacement(); + $this->prepareFieldReplacements($fields); + + $evdata = [ + 'fields' => $fields, + 'values' => &$this->values + ]; + $event = new Doku_Event('PLUGIN_BUREAUCRACY_EMAIL_SEND', $evdata); + if($event->advise_before()) { + //set default subject + $this->subject = sprintf($this->getLang('mailsubject'), $ID); + + //build html&text table, collect replyto and subject + list($table_html, $table_text) = $this->processFieldsBuildTable($fields, $mail); + + //Body + if($this->mailtemplate) { + //show template + $this->patterns['__tablehtml__'] = '/@TABLEHTML@/'; + $this->patterns['__tabletext__'] = '/@TABLETEXT@/'; + $this->values['__tablehtml__'] = $table_html; + $this->values['__tabletext__'] = $table_text; + + list($this->_mail_html, $this->_mail_text) = $this->getContent(); + + } else { + //show simpel listing + $this->_mail_html .= sprintf($this->getLang('mailintro')."

", dformat()); + $this->_mail_html .= $table_html; + + $this->_mail_text .= sprintf($this->getLang('mailintro')."\n\n", dformat()); + $this->_mail_text .= $table_text; + } + $mail->setBody($this->_mail_text,null,null,$this->_mail_html); + + // Reply-to + if(!empty($this->replyto)) { + $replyto = $mail->cleanAddress($this->replyto); + $mail->setHeader('Reply-To', $replyto, false); + } + + // To + $to = $this->replace(implode(',',$argv)); // get recipient address(es) + $to = $mail->cleanAddress($to); + $mail->to($to); + + // From + $mail->from($conf['mailfrom']); + + // Subject + $this->subject = $this->replace($this->subject); + $mail->subject($this->subject); + + if(!$mail->send()) { + throw new Exception($this->getLang('e_mail')); + } + } + $event->advise_after(); + + return '

' . $thanks . '

'; + } + + /** + * Create html and plain table of the field + * and collect values for subject and replyto + * + * @param helper_plugin_bureaucracy_field[] $fields + * @param Mailer $mail + * @return array of html and text table + */ + protected function processFieldsBuildTable($fields, $mail) { + global $ID; + + $table_html = ''; + $table_text = ''; + + foreach($fields as $field) { + $html = $text = ''; + $value = $field->getParam('value'); + $label = $field->getParam('label'); + + switch($field->getFieldType()) { + case 'fieldset': + if(!empty($field->depends_on)) { + //print fieldset only if depend condition is true + foreach($fields as $field_tmp) { + if($field_tmp->getParam('label') === $field->depends_on[0] && $field_tmp->getParam('value') === $field->depends_on[1] ) { + list($html, $text) = $this->mail_buildRow($label); + } + } + } else { + list($html, $text) = $this->mail_buildRow($label); + } + break; + case 'file': + if($value === null || $label === null) break; //print attachment only if field was visible + $file = $field->getParam('file'); + if(!$file['size']) { + $message = $this->getLang('attachmentMailEmpty'); + } else if($file['size'] > $this->getConf('maxEmailAttachmentSize')) { + $message = $file['name'] . ' ' . $this->getLang('attachmentMailToLarge'); + msg(sprintf($this->getLang('attachmentMailToLarge_userinfo'), hsc($file['name']), filesize_h($this->getConf('maxEmailAttachmentSize'))), 2); + } else { + $message = $file['name']; + $mail->attachFile($file['tmp_name'], $file['type'], $file['name']); + } + list($html, $text) = $this->mail_buildRow($label, $message); + break; + case 'subject': + $this->subject = $label; + break; + case 'usemailtemplate': + if (!is_null($field->getParam('template')) ) { + $this->mailtemplate = $this->replace($field->getParam('template')); + resolve_pageid(getNS($ID), $this->mailtemplate, $ignored); + } + break; + + default: + if($value === null || $label === null) break; + if(is_array($value)) $value = implode(', ', $value); + list($html, $text) = $this->mail_buildRow($label, $value); + + if(!is_null($field->getParam('replyto'))) { + $this->replyto[] = $value; + } + } + $table_html .= $html; + $table_text .= $text; + } + $table_html .= '
'; + + return array($table_html, $table_text); + } + + /** + * Build a row + * + * @param $column1 + * @param null $column2 + * @return array of html and text row + */ + protected function mail_buildRow($column1,$column2=null) { + if($column2 === null) { + $html = ''.hsc($column1).''; + $text = "\n=====".$column1.'====='; + } else { + $html = ''.hsc($column1).''.hsc($column2).''; + $text = "\n $column1 \t\t $column2"; + } + return array($html, $text); + } + + /** + * Parse mail template in html and text, and perform replacements + * + * @return array html and text content + */ + protected function getContent() { + $content = rawWiki($this->mailtemplate); + $html = ''; + $text = ''; + + if(preg_match_all('#(.*?)#is', $content, $matches)) { + foreach($matches[1] as $index => $codeoptions) { + list($syntax,) = explode(' ', trim($codeoptions), 2); + if($syntax == 'html') { + $html = $matches[2][$index]; + } + if($syntax == 'text' || $syntax == '') { + $text = $matches[2][$index]; + } + } + } + return array( + $this->replace($html), + $this->replace($text) + ); + } +} +// vim:ts=4:sw=4:et:enc=utf-8: diff --git a/platform/www/lib/plugins/bureaucracy/helper/actionscript.php b/platform/www/lib/plugins/bureaucracy/helper/actionscript.php new file mode 100644 index 0000000..f308721 --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/helper/actionscript.php @@ -0,0 +1,62 @@ +validateScriptName($scriptName)) { + $cleanedScriptName = hsc($scriptName); + throw new InvalidArgumentException("The supplied scriptname \"$cleanedScriptName\" is invalid! It must conform to {hsc($this->scriptNamePattern)}!"); + } + + $path = DOKU_CONF . 'plugin/bureaucracy/' . $scriptName; + + if (!file_exists($path)) { + $shortPath = 'conf/plugin/bureaucracy/' . $scriptName; + throw new InvalidArgumentException("Script $shortPath doesn't exist!"); + } + + require $path; + + $classFragment = substr($scriptName, 0, strpos($scriptName, '.')); + $className = 'helper_plugin_bureaucracy_handler_' . $classFragment; + + $deprecatedClassName = 'bureaucracy_handler_' . $classFragment; + if (!class_exists($className) && class_exists($deprecatedClassName)) { + msg("Please change this script's class-name to $className. +Your current scheme $deprecatedClassName is deprecated and will stop working in the future.", 2); + $className = $deprecatedClassName; + } + + /** @var dokuwiki\plugin\bureaucracy\interfaces\bureaucracy_handler_interface $handler */ + $handler = new $className; + + if (!is_a($handler, dokuwiki\plugin\bureaucracy\interfaces\bureaucracy_handler_interface::class)) { + throw new InvalidArgumentException('The handler must implement the interface dokuwiki\\plugin\\bureaucracy\\interfaces\\bureaucracy_handler_interface !'); + } + + return $handler->handleData($fields, $thanks); + } + + /** + * @param $scriptName + * + * @return bool + */ + protected function validateScriptName($scriptName) { + $valid = preg_match($this->scriptNamePattern, $scriptName); + return $valid === 1; + } + +} diff --git a/platform/www/lib/plugins/bureaucracy/helper/actiontemplate.php b/platform/www/lib/plugins/bureaucracy/helper/actiontemplate.php new file mode 100644 index 0000000..04714d8 --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/helper/actiontemplate.php @@ -0,0 +1,459 @@ + + */ + +class helper_plugin_bureaucracy_actiontemplate extends helper_plugin_bureaucracy_action { + + var $targetpages; + var $pagename; + + /** + * Performs template action + * + * @param helper_plugin_bureaucracy_field[] $fields array with form fields + * @param string $thanks thanks message + * @param array $argv array with entries: template, pagename, separator + * @return array|mixed + * + * @throws Exception + */ + public function run($fields, $thanks, $argv) { + global $conf; + + [$tpl, $this->pagename] = $argv; + $sep = $argv[2] ?? $conf['sepchar']; + + $this->patterns = array(); + $this->values = array(); + $this->targetpages = array(); + + $this->prepareNamespacetemplateReplacements(); + $this->prepareDateTimereplacements(); + $this->prepareLanguagePlaceholder(); + $this->prepareNoincludeReplacement(); + $this->prepareFieldReplacements($fields); + + $evdata = array( + 'patterns' => &$this->patterns, + 'values' => &$this->values, + 'fields' => $fields, + 'action' => $this + ); + + $event = new Doku_Event('PLUGIN_BUREAUCRACY_PAGENAME', $evdata); + if ($event->advise_before()) { + $this->buildTargetPagename($fields, $sep); + } + $event->advise_after(); + + //target&template(s) from addpage fields + $this->getAdditionalTargetpages($fields); + //target&template(s) from action field + $tpl = $this->getActionTargetpages($tpl); + + if(empty($this->targetpages)) { + throw new Exception(sprintf($this->getLang('e_template'), $tpl)); + } + + $this->checkTargetPageNames(); + + $this->processUploads($fields); + $this->replaceAndSavePages($fields); + + $ret = $this->buildThankYouPage($thanks); + + return $ret; + } + + /** + * Prepare and resolve target page + * + * @param helper_plugin_bureaucracy_field[] $fields List of field objects + * @param string $sep Separator between fields for page id + * @throws Exception missing pagename + */ + protected function buildTargetPagename($fields, $sep) { + global $ID; + + foreach ($fields as $field) { + $pname = $field->getParam('pagename'); + if (!is_null($pname)) { + if (is_array($pname)) $pname = implode($sep, $pname); + $this->pagename .= $sep . $pname; + } + } + + $this->pagename = $this->replace($this->pagename); + + $myns = getNS($ID); + resolve_pageid($myns, $this->pagename, $ignored); // resolve relatives + + if ($this->pagename === '') { + throw new Exception($this->getLang('e_pagename')); + } + } + + /** + * Handle templates from addpage field + * + * @param helper_plugin_bureaucracy_field[] $fields List of field objects + * @return array + */ + function getAdditionalTargetpages($fields) { + global $ID; + $ns = getNS($ID); + + foreach ($fields as $field) { + if (!is_null($field->getParam('page_tpl')) && !is_null($field->getParam('page_tgt')) ) { + //template + $templatepage = $this->replace($field->getParam('page_tpl')); + resolve_pageid(getNS($ID), $templatepage, $ignored); + + //target + $relativetargetpage = $field->getParam('page_tgt'); + resolve_pageid($ns, $relativeTargetPageid, $ignored); + $targetpage = "$this->pagename:$relativetargetpage"; + + $auth = $this->aclcheck($templatepage); // runas + if ($auth >= AUTH_READ ) { + $this->addParsedTargetpage($targetpage, $templatepage); + } + } + } + } + + /** + * Returns raw pagetemplate contents for the ID's namespace + * + * @param string $id the id of the page to be created + * @return string raw pagetemplate content + */ + protected function rawPageTemplate($id) { + global $conf; + + $path = dirname(wikiFN($id)); + if(file_exists($path.'/_template.txt')) { + $tplfile = $path.'/_template.txt'; + } else { + // search upper namespaces for templates + $len = strlen(rtrim($conf['datadir'], '/')); + while(strlen($path) >= $len) { + if(file_exists($path.'/__template.txt')) { + $tplfile = $path.'/__template.txt'; + break; + } + $path = substr($path, 0, strrpos($path, '/')); + } + } + + $tpl = io_readFile($tplfile); + return $tpl; + } + + /** + * Load template(s) for targetpage as given via action field + * + * @param string $tpl template name as given in form + * @return string parsed templatename + */ + protected function getActionTargetpages($tpl) { + global $USERINFO; + global $conf; + global $ID; + $runas = $this->getConf('runas'); + + if ($tpl == '_') { + // use namespace template + if (!isset($this->targetpages[$this->pagename])) { + $raw = $this->rawPageTemplate($this->pagename); + $this->noreplace_save($raw); + $this->targetpages[$this->pagename] = pageTemplate(array($this->pagename)); + } + } elseif ($tpl !== '!') { + $tpl = $this->replace($tpl); + + // resolve templates, but keep references to whole namespaces intact (ending in a colon) + if(substr($tpl, -1) == ':') { + $tpl = $tpl.'xxx'; // append a fake page name + resolve_pageid(getNS($ID), $tpl, $ignored); + $tpl = substr($tpl, 0, -3); // cut off fake page name again + } else { + resolve_pageid(getNS($ID), $tpl, $ignored); + } + + $backup = array(); + if ($runas) { + // Hack user credentials. + $backup = array($_SERVER['REMOTE_USER'], $USERINFO['grps']); + $_SERVER['REMOTE_USER'] = $runas; + $USERINFO['grps'] = array(); + } + + $template_pages = array(); + //search checks acl (as runas) + $opts = array( + 'depth' => 0, + 'listfiles' => true, + 'showhidden' => true + ); + search($template_pages, $conf['datadir'], 'search_universal', $opts, str_replace(':', '/', getNS($tpl))); + + foreach ($template_pages as $template_page) { + $templatepageid = cleanID($template_page['id']); + // try to replace $tpl path with $this->pagename path in the founded $templatepageid + // - a single-page template will only match on itself and will be replaced, + // other newtargets are pages in same namespace, so aren't changed + // - a namespace as template will match at the namespaces-part of the path of pages in this namespace + // so these newtargets are changed + // if there exist a single-page and a namespace with name $tpl, both are selected + $newTargetpageid = preg_replace('/^' . preg_quote_cb(cleanID($tpl)) . '($|:)/', $this->pagename . '$1', $templatepageid); + + if ($newTargetpageid === $templatepageid) { + // only a single-page template or page in the namespace template + // which matches the $tpl path are changed + continue; + } + + if (!isset($this->targetpages[$newTargetpageid])) { + $this->addParsedTargetpage($newTargetpageid, $templatepageid); + } + } + + if ($runas) { + /* Restore user credentials. */ + list($_SERVER['REMOTE_USER'], $USERINFO['grps']) = $backup; + } + } + return $tpl; + } + + /** + * Checks for existance and access of target pages + * + * @return mixed + * @throws Exception + */ + protected function checkTargetPageNames() { + foreach (array_keys($this->targetpages) as $pname) { + // prevent overriding already existing pages + if (page_exists($pname)) { + throw new Exception(sprintf($this->getLang('e_pageexists'), html_wikilink($pname))); + } + + $auth = $this->aclcheck($pname); + if ($auth < AUTH_CREATE) { + throw new Exception($this->getLang('e_denied')); + } + } + } + + /** + * Perform replacements on the collected templates, and save the pages. + * + * Note: wrt runas, for changelog are used: + * - $INFO['userinfo']['name'] + * - $INPUT->server->str('REMOTE_USER') + */ + protected function replaceAndSavePages($fields) { + global $ID; + foreach ($this->targetpages as $pageName => $template) { + // set NSBASE var to make certain dataplugin constructs easier + $this->patterns['__nsbase__'] = '/@NSBASE@/'; + $this->values['__nsbase__'] = noNS(getNS($pageName)); + + $evdata = array( + 'patterns' => &$this->patterns, + 'values' => &$this->values, + 'id' => $pageName, + 'template' => $template, + 'form' => $ID, + 'fields' => $fields + ); + + $event = new Doku_Event('PLUGIN_BUREAUCRACY_TEMPLATE_SAVE', $evdata); + if($event->advise_before()) { + // save page + saveWikiText( + $evdata['id'], + cleanText($this->replace($evdata['template'], false)), + sprintf($this->getLang('summary'), $ID) + ); + } + $event->advise_after(); + } + } + + /** + * (Callback) Sorts first by namespace depth, next by page ids + * + * @param string $a + * @param string $b + * @return int positive if $b is in deeper namespace than $a, negative higher. + * further sorted by pageids + * + * return an integer less than, equal to, or + * greater than zero if the first argument is considered to be + * respectively less than, equal to, or greater than the second. + */ + public function _sorttargetpages($a, $b) { + $ns_diff = substr_count($a, ':') - substr_count($b, ':'); + return ($ns_diff === 0) ? strcmp($a, $b) : ($ns_diff > 0 ? -1 : 1); + } + + /** + * (Callback) Build content of item + * + * @param array $item + * @return string + */ + public function html_list_index($item){ + $ret = ''; + if($item['type']=='f'){ + $ret .= html_wikilink(':'.$item['id']); + } else { + $ret .= '' . trim(substr($item['id'], strrpos($item['id'], ':', -2)), ':') . ''; + } + return $ret; + } + + /** + * Build thanks message, trigger indexing and rendering of new pages. + * + * @param string $thanks + * @return string html of thanks message or when redirect the first page id of created pages + */ + protected function buildThankYouPage($thanks) { + global $ID; + $backupID = $ID; + + $html = "

$thanks

"; + + // Build result tree + $pages = array_keys($this->targetpages); + usort($pages, array($this, '_sorttargetpages')); + + $data = array(); + $last_folder = array(); + foreach ($pages as $ID) { + $lvl = substr_count($ID, ':'); + for ($n = 0; $n < $lvl; ++$n) { + if (!isset($last_folder[$n]) || strpos($ID, $last_folder[$n]['id']) !== 0) { + $last_folder[$n] = array( + 'id' => substr($ID, 0, strpos($ID, ':', ($n > 0 ? strlen($last_folder[$n - 1]['id']) : 0) + 1) + 1), + 'level' => $n + 1, + 'open' => 1 + ); + $data[] = $last_folder[$n]; + } + } + $data[] = array('id' => $ID, 'level' => 1 + substr_count($ID, ':'), 'type' => 'f'); + } + $html .= html_buildlist($data, 'idx', array($this, 'html_list_index'), 'html_li_index'); + + // Add indexer bugs for every just-created page + $html .= '
'; + ob_start(); + foreach ($pages as $ID) { + // indexerWebBug uses ID and INFO[exists], but the bureaucracy form + // page always exists, as does the just-saved page, so INFO[exists] + // is correct in any case + tpl_indexerWebBug(); + + // the iframe will trigger real rendering of the pages to make sure + // any used plugins are initialized (eg. the do plugin) + echo ''; + } + $html .= ob_get_contents(); + ob_end_clean(); + $html .= '
'; + + $ID = $backupID; + return $html; + } + + /** + * move the uploaded files to :FILENAME + * + * + * @param helper_plugin_bureaucracy_field[] $fields + * @throws Exception + */ + protected function processUploads($fields) { + foreach($fields as $field) { + + if($field->getFieldType() !== 'file') continue; + + $label = $field->getParam('label'); + $file = $field->getParam('file'); + $ns = $field->getParam('namespace'); + + //skip empty files + if(!$file['size']) { + $this->values[$label] = ''; + continue; + } + + $id = $ns.':'.$file['name']; + resolve_mediaid($this->pagename, $id, $ignored); // resolve relatives + + $auth = $this->aclcheck($id); // runas + $move = 'copy_uploaded_file'; + //prevent from is_uploaded_file() check + if(defined('DOKU_UNITTEST')) { + $move = 'copy'; + } + $res = media_save( + array('name' => $file['tmp_name']), + $id, + false, + $auth, + $move); + + if(is_array($res)) throw new Exception($res[0]); + + $this->values[$label] = $res; + + } + } + + /** + * Load page data and do default pattern replacements like namespace templates do + * and add it to list of targetpages + * + * Note: for runas the values of the real user are used for the placeholders + * @NAME@ => $USERINFO['name'] + * @MAIL@ => $USERINFO['mail'] + * and the replaced value: + * @USER@ => $INPUT->server->str('REMOTE_USER') + * + * @param string $targetpageid pageid of destination + * @param string $templatepageid pageid of template for this targetpage + */ + protected function addParsedTargetpage($targetpageid, $templatepageid) { + $tpl = rawWiki($templatepageid); + $this->noreplace_save($tpl); + + $data = array( + 'id' => $targetpageid, + 'tpl' => $tpl, + 'doreplace' => true, + ); + parsePageTemplate($data); + + //collect and apply some other replacements + $patterns = array(); + $values = array(); + $keys = array('__lang__', '__trans__', '__year__', '__month__', '__day__', '__time__'); + foreach($keys as $key) { + $patterns[$key] = $this->patterns[$key]; + $values[$key] = $this->values[$key]; + } + + $this->targetpages[$targetpageid] = preg_replace($patterns, $values, $data['tpl']); + } + +} +// vim:ts=4:sw=4:et:enc=utf-8: diff --git a/platform/www/lib/plugins/bureaucracy/helper/field.php b/platform/www/lib/plugins/bureaucracy/helper/field.php new file mode 100644 index 0000000..070e331 --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/helper/field.php @@ -0,0 +1,508 @@ + + **/ + +/** + * Class helper_plugin_bureaucracy_field + * + * base class for all the form fields + */ +class helper_plugin_bureaucracy_field extends syntax_plugin_bureaucracy { + + protected $mandatory_args = 2; + public $opt = array(); + /** @var string|array */ + protected $tpl; + protected $checks = array(); + public $hidden = false; + protected $error = false; + protected $checktypes = array( + '/' => 'match', + '<' => 'max', + '>' => 'min' + ); + + /** + * Construct a helper_plugin_bureaucracy_field object + * + * This constructor initializes a helper_plugin_bureaucracy_field object + * based on a given definition. + * + * The first two items represent: + * * the type of the field + * * and the label the field has been given. + * Additional arguments are type-specific mandatory extra arguments and optional arguments. + * + * The optional arguments may add constraints to the field value, provide a + * default value, mark the field as optional or define that the field is + * part of a pagename (when using the template action). + * + * Since the field objects are cached, this constructor may not reference + * request data. + * + * @param array $args The tokenized definition, only split at spaces + */ + public function initialize($args) { + $this->init($args); + $this->standardArgs($args); + } + + /** + * Return false to prevent DokuWiki reusing instances of the plugin + * + * @return bool + */ + public function isSingleton() { + return false; + } + + /** + * Checks number of arguments and store 'cmd', 'label' and 'display' values + * + * @param array $args array with the definition + */ + protected function init(&$args) { + if(count($args) < $this->mandatory_args){ + msg(sprintf($this->getLang('e_missingargs'), hsc($args[0]), + hsc($args[1])), -1); + return; + } + + // get standard arguments + $this->opt = array(); + foreach (array('cmd', 'label') as $key) { + if (count($args) === 0) break; + $this->opt[$key] = array_shift($args); + } + $this->opt['display'] = $this->opt['label']; // allow to modify display value independently + } + + /** + * Check for additional arguments and store their values + * + * @param array $args array with remaining definition arguments + */ + protected function standardArgs($args) { + // parse additional arguments + foreach($args as $arg){ + if ($arg[0] == '=') { + $this->setVal(substr($arg,1)); + } elseif ($arg == '!') { + $this->opt['optional'] = true; + } elseif ($arg == '^') { + //only one field has focus + if (helper_plugin_bureaucracy_field::hasFocus()) { + $this->opt['id'] = 'focus__this'; + } + } elseif($arg == '@') { + $this->opt['pagename'] = true; + } elseif($arg == '@@') { + $this->opt['replyto'] = true; + } elseif(preg_match('/x\d/', $arg)) { + $this->opt['rows'] = substr($arg,1); + } elseif($arg[0] == '.') { + $this->opt['class'] = substr($arg, 1); + } elseif(preg_match('/^0{2,}$/', $arg)) { + $this->opt['leadingzeros'] = strlen($arg); + } elseif($arg[0].$arg[1] == '**') { + $this->opt['matchexplanation'] = substr($arg,2); + } else { + $t = $arg[0]; + $d = substr($arg,1); + if (in_array($t, array('>', '<')) && !is_numeric($d)) { + break; + } + if ($t == '/') { + if (substr($d, -1) !== '/') { + break; + } + $d = substr($d, 0, -1); + } + if (!isset($this->checktypes[$t]) || !method_exists($this, 'validate_' . $this->checktypes[$t])) { + msg(sprintf($this->getLang('e_unknownconstraint'), hsc($t).' ('.hsc($arg).')'), -1); + return; + } + $this->checks[] = array('t' => $t, 'd' => $d); + } + } + } + + /** + * Add parsed element to Form which generates XHTML + * + * Outputs the represented field using the passed Doku_Form object. + * Additional parameters (CSS class & HTML name) are passed in $params. + * HTML output is created by passing the template $this->tpl to the simple + * template engine _parse_tpl. + * + * @param array $params Additional HTML specific parameters + * @param Doku_Form $form The target Doku_Form object + * @param int $formid unique identifier of the form which contains this field + */ + public function renderfield($params, Doku_Form $form, $formid) { + $this->_handlePreload(); + if(!$form->_infieldset){ + $form->startFieldset(''); + } + if ($this->error) { + $params['class'] = 'bureaucracy_error'; + } + + $params = array_merge($this->opt, $params); + $form->addElement($this->_parse_tpl($this->tpl, $params)); + } + + /** + * Only the first use get the focus, next calls not + * + * @return bool + */ + protected static function hasFocus(){ + static $focus = true; + if($focus) { + $focus = false; + return true; + } else { + return false; + } + } + + + /** + * Check for preload value in the request url + */ + protected function _handlePreload() { + $preload_name = '@' . strtr($this->getParam('label'),' .','__') . '@'; + if (isset($_GET[$preload_name])) { + $this->setVal($_GET[$preload_name]); + } + } + + /** + * Handle a post to the field + * + * Accepts and validates a posted value. + * + * (Overridden by fieldset, which has as argument an array with the form array by reference) + * + * @param string $value The passed value or array or null if none given + * @param helper_plugin_bureaucracy_field[] $fields (reference) form fields (POST handled upto $this field) + * @param int $index index number of field in form + * @param int $formid unique identifier of the form which contains this field + * @return bool Whether the passed value is valid + */ + public function handle_post($value, &$fields, $index, $formid) { + return $this->hidden || $this->setVal($value); + } + + /** + * Get the field type + * + * @return string + **/ + public function getFieldType() { + return $this->opt['cmd']; + } + + /** + * Get the replacement pattern used by action + * + * @return string + */ + public function getReplacementPattern() { + $label = $this->getParam('label'); + $value = $this->getParam('value'); + + if (is_array($value)) { + return '/(@@|##)' . preg_quote($label, '/') . + '(?:\((?P.*?)\))?' .//delimiter + '(?:\|(?P.*?))' . (count($value) == 0 ? '' : '?') . + '\1/si'; + } + + return '/(@@|##)' . preg_quote($label, '/') . + '(?:\|(.*?))' . (is_null($value) ? '' : '?') . + '\1/si'; + } + + /** + * Used as an callback for preg_replace_callback + * + * @param $matches + * @return string + */ + public function replacementMultiValueCallback($matches) { + $value = $this->opt['value']; + + //default value + if (is_null($value) || $value === false) { + if (isset($matches['default']) && $matches['default'] != '') { + return $matches['default']; + } + return $matches[0]; + } + + //check if matched string containts a pair of brackets + $delimiter = preg_match('/\(.*\)/s', $matches[0]) ? $matches['delimiter'] : ', '; + + return implode($delimiter, $value); + } + + /** + * Get the value used by action + * If value is a callback preg_replace_callback is called instead preg_replace + * + * @return mixed|string + */ + public function getReplacementValue() { + $value = $this->getParam('value'); + + if (is_array($value)) { + return array($this, 'replacementMultiValueCallback'); + } + + return is_null($value) || $value === false ? '$2' : $value; + } + + /** + * Validate value and stores it + * + * @param mixed $value value entered into field + * @return bool whether the passed value is valid + */ + protected function setVal($value) { + if ($value === '') { + $value = null; + } + $this->opt['value'] = $value; + try { + $this->_validate(); + $this->error = false; + } catch (Exception $e) { + msg($e->getMessage(), -1); + $this->error = true; + } + return !$this->error; + } + + /** + * Whether the field is true (used for depending fieldsets) + * + * @return bool whether field is set + */ + public function isSet_() { + return !is_null($this->getParam('value')); + } + + /** + * Validate value of field and throws exceptions for bad values. + * + * @throws Exception when field didn't validate. + */ + protected function _validate() { + $value = $this->getParam('value'); + if (is_null($value)) { + if(!isset($this->opt['optional'])) { + throw new Exception(sprintf($this->getLang('e_required'),hsc($this->opt['label']))); + } + return; + } + + foreach ($this->checks as $check) { + $checktype = $this->checktypes[$check['t']]; + if (!call_user_func(array($this, 'validate_' . $checktype), $check['d'], $value)) { + //replacement is custom explanation or just the regexp or the requested value + if(isset($this->opt['matchexplanation'])) { + $replacement = hsc($this->opt['matchexplanation']); + } elseif($checktype == 'match') { + $replacement = sprintf($this->getLang('checkagainst'), hsc($check['d'])); + } else { + $replacement = hsc($check['d']); + } + + throw new Exception(sprintf($this->getLang('e_' . $checktype), hsc($this->opt['label']), $replacement)); + } + } + } + + /** + * Get an arbitrary parameter + * + * @param string $name + * @return mixed|null + */ + public function getParam($name) { + if (!isset($this->opt[$name]) || $name === 'value' && $this->hidden) { + return null; + } + if ($name === 'pagename') { + // If $this->opt['pagename'] is set, return the escaped value of the field. + $value = $this->getParam('value'); + if (is_null($value)) { + return null; + } + global $conf; + if($conf['useslash']) $value = str_replace('/',' ',$value); + return str_replace(':',' ',$value); + } + return $this->opt[$name]; + } + + /** + * Parse a template with given parameters + * + * Replaces variables specified like @@VARNAME|default@@ using the passed + * value map. + * + * @param string|array $tpl The template as string or array + * @param array $params A hash mapping parameters to values + * + * @return string|array The parsed template + */ + protected function _parse_tpl($tpl, $params) { + // addElement supports a special array format as well. In this case + // not all elements should be escaped. + $is_simple = !is_array($tpl); + if ($is_simple) $tpl = array($tpl); + + foreach ($tpl as &$val) { + // Select box passes options as an array. We do not escape those. + if (is_array($val)) continue; + + // find all variables and their defaults or param values + preg_match_all('/@@([A-Z]+)(?:\|((?:[^@]|@$|@[^@])*))?@@/', $val, $pregs); + for ($i = 0 ; $i < count($pregs[2]) ; ++$i) { + if (isset($params[strtolower($pregs[1][$i])])) { + $pregs[2][$i] = $params[strtolower($pregs[1][$i])]; + } + } + // we now have placeholders in $pregs[0] and their values in $pregs[2] + $replacements = array(); // check if empty to prevent php 5.3 warning + if (!empty($pregs[0])) { + $replacements = array_combine($pregs[0], $pregs[2]); + } + + if($is_simple){ + // for simple string templates, we escape all replacements + $replacements = array_map('hsc', $replacements); + }else{ + // for the array ones, we escape the label and display only + if(isset($replacements['@@LABEL@@'])) $replacements['@@LABEL@@'] = hsc($replacements['@@LABEL@@']); + if(isset($replacements['@@DISPLAY@@'])) $replacements['@@DISPLAY@@'] = hsc($replacements['@@DISPLAY@@']); + } + + // we attach a mandatory marker to the display + if(isset($replacements['@@DISPLAY@@']) && !isset($params['optional'])){ + $replacements['@@DISPLAY@@'] .= ' *'; + } + $val = str_replace(array_keys($replacements), array_values($replacements), $val); + } + return $is_simple ? $tpl[0] : $tpl; + } + + /** + * Executed after performing the action hooks + */ + public function after_action() { + } + + /** + * Constraint function: value of field should match this regexp + * + * @param string $d regexp + * @param mixed $value + * @return int|bool + */ + protected function validate_match($d, $value) { + return @preg_match('/' . $d . '/i', $value); + } + + /** + * Constraint function: value of field should be bigger + * + * @param int|number $d lower bound + * @param mixed $value of field + * @return bool + */ + protected function validate_min($d, $value) { + return $value > $d; + } + + /** + * Constraint function: value of field should be smaller + * + * @param int|number $d upper bound + * @param mixed $value of field + * @return bool + */ + protected function validate_max($d, $value) { + return $value < $d; + } + + /** + * Available methods + * + * @return array + */ + public function getMethods() { + $result = array(); + $result[] = array( + 'name' => 'initialize', + 'desc' => 'Initiate object, first parameters are at least cmd and label', + 'params' => array( + 'params' => 'array' + ) + ); + $result[] = array( + 'name' => 'renderfield', + 'desc' => 'Add parsed element to Form which generates XHTML', + 'params' => array( + 'params' => 'array', + 'form' => 'Doku_Form', + 'formid' => 'integer' + ) + ); + $result[] = array( + 'name' => 'handle_post', + 'desc' => 'Handle a post to the field', + 'params' => array( + 'value' => 'array', + 'fields' => 'helper_plugin_bureaucracy_field[]', + 'index' => 'Doku_Form', + 'formid' => 'integer' + ), + 'return' => array('isvalid' => 'bool') + ); + $result[] = array( + 'name' => 'getFieldType', + 'desc' => 'Get the field type', + 'return' => array('fieldtype' => 'string') + ); + $result[] = array( + 'name' => 'isSet_', + 'desc' => 'Whether the field is true (used for depending fieldsets) ', + 'return' => array('isset' => 'bool') + ); + $result[] = array( + 'name' => 'getParam', + 'desc' => 'Get an arbitrary parameter', + 'params' => array( + 'name' => 'string' + ), + 'return' => array('Parameter value' => 'mixed|null') + ); + $result[] = array( + 'name' => 'after_action', + 'desc' => 'Executed after performing the action hooks' + ); + return $result; + } + +} diff --git a/platform/www/lib/plugins/bureaucracy/helper/fieldaddpage.php b/platform/www/lib/plugins/bureaucracy/helper/fieldaddpage.php new file mode 100644 index 0000000..0c024fd --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/helper/fieldaddpage.php @@ -0,0 +1,63 @@ +getLang('e_missingargs'), hsc($args[0]), + hsc($args[1])), -1); + return; + } + + // get standard arguments + $this->opt = array_combine(array('cmd', 'page_tpl', 'page_tgt'), $args); + } + + /** + * Nothing displayed + * + * @params array $params Additional HTML specific parameters + * @params Doku_Form $form The target Doku_Form object + * @params int $formid unique identifier of the form which contains this field + */ + function renderfield($params, Doku_Form $form, $formid) { + } + + /** + * Handle a post to the field + * + * @param string $value null + * @param helper_plugin_bureaucracy_field[] $fields (reference) form fields (POST handled upto $this field) + * @param int $index index number of field in form + * @param int $formid unique identifier of the form which contains this field + * @return bool Whether the passed value is valid + */ + function handle_post($value, &$fields, $index, $formid) { + return true; + } + + /** + * Get an arbitrary parameter + * + * @param string $name + * @return mixed|null + */ + function getParam($name) { + return ($name === 'value' || + (in_array($name, array('page_tpl', 'page_tgt')) && $this->hidden)) ? + null : + parent::getParam($name); + } +} diff --git a/platform/www/lib/plugins/bureaucracy/helper/fielddate.php b/platform/www/lib/plugins/bureaucracy/helper/fielddate.php new file mode 100644 index 0000000..6feae1c --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/helper/fielddate.php @@ -0,0 +1,42 @@ + 'datepicker edit', + 'maxlength'=>'10' + ); + if(!isset($this->opt['optional'])) { + $attr['required'] = 'required'; + $attr['class'] .= ' required'; + } + $this->tpl = form_makeTextField('@@NAME@@', '@@VALUE@@', '@@DISPLAY@@', '@@ID@@', '@@CLASS@@', $attr); + } + + /** + * Validate field input + * + * @throws Exception when empty or wrong date format + */ + protected function _validate() { + parent::_validate(); + + $value = $this->getParam('value'); + if (!is_null($value) && !preg_match('/^\d{4}-\d{2}-\d{2}$/', $value)) { + throw new Exception(sprintf($this->getLang('e_date'),hsc($this->getParam('display')))); + } + } +} diff --git a/platform/www/lib/plugins/bureaucracy/helper/fieldemail.php b/platform/www/lib/plugins/bureaucracy/helper/fieldemail.php new file mode 100644 index 0000000..7857bd7 --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/helper/fieldemail.php @@ -0,0 +1,30 @@ +getParam('value'); + if(!is_null($value) && $value !== '@MAIL@' && !mail_isvalid($value)){ + throw new Exception(sprintf($this->getLang('e_email'),hsc($this->getParam('display')))); + } + } +} diff --git a/platform/www/lib/plugins/bureaucracy/helper/fieldfieldset.php b/platform/www/lib/plugins/bureaucracy/helper/fieldfieldset.php new file mode 100644 index 0000000..ddce2b6 --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/helper/fieldfieldset.php @@ -0,0 +1,114 @@ +opt = array('cmd' => array_shift($args)); + + if (count($args) > 0) { + $this->opt['label'] = array_shift($args); + $this->opt['display'] = $this->opt['label']; + + $this->depends_on = $args; + } + } + + /** + * Render the top of the fieldset as XHTML + * + * @param array $params Additional HTML specific parameters + * @param Doku_Form $form The target Doku_Form object + * @param int $formid unique identifier of the form which contains this field + */ + function renderfield($params, Doku_Form $form, $formid) { + $form->startFieldset(hsc($this->getParam('display'))); + if (!empty($this->depends_on)) { + $dependencies = array_map('hsc',(array) $this->depends_on); + if (count($this->depends_on) > 1) { + $msg = 'Only edit this fieldset if ' . + '“%s” '. + 'is set to “%s”.'; + } else { + $msg = 'Only edit this fieldset if ' . + '“%s” is set.'; + } + + $form->addElement('

' . vsprintf($msg, $dependencies) . '

'); + } + } + + /** + * Handle a post to the fieldset + * + * When fieldset is closed, set containing fields to hidden + * + * @param null $value field value of fieldset always empty + * @param helper_plugin_bureaucracy_field[] $fields (reference) form fields (POST handled upto $this field) + * @param int $index index number of field in form + * @param int $formid unique identifier of the form which contains this field + * @return bool Whether the passed value is valid + */ + public function handle_post($value, &$fields, $index, $formid) { + if(empty($this->depends_on)) { + return true; + } + + // search the field where fieldset depends on in fields before fieldset + $hidden = false; + for ($n = 0 ; $n < $index; ++$n) { + $field = $fields[$n]; + if ($field->getParam('label') != $this->depends_on[0]) { + continue; + } + if(count($this->depends_on) > 1) { + $hidden = $field->getParam('value') != $this->depends_on[1]; + } else { + $hidden = !$field->isSet_(); + } + break; + } + // mark fields after this fieldset as hidden + if ($hidden) { + $this->hidden = true; + for ($n = $index + 1 ; $n < count($fields) ; ++$n) { + $field = $fields[$n]; + if ($field->getFieldType() === 'fieldset') { + break; + } + $field->hidden = true; + } + } + return true; + } + + /** + * Get an arbitrary parameter + * + * @param string $name + * @return mixed|null + */ + function getParam($name) { + if($name === 'value') { + return null; + } else { + return parent::getParam($name); + } + } +} diff --git a/platform/www/lib/plugins/bureaucracy/helper/fieldfile.php b/platform/www/lib/plugins/bureaucracy/helper/fieldfile.php new file mode 100644 index 0000000..285308e --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/helper/fieldfile.php @@ -0,0 +1,75 @@ +init($args); + + //default namespace for file upload (pagepath:file_name) + $this->opt['namespace'] = '.'; + + //check whenever the first argument is an upload namespace + if (isset($args[0]) && preg_match('/^[a-z.\-_:]+$/', $args[0])) { + $this->opt['namespace'] = array_shift($args); + } + $this->standardArgs($args); + + $attr = array(); + if(!isset($this->opt['optional'])) { + $attr['required'] = 'required'; + } + + $this->tpl = form_makeFileField('@@NAME@@', '@@DISPLAY@@', '@@ID@@', '@@CLASS@@', $attr); + + if(!isset($this->opt['optional'])){ + $this->tpl['class'] .= ' required'; + } + } + + /** + * Handle a post to the field + * + * Accepts and validates a posted value. + * + * @param array $value The passed value or array or null if none given + * @param helper_plugin_bureaucracy_field[] $fields (reference) form fields (POST handled upto $this field) + * @param int $index index number of field in form + * @param int $formid unique identifier of the form which contains this field + * @return bool Whether the passed filename is valid + */ + public function handle_post($value, &$fields, $index, $formid) { + $this->opt['file'] = $value; + + return parent::handle_post($value['name'], $fields, $index, $formid); + } + + /** + * @throws Exception max size, required or upload error + */ + protected function _validate() { + global $lang; + parent::_validate(); + + $file = $this->getParam('file'); + if($file['error'] == 1 || $file['error'] == 2) { + throw new Exception(sprintf($lang['uploadsize'],filesize_h(php_to_byte(ini_get('upload_max_filesize'))))); + } else if($file['error'] == 4) { + if(!isset($this->opt['optional'])) { + throw new Exception(sprintf($this->getLang('e_required'),hsc($this->opt['label']))); + } + } else if( $file['error'] || !is_uploaded_file($file['tmp_name'])) { + throw new Exception(hsc($this->opt['label']) .' '. $lang['uploadfail'] . ' (' .$file['error'] . ')' ); + } + } +} diff --git a/platform/www/lib/plugins/bureaucracy/helper/fieldhidden.php b/platform/www/lib/plugins/bureaucracy/helper/fieldhidden.php new file mode 100644 index 0000000..dd63753 --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/helper/fieldhidden.php @@ -0,0 +1,47 @@ +_handlePreload(); + $form->addHidden($params['name'], $this->getParam('value') . ''); + } + + /** + * Get an arbitrary parameter + * + * @param string $name + * @return mixed|null + */ + function getParam($name) { + if (!isset($this->opt[$name]) || in_array($name, array('pagename', 'value')) && $this->hidden) { + return null; + } + if ($name === 'pagename') { + // If $this->opt['pagename'] is set, return the value of the field, + // UNESCAPED. + $name = 'value'; + } + return $this->opt[$name]; + } +} diff --git a/platform/www/lib/plugins/bureaucracy/helper/fieldhiddenautoinc.php b/platform/www/lib/plugins/bureaucracy/helper/fieldhiddenautoinc.php new file mode 100644 index 0000000..787e081 --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/helper/fieldhiddenautoinc.php @@ -0,0 +1,35 @@ +_handlePreload(); + $form->addHidden($params['name'], $this->getParam('value') . ''); + } + +} diff --git a/platform/www/lib/plugins/bureaucracy/helper/fieldmultiselect.php b/platform/www/lib/plugins/bureaucracy/helper/fieldmultiselect.php new file mode 100644 index 0000000..5311d90 --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/helper/fieldmultiselect.php @@ -0,0 +1,62 @@ +init($args); + $this->opt['args'] = array_map('trim', explode('|',array_shift($args))); + $this->standardArgs($args); + if (isset($this->opt['value'])) { + $this->opt['value'] = array_map('trim', explode(',', $this->opt['value'])); + } else { + $this->opt['value'] = array(); + } + } + + /** + * Render the field as XHTML + * + * Outputs the represented field using the passed Doku_Form object. + * Additional parameters (CSS class & HTML name) are passed in $params. + * + * @params array $params Additional HTML specific parameters + * @params Doku_Form $form The target Doku_Form object + * @params int $formid unique identifier of the form which contains this field + */ + public function renderfield($params, Doku_Form $form, $formid) { + $this->_handlePreload(); + if(!$form->_infieldset){ + $form->startFieldset(''); + } + if ($this->error) { + $params['class'] = 'bureaucracy_error'; + } + $params = array_merge($this->opt, $params); + $form->addElement(call_user_func_array('form_makeListboxField', + $this->_parse_tpl( + array( + '@@NAME@@[]', + $params['args'], + $this->opt['value'], + '@@DISPLAY@@', + '@@ID@@', + '@@CLASS@@', + array('multiple' => 'multiple') + ), + $params + ))); + } +} \ No newline at end of file diff --git a/platform/www/lib/plugins/bureaucracy/helper/fieldnumber.php b/platform/www/lib/plugins/bureaucracy/helper/fieldnumber.php new file mode 100644 index 0000000..93a2242 --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/helper/fieldnumber.php @@ -0,0 +1,119 @@ +autoinc = true; + } + + parent::initialize($args); + + if ($this->autoinc) { + global $ID; + $key = $this->get_key(); + $c_val = p_get_metadata($ID, 'bureaucracy ' . $key); + if (is_null($c_val)) { + if (!isset($this->opt['value'])) { + $this->opt['value'] = 0; + } + p_set_metadata($ID, array('bureaucracy' => array($key => $this->opt['value']))); + } else { + $this->opt['value'] = $c_val; + } + } + $this->opt['value'] = $this->addLeadingzeros($this->opt['value']); + } + + /** + * Validate field value + * + * @throws Exception when not a number + */ + protected function _validate() { + $value = $this->getParam('value'); + if (!is_null($value) && !is_numeric($value)){ + throw new Exception(sprintf($this->getLang('e_numeric'),hsc($this->getParam('display')))); + } + + parent::_validate(); + } + + /** + * Handle a post to the field + * + * Accepts and validates a posted value. + * + * @param string $value The passed value or array or null if none given + * @param array $fields (reference) form fields (POST handled upto $this field) + * @param int $index index number of field in form + * @param int $formid unique identifier of the form which contains this field + * @return bool Whether the passed value is valid + */ + public function handle_post($value, &$fields, $index, $formid) { + $value = $this->addLeadingzeros($value); + + return parent::handle_post($value, $fields, $index, $formid); + } + + /** + * Returns the cleaned key for this field required for metadata + * + * @return string key + */ + private function get_key() { + return preg_replace('/\W/', '', $this->opt['label']) . '_autoinc'; + } + + /** + * Executed after performing the action hooks + * + * Increases counter and purge cache + */ + public function after_action() { + if ($this->autoinc) { + global $ID; + p_set_metadata($ID, array('bureaucracy' => array($this->get_key() => $this->opt['value'] + 1))); + // Force rerendering by removing the instructions cache file + $cache_fn = getCacheName(wikiFN($ID).$_SERVER['HTTP_HOST'].$_SERVER['SERVER_PORT'],'.'.'i'); + if (file_exists($cache_fn)) { + unlink($cache_fn); + } + } + } + + /** + * Add leading zeros, depending on the corresponding field option + * + * @param int|string $value number + * @return string + */ + protected function addLeadingzeros(&$value) { + if (isset($this->opt['leadingzeros'])) { + $length = strlen($value); + for($i = $length; $i < $this->opt['leadingzeros']; $i++) { + $value = '0' . $value; + } + return $value; + } + return $value; + } +} diff --git a/platform/www/lib/plugins/bureaucracy/helper/fieldonoff.php b/platform/www/lib/plugins/bureaucracy/helper/fieldonoff.php new file mode 100644 index 0000000..d73177b --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/helper/fieldonoff.php @@ -0,0 +1,16 @@ +opt['optional'])) { + $attr['required'] = 'required'; + } + $this->tpl = form_makePasswordField('@@NAME@@', '@@DISPLAY@@', '@@ID@@', '@@CLASS@@', $attr); + + if(!isset($this->opt['optional'])){ + $this->tpl['class'] .= ' required'; + } + } +} diff --git a/platform/www/lib/plugins/bureaucracy/helper/fieldradio.php b/platform/www/lib/plugins/bureaucracy/helper/fieldradio.php new file mode 100644 index 0000000..e2b466d --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/helper/fieldradio.php @@ -0,0 +1,82 @@ +init($args); + $this->opt['args'] = array_filter(array_map('trim', explode('|',array_shift($args)))); + $this->standardArgs($args); + } + + /** + * Render the field as XHTML + * + * Outputs the represented field using the passed Doku_Form object. + * Additional parameters (CSS class & HTML name) are passed in $params. + * + * @params array $params Additional HTML specific parameters + * @params Doku_Form $form The target Doku_Form object + * @params int $formid unique identifier of the form which contains this field + */ + public function renderfield($params, Doku_Form $form, $formid) { + $this->_handlePreload(); + if(!$form->_infieldset){ + $form->startFieldset(''); + } + if ($this->error) { + $params['class'] = 'bureaucracy_error'; + } + $params = array_merge($this->opt, $params); + + list($name, $entries, $value, $label, $id, $class) = $this->_parse_tpl( + array( + '@@NAME@@', + $params['args'], + '@@VALUE@@', + '@@DISPLAY@@', + '@@ID@@', + '@@CLASS@@' + ), + $params + ); + + $value = (in_array($value, $entries) ? $value : null); + $valueoffieldwithid = ($value !== null ? $value : current($entries)); + // label + $s = ''; + $s .= ''; + $form->addElement($s); + + // radio fields + foreach($entries as $val) { + if($value === $val) { + $attrs = array('checked' => 'checked'); + } else { + $attrs = array(); + } + if($valueoffieldwithid === $val) { + $_id = $id; //e.g. autofocus with 'focus__this' id + } else { + $_id = ''; + } + $form->addElement(form_makeRadioField($name, $val, $val, $_id, $class, $attrs)); + } + } +} diff --git a/platform/www/lib/plugins/bureaucracy/helper/fieldselect.php b/platform/www/lib/plugins/bureaucracy/helper/fieldselect.php new file mode 100644 index 0000000..391e562 --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/helper/fieldselect.php @@ -0,0 +1,61 @@ +init($args); + $this->opt['args'] = array_map('trim', explode('|',array_shift($args))); + $this->standardArgs($args); + if (!isset($this->opt['value']) && isset($this->opt['optional'])) { + array_unshift($this->opt['args'],' '); + } + } + + /** + * Render the field as XHTML + * + * Outputs the represented field using the passed Doku_Form object. + * Additional parameters (CSS class & HTML name) are passed in $params. + * + * @params array $params Additional HTML specific parameters + * @params Doku_Form $form The target Doku_Form object + * @params int $formid unique identifier of the form which contains this field + */ + public function renderfield($params, Doku_Form $form, $formid) { + $this->_handlePreload(); + if(!$form->_infieldset){ + $form->startFieldset(''); + } + if ($this->error) { + $params['class'] = 'bureaucracy_error'; + } + $params = array_merge($this->opt, $params); + $form->addElement(call_user_func_array('form_makeListboxField', + $this->_parse_tpl( + array( + '@@NAME@@', + $params['args'], + '@@VALUE|' . $params['args'][0] . '@@', + '@@DISPLAY@@', + '@@ID@@', + '@@CLASS@@' + ), + $params + ))); + } +} diff --git a/platform/www/lib/plugins/bureaucracy/helper/fieldstatic.php b/platform/www/lib/plugins/bureaucracy/helper/fieldstatic.php new file mode 100644 index 0000000..191be72 --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/helper/fieldstatic.php @@ -0,0 +1,60 @@ +@@DISPLAY@@

'; + + /** + * Arguments: + * - cmd + * - text + * + * @param array $args The tokenized definition, only split at spaces + */ + public function initialize($args) { + parent::initialize($args); + // make always optional to prevent being marked as required + $this->opt['optional'] = true; + } + + /** + * Handle a post to the field + * + * @param string $value The passed value + * @param helper_plugin_bureaucracy_field[] $fields (reference) form fields (POST handled upto $this field) + * @param int $index index number of field in form + * @param int $formid unique identifier of the form which contains this field + * @return bool Whether the passed value is valid + */ + public function handle_post($value, &$fields, $index, $formid) { + return true; + } + + /** + * Get an arbitrary parameter + * + * @param string $name + * @return mixed|null + */ + public function getParam($name) { + return ($name === 'value') ? null : parent::getParam($name); + } + + /** + * Render the field as XHTML + * + * @params array $params Additional HTML specific parameters + * @params Doku_Form $form The target Doku_Form object + * @params int $formid unique identifier of the form which contains this field + */ + public function renderfield($params, Doku_Form $form, $formid) { + if (!isset($this->opt['display'])) { + $this->opt['display'] = $this->opt['label']; + } + parent::renderfield($params, $form, $formid); + } + +} diff --git a/platform/www/lib/plugins/bureaucracy/helper/fieldsubject.php b/platform/www/lib/plugins/bureaucracy/helper/fieldsubject.php new file mode 100644 index 0000000..f49c2b7 --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/helper/fieldsubject.php @@ -0,0 +1,37 @@ +_handlePreload(); + } + + /** + * Handle a post to the field + * + * @param string $value null + * @param helper_plugin_bureaucracy_field[] $fields (reference) form fields (POST handled upto $this field) + * @param int $index index number of field in form + * @param int $formid unique identifier of the form which contains this field + * @return bool Whether the passed value is valid + */ + function handle_post($value, &$fields, $index, $formid) { + return true; + } +} \ No newline at end of file diff --git a/platform/www/lib/plugins/bureaucracy/helper/fieldsubmit.php b/platform/www/lib/plugins/bureaucracy/helper/fieldsubmit.php new file mode 100644 index 0000000..b9f2e45 --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/helper/fieldsubmit.php @@ -0,0 +1,89 @@ +opt['optional'] = true; + } + + /** + * Render the field as XHTML + * + * @params array $params Additional HTML specific parameters + * @params Doku_Form $form The target Doku_Form object + * @params int $formid unique identifier of the form which contains this field + */ + public function renderfield($params, Doku_Form $form, $formid) { + if(!isset(helper_plugin_bureaucracy_fieldsubmit::$captcha_displayed[$formid])) { + helper_plugin_bureaucracy_fieldsubmit::$captcha_displayed[$formid] = true; + /** @var helper_plugin_captcha $helper */ + $helper = null; + if(@is_dir(DOKU_PLUGIN.'captcha')) $helper = plugin_load('helper','captcha'); + if(!is_null($helper) && $helper->isEnabled()){ + $form->addElement($helper->getHTML()); + } + } + $attr = array(); + if(isset($this->opt['id'])) { + $attr['id'] = $this->opt['id']; + } + $this->tpl = form_makeButton('submit','', '@@DISPLAY|' . $this->getLang('submit') . '@@', $attr); + parent::renderfield($params, $form, $formid); + } + + /** + * Handle a post to the field + * + * Accepts and validates a posted captcha value. + * + * @param string $value The passed value + * @param helper_plugin_bureaucracy_field[] $fields (reference) form fields (POST handled upto $this field) + * @param int $index index number of field in form + * @param int $formid unique identifier of the form which contains this field + * @return bool Whether the posted form has a valid captcha + */ + public function handle_post($value, &$fields, $index, $formid) { + if ($this->hidden) { + return true; + } + if(!isset(helper_plugin_bureaucracy_fieldsubmit::$captcha_checked[$formid])) { + helper_plugin_bureaucracy_fieldsubmit::$captcha_checked[$formid] = true; + // check CAPTCHA + /** @var helper_plugin_captcha $helper */ + $helper = null; + if(@is_dir(DOKU_PLUGIN.'captcha')) $helper = plugin_load('helper','captcha'); + if(!is_null($helper) && $helper->isEnabled()){ + return $helper->check(); + } + } + return true; + } + + /** + * Get an arbitrary parameter + * + * @param string $name + * @return mixed|null + */ + public function getParam($name) { + return ($name === 'value') ? null : parent::getParam($name); + } + +} diff --git a/platform/www/lib/plugins/bureaucracy/helper/fieldtextarea.php b/platform/www/lib/plugins/bureaucracy/helper/fieldtextarea.php new file mode 100644 index 0000000..0dfcce2 --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/helper/fieldtextarea.php @@ -0,0 +1,29 @@ +opt['class'])) { + $this->opt['class'] = ''; + } + $this->opt['class'] .= ' textareafield'; + } + + protected $tpl = +''; + +} diff --git a/platform/www/lib/plugins/bureaucracy/helper/fieldtextbox.php b/platform/www/lib/plugins/bureaucracy/helper/fieldtextbox.php new file mode 100644 index 0000000..430cc2d --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/helper/fieldtextbox.php @@ -0,0 +1,34 @@ +opt['optional'])) { + $attr['required'] = 'required'; + } + + $this->tpl = form_makeTextField('@@NAME@@', '@@VALUE@@', '@@DISPLAY@@', '@@ID@@', '@@CLASS@@', $attr); + if(isset($this->opt['class'])){ + $this->tpl['class'] .= ' '.$this->opt['class']; + } + if(!isset($this->opt['optional'])){ + $this->tpl['class'] .= ' required'; + } + } +} diff --git a/platform/www/lib/plugins/bureaucracy/helper/fieldtime.php b/platform/www/lib/plugins/bureaucracy/helper/fieldtime.php new file mode 100644 index 0000000..164e71f --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/helper/fieldtime.php @@ -0,0 +1,42 @@ + 'timefield edit', + 'maxlength'=>'8' + ); + if(!isset($this->opt['optional'])) { + $attr['required'] = 'required'; + $attr['class'] .= ' required'; + } + $this->tpl = form_makeTextField('@@NAME@@', '@@VALUE@@', '@@DISPLAY@@', '@@ID@@', '@@CLASS@@', $attr); + } + + /** + * Validate field input + * + * @throws Exception when empty or wrong time format + */ + protected function _validate() { + parent::_validate(); + + $value = $this->getParam('value'); + if (!is_null($value) && !preg_match('/^\d{1,2}:\d{2}(?::\d{2})?$/', $value)) { + throw new Exception(sprintf($this->getLang('e_time'),hsc($this->getParam('display')))); + } + } +} diff --git a/platform/www/lib/plugins/bureaucracy/helper/fieldusemailtemplate.php b/platform/www/lib/plugins/bureaucracy/helper/fieldusemailtemplate.php new file mode 100644 index 0000000..775f87b --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/helper/fieldusemailtemplate.php @@ -0,0 +1,62 @@ +getLang('e_missingargs'), hsc($args[0]), + hsc($args[1])), -1); + return; + } + + // get standard arguments + $this->opt = array_combine(array('cmd', 'template'), $args); + } + + /** + * Nothing displayed + * + * @params array $params Additional HTML specific parameters + * @params Doku_Form $form The target Doku_Form object + * @params int $formid unique identifier of the form which contains this field + */ + function renderfield($params, Doku_Form $form, $formid) { + } + + /** + * Handle a post to the field + * + * @param string $value null + * @param helper_plugin_bureaucracy_field[] $fields (reference) form fields (POST handled upto $this field) + * @param int $index index number of field in form + * @param int $formid unique identifier of the form which contains this field + * @return bool Whether the passed value is valid + */ + function handle_post($value, &$fields, $index, $formid) { + return true; + } + + /** + * Get an arbitrary parameter + * + * @param string $name + * @return mixed|null + */ + function getParam($name) { + return ($name === 'value' || + (in_array($name, array('template')) && $this->hidden)) ? + null : + parent::getParam($name); + } +} diff --git a/platform/www/lib/plugins/bureaucracy/helper/fielduser.php b/platform/www/lib/plugins/bureaucracy/helper/fielduser.php new file mode 100644 index 0000000..49608e1 --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/helper/fielduser.php @@ -0,0 +1,99 @@ +tpl['class'] .= ' userpicker'; + } + + /** + * Allow receiving user attributes by ".". Ex. user.name + * You can pass an optional argument to user.grps enclosed in brackets, used as an groups delimiter Ex. user.grps(, ) + * + * @return string + */ + public function getReplacementPattern() { + $label = $this->opt['label']; + + return '/(@@|##)' . preg_quote($label, '/') . + '(?:\.(.*?))?' . //match attribute after "." + '(?:\((.*?)\))?' . //match parameter enclosed in "()". Used for grps separator + '\1/si'; + } + + /** + * Used as an callback for preg_replace_callback + * + * @param $matches + * @return string + */ + public function replacementValueCallback($matches) { + /** @var DokuWiki_Auth_Plugin $auth */ + global $auth; + + $value = $this->opt['value']; + //attr doesn't exists + if (!isset($matches[2])) { + return is_null($value) || $value === false ? '' : $value; + } + $attr = $matches[2]; + + $udata = $auth->getUserData($value); + //no such user + if ($udata === false) { + return $matches[0]; + } + + switch($attr) { + case 'name': + case 'mail': + return $udata[$attr]; + case 'grps': + $delitmiter = ', '; + if (isset($matches[3])) { + $delitmiter = $matches[3]; + } + return implode($delitmiter, $udata['grps']); + default: + return $matches[0]; + } + } + + /** + * Return the callback for user replacement + * + * @return array + */ + public function getReplacementValue() { + return array($this, 'replacementValueCallback'); + } + + /** + * Validate value of field + * + * @throws Exception when user not exists + */ + protected function _validate() { + parent::_validate(); + + /** @var DokuWiki_Auth_Plugin $auth */ + global $auth; + $value = $this->getParam('value'); + if (!is_null($value) && $auth->getUserData($value) === false) { + throw new Exception(sprintf($this->getLang('e_user'),hsc($this->getParam('display')))); + } + } +} diff --git a/platform/www/lib/plugins/bureaucracy/helper/fieldusers.php b/platform/www/lib/plugins/bureaucracy/helper/fieldusers.php new file mode 100644 index 0000000..bd5dce7 --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/helper/fieldusers.php @@ -0,0 +1,96 @@ +tpl['class'] .= ' userspicker'; + } + + /** + * Allow receiving user attributes by ".". Ex. user.name + * You can pass an optional argument to user.grps enclosed in brackets, used as an groups delimiter Ex. user.grps(, ) + * + * @return string + */ + public function getReplacementPattern() { + $label = $this->opt['label']; + return '/(@@|##)' . preg_quote($label, '/') . + '(?:\((?P.*?)\))?' .//delimiter + '(?:\.(?P.*?))?' . //match attribute after "." + '\1/si'; + } + + /** + * Used as an callback for preg_replace_callback + * + * @param $matches + * @return string + */ + public function replacementValueCallback($matches) { + /** @var DokuWiki_Auth_Plugin $auth */ + global $auth; + + $value = $this->opt['value']; + //copy the value by default + if (isset($matches[2]) && is_array($matches[2]) && count($matches[2]) == 2) { + return is_null($value) || $value === false ? $matches[0] : $value; + } + + $attribute = isset($matches['attribute']) ? $matches['attribute'] : ''; + //check if matched string containts a pair of brackets + $delimiter = preg_match('/\(.*\)/s', $matches[0]) ? $matches['delimiter'] : ', '; + $users = array_map('trim', explode(',', $value)); + + switch($attribute) { + case '': + return implode($delimiter, $users); + case 'name': + case 'mail': + return implode($delimiter, array_map(function ($user) use ($auth, $attribute) { + return $auth->getUserData($user)[$attribute]; + }, $users)); + default: + return $matches[0]; + } + } + + /** + * Return the callback for user replacement + * + * @return array + */ + public function getReplacementValue() { + return array($this, 'replacementValueCallback'); + } + + /** + * Validate value of field + * + * @throws Exception when user not exists + */ + protected function _validate() { + parent::_validate(); + + /** @var DokuWiki_Auth_Plugin $auth */ + global $auth; + $users = array_filter(preg_split('/\s*,\s*/', $this->getParam('value'))); + foreach ($users as $user) { + if ($auth->getUserData($user) === false) { + throw new Exception(sprintf($this->getLang('e_users'), hsc($this->getParam('display')))); + } + } + } +} diff --git a/platform/www/lib/plugins/bureaucracy/helper/fieldwiki.php b/platform/www/lib/plugins/bureaucracy/helper/fieldwiki.php new file mode 100644 index 0000000..dada855 --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/helper/fieldwiki.php @@ -0,0 +1,70 @@ +@@LABEL@@

'; + + /** + * Arguments: + * - cmd + * - wiki text + * + * @param array $args The tokenized definition, only split at spaces + */ + public function initialize($args) { + parent::initialize($args); + // make always optional to prevent being marked as required + $this->opt['optional'] = true; + } + + /** + * Handle a post to the field + * + * @param null $value empty + * @param helper_plugin_bureaucracy_field[] $fields (reference) form fields (POST handled upto $this field) + * @param int $index index number of field in form + * @param int $formid unique identifier of the form which contains this field + * @return bool Whether the passed value is valid + */ + public function handle_post($value, &$fields, $index, $formid) { + return true; + } + + /** + * Get an arbitrary parameter + * + * @param string $name + * @return mixed|null + */ + public function getParam($name) { + return ($name === 'value') ? null : parent::getParam($name); + } + + /** + * Returns parsed wiki instructions + * + * @param string|array $tpl The template as string + * @param array $params A hash mapping parameters to values + * + * @return string The parsed template + */ + protected function _parse_tpl($tpl, $params) { + $ins = p_get_instructions($params['display']); + // remove document and p instructions (opening and closing) + $start = 2; + $end = 2; + // check if struct instructions have to be removed as well from the beginning or end + if (isset($ins[1][1][0]) && $ins[1][1][0] === 'struct_output') { + $start = 3; + } elseif (isset($ins[count($ins) - 2][1][0]) && $ins[count($ins) - 2][1][0] === 'struct_output') { + $end = 3; + } + $ins = array_slice($ins, $start, -$end); + $tpl = p_render('xhtml', $ins, $byref_ignore); + return '

'.$tpl.'

'; + } +} diff --git a/platform/www/lib/plugins/bureaucracy/helper/fieldyesno.php b/platform/www/lib/plugins/bureaucracy/helper/fieldyesno.php new file mode 100644 index 0000000..77b83de --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/helper/fieldyesno.php @@ -0,0 +1,98 @@ +init($args); + $newargs = array(); + foreach ($args as $arg) { + switch ($arg[0]) { + case '=': + if($arg == '==1') { + $this->opt['value'] = '1'; + }elseif($arg == '==0') { + $this->opt['value'] = '0'; + }else{ + $this->opt['true_value'] = substr($arg, 1); + } + break; + case '!': + $this->opt['false_value'] = substr($arg, 1); + break; + default: + $newargs[] = $arg; + } + } + $this->standardArgs($newargs); + $this->opt['optional'] = true; + } + + /** + * Get an arbitrary parameter + * + * @param string $key + * @return mixed|null + */ + public function getParam($key) { + if ($key === 'value') { + if ($this->opt['value'] === '1') { + return isset($this->opt['true_value']) ? + $this->opt['true_value'] : + null; + } elseif ($this->opt['value'] === '0') { + return isset($this->opt['false_value']) ? + $this->opt['false_value'] : + null; + } + } + return parent::getParam($key); + } + + /** + * Whether the field is true (used for depending fieldsets) + * + * @return bool whether field is set + */ + public function isSet_() { + return $this->opt['value'] === '1'; + } + + /** + * Render the field as XHTML + * + * @params array $params Additional HTML specific parameters + * @params Doku_Form $form The target Doku_Form object + * @params int $formid unique identifier of the form which contains this field + */ + public function renderfield($params, Doku_Form $form, $formid) { + $id = 'bureaucracy__'.md5(rand()); + if(isset($this->opt['id'])) { + $id = $this->opt['id']; + } + $params = array_merge( + array('value' => false), + $this->opt, + $params + ); + $check = $params['value'] ? 'checked="checked"' : ''; + $this->tpl = ''; + parent::renderfield($params, $form, $formid); + } +} diff --git a/platform/www/lib/plugins/bureaucracy/interfaces/bureaucracy_handler_interface.php b/platform/www/lib/plugins/bureaucracy/interfaces/bureaucracy_handler_interface.php new file mode 100644 index 0000000..41c461f --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/interfaces/bureaucracy_handler_interface.php @@ -0,0 +1,19 @@ + + */ +$lang['e_unknowntype'] = 'Unbekannter Typ "%s"'; +$lang['e_unknownaction'] = 'Unbekannte Aktion "%s"'; +$lang['e_missingargs'] = 'Nicht genug Argumente für %s %s'; +$lang['e_noaction'] = 'Keine Aktion definiert - wohin sollen die Daten gesendet werden?'; +$lang['e_mail'] = 'Beim Versenden der Daten ist ein Fehler aufgetreten'; +$lang['e_unknownconstraint'] = 'Unbekannter Feld-Parameter %s'; +$lang['e_labelpage'] = 'Seite mit Feldnamen %s nicht gefunden'; +$lang['e_required'] = '"%s" muss ausgefüllt werden.'; +$lang['e_match'] = '"%s" wurde nicht korrekt ausgefüllt. %s'; +$lang['checkagainst'] = '(überprüft gegen /%s/)'; +$lang['e_email'] = '"%s" muss eine gültige E-Mail Adresse sein.'; +$lang['e_numeric'] = '"%s" muss eine Nummer sein.'; +$lang['e_date'] = '"%s" muss ein gültiges Datum im Format jjjj-mm-tt sein.'; +$lang['e_time'] = '"%s" muss eine gültige Zeit im Format (h)h:mm(:ss) sein.'; +$lang['e_user'] = '"%s" muss der Name eines existierenden Benutzers sein.'; +$lang['e_users'] = '"%s" muss eine komma-separierte Liste existierender Benutzer sein.'; +$lang['e_min'] = '"%s" muss größer sein als %s.'; +$lang['e_max'] = '"%s" muss kleiner sein als %s.'; +$lang['e_pagename'] = 'Seitenname nicht angegeben.'; +$lang['e_pageexists'] = 'Die Seite "%s" exisistiert bereits. Bitte wählen Sie einen anderen Namen.'; +$lang['e_template'] = 'Das Template "%s" konnte nicht geladen werden. Möglicherweise existiert es nicht oder Sie verfügen nicht über die benötigten Rechte.'; +$lang['e_denied'] = 'Sie sind nicht berechtigt diese Seite anzulegen. Haben Sie vielleicht vergessen sich anzumelden?'; +$lang['mailsubject'] = 'Formulardaten übermittelt von %s'; +$lang['mailintro'] = 'Die folgenden Daten wurden am %s abgeschickt.'; +$lang['mail_thanks'] = 'Ihre Daten wurden erfolgreich versandt. Vielen Dank.'; +$lang['template_thanks'] = 'Die Seite wurde angelegt, folgen Sie dem Link um die neue Seite aufzurufen.'; +$lang['summary'] = 'Erstellt mit dem Formular %s'; +$lang['attachmentMailEmpty'] = '(Datei nicht angegeben)'; +$lang['attachmentMailToLarge'] = '(Datei zu groß für Mail-Anhang)'; +$lang['attachmentMailToLarge_userinfo'] = 'Die Datei "%s" ist zu groß als Mail-Anhang (>%s) (E-Mail ohne Datei gesendet)'; +$lang['submit'] = 'Absenden'; diff --git a/platform/www/lib/plugins/bureaucracy/lang/de/settings.php b/platform/www/lib/plugins/bureaucracy/lang/de/settings.php new file mode 100644 index 0000000..f81c634 --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/lang/de/settings.php @@ -0,0 +1,8 @@ +%s) (mail was sent nevertheless)'; + +$lang['submit'] = 'Submit'; diff --git a/platform/www/lib/plugins/bureaucracy/lang/en/settings.php b/platform/www/lib/plugins/bureaucracy/lang/en/settings.php new file mode 100644 index 0000000..9c8f365 --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/lang/en/settings.php @@ -0,0 +1,5 @@ + + */ +$lang['e_unknowntype'] = 'Tipo desconocido "%s"'; +$lang['e_unknownaction'] = 'Acción desconocida "%s"'; +$lang['e_missingargs'] = 'Faltan argumentos para %s %s'; +$lang['e_noaction'] = 'Falta definir la acción - ¿Dónde enviamos los datos?'; +$lang['e_mail'] = 'Algún problema al enviar los datos'; +$lang['e_unknownconstraint'] = 'Faltan los límites del campo %s'; +$lang['e_labelpage'] = 'Pagina de LABELS "%s" no encontrada'; +$lang['e_required'] = '"%s" es necesario'; +$lang['e_match'] = '"%s" no esta completado correctamente. %s'; +$lang['checkagainst'] = '(Comprobado con /%s/i)'; +$lang['e_email'] = '"%s" tiene que ser un eMail válido.'; +$lang['e_numeric'] = '"%s" debe ser numérico.'; +$lang['e_date'] = '"%s" debe que ser una fecha válida con formato yyyy-mm-dd'; +$lang['e_time'] = '"%s" debe ser una hora válida con formato (h)h:mm(:ss)'; +$lang['e_user'] = '"%s" debe ser el nombre de un usuario existente.'; +$lang['e_users'] = '"%s" tiene que contener una lista de usuarios existentes separados por comas.'; +$lang['e_min'] = '"%s" debe ser mayor de %s.'; +$lang['e_max'] = '"%s" debe ser menor de %s.'; +$lang['e_pagename'] = 'Falta el nombre de la página.'; +$lang['e_pageexists'] = 'La pagina "%s" existe. Escoja un nombre diferente.'; +$lang['e_template'] = 'No se puede leer la plantilla "%s". O no existe, o no tenemos permisos de lectura.'; +$lang['e_denied'] = 'No tiene permisos para crear la página, ¿Esta logueado?'; +$lang['mailsubject'] = 'Formulario enviado en %s'; +$lang['mailintro'] = 'Los siguientes datos enviados en %s'; +$lang['mail_thanks'] = 'Formulario enviado correctamente. Gracias.'; +$lang['template_thanks'] = 'La página esta creada, siga el enlace para abrirla.'; +$lang['summary'] = 'Creada desde el formulario en %s'; +$lang['attachmentMailEmpty'] = '(fichero no enviado)'; +$lang['attachmentMailToLarge'] = '(fichero demasiado largo para incrustarlo en un eMail)'; +$lang['attachmentMailToLarge_userinfo'] = 'Fichero "%s" demasiado largo para incrustarlo en un eMail (>%s) (eMail enviado de todas formas)'; +$lang['submit'] = 'Enviar'; diff --git a/platform/www/lib/plugins/bureaucracy/lang/es/settings.php b/platform/www/lib/plugins/bureaucracy/lang/es/settings.php new file mode 100644 index 0000000..e783e78 --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/lang/es/settings.php @@ -0,0 +1,9 @@ + + */ +$lang['runas'] = 'Afecta el modo plantilla. Use los permisos de este usuario (virtual) cuando compruebe los ACLs para leer plantillas y crear páginas.'; +$lang['maxEmailAttachmentSize'] = 'Maximo tamaño, en Bytes, de los elementos incrustados en un eMail. (por fichero)'; diff --git a/platform/www/lib/plugins/bureaucracy/lang/fa/lang.php b/platform/www/lib/plugins/bureaucracy/lang/fa/lang.php new file mode 100644 index 0000000..95043e6 --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/lang/fa/lang.php @@ -0,0 +1,38 @@ + + */ +$lang['e_unknowntype'] = 'نوع ناشناخته "%s"'; +$lang['e_unknownaction'] = 'عمل ناشناخته "%s"'; +$lang['e_missingargs'] = 'آرگومانهای ناکافی برای %s %s'; +$lang['e_noaction'] = 'عملی تعریف نشده است- داده‌ها باید به کجا فرستاده شوند؟'; +$lang['e_mail'] = 'در فرستادن داده‌ها اشکالی پیش آمده است'; +$lang['e_unknownconstraint'] = 'قید فیلد ناشناخته %s'; +$lang['e_labelpage'] = 'صفحه برچسب %s یافته نشد'; +$lang['e_required'] = '"%s" ضروری است'; +$lang['e_match'] = '"%s" به درستی پر نشد. %s'; +$lang['checkagainst'] = '(بررسی شده نسبت به /%s/i)'; +$lang['e_email'] = '"%s" باید یک نشانی ایمیل صحیح باشد.'; +$lang['e_numeric'] = '"%s" باید یک عدد باشد.'; +$lang['e_date'] = '"%s" باید یک تاریخ صحیح با صورت yyyy-mm-dd باشد.'; +$lang['e_time'] = '"%s" باید یک زمان صحیح با صورت (h)h:mm(:ss) باشد.'; +$lang['e_user'] = '"%s" باید نام یک کاربر موجود باشد.'; +$lang['e_users'] = '"%s" باید یک لیست جداشده‌باکاما از نام کاربران موجود باشد.'; +$lang['e_min'] = '"%s" باید بزرگتر از %s باشد.'; +$lang['e_max'] = '"%s" باید کمتر از %s باشد.'; +$lang['e_pagename'] = 'نام صفحه فراموش شده است.'; +$lang['e_pageexists'] = 'صفحه "%s" هم‌اکنون موجود است. لطفاً یک نام صفحه متفاوت انتخاب کنید.'; +$lang['e_template'] = 'امکان خواندن قالب "%s" نبود. شاید وجود ندارد یا شما اجازه خواندن را ندارید.'; +$lang['e_denied'] = 'شما اجازه ایجاد این صفحه را ندارید، نکند فراموش کردید وارد حساب کاربری شوید؟'; +$lang['mailsubject'] = 'داده‌های فُرم در %s ارسال شدند. '; +$lang['mailintro'] = 'داده‌های زیر روی %s ارسال شدند. '; +$lang['mail_thanks'] = 'داده‌های شما با موفقیت فرستاده شدند. با تشکر از شما.'; +$lang['template_thanks'] = 'این صفحه ایجاد شده است، برای باز کردن آن روی پیوند کلیک کنید. '; +$lang['summary'] = 'ایجاد شده از فُرم در %s'; +$lang['attachmentMailEmpty'] = '(فایل ارسال نشد)'; +$lang['attachmentMailToLarge'] = '(فایل برای پیوست شدن به ایمیل بیش از حد بزرگ است)'; +$lang['attachmentMailToLarge_userinfo'] = 'فایل "%s" برای پیوست شدن به ایمیل بیش‌ازحد بزرگ است (>%s)(با این‌حال ایمیل فرستاده شد)'; +$lang['submit'] = 'ارسال'; diff --git a/platform/www/lib/plugins/bureaucracy/lang/fa/settings.php b/platform/www/lib/plugins/bureaucracy/lang/fa/settings.php new file mode 100644 index 0000000..8bfc3b8 --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/lang/fa/settings.php @@ -0,0 +1,9 @@ + + */ +$lang['runas'] = 'روی حالت قالب اثر می‌گذارد. از این اجازه‌های کاربر (مجازی) وقتی استفاده کنید که ACL ها برای خواندن قالبها و ایجاد صفحات بررسی می‌شوند. '; +$lang['maxEmailAttachmentSize'] = 'اندازه حداکثر پیوست‌های ایمیل بر حسب بایت. (به ازای هر فایل)'; diff --git a/platform/www/lib/plugins/bureaucracy/lang/fr/lang.php b/platform/www/lib/plugins/bureaucracy/lang/fr/lang.php new file mode 100644 index 0000000..5bae4e0 --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/lang/fr/lang.php @@ -0,0 +1,38 @@ + + */ +$lang['e_unknowntype'] = 'Type inconu "%s"'; +$lang['e_unknownaction'] = 'Action inconnue "%s"'; +$lang['e_missingargs'] = 'Pas assez d\'arguments pour %s %s'; +$lang['e_noaction'] = 'Pas d\'action définie - que faire des données ?'; +$lang['e_mail'] = 'Erreur lors de l\'envoi des données'; +$lang['e_unknownconstraint'] = 'Contrainte de champ inconue %s'; +$lang['e_labelpage'] = 'Page de label %s non trouvée.'; +$lang['e_required'] = '"%s" est requis'; +$lang['e_match'] = '"%s" n\'est pas remplis correctement. %s'; +$lang['checkagainst'] = '(vérifié avec /%s/i)'; +$lang['e_email'] = '"%s" doit être une adresse de courriel valide.'; +$lang['e_numeric'] = '"%s" doit être un nombre.'; +$lang['e_date'] = '"%s" doit être une date valide au format yyyy-mm-dd.'; +$lang['e_time'] = '"%s" nécessite une heure valide au format (h)h:mm(:ss).'; +$lang['e_user'] = '"%s" doit être le nom d\'un utilisateur existant.'; +$lang['e_users'] = '"%s" doit être une liste à virgules de noms d\'utilisateurs.'; +$lang['e_min'] = '"%s" doit être plus grand que %s.'; +$lang['e_max'] = '"%s" doit être plus petit que %s.'; +$lang['e_pagename'] = 'Nom de page manquant.'; +$lang['e_pageexists'] = 'La page "%s" existe déjà. Veuillez choisir un autre nom.'; +$lang['e_template'] = 'Modèle "%s" introuvable. Il n\'existe pas ou vous n\'avez pas l\'autorisation de lecture.'; +$lang['e_denied'] = 'Vous n\'avez pas le droit de créer cette page, vous êtes vous connecté ?'; +$lang['mailsubject'] = 'Données du formulaire de la page %s'; +$lang['mailintro'] = 'Les données suivantes ont été envoyées le %s.'; +$lang['mail_thanks'] = 'Données envoyées avec succès. Merci.'; +$lang['template_thanks'] = 'La page est créée, suivez le lien pour l\'ouvrir.'; +$lang['summary'] = 'Créé depuis le formulaire %s'; +$lang['attachmentMailEmpty'] = '(fichier non envoyé)'; +$lang['attachmentMailToLarge'] = '(fichier trop grand comme pièce jointe de courriel)'; +$lang['attachmentMailToLarge_userinfo'] = 'fichier "%s" trop grand comme pièce jointe (>%s). Le message est tout de même parti.'; +$lang['submit'] = 'Envoyer'; diff --git a/platform/www/lib/plugins/bureaucracy/lang/fr/settings.php b/platform/www/lib/plugins/bureaucracy/lang/fr/settings.php new file mode 100644 index 0000000..72031df --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/lang/fr/settings.php @@ -0,0 +1,9 @@ + + */ +$lang['runas'] = 'Mode «template» : teste les ACL avec les permissions de cet utilisateur (virtuel) pour la lecture des modèles et la création de page.'; +$lang['maxEmailAttachmentSize'] = 'Taille max en octet des pièces jointes dans les courriels. (par fichier)'; diff --git a/platform/www/lib/plugins/bureaucracy/lang/hr/lang.php b/platform/www/lib/plugins/bureaucracy/lang/hr/lang.php new file mode 100644 index 0000000..339d3b8 --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/lang/hr/lang.php @@ -0,0 +1,38 @@ + + */ +$lang['e_unknowntype'] = 'Nepoznat tip "%s"'; +$lang['e_unknownaction'] = 'Nepoznata aktivnost "%s"'; +$lang['e_missingargs'] = 'Nema dovoljno argumenata za %s %s'; +$lang['e_noaction'] = 'Nema definirane akcije - gdje podaci trebaju biti poslani?'; +$lang['e_mail'] = 'Nešto je pošlo krivo s slanjem ovih podataka'; +$lang['e_unknownconstraint'] = 'Nepoznato ograničenje polja %s'; +$lang['e_labelpage'] = 'Stranica s labelama %s nije nađena'; +$lang['e_required'] = '"%s" je obvezan'; +$lang['e_match'] = '"%s" nije ispravno popunjen. %s'; +$lang['checkagainst'] = '(Provjereno prema /%s/i)'; +$lang['e_email'] = '"%s" treba biti valjana adresa e-pošte.'; +$lang['e_numeric'] = '"%s" treba biti broj.'; +$lang['e_date'] = '"%s" treba biti valjani datum u obliku gggg-mm-dd.'; +$lang['e_time'] = '"%s" treba biti u valjanom obliku (h)h:mm(:ss).'; +$lang['e_user'] = '"%s" treba biti ime postojećeg korisnika.'; +$lang['e_users'] = '"%s" treba biti zarezom odvojena lista imena postojećih korisnika.'; +$lang['e_min'] = '"%s" treba biti veći od %s.'; +$lang['e_max'] = '"%s" treba biti manji od %s.'; +$lang['e_pagename'] = 'Nedostaje ime stranice.'; +$lang['e_pageexists'] = 'Strnaica "%s" već postoji. Molimo odaberite drugo ime stranice.'; +$lang['e_template'] = 'Nemogu pročitati predložak "%s". Možda ne postoji ili nemate pravo čitanja?'; +$lang['e_denied'] = 'Nije Vam dopušteno stvaranje ove stranice, možda ste se zaboravili prijaviti?'; +$lang['mailsubject'] = 'Podaci proslijeđeni u %s'; +$lang['mailintro'] = 'Slijedeći podaci su proslijeđeni u %s.'; +$lang['mail_thanks'] = 'Vaši podaci su uspješno poslani. Hvala.'; +$lang['template_thanks'] = 'Stranica je kreirana, slijedi vezu za njeno otvaranje.'; +$lang['summary'] = 'Kreirano iz forme u %s'; +$lang['attachmentMailEmpty'] = '(datoteka nije poslana)'; +$lang['attachmentMailToLarge'] = '(datoteka prevelika za prilog pošte)'; +$lang['attachmentMailToLarge_userinfo'] = 'datoteka "%s" prevelika za prilog pošte (>%s) (pošta je ipak poslana)'; +$lang['submit'] = 'Proslijedi'; diff --git a/platform/www/lib/plugins/bureaucracy/lang/hr/settings.php b/platform/www/lib/plugins/bureaucracy/lang/hr/settings.php new file mode 100644 index 0000000..d9df8dd --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/lang/hr/settings.php @@ -0,0 +1,9 @@ + + */ +$lang['runas'] = 'Utječe na mod predloška. Koristi ove (virtualne) ovlasti kada provjeravaš ACL za čitanje predloška i stvaranje stranice.'; +$lang['maxEmailAttachmentSize'] = 'Maksimalna veličina priloga pošti u Bajtovima. (po datoteci)'; diff --git a/platform/www/lib/plugins/bureaucracy/lang/it/lang.php b/platform/www/lib/plugins/bureaucracy/lang/it/lang.php new file mode 100644 index 0000000..dcbbd0c --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/lang/it/lang.php @@ -0,0 +1,19 @@ + + */ +$lang['e_unknowntype'] = '"%s" という型はありません。'; +$lang['e_unknownaction'] = '不明なアクション「%s」'; +$lang['e_missingargs'] = '%s %s には引数が十分ではありません。'; +$lang['e_noaction'] = 'action が定義されていません - どこにデータを送信するのですか?'; +$lang['e_mail'] = 'データの送信について何かがおかしいです。'; +$lang['e_unknownconstraint'] = '%s という項目制約がありません。'; +$lang['e_labelpage'] = '%s という Labelpage がありません。'; +$lang['e_required'] = '"%s" が必要です。'; +$lang['e_match'] = '"%s" が正しく記入されていません。%s'; +$lang['checkagainst'] = '(/%s/i と照合)'; +$lang['e_email'] = '"%s" は有効なメールアドレスである必要があります。'; +$lang['e_numeric'] = '"%s" は数字である必要があります。'; +$lang['e_date'] = '"%s" は yyyy-mm-dd 形式の日付である必要があります。'; +$lang['e_time'] = '「%s」は、型 (h)h:mm(:ss) に沿った適切な時刻である必要があります。'; +$lang['e_user'] = '"%s" 既存のユーザー名である必要があります。'; +$lang['e_users'] = '"%s" 既存のユーザー名のカンマ区切り一覧である必要があります。'; +$lang['e_min'] = '"%s" は %s より大きい必要があります。'; +$lang['e_max'] = '"%s" は %s より小さい必要があります。'; +$lang['e_pagename'] = 'ページ名がありません。'; +$lang['e_pageexists'] = '"%s" というページは既に存在します。別のページ名を選んで下さい。'; +$lang['e_template'] = '"%s" というテンプレートが読めません。存在しないか読み込み権限がないのではないですか?'; +$lang['e_denied'] = 'このページの作成は許可されません。ログインし忘れていませんか?'; +$lang['mailsubject'] = 'フォームのデータは %s へ送信されました。'; +$lang['mailintro'] = '以下のデータは %s に送信されました。'; +$lang['mail_thanks'] = 'データは正常に送信されました。ありがとう。'; +$lang['template_thanks'] = 'ページは作成されました。開くためにリンクをたどってください。'; +$lang['summary'] = '%s のフォームから作成されました。'; +$lang['attachmentMailEmpty'] = '(ファイル未選択)'; +$lang['attachmentMailToLarge'] = '(メールに添付するにはファイルが大き過ぎます)'; +$lang['attachmentMailToLarge_userinfo'] = 'ファイル「%s」はメールに添付するには大き過ぎます(>%s)(メール自体は送信されました)'; +$lang['submit'] = '送信'; diff --git a/platform/www/lib/plugins/bureaucracy/lang/ja/settings.php b/platform/www/lib/plugins/bureaucracy/lang/ja/settings.php new file mode 100644 index 0000000..ae1478a --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/lang/ja/settings.php @@ -0,0 +1,9 @@ + + */ +$lang['runas'] = 'テンプレートモードに影響があります。テンプレートを読み込み、ページを作成するために ACL チェックする場合、この(仮想)ユーザーの権限を使用してください。'; +$lang['maxEmailAttachmentSize'] = 'メールに添付するファイルの最大サイズ(バイト数/1ファイルごと)'; diff --git a/platform/www/lib/plugins/bureaucracy/lang/lv/lang.php b/platform/www/lib/plugins/bureaucracy/lang/lv/lang.php new file mode 100644 index 0000000..167971e --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/lang/lv/lang.php @@ -0,0 +1,30 @@ + + */ +$lang['e_unknowntype'] = 'Onbekend type "%s"'; +$lang['e_unknownaction'] = 'Onbekende actie "%s"'; +$lang['e_missingargs'] = 'Onvoldoende argumenten voor %s %s'; +$lang['e_noaction'] = 'Geen aktie opgegeven - waar moeten de gegevens heen?'; +$lang['e_mail'] = 'Het versturen van de gegevens is mislukt'; +$lang['e_unknownconstraint'] = 'Onbekende veld voorwaarde %s'; +$lang['e_labelpage'] = 'Labelpagina %s is niet gevonden'; +$lang['e_required'] = '"%s" is verplicht'; +$lang['e_match'] = '"%s" heeft een ongeldige waarde. %s'; +$lang['checkagainst'] = '(Moet voldoen aan /%s/i)'; +$lang['e_email'] = '"%s" moet een geldig e-mail adres zijn.'; +$lang['e_numeric'] = '"%s" moet een nummer zijn.'; +$lang['e_date'] = '"%s" moet een geldige datum zijn in het formaat jjjj-mm-dd.'; +$lang['e_time'] = '"%s" moet een geldige tijdstip zijn in het formaat (u)u:mm(:ss)'; +$lang['e_user'] = '"%s" moet de naam van een bestaande gebruiker zijn.'; +$lang['e_users'] = '"%s" moet een komma-gescheiden lijst van bestaande gebruikers zijn.'; +$lang['e_min'] = '"%s" moet groter zijn dan %s.'; +$lang['e_max'] = '"%s" moet kleiner zijn dan %s.'; +$lang['e_pagename'] = 'Pagina naam ontbreekt.'; +$lang['e_pageexists'] = 'De pagina "%s" bestaat al. Kies een andere pagina naam.'; +$lang['e_template'] = 'Kon de template "%s" niet lezen. wellicht bestaat de pagina niet of zijn de rechten onvoldoende?'; +$lang['e_denied'] = 'Onvoldoende rechten om deze pagina te maken, niet ingelogd?'; +$lang['mailsubject'] = 'Formulier gegevens verstuurd op %s'; +$lang['mailintro'] = 'De volgende gegevens zijn verstuurd op %s.'; +$lang['mail_thanks'] = 'De gegevens zijn verstuurt. Bedankt.'; +$lang['template_thanks'] = 'De pagina is aangemaakt, volg de link om hem te openen.'; +$lang['summary'] = 'Gemaakt door het formulier op %s'; +$lang['attachmentMailEmpty'] = '(bestand niet ingediend)'; +$lang['attachmentMailToLarge'] = '(bestand te groot voor een e-mailbijlage)'; +$lang['attachmentMailToLarge_userinfo'] = 'bestand "%s" te groot voor de e-mailbijlage (>%s) (e-mail is niettemin verstuurd)'; +$lang['submit'] = 'Submit'; diff --git a/platform/www/lib/plugins/bureaucracy/lang/nl/settings.php b/platform/www/lib/plugins/bureaucracy/lang/nl/settings.php new file mode 100644 index 0000000..9a10022 --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/lang/nl/settings.php @@ -0,0 +1,9 @@ + + */ +$lang['runas'] = 'Gebruikt in de template mode. Gebruik de rechten van deze (virtuele) gebruiker bij het controleren van de ACL gebruiker voor het lezen van templates en het maken van pagina\'s'; +$lang['maxEmailAttachmentSize'] = 'Max grootte van e-mailbijlages in Bytes. (per bestand)'; diff --git a/platform/www/lib/plugins/bureaucracy/lang/no/lang.php b/platform/www/lib/plugins/bureaucracy/lang/no/lang.php new file mode 100644 index 0000000..27916f4 --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/lang/no/lang.php @@ -0,0 +1,39 @@ + + */ +$lang['e_unknowntype'] = 'Tipo desconhecido "%s"'; +$lang['e_unknownaction'] = 'Ação desconhecida "%s"'; +$lang['e_missingargs'] = 'Argumentos insuficientes para %s %s'; +$lang['e_noaction'] = 'Nenhuma ação definida - para onde os dados devem ser enviados?'; +$lang['e_mail'] = 'Algo deu errado ao enviar esses dados'; +$lang['e_unknownconstraint'] = 'Restrição de campo desconhecida %s'; +$lang['e_labelpage'] = 'Labelpage %s não encontrada'; +$lang['e_required'] = '"%s" é obrigatório'; +$lang['e_match'] = '"%s" não foi preenchido corretamente. %s'; +$lang['checkagainst'] = '(Verificado contra /%s/i)'; +$lang['e_email'] = '"%s" precisa ser um endereço de email válido.'; +$lang['e_numeric'] = '"%s" precisa ser um número.'; +$lang['e_date'] = '"%s" precisa ser uma data válida no formato aaaa-mm-dd.'; +$lang['e_time'] = '"%s" precisa ser um horário válido no formato (h)h:mm:(:ss).'; +$lang['e_user'] = '"%s" precisa ser o nome de um usuário existente.'; +$lang['e_users'] = '"%s" precisa ser uma lista separada por vírgulas de nomes de usuários existentes.'; +$lang['e_min'] = '"%s" precisa ser maior que %s.'; +$lang['e_max'] = '"%s" precisa ser menor que %s.'; +$lang['e_pageexists'] = 'A página "%s" já existe. Por favor, escolha um nome diferente para a página.'; +$lang['e_template'] = 'Não foi possível ler o modelo "%s". Talvez ele não exista ou você não tenha permissões de leitura?'; +$lang['e_denied'] = 'Você não está autorizado a criar esta página. Talvez tenha esquecido de entrar?'; +$lang['mailsubject'] = 'Dados do formulário enviados às %s'; +$lang['mailintro'] = 'Os dados a seguir foram enviados em %s.'; +$lang['mail_thanks'] = 'Seus dados foram enviados com sucesso. Obrigado.'; +$lang['template_thanks'] = 'A página foi criada, siga o link para abri-la.'; +$lang['summary'] = 'Criado do formulário às %s.'; +$lang['attachmentMailEmpty'] = '(arquivo não enviado)'; +$lang['attachmentMailToLarge'] = '(arquivo muito grande para anexar ao email)'; +$lang['attachmentMailToLarge_userinfo'] = 'arquivo "%s" é muito grande para anexar ao email (>%s) (email enviado mesmo assim)'; +$lang['submit'] = 'Enviar'; diff --git a/platform/www/lib/plugins/bureaucracy/lang/pt/settings.php b/platform/www/lib/plugins/bureaucracy/lang/pt/settings.php new file mode 100644 index 0000000..174eb1c --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/lang/pt/settings.php @@ -0,0 +1,9 @@ + + */ +$lang['runas'] = 'Afeta o modo template. Use essas permissões (virtuais) de usuário quando checar ACLs para ler modelos e criar páginas.'; +$lang['maxEmailAttachmentSize'] = 'Tamanho máximo de anexos em bytes. (por arquivo)'; diff --git a/platform/www/lib/plugins/bureaucracy/lang/ru/lang.php b/platform/www/lib/plugins/bureaucracy/lang/ru/lang.php new file mode 100644 index 0000000..4981407 --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/lang/ru/lang.php @@ -0,0 +1,38 @@ + + */ +$lang['e_unknowntype'] = 'Неизвестный тип "%s"'; +$lang['e_unknownaction'] = 'Неизвестное действие "%s"'; +$lang['e_missingargs'] = 'Недостаточно аргументов для %s %s'; +$lang['e_noaction'] = 'Не указано действие - куда должны быть отправить данные?'; +$lang['e_mail'] = 'Произошла ошибка при отправке данных'; +$lang['e_unknownconstraint'] = 'Неизвестный ограничитель поля %s'; +$lang['e_labelpage'] = 'Метка страницы %s не найдена'; +$lang['e_required'] = '"%s" данное поле обязательно для заполнения'; +$lang['e_match'] = '"%s" заполнено неверно. %s'; +$lang['checkagainst'] = '(Checked against /%s/i)'; +$lang['e_email'] = '"%s" данное поле должно содержать правильный адрес электронной почты.'; +$lang['e_numeric'] = '"%s" данное поле должно содержать число.'; +$lang['e_date'] = '"%s" должно быть допустимой датой в формате гггг-мм-дд.'; +$lang['e_time'] = '"%s" должно быть допустимым временем в формате (ч)ч:мм(:сс).'; +$lang['e_user'] = '"%s" должно быть именем существующего пользователя.'; +$lang['e_users'] = '"%s" должно быть разделенным запятыми списком имен существующих пользователей.'; +$lang['e_min'] = '"%s" данное поле должно быть больше, чем %s.'; +$lang['e_max'] = '"%s" данное поле должно быть меньше, чем %s.'; +$lang['e_pagename'] = 'Отсутствует имя страницы.'; +$lang['e_pageexists'] = 'Страница "%s" уже существует. Пожалуйста, выберите другое имя.'; +$lang['e_template'] = 'Невозможно прочитать шаблон "%s". Возможно, он не существует, или у вас не хватает прав для чтения?'; +$lang['e_denied'] = 'Вам не разрешено создавать эту страницу, возможно, вы забыли войти?'; +$lang['mailsubject'] = 'Данные формы отправлены с %s'; +$lang['mailintro'] = 'Следующие данные отправлены %s.'; +$lang['mail_thanks'] = 'Ваши данные отправлены успешно. Спасибо.'; +$lang['template_thanks'] = 'Страница создана, следуйте по ссылке, чтобы открыть её.'; +$lang['summary'] = 'Создано по форме с %s'; +$lang['attachmentMailEmpty'] = '(файл не отправлен)'; +$lang['attachmentMailToLarge'] = '(файл слишком большой для почтового вложения)'; +$lang['attachmentMailToLarge_userinfo'] = 'файл "%s" слишком большой для почтового вложения (>%s) (но сообщение было отправлено)'; +$lang['submit'] = 'Отправить'; diff --git a/platform/www/lib/plugins/bureaucracy/lang/ru/settings.php b/platform/www/lib/plugins/bureaucracy/lang/ru/settings.php new file mode 100644 index 0000000..ab9a8fc --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/lang/ru/settings.php @@ -0,0 +1,9 @@ + + */ +$lang['runas'] = 'Использовать права (виртуального) пользователя при проверке доступа для чтения шаблонов и создания страниц.'; +$lang['maxEmailAttachmentSize'] = 'Макс. размер почтовых вложений в байтах. (на файл)'; diff --git a/platform/www/lib/plugins/bureaucracy/lang/zh/lang.php b/platform/www/lib/plugins/bureaucracy/lang/zh/lang.php new file mode 100644 index 0000000..84d6c5b --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/lang/zh/lang.php @@ -0,0 +1,39 @@ + + **/ + +jQuery(function () { + + jQuery('form.bureaucracy__plugin').each(function () { + + //show/hide fieldset and trigger depending children + function updateFieldset(input) { + jQuery.each(jQuery(input).data('dparray'), function (i, dp) { + var showOrHide = + input.parentNode.parentNode.style.display !== 'none' && // input/checkbox is displayed AND + ((input.checked === dp.tval) || // ( checkbox is checked + (input.type !== 'checkbox' && (dp.tval === true && input.value !== '')) || // OR no checkbox, but input is set + input.value === dp.tval); // OR input === dp.tval ) + + dp.fset.toggle(showOrHide); + + dp.fset.find('input,select') + .each(function () { + //toggle required attribute + var $inputelem = jQuery(this); + if($inputelem.hasClass('required')) { + if(showOrHide) { + $inputelem.attr('required', 'required'); + } else { + $inputelem.removeAttr('required') + } + } + //update dependencies + if ($inputelem.data('dparray')) { + $inputelem.change(); + } + }); + }); + } + + //look for p (with info about controller) in depending fieldsets + jQuery('p.bureaucracy_depends', this) + .each(function () { + //get controller info + var fname = jQuery(this).find('span.bureaucracy_depends_fname').html(), + fvalue = jQuery(this).find('span.bureaucracy_depends_fvalue'); + fvalue = (fvalue.length ? fvalue.html() : true); + + //get controller field and add info and change event to the input that controls depending fieldset + var fieldsetinfo = { + fset: jQuery(this).parent(), + tval: fvalue + }; + + jQuery("label") + .has(":first-child:contains('" + fname + "')").first() + .find("select,input:last") //yesno field contains first a hidden input + .each(function () { + if (!jQuery(this).data('dparray')) { + jQuery(this).data('dparray', [fieldsetinfo]); + } else { + jQuery(this).data('dparray').push(fieldsetinfo); + } + }) + .bind('change keyup', function () { + updateFieldset(this); + }) + .change(); + + }) + .hide(); //hide p.bureaucracy_depends in fieldset + + }); +}); diff --git a/platform/www/lib/plugins/bureaucracy/script/user.js b/platform/www/lib/plugins/bureaucracy/script/user.js new file mode 100755 index 0000000..9d5d806 --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/script/user.js @@ -0,0 +1,90 @@ +/** + * Provides a list of matching user names while user inputs into a userpicker + * + * @author Adrian Lang + * @author Gerrit Uitslag + */ +jQuery(function () { + /** + * Ajax request for user suggestions + * + * @param {Object} request object, with single 'term' property + * @param {Function} response callback, argument: the data array to suggest to the user. + * @param {Function} getterm callback, argument: the request Object, returns: search term + */ + function ajaxsource(request, response, getterm) { + jQuery.getJSON( + DOKU_BASE + 'lib/exe/ajax.php', { + call: 'bureaucracy_user_field', + search: getterm(request) + }, function (data) { + response(jQuery.map(data, function (name, user) { + return { + label: name + ' (' + user + ')', + value: user + } + })) + } + ); + } + + function split(val) { + return val.split(/,\s*/); + } + + function extractLast(term) { + return split(term).pop(); + } + + + /** + * pick one user + */ + jQuery(".userpicker").autocomplete({ + source: function (request, response) { + ajaxsource(request, response, function (req) { + return req.term + }) + } + }); + + /** + * pick one or more users + */ + jQuery(".userspicker") + // don't navigate away from the field on tab when selecting an item + .bind("keydown", function (event) { + if (event.keyCode === jQuery.ui.keyCode.TAB && + jQuery(this).data("ui-autocomplete").menu.active) { + event.preventDefault(); + } + }) + .autocomplete({ + minLength: 0, + source: function (request, response) { + ajaxsource(request, response, function (req) { + return extractLast(req.term) + }) + }, + search: function () { + // custom minLength + var term = extractLast(this.value); + return term.length >= 2; + }, + focus: function () { + // prevent value inserted on focus + return false; + }, + select: function (event, ui) { + var terms = split(this.value); + // remove the current input + terms.pop(); + // add the selected item + terms.push(ui.item.value); + // add placeholder to get the comma-and-space at the end + terms.push(""); + this.value = terms.join(", "); + return false; + } + }); +}); diff --git a/platform/www/lib/plugins/bureaucracy/style.css b/platform/www/lib/plugins/bureaucracy/style.css new file mode 100644 index 0000000..966de61 --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/style.css @@ -0,0 +1,101 @@ +/* Success message */ +.dokuwiki div.bureaucracy__plugin { + width: 50%; + font-size: 120%; + padding: 2em; +} + +/* Form */ +.dokuwiki form.bureaucracy__plugin { + width: 100%; + text-align: center; + margin: 2em 0; + display: block; +} + +.dokuwiki form.bureaucracy__plugin p { + font-size: 90%; + margin-top: 0.5em; +} + +.dokuwiki form.bureaucracy__plugin fieldset { + width: 80%; + text-align: left; + margin-top: 0.5em; + margin-bottom: 0.5em; +} + +.dokuwiki form.bureaucracy__plugin label { + display: block; + text-align: right; + line-height: 2em; +} + +.dokuwiki form.bureaucracy__plugin label>span { + display: inline-block; + width: 47%; + line-height: normal; +} +.dokuwiki form.bureaucracy__plugin label.textareafield { + text-align: left; +} +.dokuwiki form.bureaucracy__plugin label.textareafield>span { + width: 100%; +} + +.dokuwiki form.bureaucracy__plugin label input.edit, +.dokuwiki form.bureaucracy__plugin label select { + width: 50%; +} +.dokuwiki form.bureaucracy__plugin label input.datepicker, +.dokuwiki form.bureaucracy__plugin label input.timefield { + width: 25%; + margin-right: 25%; +} + +.dokuwiki form.bureaucracy__plugin label textarea.edit { + width: 100%; +} +.dokuwiki form.bureaucracy__plugin label input[type=checkbox] { + width: 5%; + margin-right: 45%; +} + +.dokuwiki form.bureaucracy__plugin input.button { + margin: 3px 0 3px 50%; + display: block; +} +.dokuwiki form.bureaucracy__plugin label.radiolabel span{ + width: 100%; + text-align: left; +} +.dokuwiki form.bureaucracy__plugin label input[type=radio]~span { + width: 50%; + display: inline-block; + text-align: left; + line-height: normal; +} + +.dokuwiki form.bureaucracy__plugin label.bureaucracy_error span { + color: #F00; +} + +.dokuwiki form.bureaucracy__plugin #plugin__captcha_wrapper label { + text-align: left; +} +/*responsive - small screen*/ +@media (max-width: 480px) { + .dokuwiki form.bureaucracy__plugin label { + text-align: left; + } + .dokuwiki form.bureaucracy__plugin label>span { + width: 100%; + } + .dokuwiki form.bureaucracy__plugin input.button { + margin-left: 0; + } + .dokuwiki form.bureaucracy__plugin label .edit, + .dokuwiki form.bureaucracy__plugin label select { + width: 100% !important; + } +} \ No newline at end of file diff --git a/platform/www/lib/plugins/bureaucracy/syntax.php b/platform/www/lib/plugins/bureaucracy/syntax.php new file mode 100644 index 0000000..154a9ef --- /dev/null +++ b/platform/www/lib/plugins/bureaucracy/syntax.php @@ -0,0 +1,623 @@ + + * @author Adrian Lang + */ +// must be run within Dokuwiki +if(!defined('DOKU_INC')) die(); + +/** + * All DokuWiki plugins to extend the parser/rendering mechanism + * need to inherit from this class + */ +class syntax_plugin_bureaucracy extends DokuWiki_Syntax_Plugin { + + private $form_id = 0; + var $patterns = array(); + var $values = array(); + var $noreplace = null; + var $functions = array(); + + /** + * Prepare some replacements + */ + public function __construct() { + $this->prepareDateTimereplacements(); + $this->prepareNamespacetemplateReplacements(); + $this->prepareFunctions(); + } + + /** + * What kind of syntax are we? + */ + public function getType() { + return 'substition'; + } + + /** + * What about paragraphs? + */ + public function getPType() { + return 'block'; + } + + /** + * Where to sort in? + */ + public function getSort() { + return 155; + } + + /** + * Connect pattern to lexer + * + * @param string $mode + */ + public function connectTo($mode) { + $this->Lexer->addSpecialPattern('
.*?
', $mode, 'plugin_bureaucracy'); + } + + /** + * Handler to prepare matched data for the rendering process + * + * @param string $match The text matched by the patterns + * @param int $state The lexer state for the match + * @param int $pos The character position of the matched text + * @param Doku_Handler $handler The Doku_Handler object + * @return bool|array Return an array with all data you want to use in render, false don't add an instruction + */ + public function handle($match, $state, $pos, Doku_Handler $handler) { + $match = substr($match, 6, -7); // remove form wrap + $lines = explode("\n", $match); + $actions = $rawactions = array(); + $thanks = ''; + $labels = ''; + + // parse the lines into an command/argument array + $cmds = array(); + while(count($lines) > 0) { + $line = trim(array_shift($lines)); + if(!$line) continue; + $args = $this->_parse_line($line, $lines); + $args[0] = $this->_sanitizeClassName($args[0]); + + if(in_array($args[0], array('action', 'thanks', 'labels'))) { + if(count($args) < 2) { + msg(sprintf($this->getLang('e_missingargs'), hsc($args[0]), hsc($args[1])), -1); + continue; + } + + // is action element? + if($args[0] == 'action') { + array_shift($args); + $rawactions[] = array('type' => array_shift($args), 'argv' => $args); + continue; + } + + // is thank you text? + if($args[0] == 'thanks') { + $thanks = $args[1]; + continue; + } + + // is labels? + if($args[0] == 'labels') { + $labels = $args[1]; + continue; + } + } + + if(strpos($args[0], '_') === false) { + $name = 'bureaucracy_field' . $args[0]; + } else { + //name convention: plugin_componentname + $name = $args[0]; + } + + /** @var helper_plugin_bureaucracy_field $field */ + $field = $this->loadHelper($name, false); + if($field && is_a($field, 'helper_plugin_bureaucracy_field')) { + $field->initialize($args); + $cmds[] = $field; + } else { + $evdata = array('fields' => &$cmds, 'args' => $args); + $event = new Doku_Event('PLUGIN_BUREAUCRACY_FIELD_UNKNOWN', $evdata); + if($event->advise_before()) { + msg(sprintf($this->getLang('e_unknowntype'), hsc($name)), -1); + } + } + + } + + // check if action is available + foreach($rawactions as $action) { + $action['type'] = $this->_sanitizeClassName($action['type']); + + if(strpos($action['type'], '_') === false) { + $action['actionname'] = 'bureaucracy_action' . $action['type']; + } else { + //name convention for other plugins: plugin_componentname + $action['actionname'] = $action['type']; + } + + list($plugin, $component) = explode('_', $action['actionname']); + $alternativename = $action['type'] . '_'. $action['type']; + + // bureaucracy_action or _ + if(!plugin_isdisabled($action['actionname']) || @file_exists(DOKU_PLUGIN . $plugin . '/helper/' . $component . '.php')) { + $actions[] = $action; + + // shortcut for other plugins with component name _ + } elseif(plugin_isdisabled($alternativename) || !@file_exists(DOKU_PLUGIN . $action['type'] . '/helper/' . $action['type'] . '.php')) { + $action['actionname'] = $alternativename; + $actions[] = $action; + + // not found + } else { + $evdata = array('actions' => &$actions, 'action' => $action); + $event = new Doku_Event('PLUGIN_BUREAUCRACY_ACTION_UNKNOWN', $evdata); + if($event->advise_before()) { + msg(sprintf($this->getLang('e_unknownaction'), hsc($action['actionname'])), -1); + } + } + } + + // action(s) found? + if(count($actions) < 1) { + msg($this->getLang('e_noaction'), -1); + } + + // set thank you message + if(!$thanks) { + $thanks = ""; + foreach($actions as $action) { + $thanks .= $this->getLang($action['type'] . '_thanks'); + } + } else { + $thanks = hsc($thanks); + } + return array( + 'fields' => $cmds, + 'actions' => $actions, + 'thanks' => $thanks, + 'labels' => $labels + ); + } + + /** + * Handles the actual output creation. + * + * @param string $format output format being rendered + * @param Doku_Renderer $R the current renderer object + * @param array $data data created by handler() + * @return boolean rendered correctly? (however, returned value is not used at the moment) + */ + public function render($format, Doku_Renderer $R, $data) { + if($format != 'xhtml') return false; + $R->info['cache'] = false; // don't cache + + /** + * replace some time and name placeholders in the default values + * @var $field helper_plugin_bureaucracy_field + */ + foreach($data['fields'] as &$field) { + if(isset($field->opt['value'])) { + $field->opt['value'] = $this->replace($field->opt['value']); + } + } + + if($data['labels']) $this->loadlabels($data); + + $this->form_id++; + if(isset($_POST['bureaucracy']) && checkSecurityToken() && $_POST['bureaucracy']['$$id'] == $this->form_id) { + $success = $this->_handlepost($data); + if($success !== false) { + $R->doc .= '
' . $success . '
'; + return true; + } + } + + $R->doc .= $this->_htmlform($data['fields']); + + return true; + } + + /** + * Initializes the labels, loaded from a defined labelpage + * + * @param array $data all data passed to render() + */ + protected function loadlabels(&$data) { + global $INFO; + $labelpage = $data['labels']; + $exists = false; + resolve_pageid($INFO['namespace'], $labelpage, $exists); + if(!$exists) { + msg(sprintf($this->getLang('e_labelpage'), html_wikilink($labelpage)), -1); + return; + } + + // parse simple list (first level cdata only) + $labels = array(); + $instructions = p_cached_instructions(wikiFN($labelpage)); + $inli = 0; + $item = ''; + foreach($instructions as $instruction) { + if($instruction[0] == 'listitem_open') { + $inli++; + continue; + } + if($inli === 1 && $instruction[0] == 'cdata') { + $item .= $instruction[1][0]; + } + if($instruction[0] == 'listitem_close') { + $inli--; + if($inli === 0) { + list($k, $v) = explode('=', $item, 2); + $k = trim($k); + $v = trim($v); + if($k && $v) $labels[$k] = $v; + $item = ''; + } + } + } + + // apply labels to all fields + $len = count($data['fields']); + for($i = 0; $i < $len; $i++) { + if(isset($data['fields'][$i]->depends_on)) { + // translate dependency on fieldsets + $label = $data['fields'][$i]->depends_on[0]; + if(isset($labels[$label])) { + $data['fields'][$i]->depends_on[0] = $labels[$label]; + } + + } else if(isset($data['fields'][$i]->opt['label'])) { + // translate field labels + $label = $data['fields'][$i]->opt['label']; + if(isset($labels[$label])) { + $data['fields'][$i]->opt['display'] = $labels[$label]; + } + } + } + + if(isset($data['thanks'])) { + if(isset($labels[$data['thanks']])) { + $data['thanks'] = $labels[$data['thanks']]; + } + } + + } + + /** + * Validate posted data, perform action(s) + * + * @param array $data all data passed to render() + * @return bool|string + * returns thanks message when fields validated and performed the action(s) succesfully; + * otherwise returns false. + */ + private function _handlepost($data) { + $success = true; + foreach($data['fields'] as $index => $field) { + /** @var $field helper_plugin_bureaucracy_field */ + + $isValid = true; + if($field->getFieldType() === 'file') { + $file = array(); + foreach($_FILES['bureaucracy'] as $key => $value) { + $file[$key] = $value[$index]; + } + $isValid = $field->handle_post($file, $data['fields'], $index, $this->form_id); + + } elseif($field->getFieldType() === 'fieldset' || !$field->hidden) { + $isValid = $field->handle_post($_POST['bureaucracy'][$index], $data['fields'], $index, $this->form_id); + } + + if(!$isValid) { + // Do not return instantly to allow validation of all fields. + $success = false; + } + } + if(!$success) { + return false; + } + + $thanks_array = array(); + + foreach($data['actions'] as $actionData) { + /** @var helper_plugin_bureaucracy_action $action */ + $action = $this->loadHelper($actionData['actionname'], false); + + // action helper found? + if(!$action) { + msg(sprintf($this->getLang('e_unknownaction'), hsc($actionData['actionname'])), -1); + return false; + } + + try { + $thanks_array[] = $action->run( + $data['fields'], + $data['thanks'], + $actionData['argv'] + ); + } catch(Exception $e) { + msg($e->getMessage(), -1); + return false; + } + } + + // Perform after_action hooks + foreach($data['fields'] as $field) { + $field->after_action(); + } + + // create thanks string + $thanks = implode('', array_unique($thanks_array)); + + return $thanks; + } + + /** + * Create the form + * + * @param helper_plugin_bureaucracy_field[] $fields array with form fields + * @return string html of the form + */ + private function _htmlform($fields) { + global $INFO; + + $form = new Doku_Form(array('class' => 'bureaucracy__plugin', + 'id' => 'bureaucracy__plugin' . $this->form_id, + 'enctype' => 'multipart/form-data')); + $form->addHidden('id', $INFO['id']); + $form->addHidden('bureaucracy[$$id]', $this->form_id); + + foreach($fields as $id => $field) { + $field->renderfield(array('name' => 'bureaucracy[' . $id . ']'), $form, $this->form_id); + } + + return $form->getForm(); + } + + /** + * Parse a line into (quoted) arguments + * Splits line at spaces, except when quoted + * + * @author William Fletcher + * + * @param string $line line to parse + * @param array $lines all remaining lines + * @return array with all the arguments + */ + private function _parse_line($line, &$lines) { + $args = array(); + $inQuote = false; + $escapedQuote = false; + $arg = ''; + do { + $len = strlen($line); + for($i = 0; $i < $len; $i++) { + if($line[$i] == '"') { + if($inQuote) { + if($escapedQuote) { + $arg .= '"'; + $escapedQuote = false; + continue; + } + if($i + 1 < $len && $line[$i + 1] == '"') { + $escapedQuote = true; + continue; + } + array_push($args, $arg); + $inQuote = false; + $arg = ''; + continue; + } else { + $inQuote = true; + continue; + } + } else if($line[$i] == ' ') { + if($inQuote) { + $arg .= ' '; + continue; + } else { + if(strlen($arg) < 1) continue; + array_push($args, $arg); + $arg = ''; + continue; + } + } + $arg .= $line[$i]; + } + if(!$inQuote || count($lines) === 0) break; + $line = array_shift($lines); + $arg .= "\n"; + } while(true); + if(strlen($arg) > 0) array_push($args, $arg); + return $args; + } + + /** + * Clean class name + * + * @param string $classname + * @return string cleaned name + */ + private function _sanitizeClassName($classname) { + return preg_replace('/[^\w\x7f-\xff]/', '', strtolower($classname)); + } + + /** + * Save content in tags into $this->noreplace + * + * @param string $input The text to work on + */ + protected function noreplace_save($input) { + $pattern = '/(.*?)<\/noreplace>/is'; + //save content of tags + preg_match_all($pattern, $input, $matches); + $this->noreplace = $matches[1]; + } + + /** + * Apply replacement patterns and values as prepared earlier + * (disable $strftime to prevent double replacements with default strftime() replacements in nstemplate) + * + * @param string $input The text to work on + * @param bool $strftime Apply strftime() replacements + * @return string processed text + */ + function replace($input, $strftime = true) { + //in helper_plugin_struct_field::setVal $input can be an array + //just return $input in that case + if (!is_string($input)) return $input; + if (is_null($this->noreplace)) $this->noreplace_save($input); + + foreach ($this->values as $label => $value) { + $pattern = $this->patterns[$label]; + if (is_callable($value)) { + $input = preg_replace_callback( + $pattern, + $value, + $input + ); + } else { + $input = preg_replace($pattern, $value, $input); + } + + } + + if($strftime) { + $input = preg_replace_callback( + '/%./', + function($m){return strftime($m[0]);}, + $input + ); + } + // user syntax: %%.(.*?) + // strftime() is already applied once, so syntax is at this point: %.(.*?) + $input = preg_replace_callback( + '/@DATE\((.*?)(?:,\s*(.*?))?\)@/', + array($this, 'replacedate'), + $input + ); + + //run functions + foreach ($this->functions as $name => $callback) { + $pattern = '/@' . preg_quote($name) . '\((.*?)\)@/'; + if (is_callable($callback)) { + $input = preg_replace_callback($pattern, function ($matches) use ($callback) { + return call_user_func($callback, $matches[1]); + }, $input); + } + } + + //replace tags with their original content + $pattern = '/.*?<\/noreplace>/is'; + if (is_array($this->noreplace)) foreach ($this->noreplace as $nr) { + $input = preg_replace($pattern, $nr, $input, 1); + } + + return $input; + } + + /** + * (callback) Replace date by request datestring + * e.g. '%m(30-11-1975)' is replaced by '11' + * + * @param array $match with [0]=>whole match, [1]=> first subpattern, [2] => second subpattern + * @return string + */ + function replacedate($match) { + global $conf; + + //no 2nd argument for default date format + $match[2] = $match[2] ?? $conf['dformat']; + + return strftime($match[2], strtotime($match[1])); + } + + /** + * Same replacements as applied at template namespaces + * + * @see parsePageTemplate() + */ + function prepareNamespacetemplateReplacements() { + /* @var Input $INPUT */ + global $INPUT; + global $INFO; + global $USERINFO; + global $conf; + global $ID; + + $this->patterns['__formpage_id__'] = '/@FORMPAGE_ID@/'; + $this->patterns['__formpage_ns__'] = '/@FORMPAGE_NS@/'; + $this->patterns['__formpage_curns__'] = '/@FORMPAGE_CURNS@/'; + $this->patterns['__formpage_file__'] = '/@FORMPAGE_FILE@/'; + $this->patterns['__formpage_!file__'] = '/@FORMPAGE_!FILE@/'; + $this->patterns['__formpage_!file!__'] = '/@FORMPAGE_!FILE!@/'; + $this->patterns['__formpage_page__'] = '/@FORMPAGE_PAGE@/'; + $this->patterns['__formpage_!page__'] = '/@FORMPAGE_!PAGE@/'; + $this->patterns['__formpage_!!page__'] = '/@FORMPAGE_!!PAGE@/'; + $this->patterns['__formpage_!page!__'] = '/@FORMPAGE_!PAGE!@/'; + $this->patterns['__user__'] = '/@USER@/'; + $this->patterns['__name__'] = '/@NAME@/'; + $this->patterns['__mail__'] = '/@MAIL@/'; + $this->patterns['__date__'] = '/@DATE@/'; + + // replace placeholders + $localid = isset($INFO['id']) ? $INFO['id'] : $ID; + $file = noNS($localid); + $page = strtr($file, $conf['sepchar'], ' '); + $this->values['__formpage_id__'] = $localid; + $this->values['__formpage_ns__'] = getNS($localid); + $this->values['__formpage_curns__'] = curNS($localid); + $this->values['__formpage_file__'] = $file; + $this->values['__formpage_!file__'] = utf8_ucfirst($file); + $this->values['__formpage_!file!__'] = utf8_strtoupper($file); + $this->values['__formpage_page__'] = $page; + $this->values['__formpage_!page__'] = utf8_ucfirst($page); + $this->values['__formpage_!!page__'] = utf8_ucwords($page); + $this->values['__formpage_!page!__'] = utf8_strtoupper($page); + $this->values['__user__'] = $INPUT->server->str('REMOTE_USER'); + $this->values['__name__'] = $USERINFO['name'] ?? ''; + $this->values['__mail__'] = $USERINFO['mail'] ?? ''; + $this->values['__date__'] = strftime($conf['dformat']); + } + + /** + * Date time replacements + */ + function prepareDateTimereplacements() { + $this->patterns['__year__'] = '/@YEAR@/'; + $this->patterns['__month__'] = '/@MONTH@/'; + $this->patterns['__monthname__'] = '/@MONTHNAME@/'; + $this->patterns['__day__'] = '/@DAY@/'; + $this->patterns['__time__'] = '/@TIME@/'; + $this->patterns['__timesec__'] = '/@TIMESEC@/'; + $this->values['__year__'] = date('Y'); + $this->values['__month__'] = date('m'); + $this->values['__monthname__'] = date('B'); + $this->values['__day__'] = date('d'); + $this->values['__time__'] = date('H:i'); + $this->values['__timesec__'] = date('H:i:s'); + + } + + /** + * Functions that can be used after replacements + */ + function prepareFunctions() { + $this->functions['curNS'] = 'curNS'; + $this->functions['getNS'] = 'getNS'; + $this->functions['noNS'] = 'noNS'; + $this->functions['p_get_first_heading'] = 'p_get_first_heading'; + } +} diff --git a/platform/www/lib/plugins/master.zip b/platform/www/lib/plugins/master.zip deleted file mode 100644 index 0c9a008..0000000 Binary files a/platform/www/lib/plugins/master.zip and /dev/null differ diff --git a/platform/www/lib/plugins/phpwikify/LICENSE b/platform/www/lib/plugins/phpwikify/LICENSE new file mode 100644 index 0000000..d159169 --- /dev/null +++ b/platform/www/lib/plugins/phpwikify/LICENSE @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. diff --git a/platform/www/lib/plugins/phpwikify/README.md b/platform/www/lib/plugins/phpwikify/README.md new file mode 100644 index 0000000..2c02d9e --- /dev/null +++ b/platform/www/lib/plugins/phpwikify/README.md @@ -0,0 +1,2 @@ +# phpwikify +DokuWiki plugin allowing output of PHP scripts to be parsed diff --git a/platform/www/lib/plugins/phpwikify/manager.dat b/platform/www/lib/plugins/phpwikify/manager.dat new file mode 100644 index 0000000..6b2da1c --- /dev/null +++ b/platform/www/lib/plugins/phpwikify/manager.dat @@ -0,0 +1,2 @@ +downloadurl=https://github.com/trailjeep/dokuwiki-plugin-phpwikify/archive/master.zip +installed=Sat, 12 Mar 2022 01:41:43 +0000 diff --git a/platform/www/lib/plugins/phpwikify/plugin.info.txt b/platform/www/lib/plugins/phpwikify/plugin.info.txt new file mode 100644 index 0000000..dcc4ed1 --- /dev/null +++ b/platform/www/lib/plugins/phpwikify/plugin.info.txt @@ -0,0 +1,8 @@ +# General Plugin Info do not edit +base phpwikify +author Trailjeep +email trailjeep@gmail.com +date 2020-06-05 +name PHP Wikify +desc Allows one the possibility of having output of PHP scripts parsed +url https://www.dokuwiki.org/plugin:phpwikify diff --git a/platform/www/lib/plugins/phpwikify/syntax.php b/platform/www/lib/plugins/phpwikify/syntax.php new file mode 100644 index 0000000..a15ac82 --- /dev/null +++ b/platform/www/lib/plugins/phpwikify/syntax.php @@ -0,0 +1,53 @@ + + * @author Schplurtz le Déboulonné + * @author Trailjeep + */ + +// must be run within Dokuwiki +if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/'); +if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); +require_once(DOKU_PLUGIN.'syntax.php'); + +/** + * All DokuWiki plugins to extend the parser/rendering mechanism + * need to inherit from this class + */ +class syntax_plugin_phpwikify extends DokuWiki_Syntax_Plugin { + function syntax_plugin_phpwikify() { global $PARSER_MODES; $this->allowedModes = $PARSER_MODES['formatting']; } + function getType() { return "protected"; } + function getPType() { return "normal"; } + function getSort() { return 0; } + function connectTo( $mode ) { $this->Lexer->addEntryPattern("(?=.*?)",$mode,"plugin_phpwikify"); } + function postConnect() { $this->Lexer->addExitPattern( "","plugin_phpwikify"); } + + /** + * Handle the match + */ + function handle( $match, $state, $pos, Doku_Handler $handler ) { + switch($state) { + case DOKU_LEXER_UNMATCHED : + return array($state,$match); + } + } + + /** + * Create output + */ + function render( $mode, Doku_Renderer $renderer, $data ) { + if($mode == 'xhtml'){ + list($state, $data) = $data; + ob_start(); + eval( $data ); + $renderer->doc .= p_render( "xhtml", p_get_instructions( ob_get_contents() ), $info ); + ob_end_clean(); + return true; + } + return false; + } +} +//Setup VIM: ex: et ts=4 enc=utf-8 : diff --git a/platform/www/lib/plugins/wrap/.travis.yml b/platform/www/lib/plugins/wrap/.travis.yml new file mode 100644 index 0000000..a73697f --- /dev/null +++ b/platform/www/lib/plugins/wrap/.travis.yml @@ -0,0 +1,18 @@ +language: php +php: + - "7.2" + - "7.1" + - "7.0" + - "5.6" +env: + - DOKUWIKI=master + - DOKUWIKI=stable + - DOKUWIKI=old-stable +before_install: wget https://raw.github.com/splitbrain/dokuwiki-travis/master/travis.sh +install: sh travis.sh +before_script: + - wget https://phar.phpunit.de/phpunit-5.7.phar + - cd _test +script: + - if [ "$DOKUWIKI" != "old-stable" ]; then phpunit --stderr --group plugin_wrap; fi + - if [ "$DOKUWIKI" = "old-stable" ]; then php ../phpunit-5.7.phar --stderr --group plugin_wrap; fi diff --git a/platform/www/lib/plugins/wrap/COPYING b/platform/www/lib/plugins/wrap/COPYING new file mode 100644 index 0000000..d60c31a --- /dev/null +++ b/platform/www/lib/plugins/wrap/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/platform/www/lib/plugins/wrap/README b/platform/www/lib/plugins/wrap/README new file mode 100644 index 0000000..c0a1118 --- /dev/null +++ b/platform/www/lib/plugins/wrap/README @@ -0,0 +1 @@ +see plugin.info.txt \ No newline at end of file diff --git a/platform/www/lib/plugins/wrap/_test/wrap_syntax.test.php b/platform/www/lib/plugins/wrap/_test/wrap_syntax.test.php new file mode 100644 index 0000000..768c130 --- /dev/null +++ b/platform/www/lib/plugins/wrap/_test/wrap_syntax.test.php @@ -0,0 +1,243 @@ +pluginsEnabled[] = 'wrap'; + parent::setUp(); + } + + public function test_nestedheading() { + $instructions = p_get_instructions("\n==== Heading ====\n\nSome text\n"); + $expected = + array( + array( + 'document_start', + array(), + 0 + ), + array( + 'plugin', + array( + 'wrap_divwrap', + array( + DOKU_LEXER_ENTER, + '' + ), + 1 + ), + array( + 'header', + array( + 'Heading', + 3, + 8 + ), + 8 + ), + array( + 'plugin', + array( + 'wrap_closesection', + array(), + DOKU_LEXER_SPECIAL, + false + ), + 8 + ), + array( + 'p_open', + array(), + 8 + ), + array( + 'cdata', + array( + 'Some text' + ), + 27 + ), + array( + 'p_close', + array(), + 37 + ), + array( + 'plugin', + array( + 'wrap_divwrap', + array( + DOKU_LEXER_EXIT, + '' + ), + DOKU_LEXER_EXIT, + '' + ), + 37 + ), + array( + 'document_end', + array(), + 37 + ) + ); + $this->assertEquals($expected, $instructions); + } + + public function test_blocknesting() { + $instructions = p_get_instructions("\nFoo\n\n Bar\n"); + $expected = + array( + array( + 'document_start', + array(), + 0 + ), + array( + 'plugin', + array( + 'wrap_divwrap', + array( + DOKU_LEXER_ENTER, + '' + ), + 1 + ), + array( + 'p_open', + array( + ), + 1 + ), + array( + 'cdata', + array( + 'Foo' + ), + 8 + ), + array( + 'p_close', + array(), + 11 + ), + array( + 'p_open', + array( + ), + 11 + ), + array( + 'cdata', + array( + ' Bar' + ), + 13 + ), + array( + 'p_close', + array(), + 33 + ), + array( + 'plugin', + array( + 'wrap_divwrap', + array( + DOKU_LEXER_EXIT, + '' + ), + DOKU_LEXER_EXIT, + '' + ), + 33 + ), + array( + 'document_end', + array(), + 33 + ) + ); + $this->assertEquals($expected, $instructions); + } + + public function test_inlinenesting() { + $instructions = p_get_instructions("Foo Bar"); + $expected = + array( + array( + 'document_start', + array(), + 0 + ), + array( + 'p_open', + array( + ), + 0 + ), + array( + 'plugin', + array( + 'wrap_spanwrap', + array( + DOKU_LEXER_ENTER, + '' + ), + 1 + ), + array( + 'cdata', + array( + 'Foo Bar' + ), + 7 + ), + array( + 'plugin', + array( + 'wrap_spanwrap', + array( + DOKU_LEXER_EXIT, + '' + ), + DOKU_LEXER_EXIT, + '' + ), + 32 + ), + array( + 'cdata', + array( + '' + ), + 39 + ), + array( + 'p_close', + array(), + 39 + ), + array( + 'document_end', + array(), + 39 + ) + ); + $this->assertEquals($expected, $instructions); + } + +} \ No newline at end of file diff --git a/platform/www/lib/plugins/wrap/action.php b/platform/www/lib/plugins/wrap/action.php new file mode 100644 index 0000000..2a47fca --- /dev/null +++ b/platform/www/lib/plugins/wrap/action.php @@ -0,0 +1,152 @@ + + */ + +// must be run within Dokuwiki +if(!defined('DOKU_INC')) die(); + +if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); +require_once(DOKU_PLUGIN.'action.php'); + +class action_plugin_wrap extends DokuWiki_Action_Plugin { + + /** + * register the eventhandlers + * + * @author Andreas Gohr + */ + function register(Doku_Event_Handler $controller){ + $controller->register_hook('TOOLBAR_DEFINE', 'AFTER', $this, 'handle_toolbar', array ()); + $controller->register_hook('HTML_SECEDIT_BUTTON', 'BEFORE', $this, 'handle_secedit_button'); + } + + function handle_toolbar(Doku_Event $event, $param) { + $syntaxDiv = $this->getConf('syntaxDiv'); + $syntaxSpan = $this->getConf('syntaxSpan'); + + $event->data[] = array ( + 'type' => 'picker', + 'title' => $this->getLang('picker'), + 'icon' => '../../plugins/wrap/images/toolbar/picker.png', + 'list' => array( + array( + 'type' => 'format', + 'title' => $this->getLang('column'), + 'icon' => '../../plugins/wrap/images/toolbar/column.png', + 'open' => '<'.$syntaxDiv.' group>\n<'.$syntaxDiv.' half column>\n', + 'close' => '\n\n\n<'.$syntaxDiv.' half column>\n\n\n\n', + ), + array( + 'type' => 'format', + 'title' => $this->getLang('box'), + 'icon' => '../../plugins/wrap/images/toolbar/box.png', + 'open' => '<'.$syntaxDiv.' center round box 60%>\n', + 'close' => '\n\n', + ), + array( + 'type' => 'format', + 'title' => $this->getLang('info'), + 'icon' => '../../plugins/wrap/images/note/16/info.png', + 'open' => '<'.$syntaxDiv.' center round info 60%>\n', + 'close' => '\n\n', + ), + array( + 'type' => 'format', + 'title' => $this->getLang('tip'), + 'icon' => '../../plugins/wrap/images/note/16/tip.png', + 'open' => '<'.$syntaxDiv.' center round tip 60%>\n', + 'close' => '\n\n', + ), + array( + 'type' => 'format', + 'title' => $this->getLang('important'), + 'icon' => '../../plugins/wrap/images/note/16/important.png', + 'open' => '<'.$syntaxDiv.' center round important 60%>\n', + 'close' => '\n\n', + ), + array( + 'type' => 'format', + 'title' => $this->getLang('alert'), + 'icon' => '../../plugins/wrap/images/note/16/alert.png', + 'open' => '<'.$syntaxDiv.' center round alert 60%>\n', + 'close' => '\n\n', + ), + array( + 'type' => 'format', + 'title' => $this->getLang('help'), + 'icon' => '../../plugins/wrap/images/note/16/help.png', + 'open' => '<'.$syntaxDiv.' center round help 60%>\n', + 'close' => '\n\n', + ), + array( + 'type' => 'format', + 'title' => $this->getLang('download'), + 'icon' => '../../plugins/wrap/images/note/16/download.png', + 'open' => '<'.$syntaxDiv.' center round download 60%>\n', + 'close' => '\n\n', + ), + array( + 'type' => 'format', + 'title' => $this->getLang('todo'), + 'icon' => '../../plugins/wrap/images/note/16/todo.png', + 'open' => '<'.$syntaxDiv.' center round todo 60%>\n', + 'close' => '\n\n', + ), + array( + 'type' => 'insert', + 'title' => $this->getLang('clear'), + 'icon' => '../../plugins/wrap/images/toolbar/clear.png', + 'insert' => '<'.$syntaxDiv.' clear/>\n', + ), + array( + 'type' => 'format', + 'title' => $this->getLang('em'), + 'icon' => '../../plugins/wrap/images/toolbar/em.png', + 'open' => '<'.$syntaxSpan.' em>', + 'close' => '', + ), + array( + 'type' => 'format', + 'title' => $this->getLang('hi'), + 'icon' => '../../plugins/wrap/images/toolbar/hi.png', + 'open' => '<'.$syntaxSpan.' hi>', + 'close' => '', + ), + array( + 'type' => 'format', + 'title' => $this->getLang('lo'), + 'icon' => '../../plugins/wrap/images/toolbar/lo.png', + 'open' => '<'.$syntaxSpan.' lo>', + 'close' => '', + ), + ) + ); + } + + /** + * Handle section edit buttons, prevents section buttons inside the wrap plugin from being rendered + * + * @param Doku_Event $event The event object + * @param array $param Parameters for the event + */ + public function handle_secedit_button(Doku_Event $event, $param) { + // counter of the number of currently opened wraps + static $wraps = 0; + $data = $event->data; + + if ($data['target'] == 'plugin_wrap_start') { + ++$wraps; + } elseif ($data['target'] == 'plugin_wrap_end') { + --$wraps; + } elseif ($wraps > 0 && $data['target'] == 'section') { + $event->preventDefault(); + $event->stopPropagation(); + $event->result = ''; + } + } +} + diff --git a/platform/www/lib/plugins/wrap/all.less b/platform/www/lib/plugins/wrap/all.less new file mode 100644 index 0000000..c8f6ee5 --- /dev/null +++ b/platform/www/lib/plugins/wrap/all.less @@ -0,0 +1,352 @@ +/******************************************************************** +Screen and Print Styles for the Wrap Plugin +********************************************************************/ + +.dokuwiki { + +/* resetting the box model to something more sane makes life a whole lot easier */ +.plugin_wrap { + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + box-sizing: border-box; +} + +/* emulate a headline + (only with 'emulatedHeadlines' config option set) + @deprecated 2018-03-20 */ +.plugin_wrap.wrap__emuhead em strong { + font-size: 130%; + font-weight: bold; + font-style: normal; + display: block; +} +/* emulate a bigger headline with a bottom border */ +.plugin_wrap.wrap__emuhead em strong em.u { + font-size: 115%; + border-bottom: 1px solid @ini_border; + font-style: normal; + text-decoration: none; + display: block; +} +/* different bigger headline for safety notes */ +.wrap_danger.wrap__emuhead em strong em.u, +.wrap_warning.wrap__emuhead em strong em.u, +.wrap_caution.wrap__emuhead em strong em.u, +.wrap_notice.wrap__emuhead em strong em.u, +.wrap_safety.wrap__emuhead em strong em.u { + text-transform: uppercase; + border-bottom-width: 0; +} +/* change border colour of emulated headlines inside boxes to something more neutral + (to match all the different background colours) */ +.wrap_box.wrap__emuhead em strong em.u, +.wrap_info.wrap__emuhead em strong em.u, +.wrap_important.wrap__emuhead em strong em.u, +.wrap_alert.wrap__emuhead em strong em.u, +.wrap_tip.wrap__emuhead em strong em.u, +.wrap_help.wrap__emuhead em strong em.u, +.wrap_todo.wrap__emuhead em strong em.u, +.wrap_download.wrap__emuhead em strong em.u { + border-bottom-color: #999; +} + +/* real headlines should not be indented inside a wrap */ +.plugin_wrap h1, +.plugin_wrap h2, +.plugin_wrap h3, +.plugin_wrap h4, +.plugin_wrap h5 { + margin-left: 0; + margin-right: 0; +} + +/* columns +********************************************************************/ + +.wrap_left, +.wrap_column { + float: left; + margin-right: 1.5em; +} +[dir=rtl] .wrap_column { + float: right; + margin-left: 1.5em; + margin-right: 0; +} +.wrap_right { + float: right; + margin-left: 1.5em; +} +.wrap_center { + display: block; + margin-left: auto; + margin-right: auto; +} + +/*____________ CSS3 columns ____________*/ + +.wrap_col2, .wrap_col3, .wrap_col4, .wrap_col5, +.wrap_colsmall, .wrap_colmedium, .wrap_collarge { + -moz-column-gap: 1.5em; + -webkit-column-gap: 1.5em; + column-gap: 1.5em; + -moz-column-rule: 1px dotted #666; + -webkit-column-rule: 1px dotted #666; + column-rule: 1px dotted #666; +} +.wrap_col2 { + -moz-column-count: 2; + -webkit-column-count: 2; + column-count: 2; +} +.wrap_col3 { + -moz-column-count: 3; + -webkit-column-count: 3; + column-count: 3; +} +.wrap_col4 { + -moz-column-count: 4; + -webkit-column-count: 4; + column-count: 4; +} +.wrap_col5 { + -moz-column-count: 5; + -webkit-column-count: 5; + column-count: 5; +} + +.wrap_colsmall { + -moz-column-width: 10em; + -webkit-column-width: 10em; + column-width: 10em; +} +.wrap_colmedium { + -moz-column-width: 20em; + -webkit-column-width: 20em; + column-width: 20em; +} +.wrap_collarge { + -moz-column-width: 30em; + -webkit-column-width: 30em; + column-width: 30em; +} + + +/* widths +********************************************************************/ + +.wrap_twothirds { + width: 65%; + margin-right: 5%; +} + +.wrap_half { + width: 48%; + margin-right: 4%; +} + +.wrap_third { + width: 30%; + margin-right: 5%; +} + +.wrap_quarter { + width: 22%; + margin-right: 4%; +} + +[dir=rtl] .wrap_half, +[dir=rtl] .wrap_quarter { + margin-right: 0; + margin-left: 4%; +} +[dir=rtl] .wrap_twothirds, +[dir=rtl] .wrap_third { + margin-right: 0; + margin-left: 5%; +} + +/* this doesn't always work when third and twothirds are mixed across rows + but can be fixed by adding any div (e.g. ) after a row */ +.wrap_half + .wrap_half, +.wrap_third + .wrap_twothirds, +.wrap_twothirds + .wrap_third, +.wrap_third + .wrap_third + .wrap_third, +.wrap_quarter + .wrap_quarter + .wrap_quarter + .wrap_quarter { + margin-right: 0; + + [dir=rtl] & { + margin-left: 0; + } + + + * { + clear: left; + [dir=rtl] & { + clear: right; + } + } +} + +/* show 2 instead 4 columns on medium sized screens (mobile, etc) */ +@media only screen and (max-width: 950px) { + +.wrap_quarter { + width: 48%; +} +.wrap_quarter:nth-of-type(2n) { + margin-right: 0; +} +[dir=rtl] .wrap_quarter:nth-of-type(2n) { + margin-left: 0; +} +.wrap_quarter:nth-of-type(2n+1) { + clear: left; +} +[dir=rtl] .wrap_quarter:nth-of-type(2n) { + clear: right; +} + +} /* /@media */ + +/* show full width on smaller screens (mobile, etc) */ +@media only screen and (max-width: 600px) { + +.wrap_twothirds, +.wrap_half, +.wrap_third, +.wrap_quarter { + width: auto; + margin-right: 0; + margin-left: 0; + float: none; +} + +} /* /@media */ + + +/* alignments +********************************************************************/ + +.wrap_leftalign { + text-align: left; +} +.wrap_centeralign { + text-align: center; +} +.wrap_rightalign { + text-align: right; +} +.wrap_justify { + text-align: justify; +} + + +/* box +********************************************************************/ + +/* see styles for boxes and notes with icons in style.css */ + +/*____________ rounded corners ____________*/ +/* (only for modern browsers) */ + +div.wrap_round { + border-radius: 1.4em; +} +span.wrap_round { + border-radius: .14em; +} + + +/* mark +********************************************************************/ + +.wrap_lo { + color: @ini_text_neu; + font-size: 85%; +} +.wrap_em { + color: #c00; + font-weight: bold; +} +.wrap__dark.wrap_em { + color: #f66; +} + +/* see styles for highlighted text in style.css */ + + +/* miscellaneous +********************************************************************/ + +/*____________ tablewidth ____________*/ + +.wrap_tablewidth table { + width: 100%; +} + +/*____________ indent ____________*/ + +.wrap_indent { + padding-left: 1.5em; +} +[dir=rtl] .wrap_indent { + padding-right: 1.5em; + padding-left: 0; +} + + +/*____________ outdent ____________*/ + +.wrap_outdent { + margin-left: -1.5em; +} +[dir=rtl] .wrap_outdent { + margin-right: -1.5em; + margin-left: 0; +} + +/*____________ word wrapping in pre ____________*/ + +div.wrap_prewrap pre { + white-space: pre-wrap; + word-wrap: break-word;/* for IE < 8 */ +} + +/*____________ spoiler ____________*/ + +div.wrap_spoiler { + margin-bottom: 1.5em; +} +/* see rest of spoiler styles in style.css */ + +/*____________ clear float ____________*/ + +.wrap_clear { + clear: both; + line-height: 0; + height: 0; + font-size: 1px; + visibility: hidden; + overflow: hidden; +} + +/*____________ hide ____________*/ + +.wrap_hide { + display: none; +} + + +/*____________ button-style link ____________*/ + +.wrap_button a:link, +.wrap_button a:visited { + background-image: none; + border: 1px solid @ini_border; + border-radius: .3em; + padding: .5em .7em; + text-decoration: none; +} +/* see rest of button link styles in style.css */ + +} /* /.dokuwiki */ diff --git a/platform/www/lib/plugins/wrap/conf/default.php b/platform/www/lib/plugins/wrap/conf/default.php new file mode 100644 index 0000000..6897bb3 --- /dev/null +++ b/platform/www/lib/plugins/wrap/conf/default.php @@ -0,0 +1,13 @@ + array(0,1)); +$meta['syntaxDiv'] = array('multichoice','_choices' => array('WRAP','block', 'div')); +$meta['syntaxSpan'] = array('multichoice','_choices' => array('wrap', 'inline', 'span')); +$meta['darkTpl'] = array('onoff'); +$meta['emulatedHeadlines'] = array('onoff'); diff --git a/platform/www/lib/plugins/wrap/example.txt b/platform/www/lib/plugins/wrap/example.txt new file mode 100644 index 0000000..c0e20c8 --- /dev/null +++ b/platform/www/lib/plugins/wrap/example.txt @@ -0,0 +1,455 @@ +====== Examples for the Wrap Plugin ====== + +===== Basic syntax ===== + +An uppercase **%%%%** (or alternatively **%%%%** or **%%
%%**) creates a **''div''** and should be used for **"big"** containers, **surrounding** paragraphs, lists, tables, etc. + + + +"big" content + + +or + +"big" content + + +or +
+"big" content +
+
+ +A lowercase **%%%%** (or alternatively **%%%%** or **%%%%**) creates a **''span''** and should be used for **"small"** containers, **inside** paragraphs, lists, tables, etc. + + +"small" content + +or +"small" content + +or +"small" content + + +:!: Please note, some things **won't work with lowercase spans**: + * **alignments** (including alignments generated by changing the text direction) + * **multi-columns** + * and **widths** +if the according wrap isn't floated as well. + +A shorthand of uppercase **%%%%** and lowercase **%%%%** are available if the container is empty or unnecessary. + + + +or + +or +
+ + +and + + +or + +or + + + +===== Classes and Styles ===== + + +==== Columns and Floats ==== + +You can have columns easily by adding the class ''column'' and a width, e.g. + ...content... + +The example below uses the following structure: + + + + +...content... +...content... +...content... + + + + + + + +=== Floating Options === + +Normally you would only need the class ''column'', but for more sophisticated uses (not only for columns, but for any other classes, like [[#boxes and notes]] as well) you can have several kinds of "floats": + + * **''column''** is the same as ''left'' in LTR languages and the same as ''right'' in RTL languages + * **''left''** will let you float your wrap on the left + * **''right''** will let the wrap float right + * **''center''** will position the wrap in the horizontal center of the page + + + +=== Widths === + +You can set any valid widths (but only on divs): ''%, px, em, rem, ex, ch, vw, vh, pt, pc, cm, mm, in'', but most of the time you'd only want either + +^type^e.g.^note^ +^''%''|''30%''|makes sense in most cases| +^''px''|''420px''|makes sense if your container contains images with a certain width| +^''em''|''20em''|makes sense if you like your wrap container to grow and shrink with the font size| + + + +=== Width Keywords === + +With certain width keywords you can fit your columns automatically to fill the available horizontal space. Those columns will also react to the screen size, so will be responsive and wrap underneath each other on mobile devices. + +There are four width keywords. These should not be combined with any other width, only ''third'' can be combined with ''twothirds''. + + * **''half''** fits two columns in a row + * **''third''** fits three columns in a row + * **''quarter''** fits four columns in a row + * **''twothirds''** together with ''third'' fits a 2/3 and a 1/3 column in a row + +:!: Attention: In order to work properly, wraps with width keywords need an **additional ''%%%%'' around a set** of them. If you mix several types in one group, you might need a ''%%%%'' after a row. + + + + + +You can use the same options with spans (as each element that floats is automatically a block level element), but it probably doesn't make too much sense. :!: Widths on spans normally do not work (by design), but can make sense, when it is floating. + +:!: Attention: What is the difference between widths and width keywords and when is it best to use which? **Widths** can cause problems and will never fully add up, therefore will break the layout under some circumstances. (See [[http://en.wikipedia.org/wiki/Internet_Explorer_box_model_bug|box model]] for a technical explanation.) So, getting widths right will need some fiddling around and testing in various browsers. **Width keywords** on the other hand fit automatically and work better on mobile devices. But the drawback is that they need an extra wrap around them and don't work properly in older browsers (IE8 and under). + +All of those options will also work in the [[#boxes and notes]] wraps (see below). + +=== Old Emulated Headline (deprecated) === + +When the ''emulatedHeadlines'' config option is enabled, every ''%%//**__text like this__**//%%'' or ''%%//**like that**//%%'' will create an "emulated headline" within a wrap. This feature is deprecated and will be removed at some point as standard headlines within wraps are supported for a while now. + +If that config options is enabled and you need text that is bold and italic, simply use it the other way around: ''%%**//No Headline//**%%''. + + +=== Multi-columns === + + +Multi-columns work best in modern browsers (no IE9 and below) but should still be considered experimental as some browser behaviour is still inconsistent and buggy. + +Just use **''%%colsmall%%''** for small width columns, **''%%colmedium%%''** for medium width columns and **''%%collarge%%''** for large width columns. +Or you can use **''%%col2%%''** for 2 columns, **''%%col3%%''** for 3 columns, **''%%col4%%''** for 4 columns and **''%%col5%%''** for 5 columns. +The former type of column is determined by its width, the latter by its amount. The width-based columns are ideal for different layouts and device widths. + +:!: Note: Multi-columns don't make sense for spans. + + +Don't use this for bigger columns containing more than just text. Use the [[#columns and floats]] mentioned above instead. + + +==== Alignments ==== + +You can use these different text alignments: + + * ''leftalign'' + * ''rightalign'' + * ''centeralign'' + * ''justify'' + + +Center aligned text ... + + + +... and right aligned. + + + + +Center aligned text ... + + + +... and right aligned. + + + +:!: You cannot add alignments to spans. + + +==== Boxes and Notes ==== + + +=== round box 500px center === + + * ''box'' creates a box around the container and uses the colours from the template's ''style.ini'' as default colours (''%%__background_alt__%%'' and ''%%__text__%%'') + * any of the classes ''info'', ''tip'', ''important'', ''alert'', ''help'', ''download'', ''todo'' will add a special note container with a corresponding icon + * the classes ''danger'', ''warning'', ''caution'', ''notice'', ''safety'' use safety colours (and no icons) + * ''round'' can be added to anything with a background colour or a border and will only work in modern browsers (no IE8 and under) + + + + +=== Info === +%%%% + + + + +=== Tip === +%%%% + + + + +=== Important === +%%%% + + + + +=== Alert === +%%%% + + + + +=== Help === +%%%% + + + + +=== Download === +%%%% + + + + +=== Todo === +%%%% + + + + + + +**Safety Notes:** + +Best only use simple markup in safety notes. + + +=== Danger === +%%%% + + + +=== Warning === +%%%% + + + +=== Caution === +%%%% + + + +=== Notice === +%%%% + + + +=== Safety === +%%%% + + + + + +You can use notes and boxes also inside text with spans like this: +info, help, alert, important, tip, download, todo and round box and danger, warning, caution, notice, safety. + info, help, ... + +==== Marks ==== + +You can mark text as highlighted, less significant and especially emphasised. + + You can mark text as highlighted, less significant and especially emphasised. + +:!: This might look ugly in some templates and should be adjusted accordingly. + +==== Tabs ==== + +You can create a row of tabs by simply wrapping a list of links in ''%%%%''. + + + * [[Some page]] + * [[example|This page]] + * [[Another page]] + + + + * [[Some page]] + * [[example|This page]] + * [[Another page]] + + +:!: Please note, the styling of these tabs depend on the template you are using and not on the wrap plugin. If you only see a list of links and no tabs, please make sure to add "tabs" to the ''noPrefix'' config option and that your template supports at least the 2012-01-25 "Angua" DokuWiki release. + +==== Miscellaneous ==== + +=== Clear float === + +After using any of the float classes, you might come across following text protruding into the space where only the floating containers should be. To prevent that, you should simply add this after your last column: + + + +=== Table width === + +You can set the width of a table via ''tablewidth'' as every table inside that wrap will always be 100% wide. This makes it possible to give tables any width by adding an additional width to the wrap (or none for 100%). + + +^ Table ^ is ^ +| 80% | wide | + + + + ^ Table ^ is ^ + | 80% | wide | + + +=== Indent === + +This text will appear indented. + + This text will appear indented. + +=== Outdent === + +This text will appear "outdented". + + This text will appear "outdented". + +=== Prewrap === + + + +Inside this code block the words will wrap to a new line although they are all in one line. + + + + + + Inside this code block the words will wrap to a new line although they are all in one line. + + + +=== Spoiler === + +Here follows a spoiler: Darth Vader is Luke's father. + + Here follows a spoiler: Darth Vader is Luke's father. + +Just select the text in the spoiler box to be able to read its content. + +=== Button links === + +A link that looks like a button: [[wiki:Syntax]] + + A link that looks like a button: [[wiki:Syntax]] + +=== Hide === + +The following text is hidden: John, please revise that sentence. + + The following text is hidden: John, please revise that sentence. + +:!: Warning: The text will still appear in the source code, in non-modern browsers and is searchable. Do not hide any security risky secrets with it! + +=== Pagebreak === + +The following will add a pagebreak: + + The following will add a pagebreak: + +This has no effect on the browser screen. A [[http://reference.sitepoint.com/css/page-break-after|pagebreak]] will force a new page in printouts. + +=== Nopagebreak === + +The following will try to avoid a pagebreak: much content, belonging together (like a long table) + + The following will try to avoid a pagebreak: much content, belonging together (like a long table) + +This also has no effect on the browser screen. It will try to [[http://reference.sitepoint.com/css/page-break-inside|avoid a page break]] in printouts. + +=== Noprint === + +This text appears on the screen, but not in print. + + This text appears on the screen, but not in print. + +=== Onlyprint === + +This text does not appear on the screen, but only in print. + + This text does not appear on the screen, but only in print. + + +==== Combining and Nesting ==== + +You can combine and nest all classes and types of boxes, e.g. + + +===Outer box floats right === + + +Inner nested box floats left and is partly __em__phasized and __hi__ghlighted with a nested __notice__ inside. + + +Text inside outer right box, but beneath inner left box. + + + + +Round tip box underneath, after a ''clear''. + + + + + + + +=== Outer box floats right === + + +Inner nested box floats left and is partly __em__phasized and __hi__ghlighted with a nested __notice__ inside. + + +Text inside outer right box, but beneath inner left box. + + + + +Round tip box underneath, after a ''clear''. + + + + + + +===== Language and Text Direction ===== + +You can change the language and the reading direction of a wrap container by simply adding a colon followed by the language code, like this: + + + +זה עברית. ((This means "This is Hebrew.", at least according to [[http://translate.google.com/|Google Translate]].)) + + + + +זה עברית. ((This means "This is Hebrew.", at least according to [[http://translate.google.com/|Google Translate]].)) + + +The text direction (''rtl'', right to left or ''ltr'', left to right) will get inserted automatically and is solely dependent on the language. The list of currently supported languages is taken from: http://meta.wikimedia.org/wiki/Template:List_of_language_names_ordered_by_code +(If you specify a language not listed there, it simply won't do anything.) diff --git a/platform/www/lib/plugins/wrap/helper.php b/platform/www/lib/plugins/wrap/helper.php new file mode 100644 index 0000000..13620d4 --- /dev/null +++ b/platform/www/lib/plugins/wrap/helper.php @@ -0,0 +1,788 @@ + + */ + +// must be run within Dokuwiki +if(!defined('DOKU_INC')) die(); + +class helper_plugin_wrap extends DokuWiki_Plugin { + static protected $boxes = array ('wrap_box', 'wrap_danger', 'wrap_warning', 'wrap_caution', 'wrap_notice', 'wrap_safety', + 'wrap_info', 'wrap_important', 'wrap_alert', 'wrap_tip', 'wrap_help', 'wrap_todo', + 'wrap_download', 'wrap_hi', 'wrap_spoiler'); + static protected $paragraphs = array ('wrap_leftalign', 'wrap_rightalign', 'wrap_centeralign', 'wrap_justify'); + static protected $column_count = 0; + static $box_left_pos = 0; + static $box_right_pos = 0; + static $box_first = true; + static $table_entr = 0; + + /** + * get attributes (pull apart the string between '') + * and identify classes, width, lang and dir + * + * @author Anika Henke + * @author Christopher Smith + * (parts taken from http://www.dokuwiki.org/plugin:box) + */ + function getAttributes($data, $useNoPrefix=true) { + + $attr = array(); + $tokens = preg_split('/\s+/', $data, 9); + + // anonymous function to convert inclusive comma separated items to regex pattern + $pattern = function ($csv) { + return '/^(?:'. str_replace(['?','*',' ',','], + ['.','.*','','|'], $csv) .')$/'; + }; + + // noPrefix: comma separated class names that should be excluded from + // being prefixed with "wrap_", + // each item may contain wildcard (*, ?) + $noPrefix = ($this->getConf('noPrefix') && $useNoPrefix) ? $pattern($this->getConf('noPrefix')) : ''; + + // restrictedClasses : comma separated class names that should be checked + // based on restriction type (whitelist or blacklist), + // each item may contain wildcard (*, ?) + $restrictedClasses = ($this->getConf('restrictedClasses')) ? + $pattern($this->getConf('restrictedClasses')) : ''; + $restrictionType = $this->getConf('restrictionType'); + + foreach ($tokens as $token) { + + //get width + if (preg_match('/^\d*\.?\d+(%|px|em|rem|ex|ch|vw|vh|pt|pc|cm|mm|in)$/', $token)) { + $attr['width'] = $token; + continue; + } + + //get lang + if (preg_match('/\:([a-z\-]+)/', $token)) { + $attr['lang'] = trim($token,':'); + continue; + } + + //get id + if (preg_match('/#([A-Za-z0-9_-]+)/', $token)) { + $attr['id'] = trim($token,'#'); + continue; + } + + //get classes + //restrict token (class names) characters to prevent any malicious data + if (preg_match('/[^A-Za-z0-9_-]/',$token)) continue; + if ($restrictedClasses) { + $classIsInList = preg_match($restrictedClasses, $token); + // either allow only certain classes or disallow certain classes + if ($restrictionType xor $classIsInList) continue; + } + // prefix adjustment of class name + $prefix = (preg_match($noPrefix, $token)) ? '' : 'wrap_'; + $attr['class'] = (isset($attr['class']) ? $attr['class'].' ' : '').$prefix.$token; + } + if ($this->getConf('darkTpl')) { + $attr['class'] = (isset($attr['class']) ? $attr['class'].' ' : '').'wrap__dark'; + } + if ($this->getConf('emulatedHeadings')) { + $attr['class'] = (isset($attr['class']) ? $attr['class'].' ' : '').'wrap__emuhead'; + } + + //get dir + if($attr['lang']) { + $lang2dirFile = dirname(__FILE__).'/conf/lang2dir.conf'; + if (@file_exists($lang2dirFile)) { + $lang2dir = confToHash($lang2dirFile); + $attr['dir'] = strtr($attr['lang'],$lang2dir); + } + } + + return $attr; + } + + /** + * build attributes (write out classes, width, lang and dir) + */ + function buildAttributes($data, $addClass='', $mode='xhtml') { + + $attr = $this->getAttributes($data); + $out = ''; + + if ($mode=='xhtml') { + if($attr['class']) $out .= ' class="'.hsc($attr['class']).' '.$addClass.'"'; + // if used in other plugins, they might want to add their own class(es) + elseif($addClass) $out .= ' class="'.$addClass.'"'; + if($attr['id']) $out .= ' id="'.hsc($attr['id']).'"'; + // width on spans normally doesn't make much sense, but in the case of floating elements it could be used + if($attr['width']) { + if (strpos($attr['width'],'%') !== false) { + $out .= ' style="width: '.hsc($attr['width']).';"'; + } else { + // anything but % should be 100% when the screen gets smaller + $out .= ' style="width: '.hsc($attr['width']).'; max-width: 100%;"'; + } + } + // only write lang if it's a language in lang2dir.conf + if($attr['dir']) $out .= ' lang="'.$attr['lang'].'" xml:lang="'.$attr['lang'].'" dir="'.$attr['dir'].'"'; + } + + return $out; + } + + /** + * render ODT element, Open + * (get Attributes, select ODT element that fits, render it, return element name) + */ + function renderODTElementOpen($renderer, $HTMLelement, $data) { + $attr = $this->getAttributes($data, false); + $attr_string = $this->buildAttributes($data); + $classes = explode (' ', $attr['class']); + + // Get language + $language = $attr['lang']; + + $is_indent = in_array ('wrap_indent', $classes); + $is_outdent = in_array ('wrap_outdent', $classes); + $is_column = in_array ('wrap_column', $classes); + $is_group = in_array ('wrap_group', $classes); + $is_pagebreak = in_array ('wrap_pagebreak', $classes); + + // Check for multicolumns + $columns = 0; + preg_match ('/wrap_col\d/', $attr ['class'], $matches); + if ( empty ($matches [0]) === false ) { + $columns = $matches [0] [strlen($matches [0])-1]; + } + + // Check for boxes + $is_box = false; + foreach (self::$boxes as $box) { + if ( strpos ($attr ['class'], $box) !== false ) { + $is_box = true; + break; + } + } + + // Check for paragraphs + $is_paragraph = false; + if ( empty($language) === false ) { + $is_paragraph = true; + } else { + foreach (self::$paragraphs as $paragraph) { + if ( strpos ($attr ['class'], $paragraph) !== false ) { + $is_paragraph = true; + break; + } + } + } + + $style = NULL; + if ( empty($attr['width']) === false ) { + $style = 'width: '.$attr['width'].';'; + } + $attr ['class'] = 'dokuwiki '.$attr ['class']; + + // Call corresponding functions for current wrap class + if ( $HTMLelement == 'span' ) { + if ( $is_indent === false && $is_outdent === false ) { + $this->renderODTOpenSpan ($renderer, $attr ['class'], $style, $language, $attr_string); + return 'span'; + } else { + $this->renderODTOpenParagraph ($renderer, $attr ['class'], $style, $attr ['dir'], $language, $is_indent, $is_outdent, true, $attr_string); + return 'paragraph'; + } + } else if ( $HTMLelement == 'div' ) { + if ( $is_box === true ) { + $wrap = $this->loadHelper('wrap'); + $fullattr = $wrap->buildAttributes($data, 'plugin_wrap'); + + if ( method_exists ($renderer, 'getODTPropertiesFromElement') === false ) { + $this->renderODTOpenBox ($renderer, $attr ['class'], $style, $fullattr); + } else { + $this->renderODTOpenTable ($renderer, $attr, $style, $attr_string); + } + return 'box'; + } else if ( $columns > 0 ) { + $this->renderODTOpenColumns ($renderer, $attr ['class'], $style); + return 'multicolumn'; + } else if ( $is_paragraph === true || $is_indent === true || $is_outdent === true ) { + $this->renderODTOpenParagraph ($renderer, $attr ['class'], $style, $attr ['dir'], $language, $is_indent, $is_outdent, false, $attr_string); + return 'paragraph'; + } else if ( $is_pagebreak === true ) { + $renderer->pagebreak (); + // Pagebreak hasn't got a closing stack so we return/push 'other' on the stack + return 'other'; + } else if ( $is_column === true ) { + $this->renderODTOpenColumn ($renderer, $attr ['class'], $style, $attr_string); + return 'column'; + } else if ( $is_group === true ) { + $this->renderODTOpenGroup ($renderer, $attr ['class'], $style); + return 'group'; + } else if (strpos ($attr ['class'], 'wrap_clear') !== false ) { + $renderer->linebreak(); + $renderer->p_close(); + $renderer->p_open(); + + self::$box_left_pos = 0; + self::$box_right_pos = 0; + self::$box_first = true; + } + } + return 'other'; + } + + /** + * render ODT element, Close + */ + function renderODTElementClose($renderer, $element) { + switch ($element) { + case 'box': + if ( method_exists ($renderer, 'getODTPropertiesFromElement') === false ) { + $this->renderODTCloseBox ($renderer); + } else { + $this->renderODTCloseTable ($renderer); + } + break; + case 'multicolumn': + $this->renderODTCloseColumns($renderer); + break; + case 'paragraph': + $this->renderODTCloseParagraph($renderer); + break; + case 'column': + $this->renderODTCloseColumn($renderer); + break; + case 'group': + $this->renderODTCloseGroup($renderer); + break; + case 'span': + $this->renderODTCloseSpan($renderer); + break; + // No default by intention. + } + } + + function renderODTOpenBox ($renderer, $class, $style, $fullattr) { + $properties = array (); + + if ( method_exists ($renderer, 'getODTProperties') === false ) { + // Function is not supported by installed ODT plugin version, return. + return; + } + + // Get CSS properties for ODT export. + $renderer->getODTProperties ($properties, 'div', $class, $style); + + if ( empty($properties ['background-image']) === false ) { + $properties ['background-image'] = + $renderer->replaceURLPrefix ($properties ['background-image'], DOKU_INC); + } + + if ( empty($properties ['float']) === true ) { + // If the float property is not set, set it to 'left' becuase the ODT plugin + // would default to 'center' which is diffeent to the XHTML behaviour. + if ( strpos ($class, 'wrap_center') === false ) { + $properties ['float'] = 'left'; + } else { + $properties ['float'] = 'center'; + } + } + + // The display property has differing usage in CSS. So we better overwrite it. + $properties ['display'] = 'always'; + if ( stripos ($class, 'wrap_noprint') !== false ) { + $properties ['display'] = 'screen'; + } + if ( stripos ($class, 'wrap_onlyprint') !== false ) { + $properties ['display'] = 'printer'; + } + + $renderer->_odtDivOpenAsFrameUseProperties ($properties); + } + + function renderODTCloseBox ($renderer) { + if ( method_exists ($renderer, '_odtDivCloseAsFrame') === false ) { + // Function is not supported by installed ODT plugin version, return. + return; + } + $renderer->_odtDivCloseAsFrame (); + } + + function renderODTOpenColumns ($renderer, $class, $style) { + $properties = array (); + + if ( method_exists ($renderer, 'getODTProperties') === false ) { + // Function is not supported by installed ODT plugin version, return. + return; + } + + // Get CSS properties for ODT export. + $renderer->getODTProperties ($properties, 'div', $class, $style); + + $renderer->_odtOpenMultiColumnFrame($properties); + } + + function renderODTCloseColumns ($renderer) { + if ( method_exists ($renderer, '_odtCloseMultiColumnFrame') === false ) { + // Function is not supported by installed ODT plugin version, return. + return; + } + $renderer->_odtCloseMultiColumnFrame(); + } + + function renderODTOpenParagraph ($renderer, $class, $style, $dir, $language, $is_indent, $is_outdent, $indent_first, $attr=NULL) { + $properties = array (); + + if ( method_exists ($renderer, 'getODTPropertiesFromElement') === true ) { + // Get CSS properties for ODT export. + // Set parameter $inherit=false to prevent changiung the font-size and family! + $renderer->getODTPropertiesNew ($properties, 'p', $attr, NULL, false); + } else if ( method_exists ($renderer, 'getODTProperties') === true ) { + // Get CSS properties for ODT export (deprecated version). + $renderer->getODTProperties ($properties, 'p', $class, $style); + + if ( empty($properties ['background-image']) === false ) { + $properties ['background-image'] = + $renderer->replaceURLPrefix ($properties ['background-image'], DOKU_INC); + } + } else { + // To old ODT plugin version. + return; + } + + if ( empty($properties ['text-align']) ) + { + if ($dir == 'ltr') { + $properties ['text-align'] = 'left'; + $properties ['writing-mode'] = 'lr'; + } + if ($dir == 'rtl') { + $properties ['text-align'] = 'right'; + $properties ['writing-mode'] = 'rl'; + } + } + + $name = ''; + if ( empty($language) === false ) { + $properties ['lang'] = $language; + $name .= 'Language: '.$language; + } + + if ( $indent_first === true ) { + // Eventually indent or outdent first line only... + if ( $is_indent === true ) { + // FIXME: Has to be adjusted if test direction will be supported. + // See all.css + $properties ['text-indent'] = $properties ['padding-left']; + $properties ['padding-left'] = 0; + $name .= 'Indent first'; + } + if ( $is_outdent === true ) { + // FIXME: Has to be adjusted if text (RTL, LTR) direction will be supported. + // See all.css + $properties ['text-indent'] = $properties ['margin-left']; + $properties ['margin-left'] = 0; + $name .= 'Outdent first'; + } + } else { + // Eventually indent or outdent the whole paragraph... + if ( $is_indent === true ) { + // FIXME: Has to be adjusted if test direction will be supported. + // See all.css + $properties ['margin-left'] = $properties ['padding-left']; + $properties ['padding-left'] = 0; + $name .= 'Indent'; + } + if ( $is_outdent === true ) { + // Nothing to change: keep left margin property. + // FIXME: Has to be adjusted if text (RTL, LTR) direction will be supported. + // See all.css + $name .= 'Outdent'; + } + } + + $renderer->p_close(); + if ( method_exists ($renderer, 'createParagraphStyle') === false ) { + // Older ODT plugin version. + $renderer->_odtParagraphOpenUseProperties($properties); + } else { + // Newer version create our own common styles. + + // Create parent style to group the others beneath it + if (!$renderer->styleExists('Plugin_Wrap_Paragraphs')) { + $parent_properties = array(); + $parent_properties ['style-parent'] = NULL; + $parent_properties ['style-class'] = 'Plugin Wrap Paragraphs'; + $parent_properties ['style-name'] = 'Plugin_Wrap_Paragraphs'; + $parent_properties ['style-display-name'] = 'Plugin Wrap'; + $renderer->createParagraphStyle($parent_properties); + } + + $name .= $this->getODTCommonStyleName($class); + $style_name = 'Plugin_Wrap_Paragraph_'.$name; + if (!$renderer->styleExists($style_name)) { + $properties ['style-parent'] = 'Plugin_Wrap_Paragraphs'; + $properties ['style-class'] = NULL; + $properties ['style-name'] = $style_name; + $properties ['style-display-name'] = $name; + $renderer->createParagraphStyle($properties); + } + + $renderer->p_open($style_name); + } + } + + function renderODTCloseParagraph ($renderer) { + if ( method_exists ($renderer, 'p_close') === false ) { + // Function is not supported by installed ODT plugin version, return. + return; + } + $renderer->p_close(); + } + + function renderODTOpenColumn ($renderer, $class, $style, $attr) { + $properties = array (); + + if ( method_exists ($renderer, 'getODTPropertiesFromElement') === true ) { + // Get CSS properties for ODT export. + $renderer->getODTPropertiesNew ($properties, 'div', $attr); + } else if ( method_exists ($renderer, 'getODTProperties') === true ) { + // Get CSS properties for ODT export (deprecated version). + $renderer->getODTProperties ($properties, NULL, $class, $style); + } else { + // To old ODT plugin version. + return; + } + + // Frames/Textboxes still have some issues with formatting (at least in LibreOffice) + // So as a workaround we implement columns as a table. + // This is why we now use the margin of the div as the padding for the ODT table. + $properties ['padding-left'] = $properties ['margin-left']; + $properties ['padding-right'] = $properties ['margin-right']; + $properties ['padding-top'] = $properties ['margin-top']; + $properties ['padding-bottom'] = $properties ['margin-bottom']; + $properties ['margin-left'] = NULL; + $properties ['margin-right'] = NULL; + $properties ['margin-top'] = NULL; + $properties ['margin-bottom'] = NULL; + + // Percentage values are not supported for the padding. Convert to absolute values. + $length = strlen ($properties ['padding-left']); + if ( $length > 0 && $properties ['padding-left'] [$length-1] == '%' ) { + $properties ['padding-left'] = trim ($properties ['padding-left'], '%'); + $properties ['padding-left'] = $renderer->_getAbsWidthMindMargins ($properties ['padding-left']).'cm'; + } + $length = strlen ($properties ['padding-right']); + if ( $length > 0 && $properties ['padding-right'] [$length-1] == '%' ) { + $properties ['padding-right'] = trim ($properties ['padding-right'], '%'); + $properties ['padding-right'] = $renderer->_getAbsWidthMindMargins ($properties ['padding-right']).'cm'; + } + $length = strlen ($properties ['padding-top']); + if ( $length > 0 && $properties ['padding-top'] [$length-1] == '%' ) { + $properties ['padding-top'] = trim ($properties ['padding-top'], '%'); + $properties ['padding-top'] = $renderer->_getAbsWidthMindMargins ($properties ['padding-top']).'cm'; + } + $length = strlen ($properties ['padding-bottom']); + if ( $length > 0 && $properties ['padding-bottom'] [$length-1] == '%' ) { + $properties ['padding-bottom'] = trim ($properties ['padding-bottom'], '%'); + $properties ['padding-bottom'] = $renderer->_getAbsWidthMindMargins ($properties ['padding-bottom']).'cm'; + } + + $this->column_count++; + if ( $this->column_count == 1 ) { + // If this is the first column opened since the group was opened + // then we have to open the table and a (single) row first. + $properties ['width'] = '100%'; + $renderer->_odtTableOpenUseProperties($properties); + $renderer->_odtTableRowOpenUseProperties($properties); + } + + // We did not specify any max column value when we opened the table. + // So we have to tell the renderer to add a column just now. + unset($properties ['width']); + $renderer->_odtTableAddColumnUseProperties($properties); + + // Open the cell. + $renderer->_odtTableCellOpenUseProperties($properties); + } + + function renderODTCloseColumn ($renderer) { + if ( method_exists ($renderer, '_odtTableAddColumnUseProperties') === false ) { + // Function is not supported by installed ODT plugin version, return. + return; + } + + $renderer->tablecell_close(); + } + + function renderODTOpenGroup ($renderer, $class, $style) { + // Nothing to do for now. + } + + function renderODTCloseGroup ($renderer) { + // If a table has been opened in the group we close it now. + if ( $this->column_count > 0 ) { + // At last we need to close the row and the table! + $renderer->tablerow_close(); + //$renderer->table_close(); + $renderer->_odtTableClose(); + } + $this->column_count = 0; + } + + function renderODTOpenSpan ($renderer, $class, $style, $language, $attr) { + $properties = array (); + + if ( method_exists ($renderer, 'getODTPropertiesFromElement') === true ) { + // Get CSS properties for ODT export. + // Set parameter $inherit=false to prevent changiung the font-size and family! + $renderer->getODTPropertiesNew ($properties, 'span', $attr, NULL, false); + } else if ( method_exists ($renderer, 'getODTProperties') === true ) { + // Get CSS properties for ODT export (deprecated version). + $renderer->getODTProperties ($properties, 'span', $class, $style); + + if ( empty($properties ['background-image']) === false ) { + $properties ['background-image'] = + $renderer->replaceURLPrefix ($properties ['background-image'], DOKU_INC); + } + } else { + // To old ODT plugin version. + return; + } + + $name = ''; + if ( empty($language) === false ) { + $properties ['lang'] = $language; + $name .= 'Language: '.$language; + } + + if ( method_exists ($renderer, 'getODTPropertiesFromElement') === false ) { + // Older ODT plugin version. + $renderer->_odtSpanOpenUseProperties($properties); + } else { + // Newer version create our own common styles. + $properties ['font-size'] = NULL; + + // Create parent style to group the others beneath it + if (!$renderer->styleExists('Plugin_Wrap_Spans')) { + $parent_properties = array(); + $parent_properties ['style-parent'] = NULL; + $parent_properties ['style-class'] = 'Plugin Wrap Spans'; + $parent_properties ['style-name'] = 'Plugin_Wrap_Spans'; + $parent_properties ['style-display-name'] = 'Plugin Wrap'; + $renderer->createTextStyle($parent_properties); + } + + $name .= $this->getODTCommonStyleName($class); + $style_name = 'Plugin_Wrap_Span_'.$name; + if (!$renderer->styleExists($style_name)) { + $properties ['style-parent'] = 'Plugin_Wrap_Spans'; + $properties ['style-class'] = NULL; + $properties ['style-name'] = $style_name; + $properties ['style-display-name'] = $name; + $renderer->createTextStyle($properties); + } + + if (!empty($properties ['background-image'])) { + if (method_exists ($renderer, '_odtAddImageUseProperties') === true) { + $size = NULL; + if (!empty($properties ['font-size'])) { + $size = $properties ['font-size']; + $size = $renderer->addToValue($size, '2pt'); + } + $properties ['width'] = $size; + $properties ['height'] = $size; + $properties ['title'] = NULL; + $renderer->_odtAddImageUseProperties ($properties ['background-image'],$properties); + } else { + $renderer->_odtAddImage ($properties ['background-image'],NULL,NULL,NULL,NULL,NULL); + } + } + $renderer->_odtSpanOpen($style_name); + } + } + + function renderODTCloseSpan ($renderer) { + if ( method_exists ($renderer, '_odtSpanClose') === false ) { + // Function is not supported by installed ODT plugin version, return. + return; + } + $renderer->_odtSpanClose(); + } + + function renderODTOpenTable ($renderer, $attr, $style, $attr_string) { + self::$table_entr += 1; + + $class = $attr ['class']; + $css_properties = array (); + + if ( method_exists ($renderer, 'getODTPropertiesFromElement') === false ) { + // Function is not supported by installed ODT plugin version, return. + return; + } + + // Get CSS properties for ODT export. + $renderer->getODTPropertiesNew ($css_properties, 'div', $attr_string, NULL, true); + + if ( empty($css_properties ['float']) === true ) { + // If the float property is not set, set it to 'left' becuase the ODT plugin + // would default to 'center' which is diffeent to the XHTML behaviour. + //$css_properties ['float'] = 'left'; + if (strpos ($class, 'wrap_left') !== false ) { + $css_properties ['float'] = 'left'; + } else if (strpos ($class, 'wrap_center') !== false ) { + $css_properties ['float'] = 'center'; + } else if (strpos ($class, 'wrap_right') !== false) { + $css_properties ['float'] = 'right'; + } + } + + // The display property has differing usage in CSS. So we better overwrite it. + $css_properties ['display'] = 'always'; + if ( stripos ($class, 'wrap_noprint') !== false ) { + $css_properties ['display'] = 'screen'; + } + if ( stripos ($class, 'wrap_onlyprint') !== false ) { + $css_properties ['display'] = 'printer'; + } + + $background_color = $css_properties ['background-color']; + $image = $css_properties ['background-image']; + $margin_top = $css_properties ['margin-top']; + $margin_right = $css_properties ['margin-right']; + $margin_bottom = $css_properties ['margin-bottom']; + $margin_left = $css_properties ['margin-left']; + $width = $attr ['width']; + + // Open 2x1 table if image is present + // otherwise only a 1x1 table + $properties = array(); + $properties ['width'] = '100%'; + $properties ['align'] = 'center'; + $properties ['margin-top'] = $margin_top; + $properties ['margin-right'] = $margin_right; + $properties ['margin-bottom'] = $margin_bottom; + $properties ['margin-left'] = $margin_left; + + $frame_props = array(); + if (!empty($css_properties ['border'])) { + $frame_props ['border'] = $css_properties ['border']; + } else { + $frame_props ['border'] = 'none'; + } + $frame_props ['min-height'] = '1cm'; + $frame_props ['width'] = $attr ['width']; + $frame_props ['float'] = $css_properties ['float']; + if ( self::$table_entr > 1 ) { + $frame_props ['anchor-type'] = 'as-char'; + } else { + $frame_props ['anchor-type'] = 'paragraph'; + } + $frame_props ['textarea-horizontal-align'] = 'left'; + $frame_props ['run-through'] = 'foreground'; + $frame_props ['vertical-pos'] = 'from-top'; + $frame_props ['vertical-rel'] = 'paragraph'; + $frame_props ['horizontal-pos'] = 'from-left'; + $frame_props ['horizontal-rel'] = 'paragraph'; + $frame_props ['wrap'] = 'parallel'; + $frame_props ['number-wrapped-paragraphs'] = 'no-limit'; + if (!empty($frame_props ['float']) && + $frame_props ['float'] != 'center') { + $frame_props ['margin-top'] = '0cm'; + $frame_props ['margin-right'] = '0cm'; + $frame_props ['margin-bottom'] = '0cm'; + $frame_props ['margin-left'] = '0cm'; + $frame_props ['padding-top'] = '0cm'; + $frame_props ['padding-bottom'] = '0cm'; + } else { + // No wrapping on not floating divs + $frame_props ['wrap'] = 'none'; + } + + switch ($frame_props ['float']) { + case 'left': + if ( self::$table_entr == 1 ) { + $frame_props ['y'] = '0cm'; + $frame_props ['x'] = self::$box_left_pos.'cm'; + self::$box_left_pos += trim($frame_props ['width'], 'cm'); + } + $frame_props ['padding-left'] = '0cm'; + break; + case 'right': + $frame_props ['horizontal-rel'] = 'paragraph'; + $frame_props ['horizontal-pos'] = 'right'; + $frame_props ['padding-right'] = '0cm'; + break; + case 'center': + $frame_props ['horizontal-pos'] = 'center'; + break; + default: + $frame_props ['padding-left'] = '0cm'; + break; + } + $renderer->_odtOpenTextBoxUseProperties($frame_props); + + $renderer->_odtTableOpenUseProperties($properties); + + if (!empty($image)) { + $properties = array(); + $properties ['width'] = '2cm'; + $renderer->_odtTableAddColumnUseProperties($properties); + } + + $properties = array(); + $renderer->_odtTableAddColumnUseProperties($properties); + + $renderer->tablerow_open(); + + if (!empty($image)) { + $properties = array(); + $properties ['vertical-align'] = 'middle'; + $properties ['text-align'] = 'center'; + $properties ['padding'] = '0.1cm'; + $properties ['background-color'] = $background_color; + + $renderer->_odtTableCellOpenUseProperties($properties); + $renderer->_odtAddImage($image); + $renderer->tablecell_close(); + } + + $properties = array(); + $properties ['vertical-align'] = 'middle'; + $properties ['padding'] = '0.3cm'; + $properties ['background-color'] = $background_color; + $properties ['border'] = 'none'; + $renderer->_odtTableCellOpenUseProperties($properties); + } + + function renderODTCloseTable ($renderer) { + $renderer->tablecell_close(); + $renderer->tablerow_close(); + $renderer->_odtTableClose(); + $renderer->_odtCloseTextBox (); + + self::$table_entr -= 1; + } + + protected function getODTCommonStyleName ($class_string) { + static $map = array ( + 'wrap_box' => 'Box', 'wrap_danger' => 'Danger', 'wrap_warning' => 'Warning', + 'wrap_caution' => 'Caution', 'wrap_notice' => 'Notice', 'wrap_safety' => 'Safety', + 'wrap_info' => 'Info', 'wrap_important' => 'Important', 'wrap_alert' => 'Alert', + 'wrap_tip' => 'Tip', 'wrap_help' => 'Help', 'wrap_todo' => 'To do', + 'wrap_download' => 'Download', 'wrap_hi' => 'Highlighted', 'wrap_spoiler' => 'Spoiler', + 'wrap_leftalign' => 'Left aligned', 'wrap_rightalign' => 'Right aligned', + 'wrap_centeralign' => 'Centered', 'wrap_justify' => 'Justify', 'wrap_em' => 'Emphasised', + 'wrap_lo' => 'Less significant'); + $classes = explode(' ', $class_string); + $name = ''; + foreach ($classes as $class) { + if (array_key_exists($class, $map)) { + $name .= $map [$class]; + } + } + return ($name); + } +} diff --git a/platform/www/lib/plugins/wrap/images/README b/platform/www/lib/plugins/wrap/images/README new file mode 100644 index 0000000..a44a9f4 --- /dev/null +++ b/platform/www/lib/plugins/wrap/images/README @@ -0,0 +1,18 @@ +_NOTE_ + +Icon set: Human-O2 +Designer: Oliver Scholtz (and others) [~schollidesign] +License: GPL (http://www.gnu.org/copyleft/gpl.html) +URL: http://schollidesign.deviantart.com/art/Human-O2-Iconset-105344123 + +_TOOLBAR_ + +Icon set: Silk +Designer: Mark James +License: Creative Commons Attribution 2.5 License (http://creativecommons.org/licenses/by/2.5/) +URL: http://www.famfamfam.com/lab/icons/silk/ + +Icon set: Silk Companion +Designer: Damien Guard +License: Creative Commons Attribution 2.5 License (http://creativecommons.org/licenses/by/2.5/) +URL: http://www.damieng.com/icons/silkcompanion diff --git a/platform/www/lib/plugins/wrap/images/note/16/alert.png b/platform/www/lib/plugins/wrap/images/note/16/alert.png new file mode 100644 index 0000000..f051b1d Binary files /dev/null and b/platform/www/lib/plugins/wrap/images/note/16/alert.png differ diff --git a/platform/www/lib/plugins/wrap/images/note/16/download.png b/platform/www/lib/plugins/wrap/images/note/16/download.png new file mode 100644 index 0000000..e8c7221 Binary files /dev/null and b/platform/www/lib/plugins/wrap/images/note/16/download.png differ diff --git a/platform/www/lib/plugins/wrap/images/note/16/help.png b/platform/www/lib/plugins/wrap/images/note/16/help.png new file mode 100644 index 0000000..2e923a2 Binary files /dev/null and b/platform/www/lib/plugins/wrap/images/note/16/help.png differ diff --git a/platform/www/lib/plugins/wrap/images/note/16/important.png b/platform/www/lib/plugins/wrap/images/note/16/important.png new file mode 100644 index 0000000..0d7f1f0 Binary files /dev/null and b/platform/www/lib/plugins/wrap/images/note/16/important.png differ diff --git a/platform/www/lib/plugins/wrap/images/note/16/info.png b/platform/www/lib/plugins/wrap/images/note/16/info.png new file mode 100644 index 0000000..9b38f8e Binary files /dev/null and b/platform/www/lib/plugins/wrap/images/note/16/info.png differ diff --git a/platform/www/lib/plugins/wrap/images/note/16/tip.png b/platform/www/lib/plugins/wrap/images/note/16/tip.png new file mode 100644 index 0000000..23824bb Binary files /dev/null and b/platform/www/lib/plugins/wrap/images/note/16/tip.png differ diff --git a/platform/www/lib/plugins/wrap/images/note/16/todo.png b/platform/www/lib/plugins/wrap/images/note/16/todo.png new file mode 100644 index 0000000..ebaf17a Binary files /dev/null and b/platform/www/lib/plugins/wrap/images/note/16/todo.png differ diff --git a/platform/www/lib/plugins/wrap/images/note/48/alert.png b/platform/www/lib/plugins/wrap/images/note/48/alert.png new file mode 100644 index 0000000..e6f090f Binary files /dev/null and b/platform/www/lib/plugins/wrap/images/note/48/alert.png differ diff --git a/platform/www/lib/plugins/wrap/images/note/48/download.png b/platform/www/lib/plugins/wrap/images/note/48/download.png new file mode 100644 index 0000000..8f7def1 Binary files /dev/null and b/platform/www/lib/plugins/wrap/images/note/48/download.png differ diff --git a/platform/www/lib/plugins/wrap/images/note/48/help.png b/platform/www/lib/plugins/wrap/images/note/48/help.png new file mode 100644 index 0000000..e39a09d Binary files /dev/null and b/platform/www/lib/plugins/wrap/images/note/48/help.png differ diff --git a/platform/www/lib/plugins/wrap/images/note/48/important.png b/platform/www/lib/plugins/wrap/images/note/48/important.png new file mode 100644 index 0000000..6910ef6 Binary files /dev/null and b/platform/www/lib/plugins/wrap/images/note/48/important.png differ diff --git a/platform/www/lib/plugins/wrap/images/note/48/info.png b/platform/www/lib/plugins/wrap/images/note/48/info.png new file mode 100644 index 0000000..ccb25e8 Binary files /dev/null and b/platform/www/lib/plugins/wrap/images/note/48/info.png differ diff --git a/platform/www/lib/plugins/wrap/images/note/48/tip.png b/platform/www/lib/plugins/wrap/images/note/48/tip.png new file mode 100644 index 0000000..7bd8951 Binary files /dev/null and b/platform/www/lib/plugins/wrap/images/note/48/tip.png differ diff --git a/platform/www/lib/plugins/wrap/images/note/48/todo.png b/platform/www/lib/plugins/wrap/images/note/48/todo.png new file mode 100644 index 0000000..cfbc272 Binary files /dev/null and b/platform/www/lib/plugins/wrap/images/note/48/todo.png differ diff --git a/platform/www/lib/plugins/wrap/images/toolbar/box.png b/platform/www/lib/plugins/wrap/images/toolbar/box.png new file mode 100644 index 0000000..33af046 Binary files /dev/null and b/platform/www/lib/plugins/wrap/images/toolbar/box.png differ diff --git a/platform/www/lib/plugins/wrap/images/toolbar/clear.png b/platform/www/lib/plugins/wrap/images/toolbar/clear.png new file mode 100644 index 0000000..1cdcb48 Binary files /dev/null and b/platform/www/lib/plugins/wrap/images/toolbar/clear.png differ diff --git a/platform/www/lib/plugins/wrap/images/toolbar/column.png b/platform/www/lib/plugins/wrap/images/toolbar/column.png new file mode 100644 index 0000000..97b2e03 Binary files /dev/null and b/platform/www/lib/plugins/wrap/images/toolbar/column.png differ diff --git a/platform/www/lib/plugins/wrap/images/toolbar/em.png b/platform/www/lib/plugins/wrap/images/toolbar/em.png new file mode 100644 index 0000000..8940131 Binary files /dev/null and b/platform/www/lib/plugins/wrap/images/toolbar/em.png differ diff --git a/platform/www/lib/plugins/wrap/images/toolbar/hi.png b/platform/www/lib/plugins/wrap/images/toolbar/hi.png new file mode 100644 index 0000000..c57aa15 Binary files /dev/null and b/platform/www/lib/plugins/wrap/images/toolbar/hi.png differ diff --git a/platform/www/lib/plugins/wrap/images/toolbar/lo.png b/platform/www/lib/plugins/wrap/images/toolbar/lo.png new file mode 100644 index 0000000..cb64e86 Binary files /dev/null and b/platform/www/lib/plugins/wrap/images/toolbar/lo.png differ diff --git a/platform/www/lib/plugins/wrap/images/toolbar/picker.png b/platform/www/lib/plugins/wrap/images/toolbar/picker.png new file mode 100644 index 0000000..4b5b847 Binary files /dev/null and b/platform/www/lib/plugins/wrap/images/toolbar/picker.png differ diff --git a/platform/www/lib/plugins/wrap/lang/ar/lang.php b/platform/www/lib/plugins/wrap/lang/ar/lang.php new file mode 100644 index 0000000..0b2fc57 --- /dev/null +++ b/platform/www/lib/plugins/wrap/lang/ar/lang.php @@ -0,0 +1,16 @@ + + */ +$lang['column'] = 'عمود'; +$lang['box'] = 'مربع متوسط بسيط'; +$lang['info'] = 'مربع معلومات'; +$lang['tip'] = 'مربع تلميح'; +$lang['important'] = 'مربع هام'; +$lang['alert'] = 'مربع التنبيه'; +$lang['help'] = 'مربع تعليمات'; +$lang['download'] = 'مربع التحميل'; +$lang['lo'] = 'أقل أهمية'; diff --git a/platform/www/lib/plugins/wrap/lang/ar/settings.php b/platform/www/lib/plugins/wrap/lang/ar/settings.php new file mode 100644 index 0000000..808b843 --- /dev/null +++ b/platform/www/lib/plugins/wrap/lang/ar/settings.php @@ -0,0 +1,11 @@ + + */ +$lang['restrictedClasses'] = 'تقييد استخدام البرنامج المساعد لهذه الفئات (مفصولة بفاصلة)'; +$lang['restrictionType'] = 'تعين نوع القيد، إذا كانت الفئات المذكورة أعلاه يجب تضمينها أو استبعادها'; +$lang['restrictionType_o_0'] = 'السماح لجميع الفئات باستثناء تلك المذكورة أعلاه'; +$lang['restrictionType_o_1'] = 'تقييد للفئات المذكورة أعلاه فقط وليس غيرها'; diff --git a/platform/www/lib/plugins/wrap/lang/bg/lang.php b/platform/www/lib/plugins/wrap/lang/bg/lang.php new file mode 100644 index 0000000..a720dfc --- /dev/null +++ b/platform/www/lib/plugins/wrap/lang/bg/lang.php @@ -0,0 +1,21 @@ + + */ +$lang['picker'] = 'Wrap приставка'; +$lang['column'] = 'колони'; +$lang['box'] = 'обикновено центрирано поле'; +$lang['info'] = 'информационно поле'; +$lang['tip'] = 'поле за съвет'; +$lang['important'] = 'поле за важно съобщение'; +$lang['alert'] = 'поле за предупреждение'; +$lang['help'] = 'поле за съобщение за помощ'; +$lang['download'] = 'поле за сваляне'; +$lang['todo'] = 'поле за подсещане'; +$lang['clear'] = 'премахване на параметъра float'; +$lang['em'] = 'специално подчертано'; +$lang['hi'] = 'акцентирано'; +$lang['lo'] = 'маловажно'; diff --git a/platform/www/lib/plugins/wrap/lang/bg/settings.php b/platform/www/lib/plugins/wrap/lang/bg/settings.php new file mode 100644 index 0000000..a9d0c57 --- /dev/null +++ b/platform/www/lib/plugins/wrap/lang/bg/settings.php @@ -0,0 +1,16 @@ + + */ +$lang['noPrefix'] = 'Кои имена на класове трябва да бъдат изключени от списъка с имена, които могат да бъдат разширени с префикс "wrap_"? +Имената на класовете се изброяват в списък с разделител запетая.'; +$lang['restrictedClasses'] = 'Ограничи приставката да използва само тези класове. Класовете се изброяват в списък с разделител запетая.'; +$lang['restrictionType'] = 'тип на ограничението - специфицира дали изброените по-горе класове трябва да бъдат включени или изключени'; +$lang['restrictionType_o_0'] = 'позволи всички класове с изключение на посочените по-горе'; +$lang['restrictionType_o_1'] = 'ограничи единствено класовете изброени по-горе и никакви други'; +$lang['syntaxDiv'] = 'Какъв синтаксис трябва да бъде използван в лентата с инструменти за block wraps?'; +$lang['syntaxSpan'] = 'Какъв синтаксис трябва да бъде използван в лентата с инструменти за inline wraps?'; +$lang['darkTpl'] = 'Оптимизирай цветовете за тъмните шаблони?'; diff --git a/platform/www/lib/plugins/wrap/lang/bn/lang.php b/platform/www/lib/plugins/wrap/lang/bn/lang.php new file mode 100644 index 0000000..301d270 --- /dev/null +++ b/platform/www/lib/plugins/wrap/lang/bn/lang.php @@ -0,0 +1,21 @@ + + */ +$lang['picker'] = 'মোড়ানো প্লাগইন'; +$lang['column'] = 'স্তম্ভ'; +$lang['box'] = 'সহজ কেন্দ্রিক বাক্স'; +$lang['info'] = 'তথ্য বাক্স'; +$lang['tip'] = 'টিপ বাক্স'; +$lang['important'] = 'গুরুত্বপূর্ণ বাক্স'; +$lang['alert'] = 'সতর্কতা বাক্স'; +$lang['help'] = 'সাহায্য বাক্স'; +$lang['download'] = 'ডাউনলোডের বাক্স'; +$lang['todo'] = 'করণীয় বাক্স'; +$lang['clear'] = 'স্পষ্ট floats'; +$lang['em'] = 'বিশেষ করে জোর'; +$lang['hi'] = 'হাইলাইট'; +$lang['lo'] = 'কম গুরুত্বপূর্ণ'; diff --git a/platform/www/lib/plugins/wrap/lang/bn/settings.php b/platform/www/lib/plugins/wrap/lang/bn/settings.php new file mode 100644 index 0000000..baeca82 --- /dev/null +++ b/platform/www/lib/plugins/wrap/lang/bn/settings.php @@ -0,0 +1,14 @@ + + */ +$lang['noPrefix'] = 'যা (কমা দিয়ে পৃথক) শ্রেণীর নাম "wrap_" সঙ্গে অগ্রে যুক্ত হওয়া থেকে বাদ দেওয়া হবে?'; +$lang['restrictedClasses'] = 'এইসব করতে প্লাগিন ব্যবহার সীমিত (কমা দিয়ে পৃথক করা) ক্লাস'; +$lang['restrictionType'] = 'ক্লাস উপরে অন্তর্ভুক্ত বা বাদ দেওয়া হইবে যদি সীমাবদ্ধতা ধরন, নির্দিষ্ট করে'; +$lang['restrictionType_o_0'] = 'উপরোক্ত জনকে ছাড়া সব শ্রেণীর অনুমতি'; +$lang['restrictionType_o_1'] = 'শুধুমাত্র উপরোক্ত শ্রেণীর এবং কোন অন্যদের সীমিত'; +$lang['syntaxDiv'] = 'কোন বাক্য গঠন ব্লক গোপন জন্য টুলবার জুতো ব্যবহার করা উচিত?'; +$lang['syntaxSpan'] = 'কোন বাক্য গঠন ইনলাইন গোপন জন্য টুলবার জুতো ব্যবহার করা উচিত?'; diff --git a/platform/www/lib/plugins/wrap/lang/cs/lang.php b/platform/www/lib/plugins/wrap/lang/cs/lang.php new file mode 100644 index 0000000..7c3d7dc --- /dev/null +++ b/platform/www/lib/plugins/wrap/lang/cs/lang.php @@ -0,0 +1,21 @@ + + */ +$lang['picker'] = 'Zásuvný modul Wrap'; +$lang['column'] = 'sloupce'; +$lang['box'] = 'jednoduchý vystředěný rámeček'; +$lang['info'] = 'informační rámeček'; +$lang['tip'] = 'rámeček s radou'; +$lang['important'] = 'důležitý rámeček'; +$lang['alert'] = 'výstražný rámeček'; +$lang['help'] = 'pomocný rámeček'; +$lang['download'] = 'rámeček s odkazem ke stažení'; +$lang['todo'] = 'rámeček úkolu'; +$lang['clear'] = 'clear floats'; +$lang['em'] = 'zvláštně zdůrazněné'; +$lang['hi'] = 'zvýrazněné'; +$lang['lo'] = 'méně důležité'; diff --git a/platform/www/lib/plugins/wrap/lang/cs/settings.php b/platform/www/lib/plugins/wrap/lang/cs/settings.php new file mode 100644 index 0000000..6d19249 --- /dev/null +++ b/platform/www/lib/plugins/wrap/lang/cs/settings.php @@ -0,0 +1,15 @@ + + */ +$lang['noPrefix'] = 'Která (čárkou oddělená) jména tříd nemají být označována předponou "wrap_"?'; +$lang['restrictedClasses'] = 'omezit použití zásuvného modulu na tyto (čárkou oddělené) třídy'; +$lang['restrictionType'] = 'typ omezení, rozhoduje jestli mají být výše uvedené třídy zahrnuty nebo vyřazeny'; +$lang['restrictionType_o_0'] = 'povolit všechny třídy kromě těch výše'; +$lang['restrictionType_o_1'] = 'omezit pouze na třídy výše a žádné jiné'; +$lang['syntaxDiv'] = 'Jaká syntax má být použita ve výběru pro zarovnání bloku? '; +$lang['syntaxSpan'] = 'Jaká syntax má být použita ve výběru pro zarovnání v řádku? '; +$lang['darkTpl'] = 'Optimalizovat barvy pro tmavý vzhled?'; diff --git a/platform/www/lib/plugins/wrap/lang/cy/lang.php b/platform/www/lib/plugins/wrap/lang/cy/lang.php new file mode 100644 index 0000000..d071712 --- /dev/null +++ b/platform/www/lib/plugins/wrap/lang/cy/lang.php @@ -0,0 +1,22 @@ + + * @author diafol + */ +$lang['picker'] = 'Ategyn Wrap'; +$lang['column'] = 'colofnau'; +$lang['box'] = 'blwch syml wedi\'i ganoli'; +$lang['info'] = 'blwch gwyb.'; +$lang['tip'] = 'blwch awgrym'; +$lang['important'] = 'blwch pwysig'; +$lang['alert'] = 'blwch rhybudd'; +$lang['help'] = 'blwch cyngor'; +$lang['download'] = 'blwch lawrlwytho'; +$lang['todo'] = 'blwch i-wneud'; +$lang['clear'] = 'clirio \'floats\''; +$lang['em'] = 'gyda phwyslais arbennig'; +$lang['hi'] = 'aroleuedig'; +$lang['lo'] = 'llai arwyddocaol'; diff --git a/platform/www/lib/plugins/wrap/lang/cy/settings.php b/platform/www/lib/plugins/wrap/lang/cy/settings.php new file mode 100644 index 0000000..25bd349 --- /dev/null +++ b/platform/www/lib/plugins/wrap/lang/cy/settings.php @@ -0,0 +1,15 @@ + + */ +$lang['noPrefix'] = 'Pa enwau dosbarth (gwahanu gan goma) na ddylai derbyn y rhagddodiad "wrap_"?'; +$lang['restrictedClasses'] = 'cyfyngu defnydd yr ategyn hwn i\'r dosbarthiadau (gwahanu gan goma) hyn'; +$lang['restrictionType'] = 'math y cyfyngiad, yn dynodi os caiff y dosbarthiadau uchod eu cynnwys neu eu heithrio'; +$lang['restrictionType_o_0'] = 'caniatáu pob dosbarth ond y rhai uchod'; +$lang['restrictionType_o_1'] = 'cyfyngu i\'r dosbarthiadau uchod yn unig'; +$lang['syntaxDiv'] = 'Pa gystrawen a ddylid defnyddio yn newisydd y bar offer ar gyfer wrapiau bloc?'; +$lang['syntaxSpan'] = 'Pa gystrawen a ddylid defnyddio yn newisydd y bar offer ar gyfer wrapiau mewnlin?'; +$lang['darkTpl'] = 'Optimeiddio lliwiau ar gyfer templedau tywyll?'; diff --git a/platform/www/lib/plugins/wrap/lang/da/lang.php b/platform/www/lib/plugins/wrap/lang/da/lang.php new file mode 100644 index 0000000..d300095 --- /dev/null +++ b/platform/www/lib/plugins/wrap/lang/da/lang.php @@ -0,0 +1,21 @@ + + */ +$lang['picker'] = 'Wrap Plugin'; +$lang['column'] = 'række'; +$lang['box'] = 'simpel centreret boks'; +$lang['info'] = 'info boks'; +$lang['tip'] = 'tip boks'; +$lang['important'] = 'vigtig boks'; +$lang['alert'] = 'alarm boks'; +$lang['help'] = 'hjælp boks'; +$lang['download'] = 'download boks'; +$lang['todo'] = 'todo boks'; +$lang['clear'] = 'ryd flydere'; +$lang['em'] = 'specielt fremhævet'; +$lang['hi'] = 'fremhævet'; +$lang['lo'] = 'mindre vigtigt'; diff --git a/platform/www/lib/plugins/wrap/lang/da/settings.php b/platform/www/lib/plugins/wrap/lang/da/settings.php new file mode 100644 index 0000000..25b0962 --- /dev/null +++ b/platform/www/lib/plugins/wrap/lang/da/settings.php @@ -0,0 +1,12 @@ + + */ +$lang['noPrefix'] = 'Hvilke (kommaseparerede) klassenavne skal udelukkes fra at få præfikset "wrap_"?'; +$lang['restrictedClasses'] = 'begræns brugen af plugin til følgende (kommaseparerede) klasser'; +$lang['restrictionType'] = 'begrænsningstype, specificerer om ovenstående klasser skal inkluderes eller ekskluderes'; +$lang['restrictionType_o_0'] = 'tillad alle klasser på nær de ovenstående'; +$lang['restrictionType_o_1'] = 'begræns til ovenstående klasser og ingen andre'; diff --git a/platform/www/lib/plugins/wrap/lang/de-informal/lang.php b/platform/www/lib/plugins/wrap/lang/de-informal/lang.php new file mode 100644 index 0000000..0e83e08 --- /dev/null +++ b/platform/www/lib/plugins/wrap/lang/de-informal/lang.php @@ -0,0 +1,19 @@ + + */ +$lang['picker'] = 'Wrap-kromaĵo'; +$lang['column'] = 'kolumnoj'; +$lang['box'] = 'simpla centrita skatolo'; +$lang['info'] = 'inform-skatolo'; +$lang['tip'] = 'konsil-skatolo'; +$lang['important'] = 'grava skatolo'; +$lang['alert'] = 'avert-skatolo'; +$lang['help'] = 'help-skatolo'; +$lang['download'] = 'elŝut-skatolo'; +$lang['todo'] = 'farendaĵ-skatolo'; +$lang['clear'] = 'liberigi la randojn'; +$lang['em'] = 'aparte emfazita'; +$lang['hi'] = 'markita'; +$lang['lo'] = 'malpli grava'; diff --git a/platform/www/lib/plugins/wrap/lang/eo/settings.php b/platform/www/lib/plugins/wrap/lang/eo/settings.php new file mode 100644 index 0000000..89d037a --- /dev/null +++ b/platform/www/lib/plugins/wrap/lang/eo/settings.php @@ -0,0 +1,14 @@ + + */ +$lang['noPrefix'] = 'Kiuj (komo-disigitaj) klasnomoj estu ekskludataj de la prefikso "wrap_"?'; +$lang['restrictedClasses'] = 'limigi la uzon de la kromaĵo al tiuj klasoj (komo-disigitaj)'; +$lang['restrictionType'] = 'tipo de limigo (ĉu la supre menciitaj klasoj estu inkludataj aŭ ekskludataj?)'; +$lang['restrictionType_o_0'] = 'permesi ĉiujn klasojn krom la menciitaj'; +$lang['restrictionType_o_1'] = 'limigi al nur tiuj grupoj, neniuj aliaj'; +$lang['syntaxDiv'] = 'Kiun sintakson uzi por blok-volvoj en la ilaro-elektilo?'; +$lang['syntaxSpan'] = 'Kiun sintakson uzi por enliniaj volvoj en la ilaro-elektilo?'; diff --git a/platform/www/lib/plugins/wrap/lang/es/lang.php b/platform/www/lib/plugins/wrap/lang/es/lang.php new file mode 100644 index 0000000..b357aed --- /dev/null +++ b/platform/www/lib/plugins/wrap/lang/es/lang.php @@ -0,0 +1,21 @@ + + */ +$lang['picker'] = 'Wrap Plugin'; +$lang['column'] = 'columnas'; +$lang['box'] = 'caja simple centrada'; +$lang['info'] = 'caja de información'; +$lang['tip'] = 'caja de consejo'; +$lang['important'] = 'caja importante'; +$lang['alert'] = 'caja de alerta'; +$lang['help'] = 'caja de ayuda'; +$lang['download'] = 'caja de descarga'; +$lang['todo'] = 'caja de TODO'; +$lang['clear'] = 'limpiar float'; +$lang['em'] = 'especialmente enfatizado'; +$lang['hi'] = 'destacado'; +$lang['lo'] = 'menos significativo'; diff --git a/platform/www/lib/plugins/wrap/lang/es/settings.php b/platform/www/lib/plugins/wrap/lang/es/settings.php new file mode 100644 index 0000000..137a878 --- /dev/null +++ b/platform/www/lib/plugins/wrap/lang/es/settings.php @@ -0,0 +1,18 @@ + + * @author Juan Asensio Sánchez + * @author Óscar M. Lage + */ +$lang['noPrefix'] = '¿Qué nombres de clase (separados por comas) no deberían ser precedidos de "wrap_"?'; +$lang['restrictedClasses'] = 'restringir el uso de este plugin a estas clases (separadas por comas)'; +$lang['restrictionType'] = 'tipo de restricción, especifica si las clases anteriores serán incluidas o excluidas'; +$lang['restrictionType_o_0'] = 'permitir todas las clases excepto las anteriores'; +$lang['restrictionType_o_1'] = 'restringir a sólo las clases anteriores y no otras'; +$lang['syntaxDiv'] = '¿Qué sintaxis debería ser usada en el selector de la barra de herramientas para los bloques "wrap"?'; +$lang['syntaxSpan'] = '¿Qué sintaxis debería ser usada en el selector de la barra de herramientas para los "wrap" en linea?'; +$lang['darkTpl'] = '¿Optimizar colores para plantillas oscuras?'; +$lang['emulatedHeadlines'] = '¿Usar encabezados emulados? (obsoleto)'; diff --git a/platform/www/lib/plugins/wrap/lang/fa/lang.php b/platform/www/lib/plugins/wrap/lang/fa/lang.php new file mode 100644 index 0000000..0570889 --- /dev/null +++ b/platform/www/lib/plugins/wrap/lang/fa/lang.php @@ -0,0 +1,22 @@ + + * @author Sam01 + */ +$lang['picker'] = 'افزونه قراردادن'; +$lang['column'] = 'ستون‌ها'; +$lang['box'] = 'جعبه محور ساده'; +$lang['info'] = 'جعبه اطلاعات'; +$lang['tip'] = 'جعبه نکته'; +$lang['important'] = 'جعبه مهم'; +$lang['alert'] = 'جعبه هشدار'; +$lang['help'] = 'جعبه کمک'; +$lang['download'] = 'جعبه دانلود'; +$lang['todo'] = 'جعبه کاربردی'; +$lang['clear'] = 'جعبه شناور'; +$lang['em'] = 'تاکید مهم'; +$lang['hi'] = 'برجسته'; +$lang['lo'] = 'کم اهمیت'; diff --git a/platform/www/lib/plugins/wrap/lang/fa/settings.php b/platform/www/lib/plugins/wrap/lang/fa/settings.php new file mode 100644 index 0000000..30dc2d4 --- /dev/null +++ b/platform/www/lib/plugins/wrap/lang/fa/settings.php @@ -0,0 +1,15 @@ + + */ +$lang['noPrefix'] = 'کدام نام‌های کلاس باید از پیشوند شدن با "wrap_" محروم شوند؟'; +$lang['restrictedClasses'] = 'محدودکردن استفاده‌ی افزونه از این کلاس‌ها (جداکردن با کاما)'; +$lang['restrictionType'] = 'نوع محدودیت، مشخص می‌کند که آیا کلاس‌های فوق گنجانده شوند و یا محروم شوند'; +$lang['restrictionType_o_0'] = 'اجازه دادن برای طبقه‌بندی همه به جز بالایی‌ها'; +$lang['restrictionType_o_1'] = 'محدودکردن به کلاس‌های بالا و نه دیگری'; +$lang['syntaxDiv'] = 'کدام الگوی نگارشی باید استفاده شود در انتخابگر نوارابزار برای مسدودکردن قرارگرفته‌ها؟'; +$lang['syntaxSpan'] = 'کدام الگوی نگارشی باید استفاده شود در انتخاب‌گر نوارابزار برای قرارگرفته‌های درون‌خطی؟'; +$lang['darkTpl'] = 'تنظیم رنگ‌ها برای قالب‌های تیره؟'; diff --git a/platform/www/lib/plugins/wrap/lang/fr/lang.php b/platform/www/lib/plugins/wrap/lang/fr/lang.php new file mode 100644 index 0000000..d6dc321 --- /dev/null +++ b/platform/www/lib/plugins/wrap/lang/fr/lang.php @@ -0,0 +1,22 @@ + + * @author schplurtz + */ +$lang['picker'] = 'Extension Wrap'; +$lang['column'] = 'colonnes'; +$lang['box'] = 'bloc simple'; +$lang['info'] = 'bloc information'; +$lang['tip'] = 'bloc astuce'; +$lang['important'] = 'bloc important'; +$lang['alert'] = 'bloc alerte'; +$lang['help'] = 'bloc aide'; +$lang['download'] = 'bloc téléchargement'; +$lang['todo'] = 'bloc à faire'; +$lang['clear'] = 'rétablir le flux après un élément flottant'; +$lang['em'] = 'particulièrement important'; +$lang['hi'] = 'important'; +$lang['lo'] = 'peu important'; diff --git a/platform/www/lib/plugins/wrap/lang/fr/settings.php b/platform/www/lib/plugins/wrap/lang/fr/settings.php new file mode 100644 index 0000000..c2dc39f --- /dev/null +++ b/platform/www/lib/plugins/wrap/lang/fr/settings.php @@ -0,0 +1,18 @@ + + * @author Laynee + * @author Pietroni + */ +$lang['noPrefix'] = 'Quelles classes (séparées par une virgule) ne devraient pas être préfixées d\'un "wrap_" ?'; +$lang['restrictedClasses'] = 'Restreindre l\'utilisation de cette extension à ces classes. (liste séparée par des virgules)'; +$lang['restrictionType'] = 'Type de restriction. Indique s\'il faut inclure ou exclure les classes ci-dessus.'; +$lang['restrictionType_o_0'] = 'Autoriser toutes les classes sauf celles ci-dessus.'; +$lang['restrictionType_o_1'] = 'N\'autoriser que les classes ci dessus.'; +$lang['syntaxDiv'] = 'Quelle syntaxe les boutons de la barre d\'outil doivent-ils générer pour les éléments blocs ?'; +$lang['syntaxSpan'] = 'Quelle syntaxe les boutons de la barre d\'outil doivent-ils générer pour les éléments en ligne ?'; +$lang['darkTpl'] = 'Optimiser les couleurs pour les thèmes sombres?'; +$lang['emulatedHeadlines'] = 'Utiliser l\'émulation des titres ? (déprécié)'; diff --git a/platform/www/lib/plugins/wrap/lang/hr/lang.php b/platform/www/lib/plugins/wrap/lang/hr/lang.php new file mode 100644 index 0000000..c9ab06b --- /dev/null +++ b/platform/www/lib/plugins/wrap/lang/hr/lang.php @@ -0,0 +1,21 @@ + + */ +$lang['picker'] = 'Wrap dodatak'; +$lang['column'] = 'kolone'; +$lang['box'] = 'običan centrirani okvir'; +$lang['info'] = 'info okvir'; +$lang['tip'] = 'okvir savjet'; +$lang['important'] = 'okvir važno'; +$lang['alert'] = 'okvir upozorenja'; +$lang['help'] = 'okvir pomoći'; +$lang['download'] = 'okvir učitavanja'; +$lang['todo'] = 'okvir preostalo'; +$lang['clear'] = 'prazan okvir'; +$lang['em'] = 'posebno naglašeni'; +$lang['hi'] = 'istaknuti'; +$lang['lo'] = 'manje bitan'; diff --git a/platform/www/lib/plugins/wrap/lang/hr/settings.php b/platform/www/lib/plugins/wrap/lang/hr/settings.php new file mode 100644 index 0000000..1adb7dd --- /dev/null +++ b/platform/www/lib/plugins/wrap/lang/hr/settings.php @@ -0,0 +1,16 @@ + + */ +$lang['noPrefix'] = 'Koja (zarezom odvojene) imena klasa trebaju ne trebaju biti s prefiksom "wrap_"? '; +$lang['restrictedClasses'] = 'ograniči korištenje ovog dodatka na ove klase (zarezom odvojena lista)'; +$lang['restrictionType'] = 'vrsta ograničenja, određuje da li gore navedene klase trebaju biti uključene ili isključene'; +$lang['restrictionType_o_0'] = 'dozvoli sve klase osim gore navedenih'; +$lang['restrictionType_o_1'] = 'dozvoli samo gore navedene klase'; +$lang['syntaxDiv'] = 'Koja sintaksa treba biti korištena u alatnoj traci za omeđivanje bloka?'; +$lang['syntaxSpan'] = 'Koja sintaksa treba biti korištena u alatnoj traci za omeđivanje teksta u liniji?'; +$lang['darkTpl'] = 'Prilagoditi boje za tamne predloške?'; +$lang['emulatedHeadlines'] = 'Koristi imitirana zaglavlja? (Obustavljeno)'; diff --git a/platform/www/lib/plugins/wrap/lang/hu/lang.php b/platform/www/lib/plugins/wrap/lang/hu/lang.php new file mode 100644 index 0000000..4dbfc99 --- /dev/null +++ b/platform/www/lib/plugins/wrap/lang/hu/lang.php @@ -0,0 +1,21 @@ + + */ +$lang['picker'] = 'Wrap-csatoló'; +$lang['column'] = 'oszlopok'; +$lang['box'] = 'egyszerű, középre igazított doboz'; +$lang['info'] = 'információs doboz'; +$lang['tip'] = 'tippdoboz'; +$lang['important'] = 'fontos doboz'; +$lang['alert'] = 'figyelmeztető doboz'; +$lang['help'] = 'súgódoboz'; +$lang['download'] = 'letöltéshez doboz'; +$lang['todo'] = 'teendőhöz doboz'; +$lang['clear'] = 'float tiltása'; +$lang['em'] = 'különösen hangsúlyos'; +$lang['hi'] = 'kiemelt'; +$lang['lo'] = 'kevésbé fontos'; diff --git a/platform/www/lib/plugins/wrap/lang/hu/settings.php b/platform/www/lib/plugins/wrap/lang/hu/settings.php new file mode 100644 index 0000000..6f3c9da --- /dev/null +++ b/platform/www/lib/plugins/wrap/lang/hu/settings.php @@ -0,0 +1,16 @@ + + * @author DelD + */ +$lang['noPrefix'] = 'Mely (vesszővel elválasztott) osztályneveknek ne legyen "wrap_" előtagja?'; +$lang['restrictedClasses'] = 'csatoló korlátozása ezekre a (vesszővel elválasztott) osztályokra'; +$lang['restrictionType'] = 'korlátozás típusa, megadja, hogy a fenti osztályokat figyelembe vegye vagy se a csatoló'; +$lang['restrictionType_o_0'] = 'minden osztály engedélyezése, kivéve a fentieket'; +$lang['restrictionType_o_1'] = 'csak a fenti osztályok engedélyezése'; +$lang['syntaxDiv'] = 'Milyen szintaxist használjunk a blokktípusú dobozokhoz az eszközsorban?'; +$lang['syntaxSpan'] = 'Milyen szintaxist használjunk a soron belüli (inline) dobozokhoz az eszközsorban?'; +$lang['darkTpl'] = 'Optimalizáljam a színeket sötét sablonokhoz?'; diff --git a/platform/www/lib/plugins/wrap/lang/it/lang.php b/platform/www/lib/plugins/wrap/lang/it/lang.php new file mode 100644 index 0000000..19e1b68 --- /dev/null +++ b/platform/www/lib/plugins/wrap/lang/it/lang.php @@ -0,0 +1,23 @@ + + * @author Giovanni + * @author Torpedo + */ +$lang['picker'] = 'Plugin Wrap'; +$lang['column'] = 'colonne'; +$lang['box'] = 'box semplice centrato'; +$lang['info'] = 'box informazione'; +$lang['tip'] = 'box suggerimento'; +$lang['important'] = 'box importante'; +$lang['alert'] = 'box attenzione'; +$lang['help'] = 'box aiuto'; +$lang['download'] = 'box download'; +$lang['todo'] = 'box cose da fare'; +$lang['clear'] = 'elimina elementi flottanti'; +$lang['em'] = 'enfatizzato speciale'; +$lang['hi'] = 'evidenziato'; +$lang['lo'] = 'meno importante'; diff --git a/platform/www/lib/plugins/wrap/lang/it/settings.php b/platform/www/lib/plugins/wrap/lang/it/settings.php new file mode 100644 index 0000000..cbdd2c0 --- /dev/null +++ b/platform/www/lib/plugins/wrap/lang/it/settings.php @@ -0,0 +1,16 @@ + + * @author Torpedo + */ +$lang['noPrefix'] = 'quali nomi di classi (elenco separato da virgole) non devono avere il prefisso "wrap_"?'; +$lang['restrictedClasses'] = 'restringi l\'uso del plugin a queste classi (elenco separato da virgole)'; +$lang['restrictionType'] = 'tipo di restrizione, specifica se le classi sopra devono essere incluse o escluse'; +$lang['restrictionType_o_0'] = 'permetti tutte le classi tranne quelle sopra'; +$lang['restrictionType_o_1'] = 'restringi solo alle classi sopra e a nessun\'altra'; +$lang['syntaxDiv'] = 'Quale sintassi usare nella paletta degli strumenti per riquadri a blocchi?'; +$lang['syntaxSpan'] = 'Quale sintassi usare nella paletta degli strumenti per riquadri in linea?'; +$lang['darkTpl'] = 'Ottimizzare i colori per tema scuro?'; diff --git a/platform/www/lib/plugins/wrap/lang/ja/lang.php b/platform/www/lib/plugins/wrap/lang/ja/lang.php new file mode 100644 index 0000000..598b481 --- /dev/null +++ b/platform/www/lib/plugins/wrap/lang/ja/lang.php @@ -0,0 +1,21 @@ + + */ +$lang['picker'] = 'Wrap プラグイン'; +$lang['column'] = '多段組み'; +$lang['box'] = '中央配置枠'; +$lang['info'] = '情報枠'; +$lang['tip'] = 'ヒント枠'; +$lang['important'] = '重要枠'; +$lang['alert'] = '警告枠'; +$lang['help'] = 'ヘルプ枠'; +$lang['download'] = 'ダウンロード枠'; +$lang['todo'] = 'TODO枠'; +$lang['clear'] = '回り込み解除'; +$lang['em'] = '特に強調'; +$lang['hi'] = 'ハイライト表示'; +$lang['lo'] = '非強調(薄色表示)'; diff --git a/platform/www/lib/plugins/wrap/lang/ja/settings.php b/platform/www/lib/plugins/wrap/lang/ja/settings.php new file mode 100644 index 0000000..ec880ac --- /dev/null +++ b/platform/www/lib/plugins/wrap/lang/ja/settings.php @@ -0,0 +1,16 @@ + + * @author Hideaki SAWADA + */ +$lang['noPrefix'] = 'プレフィックス"wrap_" なしのCSSセレクタを例外的に適用するクラス名(カンマ区切り)'; +$lang['restrictedClasses'] = '有効性をチェックするクラス名(カンマ区切り)'; +$lang['restrictionType'] = '指定したクラスの扱い方'; +$lang['restrictionType_o_0'] = '指定クラスを無効とし、他は有効とする'; +$lang['restrictionType_o_1'] = '指定クラスのみを有効とする'; +$lang['syntaxDiv'] = 'ツールバー使用時:ブロック型構文に使用するタグ名'; +$lang['syntaxSpan'] = 'ツールバー使用時:インライン型構文に使用するタグ名'; +$lang['darkTpl'] = '色の濃いテンプレート用に最適化しますか?'; diff --git a/platform/www/lib/plugins/wrap/lang/ko/lang.php b/platform/www/lib/plugins/wrap/lang/ko/lang.php new file mode 100644 index 0000000..6dce54e --- /dev/null +++ b/platform/www/lib/plugins/wrap/lang/ko/lang.php @@ -0,0 +1,21 @@ + + */ +$lang['picker'] = 'Wrap 플러그인'; +$lang['column'] = '단'; +$lang['box'] = '간단한 가운데 상자'; +$lang['info'] = '정보 상자'; +$lang['tip'] = '팁 상자'; +$lang['important'] = '중요 상자'; +$lang['alert'] = '경고 상자'; +$lang['help'] = '도움말 상자'; +$lang['download'] = '다운로드 상자'; +$lang['todo'] = '할 일 상자'; +$lang['clear'] = '플로트 지우기'; +$lang['em'] = '특히 강조'; +$lang['hi'] = '강조'; +$lang['lo'] = '덜 중요함'; diff --git a/platform/www/lib/plugins/wrap/lang/ko/settings.php b/platform/www/lib/plugins/wrap/lang/ko/settings.php new file mode 100644 index 0000000..2ac0e01 --- /dev/null +++ b/platform/www/lib/plugins/wrap/lang/ko/settings.php @@ -0,0 +1,15 @@ + + */ +$lang['noPrefix'] = '어떤 (쉼표로 구분된) 클래스 이름이 "wrap_" 접두어가 필요가 없습니까?'; +$lang['restrictedClasses'] = '다음 (쉼표로 구분된) 클래스에 플러그인의 사용을 제한'; +$lang['restrictionType'] = '제한 유형은 위의 클래스가 포함되거나 제외되어야 하는지 지정'; +$lang['restrictionType_o_0'] = '위의 클래스를 제외하고 모든 클래스를 허용'; +$lang['restrictionType_o_1'] = '위의 클래스만 허용하고 다른 클래스를 제한'; +$lang['syntaxDiv'] = '어떤 문법이 블록 포장을 위해 도구 모음 선택기에서 사용되어야 합니까?'; +$lang['syntaxSpan'] = '어떤 문법이 인라인 포장을 위해 도구 모음 선택기에서 사용되어야 합니까?'; +$lang['darkTpl'] = '어두운 템플릿을 위해 색을 최적화하겠습니까?'; diff --git a/platform/www/lib/plugins/wrap/lang/nl/lang.php b/platform/www/lib/plugins/wrap/lang/nl/lang.php new file mode 100644 index 0000000..f771b9d --- /dev/null +++ b/platform/www/lib/plugins/wrap/lang/nl/lang.php @@ -0,0 +1,21 @@ + + */ +$lang['picker'] = 'Wrap Plugin'; +$lang['column'] = 'kolommen'; +$lang['box'] = 'simpele gecentreerde blok'; +$lang['info'] = 'informatie blok'; +$lang['tip'] = 'tip blok'; +$lang['important'] = 'belangrijk blok'; +$lang['alert'] = 'waarschuwingsblok'; +$lang['help'] = 'helpblok'; +$lang['download'] = 'downloadblok'; +$lang['todo'] = 'tedoen blok'; +$lang['clear'] = 'reset drijvende blokken (clear floats)'; +$lang['em'] = 'bijzonder benadrukken'; +$lang['hi'] = 'gemarkeerd'; +$lang['lo'] = 'minder belangrijk'; diff --git a/platform/www/lib/plugins/wrap/lang/nl/settings.php b/platform/www/lib/plugins/wrap/lang/nl/settings.php new file mode 100644 index 0000000..8fb33ae --- /dev/null +++ b/platform/www/lib/plugins/wrap/lang/nl/settings.php @@ -0,0 +1,16 @@ + + * @author Johan Wijnker + */ +$lang['noPrefix'] = 'Welke (komma gescheiden) klassennamen moeten niet het voorvoegsel "wrap_" krijgen?'; +$lang['restrictedClasses'] = 'Beperk het gebruik van de plugin tot deze (komma gescheiden) klassen'; +$lang['restrictionType'] = 'beperkingstype, specificeer of de klassen hierboven wel of niet gebruikt mogen worden'; +$lang['restrictionType_o_0'] = 'alle klassen zijn toegestaan, behalve de bovenstaande'; +$lang['restrictionType_o_1'] = 'beperk de toegestane klassen tot de bovenstaande, en geen anderen'; +$lang['syntaxDiv'] = 'Welke syntax moet worden gebruikt in het werkbalk-keuzemenu voor blok-wraps?'; +$lang['syntaxSpan'] = 'Welke syntax moet worden gebruikt in het werkbalk-keuzemenu voor inline-wraps?'; +$lang['darkTpl'] = 'Optimaliseer de kleuren voor donkere templates?'; diff --git a/platform/www/lib/plugins/wrap/lang/no/lang.php b/platform/www/lib/plugins/wrap/lang/no/lang.php new file mode 100644 index 0000000..a1734b8 --- /dev/null +++ b/platform/www/lib/plugins/wrap/lang/no/lang.php @@ -0,0 +1,24 @@ + + */ +$lang['picker'] = 'Omhylningsplugin +Omkransningsplugin'; +$lang['column'] = 'kolonner'; +$lang['box'] = 'enkel sentrert boks'; +$lang['info'] = 'infoboks'; +$lang['tip'] = 'tipsboks'; +$lang['important'] = 'viktig boks'; +$lang['alert'] = 'alarmboks'; +$lang['help'] = 'hjelpeboks'; +$lang['download'] = 'nedlastningsboks'; +$lang['todo'] = 'gjøremålsboks'; +$lang['clear'] = 'tøm floats'; +$lang['em'] = 'spesielt fremhevet (singular) +spesielt fremhevede (plural)'; +$lang['hi'] = 'markert (singular) +markerte (plural)'; +$lang['lo'] = 'mindre viktig'; diff --git a/platform/www/lib/plugins/wrap/lang/no/settings.php b/platform/www/lib/plugins/wrap/lang/no/settings.php new file mode 100644 index 0000000..1bdc762 --- /dev/null +++ b/platform/www/lib/plugins/wrap/lang/no/settings.php @@ -0,0 +1,15 @@ + + */ +$lang['noPrefix'] = 'Hvilke klasser (adskilt med komma) bør eksluderes fra å ha prefiks "wrap_"?'; +$lang['restrictedClasses'] = 'begrens bruk av plugin til klasser adskilt med komma'; +$lang['restrictionType'] = 'restriksjonstype, spesifiserer om de ovenforstående klassene skal inkluderes eller ekskluderes'; +$lang['restrictionType_o_0'] = 'vis alle klasser bortsett fra de ovenforstående'; +$lang['restrictionType_o_1'] = 'begrens til kun ovenforstående klasser og ingen fler'; +$lang['syntaxDiv'] = 'Hvilken syntaks bør brukes i verktøylinjen valg for blokkomkransning?'; +$lang['syntaxSpan'] = 'Hvilken syntaks bør brukes i verktøylinjen valg for omkransning på en linje?'; +$lang['darkTpl'] = 'Optimer farger for mørke maler?'; diff --git a/platform/www/lib/plugins/wrap/lang/pt-br/lang.php b/platform/www/lib/plugins/wrap/lang/pt-br/lang.php new file mode 100644 index 0000000..f02846a --- /dev/null +++ b/platform/www/lib/plugins/wrap/lang/pt-br/lang.php @@ -0,0 +1,22 @@ + + * @author Fábio Nogueira + */ +$lang['picker'] = 'Plugin Wrap'; +$lang['column'] = 'colunas'; +$lang['box'] = 'caixa centralizada simples'; +$lang['info'] = 'caixa de informação'; +$lang['tip'] = 'caixa de sugestão'; +$lang['important'] = 'caixa importante'; +$lang['alert'] = 'caixa de alerta'; +$lang['help'] = 'caixa de ajuda'; +$lang['download'] = 'caixa de download'; +$lang['todo'] = 'caixa de tarefas a fazer'; +$lang['clear'] = 'limpar'; +$lang['em'] = 'especialmente enfatizado'; +$lang['hi'] = 'enfatizado'; +$lang['lo'] = 'menos significativo'; diff --git a/platform/www/lib/plugins/wrap/lang/pt-br/settings.php b/platform/www/lib/plugins/wrap/lang/pt-br/settings.php new file mode 100644 index 0000000..e265965 --- /dev/null +++ b/platform/www/lib/plugins/wrap/lang/pt-br/settings.php @@ -0,0 +1,18 @@ + + * @author Juliano Marconi Lanigra + * @author Flaudísio Tolentino + * @author Fábio Nogueira + */ +$lang['noPrefix'] = 'Quais classes (separadas por vírgula) deverão ser excluídas de receber o prefixo "wrap_"?'; +$lang['restrictedClasses'] = 'uso restrito do plugin para essas classes (separadas por vírgula)'; +$lang['restrictionType'] = 'tipo de restrição, especifica se as classes acima deveriam ser incluídas ou excluídas'; +$lang['restrictionType_o_0'] = 'permite todas as classes exceto as acima'; +$lang['restrictionType_o_1'] = 'restrita somente às classes acima e nenhuma outra'; +$lang['syntaxDiv'] = 'Qual a sintaxe que deve ser utilizada no selecionador de barra de ferramentas para wraps em bloco?'; +$lang['syntaxSpan'] = 'Qual a sintaxe que deve ser utilizada no selecionador de barra de ferramentas para wraps em linha?'; +$lang['darkTpl'] = 'Otimizar cores para templates escuros?'; diff --git a/platform/www/lib/plugins/wrap/lang/ru/lang.php b/platform/www/lib/plugins/wrap/lang/ru/lang.php new file mode 100644 index 0000000..7aaddd0 --- /dev/null +++ b/platform/www/lib/plugins/wrap/lang/ru/lang.php @@ -0,0 +1,22 @@ + + * @author Ilya Rozhkov + */ +$lang['picker'] = 'Wrap'; +$lang['column'] = 'колонки'; +$lang['box'] = 'простой центрированный блок'; +$lang['info'] = 'блок «Информация»'; +$lang['tip'] = 'блок «Подсказка»'; +$lang['important'] = 'блок «Важно»'; +$lang['alert'] = 'блок «Тревога»'; +$lang['help'] = 'блок «Справка»'; +$lang['download'] = 'блок «Скачивание»'; +$lang['todo'] = 'блок «Список задач»'; +$lang['clear'] = 'очистить float’ы'; +$lang['em'] = 'пометить важным'; +$lang['hi'] = 'выделить (маркер)'; +$lang['lo'] = 'пометить неважным'; diff --git a/platform/www/lib/plugins/wrap/lang/ru/settings.php b/platform/www/lib/plugins/wrap/lang/ru/settings.php new file mode 100644 index 0000000..1cd3f56 --- /dev/null +++ b/platform/www/lib/plugins/wrap/lang/ru/settings.php @@ -0,0 +1,18 @@ + + * @author Ilya Rozhkov + * @author Rouslan + */ +$lang['noPrefix'] = 'Имена каких классов не должны начинаться с префикса wrap_? (перечислите через запятую; символы * и ? разрешены)'; +$lang['restrictedClasses'] = 'Классы плагина, которые нельзя использовать (перечислите через запятую; символы * и ? разрешены)'; +$lang['restrictionType'] = 'Тип ограничения, указывающий, должны ли быть включены или исключены классы выше'; +$lang['restrictionType_o_0'] = 'разрешить все, за исключением классов, указанных выше'; +$lang['restrictionType_o_1'] = 'ограничить только классами, указанными выше'; +$lang['syntaxDiv'] = 'Какой синтаксис использовать для создания блоков и примечаний?'; +$lang['syntaxSpan'] = 'Какой синтаксис использовать для создания блоков выделения внутри текста?'; +$lang['darkTpl'] = 'Оптимизировать цвета для тёмных тем оформления (шаблонов)?'; +$lang['emulatedHeadlines'] = 'Использовать эмуляцию заголовков? (устаревшее)'; diff --git a/platform/www/lib/plugins/wrap/lang/sk/lang.php b/platform/www/lib/plugins/wrap/lang/sk/lang.php new file mode 100644 index 0000000..af572f7 --- /dev/null +++ b/platform/www/lib/plugins/wrap/lang/sk/lang.php @@ -0,0 +1,12 @@ + + */ +$lang['picker'] = 'Wrap Plugin'; +$lang['column'] = 'stĺpec'; +$lang['em'] = 'zvlášť zdôraznený'; +$lang['hi'] = 'zvýraznený'; +$lang['lo'] = 'menej významný'; diff --git a/platform/www/lib/plugins/wrap/lang/sk/settings.php b/platform/www/lib/plugins/wrap/lang/sk/settings.php new file mode 100644 index 0000000..4e79e94 --- /dev/null +++ b/platform/www/lib/plugins/wrap/lang/sk/settings.php @@ -0,0 +1,12 @@ + + */ +$lang['noPrefix'] = 'Ktoré (čiarkou oddelené) mená tried by mali byť vynechané pri použití predpony "wrap_"?'; +$lang['restrictedClasses'] = 'Obmedzenie použitia pluginu na tieto (čiarkou oddelené) triedy'; +$lang['restrictionType'] = 'Typ obmedzenia, špecifikuje, či triedy uvedené vyššie maju byť zahrnuté alebo vynechané'; +$lang['restrictionType_o_0'] = 'povolenie pre všetky triedy okrem uvedených vyššie'; +$lang['restrictionType_o_1'] = 'obmedzenie len na triedy uvedené vyššie a žiadne iné'; diff --git a/platform/www/lib/plugins/wrap/lang/sr/lang.php b/platform/www/lib/plugins/wrap/lang/sr/lang.php new file mode 100644 index 0000000..5840a24 --- /dev/null +++ b/platform/www/lib/plugins/wrap/lang/sr/lang.php @@ -0,0 +1,21 @@ + + */ +$lang['picker'] = 'Прикључак за преламање'; +$lang['column'] = 'колоне'; +$lang['box'] = 'једноставна кутија на средини'; +$lang['info'] = 'инфо кутија'; +$lang['tip'] = 'кутија са саветима'; +$lang['important'] = 'важна кутија'; +$lang['alert'] = 'кутија са узбуном'; +$lang['help'] = 'кутија за испомоћ'; +$lang['download'] = 'кутија за преузимање'; +$lang['todo'] = 'кутија са задацима'; +$lang['clear'] = 'очисти плутајуће'; +$lang['em'] = 'нарочито назначено'; +$lang['hi'] = 'означено'; +$lang['lo'] = 'мање важно'; diff --git a/platform/www/lib/plugins/wrap/lang/sr/settings.php b/platform/www/lib/plugins/wrap/lang/sr/settings.php new file mode 100644 index 0000000..d9c626c --- /dev/null +++ b/platform/www/lib/plugins/wrap/lang/sr/settings.php @@ -0,0 +1,15 @@ + + */ +$lang['noPrefix'] = 'Која (зарезима одвојена) имена класа треба изузети од додавања префикса "wrap_"?'; +$lang['restrictedClasses'] = 'ограничи употребу прикључна на ове (зарезима одвојене) класе'; +$lang['restrictionType'] = 'врста ограничења, наводи да ли класе изнад треба укључити или искључити'; +$lang['restrictionType_o_0'] = 'дозволи све класе осим оних изнад'; +$lang['restrictionType_o_1'] = 'ограничи само на класе изнад и ниједну више'; +$lang['syntaxDiv'] = 'Коју синтаксу користити у бирачу алатне траке за преламања блокова?'; +$lang['syntaxSpan'] = 'Коју синтаксу користити у бирачу алатне траке за преламања у линији?'; +$lang['darkTpl'] = 'Оптимизовати боје за тамне шаблоне?'; diff --git a/platform/www/lib/plugins/wrap/lang/sv/lang.php b/platform/www/lib/plugins/wrap/lang/sv/lang.php new file mode 100644 index 0000000..6c71e4e --- /dev/null +++ b/platform/www/lib/plugins/wrap/lang/sv/lang.php @@ -0,0 +1,17 @@ + + */ +$lang['picker'] = 'Wrap-plugin'; +$lang['column'] = 'kolumner'; +$lang['info'] = 'infolåda'; +$lang['tip'] = 'tipslåda'; +$lang['important'] = 'viktigt-box'; +$lang['help'] = 'hjälp-box'; +$lang['download'] = 'nedladdningsbox'; +$lang['todo'] = 'att böra-box'; +$lang['hi'] = 'förstärkt'; +$lang['lo'] = 'mindre betydelsefullt'; diff --git a/platform/www/lib/plugins/wrap/lang/sv/settings.php b/platform/www/lib/plugins/wrap/lang/sv/settings.php new file mode 100644 index 0000000..e571553 --- /dev/null +++ b/platform/www/lib/plugins/wrap/lang/sv/settings.php @@ -0,0 +1,10 @@ + + */ +$lang['noPrefix'] = 'Vilka (komma-separerade) class-namn ska undantas från att få prefix "wrap_"?'; +$lang['restrictedClasses'] = 'begränsa plugin-användningen till dessa (komma-separerade) class '; +$lang['darkTpl'] = 'Optimera färger för mörkt templat?'; diff --git a/platform/www/lib/plugins/wrap/lang/tr/lang.php b/platform/www/lib/plugins/wrap/lang/tr/lang.php new file mode 100644 index 0000000..ba55922 --- /dev/null +++ b/platform/www/lib/plugins/wrap/lang/tr/lang.php @@ -0,0 +1,22 @@ + + * @author İlker R. Kapaç + */ +$lang['picker'] = 'Paket Eklentisi'; +$lang['column'] = 'sütunlar'; +$lang['box'] = 'ortalanmış basit kutu'; +$lang['info'] = 'bilgi kutusu'; +$lang['tip'] = 'ipucu kutusu'; +$lang['important'] = 'önemli kutusu'; +$lang['alert'] = 'ikaz kutusu'; +$lang['help'] = 'yardım kutusu'; +$lang['download'] = 'indirme kutusu'; +$lang['todo'] = 'yapılacaklar kutusu'; +$lang['clear'] = 'boşlukları temizle'; +$lang['em'] = 'özellikle vurgulanmış'; +$lang['hi'] = 'vurgulanmış'; +$lang['lo'] = 'daha az önemli'; diff --git a/platform/www/lib/plugins/wrap/lang/tr/settings.php b/platform/www/lib/plugins/wrap/lang/tr/settings.php new file mode 100644 index 0000000..a4f7cd5 --- /dev/null +++ b/platform/www/lib/plugins/wrap/lang/tr/settings.php @@ -0,0 +1,15 @@ + + */ +$lang['noPrefix'] = 'Hangi sınıf isimleri, (virgülle ayrılmış) önüne "wrap_" öneki almaktan hariç tutulsun?'; +$lang['restrictedClasses'] = 'eklentinin kullanımını bu sınıflarla (virgülle ayrılmış) sınırla'; +$lang['restrictionType'] = 'kısıtlama tipi, üstteki sınıfların dalil mi edileceklerini yoksa hariç mi tutulacaklarını belirler.'; +$lang['restrictionType_o_0'] = 'üsttekiler hariç tüm sınıflara izin ver'; +$lang['restrictionType_o_1'] = 'sadece üstteki sınıflarla sınırla, başkasına izin verme'; +$lang['syntaxDiv'] = 'Blok paketi için araç çubuğunda hangi sözdizimi kullanılsın?'; +$lang['syntaxSpan'] = 'Satır içi paketi için araç çubuğunda hangi sözdizimi kullanılsın?'; +$lang['darkTpl'] = 'Karanlık şablonlar için renkler iyileştirilsin mi?'; diff --git a/platform/www/lib/plugins/wrap/lang/zh-tw/lang.php b/platform/www/lib/plugins/wrap/lang/zh-tw/lang.php new file mode 100644 index 0000000..fe60272 --- /dev/null +++ b/platform/www/lib/plugins/wrap/lang/zh-tw/lang.php @@ -0,0 +1,19 @@ + + * @author maie + */ +$lang['noPrefix'] = '哪些CSS类不需要加上“wrap_"前缀?(逗号分隔)'; +$lang['restrictedClasses'] = '将插件的使用限制应用到这些类(逗号分隔)'; +$lang['restrictionType'] = '限制类型,指定上述类应该被包含或排除'; +$lang['restrictionType_o_0'] = '允许除上述类之外的所有类'; +$lang['restrictionType_o_1'] = '仅允许上述类'; +$lang['syntaxDiv'] = '在编辑工具栏的选择器中应对块级元素使用何种语法?'; +$lang['syntaxSpan'] = '在编辑工具栏的选择器中应对行内元素使用何种语法?'; +$lang['darkTpl'] = '优化黑模板的颜色?'; diff --git a/platform/www/lib/plugins/wrap/manager.dat b/platform/www/lib/plugins/wrap/manager.dat new file mode 100644 index 0000000..710202a --- /dev/null +++ b/platform/www/lib/plugins/wrap/manager.dat @@ -0,0 +1,2 @@ +downloadurl=https://github.com/selfthinker/dokuwiki_plugin_wrap/archive/stable.zip +installed=Sat, 12 Mar 2022 01:14:51 +0000 diff --git a/platform/www/lib/plugins/wrap/pdf.less b/platform/www/lib/plugins/wrap/pdf.less new file mode 100644 index 0000000..45bb3ca --- /dev/null +++ b/platform/www/lib/plugins/wrap/pdf.less @@ -0,0 +1,20 @@ +/******************************************************************** +Styles used in PDFs by the DW2PDF plugin (in addition to all.css, and +the DW2PDF plugin also includes style.css via the 'usestyles' option) +********************************************************************/ + +@import 'print_or_pdf.less'; + +.dokuwiki { + +/*____________ only print ____________*/ +/* due to including style.css, these need to be overwritten again */ + +div.wrap_onlyprint { + display: block; +} +span.wrap_onlyprint { + display: inline; +} + +} /* /.dokuwiki */ diff --git a/platform/www/lib/plugins/wrap/plugin.info.txt b/platform/www/lib/plugins/wrap/plugin.info.txt new file mode 100644 index 0000000..52d956d --- /dev/null +++ b/platform/www/lib/plugins/wrap/plugin.info.txt @@ -0,0 +1,8 @@ +base wrap +author Anika Henke +email anika@selfthinker.org +date 2018-04-22 +name Wrap Plugin +desc Universal plugin which combines functionalities of many other plugins. Wrap wiki text inside containers (divs or spans) and give them a class (choose from a variety of preset classes), a width and/or a language with its associated text direction. +url https://www.dokuwiki.org/plugin:wrap +#syntax See example.txt diff --git a/platform/www/lib/plugins/wrap/print.less b/platform/www/lib/plugins/wrap/print.less new file mode 100644 index 0000000..7fe0d8c --- /dev/null +++ b/platform/www/lib/plugins/wrap/print.less @@ -0,0 +1,45 @@ +/******************************************************************** +Print Styles for the Wrap Plugin (additional to all.css) +********************************************************************/ + +@import 'print_or_pdf.less'; + +.dokuwiki { + +/* boxes and notes with icons +********************************************************************/ + +div.wrap_box, +div.wrap_danger, div.wrap_warning, div.wrap_caution, div.wrap_notice, div.wrap_safety, +div.wrap_info, div.wrap_important, div.wrap_alert, div.wrap_tip, div.wrap_help, div.wrap_todo, div.wrap_download { + border: 2px solid #999; + padding: 1em 1em .5em; + margin-bottom: 1.5em; +} +span.wrap_box, +span.wrap_danger, span.wrap_warning, span.wrap_caution, span.wrap_notice, span.wrap_safety, +span.wrap_info, span.wrap_important, span.wrap_alert, span.wrap_tip, span.wrap_help, span.wrap_todo, span.wrap_download { + border: 1px solid #999; + padding: 0 .3em; +} + + +/* mark +********************************************************************/ + +.wrap_hi { + border: 1px solid #999; +} + + +/* miscellaneous +********************************************************************/ + +/*____________ spoiler ____________*/ + +.wrap_spoiler { + visibility: hidden; +} + + +} /* /.dokuwiki */ diff --git a/platform/www/lib/plugins/wrap/print_or_pdf.less b/platform/www/lib/plugins/wrap/print_or_pdf.less new file mode 100644 index 0000000..1d20a9e --- /dev/null +++ b/platform/www/lib/plugins/wrap/print_or_pdf.less @@ -0,0 +1,31 @@ +/******************************************************************** +Styles shared between print.css and pdf.css +********************************************************************/ + +.dokuwiki { + +/* miscellaneous +********************************************************************/ + +/*____________ pagebreak ____________*/ + +.wrap_pagebreak { + break-after: page; /* CSS 3 */ + page-break-after: always; /* CSS 2.1 */ +} + +/*____________ avoid page break ____________*/ +/* not yet supported by most browsers */ + +.wrap_nopagebreak { + break-inside: avoid; /* CSS 3 */ + page-break-inside: avoid; /* CSS 2.1 */ +} + +/*____________ no print ____________*/ + +.wrap_noprint { + display: none; +} + +} /* /.dokuwiki */ diff --git a/platform/www/lib/plugins/wrap/style.less b/platform/www/lib/plugins/wrap/style.less new file mode 100644 index 0000000..4f701a7 --- /dev/null +++ b/platform/www/lib/plugins/wrap/style.less @@ -0,0 +1,215 @@ +/******************************************************************** +Screen Styles for the Wrap Plugin (additional to all.css) +********************************************************************/ + +.dokuwiki { + +/* box +********************************************************************/ + +.wrap_box { + background: @ini_background_alt; + color: @ini_text; +} +div.wrap_box, +div.wrap_danger, +div.wrap_warning, +div.wrap_caution, +div.wrap_notice, +div.wrap_safety { + padding: 1em 1em .5em; + margin-bottom: 1.5em; + overflow: hidden; +} +span.wrap_box, +span.wrap_danger, +span.wrap_warning, +span.wrap_caution, +span.wrap_notice, +span.wrap_safety { + padding: 0 .3em; +} + +/*____________ notes with icons ____________*/ + +/* general styles for all note divs */ +div.wrap_info, +div.wrap_important, +div.wrap_alert, +div.wrap_tip, +div.wrap_help, +div.wrap_todo, +div.wrap_download { + padding: 1em 1em .5em 70px; + margin-bottom: 1.5em; + min-height: 68px; + background-position: 10px 50%; + background-repeat: no-repeat; + color: inherit; + overflow: hidden; +} +/* general styles for all note spans */ +span.wrap_info, +span.wrap_important, +span.wrap_alert, +span.wrap_tip, +span.wrap_help, +span.wrap_todo, +span.wrap_download { + padding: 0 2px 0 20px; + min-height: 20px; + background-position: 2px 50%; + background-repeat: no-repeat; + color: inherit; +} + +/* sorry for icons glued to the right side, but there is currently no way + to make this look good without adjusting the images themselves */ +[dir=rtl] div.wrap_info, +[dir=rtl] div.wrap_important, +[dir=rtl] div.wrap_alert, +[dir=rtl] div.wrap_tip, +[dir=rtl] div.wrap_help, +[dir=rtl] div.wrap_todo, +[dir=rtl] div.wrap_download { + padding: 1em 60px .5em 1em; + background-position: right 50%; +} +[dir=rtl] span.wrap_info, +[dir=rtl] span.wrap_important, +[dir=rtl] span.wrap_alert, +[dir=rtl] span.wrap_tip, +[dir=rtl] span.wrap_help, +[dir=rtl] span.wrap_todo, +[dir=rtl] span.wrap_download { + padding: 0 18px 0 2px; + background-position: right 50%; +} + +/*____________ info ____________*/ +.wrap_info { background-color: #d1d7df; } +.wrap__dark.wrap_info { background-color: #343e4a; } +div.wrap_info { background-image: url(images/note/48/info.png); } +span.wrap_info { background-image: url(images/note/16/info.png); } + +/*____________ important ____________*/ +.wrap_important { background-color: #ffd39f; } +.wrap__dark.wrap_important { background-color: #6c3b00; } +div.wrap_important { background-image: url(images/note/48/important.png); } +span.wrap_important { background-image: url(images/note/16/important.png); } + +/*____________ alert ____________*/ +.wrap_alert { background-color: #ffbcaf; } +.wrap__dark.wrap_alert { background-color: #6b1100; } +div.wrap_alert { background-image: url(images/note/48/alert.png); } +span.wrap_alert { background-image: url(images/note/16/alert.png); } + +/*____________ tip ____________*/ +.wrap_tip { background-color: #fff79f; } +.wrap__dark.wrap_tip { background-color: #4a4400; } +div.wrap_tip { background-image: url(images/note/48/tip.png); } +span.wrap_tip { background-image: url(images/note/16/tip.png); } + +/*____________ help ____________*/ +.wrap_help { background-color: #dcc2ef; } +.wrap__dark.wrap_help { background-color: #3c1757; } +div.wrap_help { background-image: url(images/note/48/help.png); } +span.wrap_help { background-image: url(images/note/16/help.png); } + +/*____________ todo ____________*/ +.wrap_todo { background-color: #c2efdd; } +.wrap__dark.wrap_todo { background-color: #17573e; } +div.wrap_todo { background-image: url(images/note/48/todo.png); } +span.wrap_todo { background-image: url(images/note/16/todo.png); } + +/*____________ download ____________*/ +.wrap_download { background-color: #d6efc2; } +.wrap__dark.wrap_download { background-color: #345717; } +div.wrap_download { background-image: url(images/note/48/download.png); } +span.wrap_download { background-image: url(images/note/16/download.png); } + + +/*____________ safety notes ____________*/ + +.wrap_danger { + background-color: #c00; + color: #fff; +} +.wrap_warning { + background-color: #f60; + color: #000; +} +.wrap_caution { + background-color: #ff0; + color: #000; +} +.wrap_notice { + background-color: #06f; + color: #fff; +} +.wrap_safety { + background-color: #090; + color: #fff; +} + +.wrap_danger *, +.wrap_warning *, +.wrap_caution *, +.wrap_notice *, +.wrap_safety * { + color: inherit !important; +} + + +/* mark +********************************************************************/ + +.wrap_hi { + background-color: #ff9; + overflow: hidden; +} +.wrap__dark.wrap_hi { + background-color: #4e4e0d; +} + + +/* miscellaneous +********************************************************************/ + +/*____________ spoiler ____________*/ + +.wrap_spoiler { + background-color: @ini_background !important; + color: @ini_background !important; + border: 1px dotted red; +} + +/*____________ only print ____________*/ + +.wrap_onlyprint { + display: none; +} + +/*____________ tabs ____________*/ +/* in addition to template styles */ + +.plugin_wrap.tabs { + margin-bottom: 1.4em; +} + +/*____________ button-style link ____________*/ + +.wrap_button a:link, +.wrap_button a:visited { + background-color: @ini_background_alt; +} +.wrap_button a:link:hover, +.wrap_button a:visited:hover, +.wrap_button a:link:focus, +.wrap_button a:visited:focus, +.wrap_button a:link:active, +.wrap_button a:visited:active { + background-color: @ini_background_neu; +} + +} /* /.dokuwiki */ diff --git a/platform/www/lib/plugins/wrap/syntax/closesection.php b/platform/www/lib/plugins/wrap/syntax/closesection.php new file mode 100644 index 0000000..4bb4837 --- /dev/null +++ b/platform/www/lib/plugins/wrap/syntax/closesection.php @@ -0,0 +1,40 @@ + + */ + +if(!defined('DOKU_INC')) die(); + +if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); +require_once(DOKU_PLUGIN.'syntax.php'); + +class syntax_plugin_wrap_closesection extends DokuWiki_Syntax_Plugin { + + function getType(){ return 'substition';} + function getPType(){ return 'block';} + function getSort(){ return 195; } + + /** + * Dummy handler, this syntax part has no syntax but is directly added to the instructions by the div syntax + */ + function handle($match, $state, $pos, Doku_Handler $handler){ + } + + /** + * Create output + */ + function render($mode, Doku_Renderer $renderer, $indata) { + if($mode == 'xhtml'){ + /** @var Doku_Renderer_xhtml $renderer */ + $renderer->finishSectionEdit(); + return true; + } + return false; + } + + +} + diff --git a/platform/www/lib/plugins/wrap/syntax/div.php b/platform/www/lib/plugins/wrap/syntax/div.php new file mode 100644 index 0000000..2a3ffca --- /dev/null +++ b/platform/www/lib/plugins/wrap/syntax/div.php @@ -0,0 +1,139 @@ + + */ + +if(!defined('DOKU_INC')) die(); + +if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); +require_once(DOKU_PLUGIN.'syntax.php'); + +class syntax_plugin_wrap_div extends DokuWiki_Syntax_Plugin { + protected $special_pattern = '\r\n]*?/>'; + protected $entry_pattern = '(?=.*?
)'; + protected $exit_pattern = '
'; + + function getType(){ return 'formatting';} + function getAllowedTypes() { return array('container', 'formatting', 'substition', 'protected', 'disabled', 'paragraphs'); } + function getPType(){ return 'stack';} + function getSort(){ return 195; } + // override default accepts() method to allow nesting - ie, to get the plugin accepts its own entry syntax + function accepts($mode) { + if ($mode == substr(get_class($this), 7)) return true; + return parent::accepts($mode); + } + + /** + * Connect pattern to lexer + */ + function connectTo($mode) { + $this->Lexer->addSpecialPattern($this->special_pattern,$mode,'plugin_wrap_'.$this->getPluginComponent()); + $this->Lexer->addEntryPattern($this->entry_pattern,$mode,'plugin_wrap_'.$this->getPluginComponent()); + } + + function postConnect() { + $this->Lexer->addExitPattern($this->exit_pattern, 'plugin_wrap_'.$this->getPluginComponent()); + $this->Lexer->addPattern('[ \t]*={2,}[^\n]+={2,}[ \t]*(?=\n)', 'plugin_wrap_'.$this->getPluginComponent()); + } + + /** + * Handle the match + */ + function handle($match, $state, $pos, Doku_Handler $handler){ + global $conf; + switch ($state) { + case DOKU_LEXER_ENTER: + case DOKU_LEXER_SPECIAL: + $data = strtolower(trim(substr($match,strpos($match,' '),-1)," \t\n/")); + return array($state, $data); + + case DOKU_LEXER_UNMATCHED: + $handler->_addCall('cdata', array($match), $pos); + break; + + case DOKU_LEXER_MATCHED: + // we have a == header ==, use the core header() renderer + // (copied from core header() in inc/parser/handler.php) + $title = trim($match); + $level = 7 - strspn($title,'='); + if($level < 1) $level = 1; + $title = trim($title,'='); + $title = trim($title); + + $handler->_addCall('header',array($title,$level,$pos), $pos); + // close the section edit the header could open + if ($title && $level <= $conf['maxseclevel']) { + $handler->addPluginCall('wrap_closesection', array(), DOKU_LEXER_SPECIAL, $pos, ''); + } + break; + + case DOKU_LEXER_EXIT: + return array($state, ''); + } + return false; + } + + /** + * Create output + */ + function render($mode, Doku_Renderer $renderer, $indata) { + static $type_stack = array (); + + if (empty($indata)) return false; + list($state, $data) = $indata; + + if($mode == 'xhtml'){ + /** @var Doku_Renderer_xhtml $renderer */ + switch ($state) { + case DOKU_LEXER_ENTER: + $sectionEditStartData = ['target' => 'plugin_wrap_start']; + $sectionEditEndData = ['target' => 'plugin_wrap_end']; + if (!defined('SEC_EDIT_PATTERN')) { + // backwards-compatibility for Frusterick Manners (2017-02-19) + $sectionEditStartData = 'plugin_wrap_start'; + $sectionEditEndData = 'plugin_wrap_end'; + } + // add a section edit right at the beginning of the wrap output + $renderer->startSectionEdit(0, $sectionEditStartData); + $renderer->finishSectionEdit(); + // add a section edit for the end of the wrap output. This prevents the renderer + // from closing the last section edit so the next section button after the wrap syntax will + // include the whole wrap syntax + $renderer->startSectionEdit(0, $sectionEditEndData); + + case DOKU_LEXER_SPECIAL: + $wrap = $this->loadHelper('wrap'); + $attr = $wrap->buildAttributes($data, 'plugin_wrap'); + + $renderer->doc .= ''; + if ($state == DOKU_LEXER_SPECIAL) $renderer->doc .= ''; + break; + + case DOKU_LEXER_EXIT: + $renderer->doc .= ''; + $renderer->finishSectionEdit(); + break; + } + return true; + } + if($mode == 'odt'){ + switch ($state) { + case DOKU_LEXER_ENTER: + $wrap = plugin_load('helper', 'wrap'); + array_push ($type_stack, $wrap->renderODTElementOpen($renderer, 'div', $data)); + break; + + case DOKU_LEXER_EXIT: + $element = array_pop ($type_stack); + $wrap = plugin_load('helper', 'wrap'); + $wrap->renderODTElementClose ($renderer, $element); + break; + } + return true; + } + return false; + } +} diff --git a/platform/www/lib/plugins/wrap/syntax/divblock.php b/platform/www/lib/plugins/wrap/syntax/divblock.php new file mode 100644 index 0000000..9bac053 --- /dev/null +++ b/platform/www/lib/plugins/wrap/syntax/divblock.php @@ -0,0 +1,21 @@ + ...
syntax + * + * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) + * @author Anika Henke + */ + +require_once(dirname(__FILE__).'/div.php'); + +class syntax_plugin_wrap_divblock extends syntax_plugin_wrap_div { + + protected $special_pattern = '\r\n]*?/>'; + protected $entry_pattern = '(?=.*?)'; + protected $exit_pattern = ''; + + +} + diff --git a/platform/www/lib/plugins/wrap/syntax/divwrap.php b/platform/www/lib/plugins/wrap/syntax/divwrap.php new file mode 100644 index 0000000..386c5ff --- /dev/null +++ b/platform/www/lib/plugins/wrap/syntax/divwrap.php @@ -0,0 +1,20 @@ + ...
syntax + * + * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) + * @author Anika Henke + */ + +require_once(dirname(__FILE__).'/div.php'); + +class syntax_plugin_wrap_divwrap extends syntax_plugin_wrap_div { + + protected $special_pattern = '\r\n]*?/>'; + protected $entry_pattern = '(?=.*?
)'; + protected $exit_pattern = ''; + +} + diff --git a/platform/www/lib/plugins/wrap/syntax/span.php b/platform/www/lib/plugins/wrap/syntax/span.php new file mode 100644 index 0000000..2611c5a --- /dev/null +++ b/platform/www/lib/plugins/wrap/syntax/span.php @@ -0,0 +1,105 @@ + + */ + +if(!defined('DOKU_INC')) die(); + +if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); +require_once(DOKU_PLUGIN.'syntax.php'); + +class syntax_plugin_wrap_span extends DokuWiki_Syntax_Plugin { + protected $special_pattern = '\r\n]*?/>'; + protected $entry_pattern = '(?=.*?)'; + protected $exit_pattern = ''; + + function getType(){ return 'formatting';} + function getAllowedTypes() { return array('formatting', 'substition', 'disabled'); } + function getPType(){ return 'normal';} + function getSort(){ return 195; } + // override default accepts() method to allow nesting - ie, to get the plugin accepts its own entry syntax + function accepts($mode) { + if ($mode == substr(get_class($this), 7)) return true; + return parent::accepts($mode); + } + + /** + * Connect pattern to lexer + */ + function connectTo($mode) { + $this->Lexer->addSpecialPattern($this->special_pattern,$mode,'plugin_wrap_'.$this->getPluginComponent()); + $this->Lexer->addEntryPattern($this->entry_pattern,$mode,'plugin_wrap_'.$this->getPluginComponent()); + } + + function postConnect() { + $this->Lexer->addExitPattern($this->exit_pattern, 'plugin_wrap_'.$this->getPluginComponent()); + } + + /** + * Handle the match + */ + function handle($match, $state, $pos, Doku_Handler $handler){ + switch ($state) { + case DOKU_LEXER_ENTER: + case DOKU_LEXER_SPECIAL: + $data = strtolower(trim(substr($match,strpos($match,' '),-1)," \t\n/")); + return array($state, $data); + + case DOKU_LEXER_UNMATCHED : + $handler->_addCall('cdata', array($match), $pos); + return false; + + case DOKU_LEXER_EXIT : + return array($state, ''); + + } + return false; + } + + /** + * Create output + */ + function render($mode, Doku_Renderer $renderer, $indata) { + static $type_stack = array (); + + if (empty($indata)) return false; + list($state, $data) = $indata; + + if($mode == 'xhtml'){ + switch ($state) { + case DOKU_LEXER_ENTER: + case DOKU_LEXER_SPECIAL: + $wrap = $this->loadHelper('wrap'); + $attr = $wrap->buildAttributes($data); + + $renderer->doc .= ''; + if ($state == DOKU_LEXER_SPECIAL) $renderer->doc .= ''; + break; + + case DOKU_LEXER_EXIT: + $renderer->doc .= ''; + break; + } + return true; + } + if($mode == 'odt'){ + switch ($state) { + case DOKU_LEXER_ENTER: + $wrap = plugin_load('helper', 'wrap'); + array_push ($type_stack, $wrap->renderODTElementOpen($renderer, 'span', $data)); + break; + + case DOKU_LEXER_EXIT: + $element = array_pop ($type_stack); + $wrap = plugin_load('helper', 'wrap'); + $wrap->renderODTElementClose ($renderer, $element); + break; + } + return true; + } + return false; + } +} diff --git a/platform/www/lib/plugins/wrap/syntax/spaninline.php b/platform/www/lib/plugins/wrap/syntax/spaninline.php new file mode 100644 index 0000000..cc7a669 --- /dev/null +++ b/platform/www/lib/plugins/wrap/syntax/spaninline.php @@ -0,0 +1,20 @@ + ... syntax + * + * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) + * @author Anika Henke + */ + +require_once(dirname(__FILE__).'/span.php'); + +class syntax_plugin_wrap_spaninline extends syntax_plugin_wrap_span { + + protected $special_pattern = '\r\n]*?/>'; + protected $entry_pattern = '(?=.*?)'; + protected $exit_pattern = ''; + +} + diff --git a/platform/www/lib/plugins/wrap/syntax/spanwrap.php b/platform/www/lib/plugins/wrap/syntax/spanwrap.php new file mode 100644 index 0000000..9c3d921 --- /dev/null +++ b/platform/www/lib/plugins/wrap/syntax/spanwrap.php @@ -0,0 +1,21 @@ + ... syntax + * + * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) + * @author Anika Henke + */ + +require_once(dirname(__FILE__).'/span.php'); + +class syntax_plugin_wrap_spanwrap extends syntax_plugin_wrap_span { + + protected $special_pattern = '\r\n]*?/>'; + protected $entry_pattern = '(?=.*?)'; + protected $exit_pattern = ''; + + +} + -- cgit v1.2.1