From 967007b0c76f5dcfd0d567b6ff3dd5357a252b79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Zieli=C5=84ski?= Date: Mon, 12 May 2025 15:45:17 +0000 Subject: [PATCH] Add JS files --- .gitignore | 1 + import/EcmPriceBooks/Email.js | 1018 + import/EcmPriceBooks/advajax.js | 480 + import/EcmPriceBooks/mintajax.js | 2 + import/EcmPriceBooks/moo1.2.js | 5308 ++ .../EcmDeleteDocument/EcmDeleteDocument.js | 70 + .../EcmDocumentNumberGenerator.js | 124 + .../EcmDropdownEditor/EcmDropdownEditor.js | 205 + include/ECM/EcmMultiPdf/EcmMultiPdf.js | 32 + .../ECM/EcmNotifications/EcmNotifications.js | 295 + include/ECM/EcmNumberFunctions.js | 196 + include/ECM/EcmPreviewPDF/EcmPreviewPDF.js | 82 + .../ECM/EcmSendPdfButton/EcmSendPdfButton.js | 82 + include/ECM/SearchProductTable.js | 1118 + include/ECM/comboselectbox.js | 1361 + include/ECM/loadEcmJsFiles.js | 8 + include/ECM/open_flash_chart/js/swfobject.js | 233 + .../OpenFlashChart/swfobject.js | 5 + .../ofcWebTest/swfobject.js | 5 + .../open_flash_chart2/js-ofc-library/ofc.js | 38 + .../js-ofc-library/open_flash_chart.js | 271 + .../js-ofc-library/open_flash_chart.min.js | 1 + .../ECM/open_flash_chart2/js/json/json2.js | 461 + include/ECM/open_flash_chart2/js/swfobject.js | 5 + .../perl-ofc-library/jquery-1.2.6.min.js | 32 + .../perl-ofc-library/json/json2.js | 461 + .../perl-ofc-library/swfobject.js | 5 + .../python-ofc-library/static/swfobject.js | 5 + include/ECM/stopEnter.js | 9 + include/ECM/tablenavigator.js | 73 + include/JSON.js | 44 + include/MySugar/javascript/MySugar.js | 674 + include/SubPanel/SubPanelTiles.js | 121 + .../javascript/SugarDependentDropdown.js | 52 + .../SugarEmailAddress/SugarEmailAddress.js | 69 + .../Fields/Address/SugarFieldAddress.js | 41 + .../Fields/Collection/SugarFieldCollection.js | 65 + .../Fields/Datetimecombo/Datetimecombo.js | 50 + .../SugarFields/Fields/File/jquery.form.js | 1279 + include/asterisk/calendar/cal.js | 75 + include/asterisk/calendar/calx.js | 159 + include/asterisk/calendar/d.js | 152 + include/asterisk/calendar/e.js | 801 + include/asterisk/calendar/homw.js | 246 + include/asterisk/calendar/launcher.js | 86 + .../formatters/default/company_detail.js | 42 + include/jQuery/ckeditor/adapters/jquery.js | 10 + include/jQuery/ckeditor/build-config.js | 133 + include/jQuery/ckeditor/ckeditor.js | 731 + include/jQuery/ckeditor/config.js | 44 + include/jQuery/ckeditor/lang/af.js | 5 + include/jQuery/ckeditor/lang/ar.js | 5 + include/jQuery/ckeditor/lang/bg.js | 5 + include/jQuery/ckeditor/lang/bn.js | 5 + include/jQuery/ckeditor/lang/bs.js | 5 + include/jQuery/ckeditor/lang/ca.js | 5 + include/jQuery/ckeditor/lang/cs.js | 5 + include/jQuery/ckeditor/lang/cy.js | 5 + include/jQuery/ckeditor/lang/da.js | 5 + include/jQuery/ckeditor/lang/de.js | 5 + include/jQuery/ckeditor/lang/el.js | 5 + include/jQuery/ckeditor/lang/en-au.js | 5 + include/jQuery/ckeditor/lang/en-ca.js | 5 + include/jQuery/ckeditor/lang/en-gb.js | 5 + include/jQuery/ckeditor/lang/en.js | 5 + include/jQuery/ckeditor/lang/eo.js | 5 + include/jQuery/ckeditor/lang/es.js | 5 + include/jQuery/ckeditor/lang/et.js | 5 + include/jQuery/ckeditor/lang/eu.js | 5 + include/jQuery/ckeditor/lang/fa.js | 5 + include/jQuery/ckeditor/lang/fi.js | 5 + include/jQuery/ckeditor/lang/fo.js | 5 + include/jQuery/ckeditor/lang/fr-ca.js | 5 + include/jQuery/ckeditor/lang/fr.js | 5 + include/jQuery/ckeditor/lang/gl.js | 5 + include/jQuery/ckeditor/lang/gu.js | 5 + include/jQuery/ckeditor/lang/he.js | 5 + include/jQuery/ckeditor/lang/hi.js | 5 + include/jQuery/ckeditor/lang/hr.js | 5 + include/jQuery/ckeditor/lang/hu.js | 5 + include/jQuery/ckeditor/lang/id.js | 5 + include/jQuery/ckeditor/lang/is.js | 5 + include/jQuery/ckeditor/lang/it.js | 5 + include/jQuery/ckeditor/lang/ja.js | 5 + include/jQuery/ckeditor/lang/ka.js | 5 + include/jQuery/ckeditor/lang/km.js | 5 + include/jQuery/ckeditor/lang/ko.js | 5 + include/jQuery/ckeditor/lang/ku.js | 5 + include/jQuery/ckeditor/lang/lt.js | 5 + include/jQuery/ckeditor/lang/lv.js | 5 + include/jQuery/ckeditor/lang/mk.js | 5 + include/jQuery/ckeditor/lang/mn.js | 5 + include/jQuery/ckeditor/lang/ms.js | 5 + include/jQuery/ckeditor/lang/nb.js | 5 + include/jQuery/ckeditor/lang/nl.js | 5 + include/jQuery/ckeditor/lang/no.js | 5 + include/jQuery/ckeditor/lang/pl.js | 5 + include/jQuery/ckeditor/lang/pt-br.js | 5 + include/jQuery/ckeditor/lang/pt.js | 5 + include/jQuery/ckeditor/lang/ro.js | 5 + include/jQuery/ckeditor/lang/ru.js | 5 + include/jQuery/ckeditor/lang/si.js | 5 + include/jQuery/ckeditor/lang/sk.js | 5 + include/jQuery/ckeditor/lang/sl.js | 5 + include/jQuery/ckeditor/lang/sq.js | 5 + include/jQuery/ckeditor/lang/sr-latn.js | 5 + include/jQuery/ckeditor/lang/sr.js | 5 + include/jQuery/ckeditor/lang/sv.js | 5 + include/jQuery/ckeditor/lang/th.js | 5 + include/jQuery/ckeditor/lang/tr.js | 5 + include/jQuery/ckeditor/lang/tt.js | 5 + include/jQuery/ckeditor/lang/ug.js | 5 + include/jQuery/ckeditor/lang/uk.js | 5 + include/jQuery/ckeditor/lang/vi.js | 5 + include/jQuery/ckeditor/lang/zh-cn.js | 5 + include/jQuery/ckeditor/lang/zh.js | 5 + .../ckeditor/plugins/about/dialogs/about.js | 7 + .../ckeditor/plugins/autogrow/plugin.js | 209 + .../ckeditor/plugins/blockquote/lang/af.js | 7 + .../ckeditor/plugins/blockquote/lang/ar.js | 7 + .../ckeditor/plugins/blockquote/lang/bg.js | 7 + .../ckeditor/plugins/blockquote/lang/bn.js | 7 + .../ckeditor/plugins/blockquote/lang/bs.js | 7 + .../ckeditor/plugins/blockquote/lang/ca.js | 7 + .../ckeditor/plugins/blockquote/lang/cs.js | 7 + .../ckeditor/plugins/blockquote/lang/cy.js | 7 + .../ckeditor/plugins/blockquote/lang/da.js | 7 + .../ckeditor/plugins/blockquote/lang/de.js | 7 + .../ckeditor/plugins/blockquote/lang/el.js | 7 + .../ckeditor/plugins/blockquote/lang/en-au.js | 7 + .../ckeditor/plugins/blockquote/lang/en-ca.js | 7 + .../ckeditor/plugins/blockquote/lang/en-gb.js | 7 + .../ckeditor/plugins/blockquote/lang/en.js | 7 + .../ckeditor/plugins/blockquote/lang/eo.js | 7 + .../ckeditor/plugins/blockquote/lang/es.js | 7 + .../ckeditor/plugins/blockquote/lang/et.js | 7 + .../ckeditor/plugins/blockquote/lang/eu.js | 7 + .../ckeditor/plugins/blockquote/lang/fa.js | 7 + .../ckeditor/plugins/blockquote/lang/fi.js | 7 + .../ckeditor/plugins/blockquote/lang/fo.js | 7 + .../ckeditor/plugins/blockquote/lang/fr-ca.js | 7 + .../ckeditor/plugins/blockquote/lang/fr.js | 7 + .../ckeditor/plugins/blockquote/lang/gl.js | 7 + .../ckeditor/plugins/blockquote/lang/gu.js | 7 + .../ckeditor/plugins/blockquote/lang/he.js | 7 + .../ckeditor/plugins/blockquote/lang/hi.js | 7 + .../ckeditor/plugins/blockquote/lang/hr.js | 7 + .../ckeditor/plugins/blockquote/lang/hu.js | 7 + .../ckeditor/plugins/blockquote/lang/id.js | 7 + .../ckeditor/plugins/blockquote/lang/is.js | 7 + .../ckeditor/plugins/blockquote/lang/it.js | 7 + .../ckeditor/plugins/blockquote/lang/ja.js | 7 + .../ckeditor/plugins/blockquote/lang/ka.js | 7 + .../ckeditor/plugins/blockquote/lang/km.js | 7 + .../ckeditor/plugins/blockquote/lang/ko.js | 7 + .../ckeditor/plugins/blockquote/lang/ku.js | 7 + .../ckeditor/plugins/blockquote/lang/lt.js | 7 + .../ckeditor/plugins/blockquote/lang/lv.js | 7 + .../ckeditor/plugins/blockquote/lang/mk.js | 7 + .../ckeditor/plugins/blockquote/lang/mn.js | 7 + .../ckeditor/plugins/blockquote/lang/ms.js | 7 + .../ckeditor/plugins/blockquote/lang/nb.js | 7 + .../ckeditor/plugins/blockquote/lang/nl.js | 7 + .../ckeditor/plugins/blockquote/lang/no.js | 7 + .../ckeditor/plugins/blockquote/lang/pl.js | 7 + .../ckeditor/plugins/blockquote/lang/pt-br.js | 7 + .../ckeditor/plugins/blockquote/lang/pt.js | 7 + .../ckeditor/plugins/blockquote/lang/ro.js | 7 + .../ckeditor/plugins/blockquote/lang/ru.js | 7 + .../ckeditor/plugins/blockquote/lang/si.js | 7 + .../ckeditor/plugins/blockquote/lang/sk.js | 7 + .../ckeditor/plugins/blockquote/lang/sl.js | 7 + .../ckeditor/plugins/blockquote/lang/sq.js | 7 + .../plugins/blockquote/lang/sr-latn.js | 7 + .../ckeditor/plugins/blockquote/lang/sr.js | 7 + .../ckeditor/plugins/blockquote/lang/sv.js | 7 + .../ckeditor/plugins/blockquote/lang/th.js | 7 + .../ckeditor/plugins/blockquote/lang/tr.js | 7 + .../ckeditor/plugins/blockquote/lang/tt.js | 7 + .../ckeditor/plugins/blockquote/lang/ug.js | 7 + .../ckeditor/plugins/blockquote/lang/uk.js | 7 + .../ckeditor/plugins/blockquote/lang/vi.js | 7 + .../ckeditor/plugins/blockquote/lang/zh-cn.js | 7 + .../ckeditor/plugins/blockquote/lang/zh.js | 7 + .../ckeditor/plugins/blockquote/plugin.js | 251 + .../jQuery/ckeditor/plugins/button/lang/af.js | 8 + .../jQuery/ckeditor/plugins/button/lang/ca.js | 8 + .../jQuery/ckeditor/plugins/button/lang/cs.js | 8 + .../jQuery/ckeditor/plugins/button/lang/da.js | 8 + .../jQuery/ckeditor/plugins/button/lang/de.js | 8 + .../jQuery/ckeditor/plugins/button/lang/el.js | 8 + .../ckeditor/plugins/button/lang/en-gb.js | 8 + .../jQuery/ckeditor/plugins/button/lang/en.js | 8 + .../jQuery/ckeditor/plugins/button/lang/eo.js | 8 + .../jQuery/ckeditor/plugins/button/lang/fa.js | 8 + .../jQuery/ckeditor/plugins/button/lang/fi.js | 8 + .../jQuery/ckeditor/plugins/button/lang/fr.js | 8 + .../jQuery/ckeditor/plugins/button/lang/gl.js | 8 + .../jQuery/ckeditor/plugins/button/lang/he.js | 8 + .../jQuery/ckeditor/plugins/button/lang/hu.js | 8 + .../jQuery/ckeditor/plugins/button/lang/it.js | 8 + .../jQuery/ckeditor/plugins/button/lang/ja.js | 8 + .../jQuery/ckeditor/plugins/button/lang/km.js | 8 + .../jQuery/ckeditor/plugins/button/lang/ku.js | 8 + .../jQuery/ckeditor/plugins/button/lang/lt.js | 8 + .../jQuery/ckeditor/plugins/button/lang/nb.js | 8 + .../jQuery/ckeditor/plugins/button/lang/nl.js | 8 + .../jQuery/ckeditor/plugins/button/lang/pl.js | 8 + .../ckeditor/plugins/button/lang/pt-br.js | 8 + .../jQuery/ckeditor/plugins/button/lang/pt.js | 8 + .../jQuery/ckeditor/plugins/button/lang/ro.js | 8 + .../jQuery/ckeditor/plugins/button/lang/ru.js | 8 + .../jQuery/ckeditor/plugins/button/lang/sk.js | 8 + .../jQuery/ckeditor/plugins/button/lang/sl.js | 8 + .../jQuery/ckeditor/plugins/button/lang/sq.js | 8 + .../jQuery/ckeditor/plugins/button/lang/sv.js | 8 + .../jQuery/ckeditor/plugins/button/lang/tr.js | 8 + .../jQuery/ckeditor/plugins/button/lang/tt.js | 8 + .../jQuery/ckeditor/plugins/button/lang/uk.js | 8 + .../jQuery/ckeditor/plugins/button/lang/vi.js | 8 + .../ckeditor/plugins/button/lang/zh-cn.js | 8 + .../jQuery/ckeditor/plugins/button/lang/zh.js | 8 + .../jQuery/ckeditor/plugins/button/plugin.js | 377 + .../plugins/clipboard/dialogs/paste.js | 11 + .../ckeditor/plugins/colorbutton/lang/af.js | 53 + .../ckeditor/plugins/colorbutton/lang/ar.js | 53 + .../ckeditor/plugins/colorbutton/lang/bg.js | 53 + .../ckeditor/plugins/colorbutton/lang/bn.js | 53 + .../ckeditor/plugins/colorbutton/lang/bs.js | 53 + .../ckeditor/plugins/colorbutton/lang/ca.js | 53 + .../ckeditor/plugins/colorbutton/lang/cs.js | 53 + .../ckeditor/plugins/colorbutton/lang/cy.js | 53 + .../ckeditor/plugins/colorbutton/lang/da.js | 53 + .../ckeditor/plugins/colorbutton/lang/de.js | 53 + .../ckeditor/plugins/colorbutton/lang/el.js | 53 + .../plugins/colorbutton/lang/en-au.js | 53 + .../plugins/colorbutton/lang/en-ca.js | 53 + .../plugins/colorbutton/lang/en-gb.js | 53 + .../ckeditor/plugins/colorbutton/lang/en.js | 53 + .../ckeditor/plugins/colorbutton/lang/eo.js | 53 + .../ckeditor/plugins/colorbutton/lang/es.js | 53 + .../ckeditor/plugins/colorbutton/lang/et.js | 53 + .../ckeditor/plugins/colorbutton/lang/eu.js | 53 + .../ckeditor/plugins/colorbutton/lang/fa.js | 53 + .../ckeditor/plugins/colorbutton/lang/fi.js | 53 + .../ckeditor/plugins/colorbutton/lang/fo.js | 53 + .../plugins/colorbutton/lang/fr-ca.js | 53 + .../ckeditor/plugins/colorbutton/lang/fr.js | 53 + .../ckeditor/plugins/colorbutton/lang/gl.js | 53 + .../ckeditor/plugins/colorbutton/lang/gu.js | 53 + .../ckeditor/plugins/colorbutton/lang/he.js | 53 + .../ckeditor/plugins/colorbutton/lang/hi.js | 53 + .../ckeditor/plugins/colorbutton/lang/hr.js | 53 + .../ckeditor/plugins/colorbutton/lang/hu.js | 53 + .../ckeditor/plugins/colorbutton/lang/id.js | 53 + .../ckeditor/plugins/colorbutton/lang/is.js | 53 + .../ckeditor/plugins/colorbutton/lang/it.js | 53 + .../ckeditor/plugins/colorbutton/lang/ja.js | 53 + .../ckeditor/plugins/colorbutton/lang/ka.js | 53 + .../ckeditor/plugins/colorbutton/lang/km.js | 53 + .../ckeditor/plugins/colorbutton/lang/ko.js | 53 + .../ckeditor/plugins/colorbutton/lang/ku.js | 53 + .../ckeditor/plugins/colorbutton/lang/lt.js | 53 + .../ckeditor/plugins/colorbutton/lang/lv.js | 53 + .../ckeditor/plugins/colorbutton/lang/mk.js | 53 + .../ckeditor/plugins/colorbutton/lang/mn.js | 53 + .../ckeditor/plugins/colorbutton/lang/ms.js | 53 + .../ckeditor/plugins/colorbutton/lang/nb.js | 53 + .../ckeditor/plugins/colorbutton/lang/nl.js | 53 + .../ckeditor/plugins/colorbutton/lang/no.js | 53 + .../ckeditor/plugins/colorbutton/lang/pl.js | 53 + .../plugins/colorbutton/lang/pt-br.js | 53 + .../ckeditor/plugins/colorbutton/lang/pt.js | 53 + .../ckeditor/plugins/colorbutton/lang/ro.js | 53 + .../ckeditor/plugins/colorbutton/lang/ru.js | 53 + .../ckeditor/plugins/colorbutton/lang/si.js | 53 + .../ckeditor/plugins/colorbutton/lang/sk.js | 53 + .../ckeditor/plugins/colorbutton/lang/sl.js | 53 + .../ckeditor/plugins/colorbutton/lang/sq.js | 53 + .../plugins/colorbutton/lang/sr-latn.js | 53 + .../ckeditor/plugins/colorbutton/lang/sr.js | 53 + .../ckeditor/plugins/colorbutton/lang/sv.js | 53 + .../ckeditor/plugins/colorbutton/lang/th.js | 53 + .../ckeditor/plugins/colorbutton/lang/tr.js | 53 + .../ckeditor/plugins/colorbutton/lang/tt.js | 53 + .../ckeditor/plugins/colorbutton/lang/ug.js | 53 + .../ckeditor/plugins/colorbutton/lang/uk.js | 53 + .../ckeditor/plugins/colorbutton/lang/vi.js | 53 + .../plugins/colorbutton/lang/zh-cn.js | 53 + .../ckeditor/plugins/colorbutton/lang/zh.js | 53 + .../ckeditor/plugins/colorbutton/plugin.js | 289 + .../colordialog/dialogs/colordialog.js | 329 + .../ckeditor/plugins/colordialog/lang/af.js | 11 + .../ckeditor/plugins/colordialog/lang/ar.js | 11 + .../ckeditor/plugins/colordialog/lang/bg.js | 11 + .../ckeditor/plugins/colordialog/lang/bn.js | 11 + .../ckeditor/plugins/colordialog/lang/bs.js | 11 + .../ckeditor/plugins/colordialog/lang/ca.js | 11 + .../ckeditor/plugins/colordialog/lang/cs.js | 11 + .../ckeditor/plugins/colordialog/lang/cy.js | 11 + .../ckeditor/plugins/colordialog/lang/da.js | 11 + .../ckeditor/plugins/colordialog/lang/de.js | 11 + .../ckeditor/plugins/colordialog/lang/el.js | 11 + .../plugins/colordialog/lang/en-au.js | 11 + .../plugins/colordialog/lang/en-ca.js | 11 + .../plugins/colordialog/lang/en-gb.js | 11 + .../ckeditor/plugins/colordialog/lang/en.js | 11 + .../ckeditor/plugins/colordialog/lang/eo.js | 11 + .../ckeditor/plugins/colordialog/lang/es.js | 11 + .../ckeditor/plugins/colordialog/lang/et.js | 11 + .../ckeditor/plugins/colordialog/lang/eu.js | 11 + .../ckeditor/plugins/colordialog/lang/fa.js | 11 + .../ckeditor/plugins/colordialog/lang/fi.js | 11 + .../ckeditor/plugins/colordialog/lang/fo.js | 11 + .../plugins/colordialog/lang/fr-ca.js | 11 + .../ckeditor/plugins/colordialog/lang/fr.js | 11 + .../ckeditor/plugins/colordialog/lang/gl.js | 11 + .../ckeditor/plugins/colordialog/lang/gu.js | 11 + .../ckeditor/plugins/colordialog/lang/he.js | 11 + .../ckeditor/plugins/colordialog/lang/hi.js | 11 + .../ckeditor/plugins/colordialog/lang/hr.js | 11 + .../ckeditor/plugins/colordialog/lang/hu.js | 11 + .../ckeditor/plugins/colordialog/lang/is.js | 11 + .../ckeditor/plugins/colordialog/lang/it.js | 11 + .../ckeditor/plugins/colordialog/lang/ja.js | 11 + .../ckeditor/plugins/colordialog/lang/ka.js | 11 + .../ckeditor/plugins/colordialog/lang/km.js | 11 + .../ckeditor/plugins/colordialog/lang/ko.js | 11 + .../ckeditor/plugins/colordialog/lang/ku.js | 11 + .../ckeditor/plugins/colordialog/lang/lt.js | 11 + .../ckeditor/plugins/colordialog/lang/lv.js | 11 + .../ckeditor/plugins/colordialog/lang/mk.js | 11 + .../ckeditor/plugins/colordialog/lang/mn.js | 11 + .../ckeditor/plugins/colordialog/lang/ms.js | 11 + .../ckeditor/plugins/colordialog/lang/nb.js | 11 + .../ckeditor/plugins/colordialog/lang/nl.js | 11 + .../ckeditor/plugins/colordialog/lang/no.js | 11 + .../ckeditor/plugins/colordialog/lang/pl.js | 11 + .../plugins/colordialog/lang/pt-br.js | 11 + .../ckeditor/plugins/colordialog/lang/pt.js | 11 + .../ckeditor/plugins/colordialog/lang/ro.js | 11 + .../ckeditor/plugins/colordialog/lang/ru.js | 11 + .../ckeditor/plugins/colordialog/lang/si.js | 11 + .../ckeditor/plugins/colordialog/lang/sk.js | 11 + .../ckeditor/plugins/colordialog/lang/sl.js | 11 + .../ckeditor/plugins/colordialog/lang/sq.js | 11 + .../plugins/colordialog/lang/sr-latn.js | 11 + .../ckeditor/plugins/colordialog/lang/sr.js | 11 + .../ckeditor/plugins/colordialog/lang/sv.js | 11 + .../ckeditor/plugins/colordialog/lang/th.js | 11 + .../ckeditor/plugins/colordialog/lang/tr.js | 11 + .../ckeditor/plugins/colordialog/lang/tt.js | 11 + .../ckeditor/plugins/colordialog/lang/ug.js | 11 + .../ckeditor/plugins/colordialog/lang/uk.js | 11 + .../ckeditor/plugins/colordialog/lang/vi.js | 11 + .../plugins/colordialog/lang/zh-cn.js | 11 + .../ckeditor/plugins/colordialog/lang/zh.js | 11 + .../ckeditor/plugins/colordialog/plugin.js | 71 + .../ckeditor/plugins/contextmenu/lang/af.js | 7 + .../ckeditor/plugins/contextmenu/lang/ar.js | 7 + .../ckeditor/plugins/contextmenu/lang/bg.js | 7 + .../ckeditor/plugins/contextmenu/lang/bn.js | 7 + .../ckeditor/plugins/contextmenu/lang/bs.js | 7 + .../ckeditor/plugins/contextmenu/lang/ca.js | 7 + .../ckeditor/plugins/contextmenu/lang/cs.js | 7 + .../ckeditor/plugins/contextmenu/lang/cy.js | 7 + .../ckeditor/plugins/contextmenu/lang/da.js | 7 + .../ckeditor/plugins/contextmenu/lang/de.js | 7 + .../ckeditor/plugins/contextmenu/lang/el.js | 7 + .../plugins/contextmenu/lang/en-au.js | 7 + .../plugins/contextmenu/lang/en-ca.js | 7 + .../plugins/contextmenu/lang/en-gb.js | 7 + .../ckeditor/plugins/contextmenu/lang/en.js | 7 + .../ckeditor/plugins/contextmenu/lang/eo.js | 7 + .../ckeditor/plugins/contextmenu/lang/es.js | 7 + .../ckeditor/plugins/contextmenu/lang/et.js | 7 + .../ckeditor/plugins/contextmenu/lang/eu.js | 7 + .../ckeditor/plugins/contextmenu/lang/fa.js | 7 + .../ckeditor/plugins/contextmenu/lang/fi.js | 7 + .../ckeditor/plugins/contextmenu/lang/fo.js | 7 + .../plugins/contextmenu/lang/fr-ca.js | 7 + .../ckeditor/plugins/contextmenu/lang/fr.js | 7 + .../ckeditor/plugins/contextmenu/lang/gl.js | 7 + .../ckeditor/plugins/contextmenu/lang/gu.js | 7 + .../ckeditor/plugins/contextmenu/lang/he.js | 7 + .../ckeditor/plugins/contextmenu/lang/hi.js | 7 + .../ckeditor/plugins/contextmenu/lang/hr.js | 7 + .../ckeditor/plugins/contextmenu/lang/hu.js | 7 + .../ckeditor/plugins/contextmenu/lang/id.js | 7 + .../ckeditor/plugins/contextmenu/lang/is.js | 7 + .../ckeditor/plugins/contextmenu/lang/it.js | 7 + .../ckeditor/plugins/contextmenu/lang/ja.js | 7 + .../ckeditor/plugins/contextmenu/lang/ka.js | 7 + .../ckeditor/plugins/contextmenu/lang/km.js | 7 + .../ckeditor/plugins/contextmenu/lang/ko.js | 7 + .../ckeditor/plugins/contextmenu/lang/ku.js | 7 + .../ckeditor/plugins/contextmenu/lang/lt.js | 7 + .../ckeditor/plugins/contextmenu/lang/lv.js | 7 + .../ckeditor/plugins/contextmenu/lang/mk.js | 7 + .../ckeditor/plugins/contextmenu/lang/mn.js | 7 + .../ckeditor/plugins/contextmenu/lang/ms.js | 7 + .../ckeditor/plugins/contextmenu/lang/nb.js | 7 + .../ckeditor/plugins/contextmenu/lang/nl.js | 7 + .../ckeditor/plugins/contextmenu/lang/no.js | 7 + .../ckeditor/plugins/contextmenu/lang/pl.js | 7 + .../plugins/contextmenu/lang/pt-br.js | 7 + .../ckeditor/plugins/contextmenu/lang/pt.js | 7 + .../ckeditor/plugins/contextmenu/lang/ro.js | 7 + .../ckeditor/plugins/contextmenu/lang/ru.js | 7 + .../ckeditor/plugins/contextmenu/lang/si.js | 7 + .../ckeditor/plugins/contextmenu/lang/sk.js | 7 + .../ckeditor/plugins/contextmenu/lang/sl.js | 7 + .../ckeditor/plugins/contextmenu/lang/sq.js | 7 + .../plugins/contextmenu/lang/sr-latn.js | 7 + .../ckeditor/plugins/contextmenu/lang/sr.js | 7 + .../ckeditor/plugins/contextmenu/lang/sv.js | 7 + .../ckeditor/plugins/contextmenu/lang/th.js | 7 + .../ckeditor/plugins/contextmenu/lang/tr.js | 7 + .../ckeditor/plugins/contextmenu/lang/tt.js | 7 + .../ckeditor/plugins/contextmenu/lang/ug.js | 7 + .../ckeditor/plugins/contextmenu/lang/uk.js | 7 + .../ckeditor/plugins/contextmenu/lang/vi.js | 7 + .../plugins/contextmenu/lang/zh-cn.js | 7 + .../ckeditor/plugins/contextmenu/lang/zh.js | 7 + .../ckeditor/plugins/contextmenu/plugin.js | 159 + .../plugins/dialog/dialogDefinition.js | 4 + .../ckeditor/plugins/elementspath/lang/af.js | 8 + .../ckeditor/plugins/elementspath/lang/ar.js | 8 + .../ckeditor/plugins/elementspath/lang/bg.js | 8 + .../ckeditor/plugins/elementspath/lang/bn.js | 8 + .../ckeditor/plugins/elementspath/lang/bs.js | 8 + .../ckeditor/plugins/elementspath/lang/ca.js | 8 + .../ckeditor/plugins/elementspath/lang/cs.js | 8 + .../ckeditor/plugins/elementspath/lang/cy.js | 8 + .../ckeditor/plugins/elementspath/lang/da.js | 8 + .../ckeditor/plugins/elementspath/lang/de.js | 8 + .../ckeditor/plugins/elementspath/lang/el.js | 8 + .../plugins/elementspath/lang/en-au.js | 8 + .../plugins/elementspath/lang/en-ca.js | 8 + .../plugins/elementspath/lang/en-gb.js | 8 + .../ckeditor/plugins/elementspath/lang/en.js | 8 + .../ckeditor/plugins/elementspath/lang/eo.js | 8 + .../ckeditor/plugins/elementspath/lang/es.js | 8 + .../ckeditor/plugins/elementspath/lang/et.js | 8 + .../ckeditor/plugins/elementspath/lang/eu.js | 8 + .../ckeditor/plugins/elementspath/lang/fa.js | 8 + .../ckeditor/plugins/elementspath/lang/fi.js | 8 + .../ckeditor/plugins/elementspath/lang/fo.js | 8 + .../plugins/elementspath/lang/fr-ca.js | 8 + .../ckeditor/plugins/elementspath/lang/fr.js | 8 + .../ckeditor/plugins/elementspath/lang/gl.js | 8 + .../ckeditor/plugins/elementspath/lang/gu.js | 8 + .../ckeditor/plugins/elementspath/lang/he.js | 8 + .../ckeditor/plugins/elementspath/lang/hi.js | 8 + .../ckeditor/plugins/elementspath/lang/hr.js | 8 + .../ckeditor/plugins/elementspath/lang/hu.js | 8 + .../ckeditor/plugins/elementspath/lang/is.js | 8 + .../ckeditor/plugins/elementspath/lang/it.js | 8 + .../ckeditor/plugins/elementspath/lang/ja.js | 8 + .../ckeditor/plugins/elementspath/lang/ka.js | 8 + .../ckeditor/plugins/elementspath/lang/km.js | 8 + .../ckeditor/plugins/elementspath/lang/ko.js | 8 + .../ckeditor/plugins/elementspath/lang/ku.js | 8 + .../ckeditor/plugins/elementspath/lang/lt.js | 8 + .../ckeditor/plugins/elementspath/lang/lv.js | 8 + .../ckeditor/plugins/elementspath/lang/mk.js | 8 + .../ckeditor/plugins/elementspath/lang/mn.js | 8 + .../ckeditor/plugins/elementspath/lang/ms.js | 8 + .../ckeditor/plugins/elementspath/lang/nb.js | 8 + .../ckeditor/plugins/elementspath/lang/nl.js | 8 + .../ckeditor/plugins/elementspath/lang/no.js | 8 + .../ckeditor/plugins/elementspath/lang/pl.js | 8 + .../plugins/elementspath/lang/pt-br.js | 8 + .../ckeditor/plugins/elementspath/lang/pt.js | 8 + .../ckeditor/plugins/elementspath/lang/ro.js | 8 + .../ckeditor/plugins/elementspath/lang/ru.js | 8 + .../ckeditor/plugins/elementspath/lang/si.js | 8 + .../ckeditor/plugins/elementspath/lang/sk.js | 8 + .../ckeditor/plugins/elementspath/lang/sl.js | 8 + .../ckeditor/plugins/elementspath/lang/sq.js | 8 + .../plugins/elementspath/lang/sr-latn.js | 8 + .../ckeditor/plugins/elementspath/lang/sr.js | 8 + .../ckeditor/plugins/elementspath/lang/sv.js | 8 + .../ckeditor/plugins/elementspath/lang/th.js | 8 + .../ckeditor/plugins/elementspath/lang/tr.js | 8 + .../ckeditor/plugins/elementspath/lang/tt.js | 8 + .../ckeditor/plugins/elementspath/lang/ug.js | 8 + .../ckeditor/plugins/elementspath/lang/uk.js | 8 + .../ckeditor/plugins/elementspath/lang/vi.js | 8 + .../plugins/elementspath/lang/zh-cn.js | 8 + .../ckeditor/plugins/elementspath/lang/zh.js | 8 + .../ckeditor/plugins/elementspath/plugin.js | 235 + .../ckeditor/plugins/floatpanel/plugin.js | 581 + .../jQuery/ckeditor/plugins/font/lang/af.js | 14 + .../jQuery/ckeditor/plugins/font/lang/ar.js | 14 + .../jQuery/ckeditor/plugins/font/lang/bg.js | 14 + .../jQuery/ckeditor/plugins/font/lang/bn.js | 14 + .../jQuery/ckeditor/plugins/font/lang/bs.js | 14 + .../jQuery/ckeditor/plugins/font/lang/ca.js | 14 + .../jQuery/ckeditor/plugins/font/lang/cs.js | 14 + .../jQuery/ckeditor/plugins/font/lang/cy.js | 14 + .../jQuery/ckeditor/plugins/font/lang/da.js | 14 + .../jQuery/ckeditor/plugins/font/lang/de.js | 14 + .../jQuery/ckeditor/plugins/font/lang/el.js | 14 + .../ckeditor/plugins/font/lang/en-au.js | 14 + .../ckeditor/plugins/font/lang/en-ca.js | 14 + .../ckeditor/plugins/font/lang/en-gb.js | 14 + .../jQuery/ckeditor/plugins/font/lang/en.js | 14 + .../jQuery/ckeditor/plugins/font/lang/eo.js | 14 + .../jQuery/ckeditor/plugins/font/lang/es.js | 14 + .../jQuery/ckeditor/plugins/font/lang/et.js | 14 + .../jQuery/ckeditor/plugins/font/lang/eu.js | 14 + .../jQuery/ckeditor/plugins/font/lang/fa.js | 14 + .../jQuery/ckeditor/plugins/font/lang/fi.js | 14 + .../jQuery/ckeditor/plugins/font/lang/fo.js | 14 + .../ckeditor/plugins/font/lang/fr-ca.js | 14 + .../jQuery/ckeditor/plugins/font/lang/fr.js | 14 + .../jQuery/ckeditor/plugins/font/lang/gl.js | 14 + .../jQuery/ckeditor/plugins/font/lang/gu.js | 14 + .../jQuery/ckeditor/plugins/font/lang/he.js | 14 + .../jQuery/ckeditor/plugins/font/lang/hi.js | 14 + .../jQuery/ckeditor/plugins/font/lang/hr.js | 14 + .../jQuery/ckeditor/plugins/font/lang/hu.js | 14 + .../jQuery/ckeditor/plugins/font/lang/id.js | 14 + .../jQuery/ckeditor/plugins/font/lang/is.js | 14 + .../jQuery/ckeditor/plugins/font/lang/it.js | 14 + .../jQuery/ckeditor/plugins/font/lang/ja.js | 14 + .../jQuery/ckeditor/plugins/font/lang/ka.js | 14 + .../jQuery/ckeditor/plugins/font/lang/km.js | 14 + .../jQuery/ckeditor/plugins/font/lang/ko.js | 14 + .../jQuery/ckeditor/plugins/font/lang/ku.js | 14 + .../jQuery/ckeditor/plugins/font/lang/lt.js | 14 + .../jQuery/ckeditor/plugins/font/lang/lv.js | 14 + .../jQuery/ckeditor/plugins/font/lang/mk.js | 14 + .../jQuery/ckeditor/plugins/font/lang/mn.js | 14 + .../jQuery/ckeditor/plugins/font/lang/ms.js | 14 + .../jQuery/ckeditor/plugins/font/lang/nb.js | 14 + .../jQuery/ckeditor/plugins/font/lang/nl.js | 14 + .../jQuery/ckeditor/plugins/font/lang/no.js | 14 + .../jQuery/ckeditor/plugins/font/lang/pl.js | 14 + .../ckeditor/plugins/font/lang/pt-br.js | 14 + .../jQuery/ckeditor/plugins/font/lang/pt.js | 14 + .../jQuery/ckeditor/plugins/font/lang/ro.js | 14 + .../jQuery/ckeditor/plugins/font/lang/ru.js | 14 + .../jQuery/ckeditor/plugins/font/lang/si.js | 14 + .../jQuery/ckeditor/plugins/font/lang/sk.js | 14 + .../jQuery/ckeditor/plugins/font/lang/sl.js | 14 + .../jQuery/ckeditor/plugins/font/lang/sq.js | 14 + .../ckeditor/plugins/font/lang/sr-latn.js | 14 + .../jQuery/ckeditor/plugins/font/lang/sr.js | 14 + .../jQuery/ckeditor/plugins/font/lang/sv.js | 14 + .../jQuery/ckeditor/plugins/font/lang/th.js | 14 + .../jQuery/ckeditor/plugins/font/lang/tr.js | 14 + .../jQuery/ckeditor/plugins/font/lang/tt.js | 14 + .../jQuery/ckeditor/plugins/font/lang/ug.js | 14 + .../jQuery/ckeditor/plugins/font/lang/uk.js | 14 + .../jQuery/ckeditor/plugins/font/lang/vi.js | 14 + .../ckeditor/plugins/font/lang/zh-cn.js | 14 + .../jQuery/ckeditor/plugins/font/lang/zh.js | 14 + .../jQuery/ckeditor/plugins/font/plugin.js | 313 + .../jQuery/ckeditor/plugins/format/lang/af.js | 18 + .../jQuery/ckeditor/plugins/format/lang/ar.js | 18 + .../jQuery/ckeditor/plugins/format/lang/bg.js | 18 + .../jQuery/ckeditor/plugins/format/lang/bn.js | 18 + .../jQuery/ckeditor/plugins/format/lang/bs.js | 18 + .../jQuery/ckeditor/plugins/format/lang/ca.js | 18 + .../jQuery/ckeditor/plugins/format/lang/cs.js | 18 + .../jQuery/ckeditor/plugins/format/lang/cy.js | 18 + .../jQuery/ckeditor/plugins/format/lang/da.js | 18 + .../jQuery/ckeditor/plugins/format/lang/de.js | 18 + .../jQuery/ckeditor/plugins/format/lang/el.js | 18 + .../ckeditor/plugins/format/lang/en-au.js | 18 + .../ckeditor/plugins/format/lang/en-ca.js | 18 + .../ckeditor/plugins/format/lang/en-gb.js | 18 + .../jQuery/ckeditor/plugins/format/lang/en.js | 18 + .../jQuery/ckeditor/plugins/format/lang/eo.js | 18 + .../jQuery/ckeditor/plugins/format/lang/es.js | 18 + .../jQuery/ckeditor/plugins/format/lang/et.js | 18 + .../jQuery/ckeditor/plugins/format/lang/eu.js | 18 + .../jQuery/ckeditor/plugins/format/lang/fa.js | 18 + .../jQuery/ckeditor/plugins/format/lang/fi.js | 18 + .../jQuery/ckeditor/plugins/format/lang/fo.js | 18 + .../ckeditor/plugins/format/lang/fr-ca.js | 18 + .../jQuery/ckeditor/plugins/format/lang/fr.js | 18 + .../jQuery/ckeditor/plugins/format/lang/gl.js | 18 + .../jQuery/ckeditor/plugins/format/lang/gu.js | 18 + .../jQuery/ckeditor/plugins/format/lang/he.js | 18 + .../jQuery/ckeditor/plugins/format/lang/hi.js | 18 + .../jQuery/ckeditor/plugins/format/lang/hr.js | 18 + .../jQuery/ckeditor/plugins/format/lang/hu.js | 18 + .../jQuery/ckeditor/plugins/format/lang/id.js | 18 + .../jQuery/ckeditor/plugins/format/lang/is.js | 18 + .../jQuery/ckeditor/plugins/format/lang/it.js | 18 + .../jQuery/ckeditor/plugins/format/lang/ja.js | 18 + .../jQuery/ckeditor/plugins/format/lang/ka.js | 18 + .../jQuery/ckeditor/plugins/format/lang/km.js | 18 + .../jQuery/ckeditor/plugins/format/lang/ko.js | 18 + .../jQuery/ckeditor/plugins/format/lang/ku.js | 18 + .../jQuery/ckeditor/plugins/format/lang/lt.js | 18 + .../jQuery/ckeditor/plugins/format/lang/lv.js | 18 + .../jQuery/ckeditor/plugins/format/lang/mk.js | 18 + .../jQuery/ckeditor/plugins/format/lang/mn.js | 18 + .../jQuery/ckeditor/plugins/format/lang/ms.js | 18 + .../jQuery/ckeditor/plugins/format/lang/nb.js | 18 + .../jQuery/ckeditor/plugins/format/lang/nl.js | 18 + .../jQuery/ckeditor/plugins/format/lang/no.js | 18 + .../jQuery/ckeditor/plugins/format/lang/pl.js | 18 + .../ckeditor/plugins/format/lang/pt-br.js | 18 + .../jQuery/ckeditor/plugins/format/lang/pt.js | 18 + .../jQuery/ckeditor/plugins/format/lang/ro.js | 18 + .../jQuery/ckeditor/plugins/format/lang/ru.js | 18 + .../jQuery/ckeditor/plugins/format/lang/si.js | 18 + .../jQuery/ckeditor/plugins/format/lang/sk.js | 18 + .../jQuery/ckeditor/plugins/format/lang/sl.js | 18 + .../jQuery/ckeditor/plugins/format/lang/sq.js | 18 + .../ckeditor/plugins/format/lang/sr-latn.js | 18 + .../jQuery/ckeditor/plugins/format/lang/sr.js | 18 + .../jQuery/ckeditor/plugins/format/lang/sv.js | 18 + .../jQuery/ckeditor/plugins/format/lang/th.js | 18 + .../jQuery/ckeditor/plugins/format/lang/tr.js | 18 + .../jQuery/ckeditor/plugins/format/lang/tt.js | 18 + .../jQuery/ckeditor/plugins/format/lang/ug.js | 18 + .../jQuery/ckeditor/plugins/format/lang/uk.js | 18 + .../jQuery/ckeditor/plugins/format/lang/vi.js | 18 + .../ckeditor/plugins/format/lang/zh-cn.js | 18 + .../jQuery/ckeditor/plugins/format/lang/zh.js | 18 + .../jQuery/ckeditor/plugins/format/plugin.js | 246 + .../plugins/horizontalrule/lang/af.js | 7 + .../plugins/horizontalrule/lang/ar.js | 7 + .../plugins/horizontalrule/lang/bg.js | 7 + .../plugins/horizontalrule/lang/bn.js | 7 + .../plugins/horizontalrule/lang/bs.js | 7 + .../plugins/horizontalrule/lang/ca.js | 7 + .../plugins/horizontalrule/lang/cs.js | 7 + .../plugins/horizontalrule/lang/cy.js | 7 + .../plugins/horizontalrule/lang/da.js | 7 + .../plugins/horizontalrule/lang/de.js | 7 + .../plugins/horizontalrule/lang/el.js | 7 + .../plugins/horizontalrule/lang/en-au.js | 7 + .../plugins/horizontalrule/lang/en-ca.js | 7 + .../plugins/horizontalrule/lang/en-gb.js | 7 + .../plugins/horizontalrule/lang/en.js | 7 + .../plugins/horizontalrule/lang/eo.js | 7 + .../plugins/horizontalrule/lang/es.js | 7 + .../plugins/horizontalrule/lang/et.js | 7 + .../plugins/horizontalrule/lang/eu.js | 7 + .../plugins/horizontalrule/lang/fa.js | 7 + .../plugins/horizontalrule/lang/fi.js | 7 + .../plugins/horizontalrule/lang/fo.js | 7 + .../plugins/horizontalrule/lang/fr-ca.js | 7 + .../plugins/horizontalrule/lang/fr.js | 7 + .../plugins/horizontalrule/lang/gl.js | 7 + .../plugins/horizontalrule/lang/gu.js | 7 + .../plugins/horizontalrule/lang/he.js | 7 + .../plugins/horizontalrule/lang/hi.js | 7 + .../plugins/horizontalrule/lang/hr.js | 7 + .../plugins/horizontalrule/lang/hu.js | 7 + .../plugins/horizontalrule/lang/id.js | 7 + .../plugins/horizontalrule/lang/is.js | 7 + .../plugins/horizontalrule/lang/it.js | 7 + .../plugins/horizontalrule/lang/ja.js | 7 + .../plugins/horizontalrule/lang/ka.js | 7 + .../plugins/horizontalrule/lang/km.js | 7 + .../plugins/horizontalrule/lang/ko.js | 7 + .../plugins/horizontalrule/lang/ku.js | 7 + .../plugins/horizontalrule/lang/lt.js | 7 + .../plugins/horizontalrule/lang/lv.js | 7 + .../plugins/horizontalrule/lang/mk.js | 7 + .../plugins/horizontalrule/lang/mn.js | 7 + .../plugins/horizontalrule/lang/ms.js | 7 + .../plugins/horizontalrule/lang/nb.js | 7 + .../plugins/horizontalrule/lang/nl.js | 7 + .../plugins/horizontalrule/lang/no.js | 7 + .../plugins/horizontalrule/lang/pl.js | 7 + .../plugins/horizontalrule/lang/pt-br.js | 7 + .../plugins/horizontalrule/lang/pt.js | 7 + .../plugins/horizontalrule/lang/ro.js | 7 + .../plugins/horizontalrule/lang/ru.js | 7 + .../plugins/horizontalrule/lang/si.js | 7 + .../plugins/horizontalrule/lang/sk.js | 7 + .../plugins/horizontalrule/lang/sl.js | 7 + .../plugins/horizontalrule/lang/sq.js | 7 + .../plugins/horizontalrule/lang/sr-latn.js | 7 + .../plugins/horizontalrule/lang/sr.js | 7 + .../plugins/horizontalrule/lang/sv.js | 7 + .../plugins/horizontalrule/lang/th.js | 7 + .../plugins/horizontalrule/lang/tr.js | 7 + .../plugins/horizontalrule/lang/tt.js | 7 + .../plugins/horizontalrule/lang/ug.js | 7 + .../plugins/horizontalrule/lang/uk.js | 7 + .../plugins/horizontalrule/lang/vi.js | 7 + .../plugins/horizontalrule/lang/zh-cn.js | 7 + .../plugins/horizontalrule/lang/zh.js | 7 + .../ckeditor/plugins/horizontalrule/plugin.js | 43 + .../ckeditor/plugins/image/dialogs/image.js | 1222 + .../jQuery/ckeditor/plugins/image/lang/af.js | 26 + .../jQuery/ckeditor/plugins/image/lang/ar.js | 26 + .../jQuery/ckeditor/plugins/image/lang/bg.js | 26 + .../jQuery/ckeditor/plugins/image/lang/bn.js | 26 + .../jQuery/ckeditor/plugins/image/lang/bs.js | 26 + .../jQuery/ckeditor/plugins/image/lang/ca.js | 26 + .../jQuery/ckeditor/plugins/image/lang/cs.js | 26 + .../jQuery/ckeditor/plugins/image/lang/cy.js | 26 + .../jQuery/ckeditor/plugins/image/lang/da.js | 26 + .../jQuery/ckeditor/plugins/image/lang/de.js | 26 + .../jQuery/ckeditor/plugins/image/lang/el.js | 26 + .../ckeditor/plugins/image/lang/en-au.js | 26 + .../ckeditor/plugins/image/lang/en-ca.js | 26 + .../ckeditor/plugins/image/lang/en-gb.js | 26 + .../jQuery/ckeditor/plugins/image/lang/en.js | 26 + .../jQuery/ckeditor/plugins/image/lang/eo.js | 26 + .../jQuery/ckeditor/plugins/image/lang/es.js | 26 + .../jQuery/ckeditor/plugins/image/lang/et.js | 26 + .../jQuery/ckeditor/plugins/image/lang/eu.js | 26 + .../jQuery/ckeditor/plugins/image/lang/fa.js | 26 + .../jQuery/ckeditor/plugins/image/lang/fi.js | 26 + .../jQuery/ckeditor/plugins/image/lang/fo.js | 26 + .../ckeditor/plugins/image/lang/fr-ca.js | 26 + .../jQuery/ckeditor/plugins/image/lang/fr.js | 26 + .../jQuery/ckeditor/plugins/image/lang/gl.js | 26 + .../jQuery/ckeditor/plugins/image/lang/gu.js | 26 + .../jQuery/ckeditor/plugins/image/lang/he.js | 26 + .../jQuery/ckeditor/plugins/image/lang/hi.js | 26 + .../jQuery/ckeditor/plugins/image/lang/hr.js | 26 + .../jQuery/ckeditor/plugins/image/lang/hu.js | 26 + .../jQuery/ckeditor/plugins/image/lang/id.js | 26 + .../jQuery/ckeditor/plugins/image/lang/is.js | 26 + .../jQuery/ckeditor/plugins/image/lang/it.js | 26 + .../jQuery/ckeditor/plugins/image/lang/ja.js | 26 + .../jQuery/ckeditor/plugins/image/lang/ka.js | 26 + .../jQuery/ckeditor/plugins/image/lang/km.js | 26 + .../jQuery/ckeditor/plugins/image/lang/ko.js | 26 + .../jQuery/ckeditor/plugins/image/lang/ku.js | 26 + .../jQuery/ckeditor/plugins/image/lang/lt.js | 26 + .../jQuery/ckeditor/plugins/image/lang/lv.js | 26 + .../jQuery/ckeditor/plugins/image/lang/mk.js | 26 + .../jQuery/ckeditor/plugins/image/lang/mn.js | 26 + .../jQuery/ckeditor/plugins/image/lang/ms.js | 26 + .../jQuery/ckeditor/plugins/image/lang/nb.js | 26 + .../jQuery/ckeditor/plugins/image/lang/nl.js | 26 + .../jQuery/ckeditor/plugins/image/lang/no.js | 26 + .../jQuery/ckeditor/plugins/image/lang/pl.js | 26 + .../ckeditor/plugins/image/lang/pt-br.js | 26 + .../jQuery/ckeditor/plugins/image/lang/pt.js | 26 + .../jQuery/ckeditor/plugins/image/lang/ro.js | 26 + .../jQuery/ckeditor/plugins/image/lang/ru.js | 26 + .../jQuery/ckeditor/plugins/image/lang/si.js | 26 + .../jQuery/ckeditor/plugins/image/lang/sk.js | 26 + .../jQuery/ckeditor/plugins/image/lang/sl.js | 26 + .../jQuery/ckeditor/plugins/image/lang/sq.js | 26 + .../ckeditor/plugins/image/lang/sr-latn.js | 26 + .../jQuery/ckeditor/plugins/image/lang/sr.js | 26 + .../jQuery/ckeditor/plugins/image/lang/sv.js | 26 + .../jQuery/ckeditor/plugins/image/lang/th.js | 26 + .../jQuery/ckeditor/plugins/image/lang/tr.js | 26 + .../jQuery/ckeditor/plugins/image/lang/tt.js | 26 + .../jQuery/ckeditor/plugins/image/lang/ug.js | 26 + .../jQuery/ckeditor/plugins/image/lang/uk.js | 26 + .../jQuery/ckeditor/plugins/image/lang/vi.js | 26 + .../ckeditor/plugins/image/lang/zh-cn.js | 26 + .../jQuery/ckeditor/plugins/image/lang/zh.js | 26 + .../jQuery/ckeditor/plugins/image/plugin.js | 173 + .../ckeditor/plugins/imagepaste/plugin.js | 109 + .../ckeditor/plugins/imageresize/plugin.js | 180 + .../ckeditor/plugins/justify/lang/af.js | 10 + .../ckeditor/plugins/justify/lang/ar.js | 10 + .../ckeditor/plugins/justify/lang/bg.js | 10 + .../ckeditor/plugins/justify/lang/bn.js | 10 + .../ckeditor/plugins/justify/lang/bs.js | 10 + .../ckeditor/plugins/justify/lang/ca.js | 10 + .../ckeditor/plugins/justify/lang/cs.js | 10 + .../ckeditor/plugins/justify/lang/cy.js | 10 + .../ckeditor/plugins/justify/lang/da.js | 10 + .../ckeditor/plugins/justify/lang/de.js | 10 + .../ckeditor/plugins/justify/lang/el.js | 10 + .../ckeditor/plugins/justify/lang/en-au.js | 10 + .../ckeditor/plugins/justify/lang/en-ca.js | 10 + .../ckeditor/plugins/justify/lang/en-gb.js | 10 + .../ckeditor/plugins/justify/lang/en.js | 10 + .../ckeditor/plugins/justify/lang/eo.js | 10 + .../ckeditor/plugins/justify/lang/es.js | 10 + .../ckeditor/plugins/justify/lang/et.js | 10 + .../ckeditor/plugins/justify/lang/eu.js | 10 + .../ckeditor/plugins/justify/lang/fa.js | 10 + .../ckeditor/plugins/justify/lang/fi.js | 10 + .../ckeditor/plugins/justify/lang/fo.js | 10 + .../ckeditor/plugins/justify/lang/fr-ca.js | 10 + .../ckeditor/plugins/justify/lang/fr.js | 10 + .../ckeditor/plugins/justify/lang/gl.js | 10 + .../ckeditor/plugins/justify/lang/gu.js | 10 + .../ckeditor/plugins/justify/lang/he.js | 10 + .../ckeditor/plugins/justify/lang/hi.js | 10 + .../ckeditor/plugins/justify/lang/hr.js | 10 + .../ckeditor/plugins/justify/lang/hu.js | 10 + .../ckeditor/plugins/justify/lang/id.js | 10 + .../ckeditor/plugins/justify/lang/is.js | 10 + .../ckeditor/plugins/justify/lang/it.js | 10 + .../ckeditor/plugins/justify/lang/ja.js | 10 + .../ckeditor/plugins/justify/lang/ka.js | 10 + .../ckeditor/plugins/justify/lang/km.js | 10 + .../ckeditor/plugins/justify/lang/ko.js | 10 + .../ckeditor/plugins/justify/lang/ku.js | 10 + .../ckeditor/plugins/justify/lang/lt.js | 10 + .../ckeditor/plugins/justify/lang/lv.js | 10 + .../ckeditor/plugins/justify/lang/mk.js | 10 + .../ckeditor/plugins/justify/lang/mn.js | 10 + .../ckeditor/plugins/justify/lang/ms.js | 10 + .../ckeditor/plugins/justify/lang/nb.js | 10 + .../ckeditor/plugins/justify/lang/nl.js | 10 + .../ckeditor/plugins/justify/lang/no.js | 10 + .../ckeditor/plugins/justify/lang/pl.js | 10 + .../ckeditor/plugins/justify/lang/pt-br.js | 10 + .../ckeditor/plugins/justify/lang/pt.js | 10 + .../ckeditor/plugins/justify/lang/ro.js | 10 + .../ckeditor/plugins/justify/lang/ru.js | 10 + .../ckeditor/plugins/justify/lang/si.js | 10 + .../ckeditor/plugins/justify/lang/sk.js | 10 + .../ckeditor/plugins/justify/lang/sl.js | 10 + .../ckeditor/plugins/justify/lang/sq.js | 10 + .../ckeditor/plugins/justify/lang/sr-latn.js | 10 + .../ckeditor/plugins/justify/lang/sr.js | 10 + .../ckeditor/plugins/justify/lang/sv.js | 10 + .../ckeditor/plugins/justify/lang/th.js | 10 + .../ckeditor/plugins/justify/lang/tr.js | 10 + .../ckeditor/plugins/justify/lang/tt.js | 10 + .../ckeditor/plugins/justify/lang/ug.js | 10 + .../ckeditor/plugins/justify/lang/uk.js | 10 + .../ckeditor/plugins/justify/lang/vi.js | 10 + .../ckeditor/plugins/justify/lang/zh-cn.js | 10 + .../ckeditor/plugins/justify/lang/zh.js | 10 + .../jQuery/ckeditor/plugins/justify/plugin.js | 245 + .../ckeditor/plugins/link/dialogs/anchor.js | 7 + .../ckeditor/plugins/link/dialogs/link.js | 26 + .../ckeditor/plugins/listblock/plugin.js | 241 + .../jQuery/ckeditor/plugins/menu/plugin.js | 545 + .../jQuery/ckeditor/plugins/panel/plugin.js | 403 + .../ckeditor/plugins/panelbutton/plugin.js | 138 + .../ckeditor/plugins/pastetext/lang/af.js | 8 + .../ckeditor/plugins/pastetext/lang/ar.js | 8 + .../ckeditor/plugins/pastetext/lang/bg.js | 8 + .../ckeditor/plugins/pastetext/lang/bn.js | 8 + .../ckeditor/plugins/pastetext/lang/bs.js | 8 + .../ckeditor/plugins/pastetext/lang/ca.js | 8 + .../ckeditor/plugins/pastetext/lang/cs.js | 8 + .../ckeditor/plugins/pastetext/lang/cy.js | 8 + .../ckeditor/plugins/pastetext/lang/da.js | 8 + .../ckeditor/plugins/pastetext/lang/de.js | 8 + .../ckeditor/plugins/pastetext/lang/el.js | 8 + .../ckeditor/plugins/pastetext/lang/en-au.js | 8 + .../ckeditor/plugins/pastetext/lang/en-ca.js | 8 + .../ckeditor/plugins/pastetext/lang/en-gb.js | 8 + .../ckeditor/plugins/pastetext/lang/en.js | 8 + .../ckeditor/plugins/pastetext/lang/eo.js | 8 + .../ckeditor/plugins/pastetext/lang/es.js | 8 + .../ckeditor/plugins/pastetext/lang/et.js | 8 + .../ckeditor/plugins/pastetext/lang/eu.js | 8 + .../ckeditor/plugins/pastetext/lang/fa.js | 8 + .../ckeditor/plugins/pastetext/lang/fi.js | 8 + .../ckeditor/plugins/pastetext/lang/fo.js | 8 + .../ckeditor/plugins/pastetext/lang/fr-ca.js | 8 + .../ckeditor/plugins/pastetext/lang/fr.js | 8 + .../ckeditor/plugins/pastetext/lang/gl.js | 8 + .../ckeditor/plugins/pastetext/lang/gu.js | 8 + .../ckeditor/plugins/pastetext/lang/he.js | 8 + .../ckeditor/plugins/pastetext/lang/hi.js | 8 + .../ckeditor/plugins/pastetext/lang/hr.js | 8 + .../ckeditor/plugins/pastetext/lang/hu.js | 8 + .../ckeditor/plugins/pastetext/lang/id.js | 8 + .../ckeditor/plugins/pastetext/lang/is.js | 8 + .../ckeditor/plugins/pastetext/lang/it.js | 8 + .../ckeditor/plugins/pastetext/lang/ja.js | 8 + .../ckeditor/plugins/pastetext/lang/ka.js | 8 + .../ckeditor/plugins/pastetext/lang/km.js | 8 + .../ckeditor/plugins/pastetext/lang/ko.js | 8 + .../ckeditor/plugins/pastetext/lang/ku.js | 8 + .../ckeditor/plugins/pastetext/lang/lt.js | 8 + .../ckeditor/plugins/pastetext/lang/lv.js | 8 + .../ckeditor/plugins/pastetext/lang/mk.js | 8 + .../ckeditor/plugins/pastetext/lang/mn.js | 8 + .../ckeditor/plugins/pastetext/lang/ms.js | 8 + .../ckeditor/plugins/pastetext/lang/nb.js | 8 + .../ckeditor/plugins/pastetext/lang/nl.js | 8 + .../ckeditor/plugins/pastetext/lang/no.js | 8 + .../ckeditor/plugins/pastetext/lang/pl.js | 8 + .../ckeditor/plugins/pastetext/lang/pt-br.js | 8 + .../ckeditor/plugins/pastetext/lang/pt.js | 8 + .../ckeditor/plugins/pastetext/lang/ro.js | 8 + .../ckeditor/plugins/pastetext/lang/ru.js | 8 + .../ckeditor/plugins/pastetext/lang/si.js | 8 + .../ckeditor/plugins/pastetext/lang/sk.js | 8 + .../ckeditor/plugins/pastetext/lang/sl.js | 8 + .../ckeditor/plugins/pastetext/lang/sq.js | 8 + .../plugins/pastetext/lang/sr-latn.js | 8 + .../ckeditor/plugins/pastetext/lang/sr.js | 8 + .../ckeditor/plugins/pastetext/lang/sv.js | 8 + .../ckeditor/plugins/pastetext/lang/th.js | 8 + .../ckeditor/plugins/pastetext/lang/tr.js | 8 + .../ckeditor/plugins/pastetext/lang/tt.js | 8 + .../ckeditor/plugins/pastetext/lang/ug.js | 8 + .../ckeditor/plugins/pastetext/lang/uk.js | 8 + .../ckeditor/plugins/pastetext/lang/vi.js | 8 + .../ckeditor/plugins/pastetext/lang/zh-cn.js | 8 + .../ckeditor/plugins/pastetext/lang/zh.js | 8 + .../ckeditor/plugins/pastetext/plugin.js | 78 + .../ckeditor/plugins/removeformat/lang/af.js | 7 + .../ckeditor/plugins/removeformat/lang/ar.js | 7 + .../ckeditor/plugins/removeformat/lang/bg.js | 7 + .../ckeditor/plugins/removeformat/lang/bn.js | 7 + .../ckeditor/plugins/removeformat/lang/bs.js | 7 + .../ckeditor/plugins/removeformat/lang/ca.js | 7 + .../ckeditor/plugins/removeformat/lang/cs.js | 7 + .../ckeditor/plugins/removeformat/lang/cy.js | 7 + .../ckeditor/plugins/removeformat/lang/da.js | 7 + .../ckeditor/plugins/removeformat/lang/de.js | 7 + .../ckeditor/plugins/removeformat/lang/el.js | 7 + .../plugins/removeformat/lang/en-au.js | 7 + .../plugins/removeformat/lang/en-ca.js | 7 + .../plugins/removeformat/lang/en-gb.js | 7 + .../ckeditor/plugins/removeformat/lang/en.js | 7 + .../ckeditor/plugins/removeformat/lang/eo.js | 7 + .../ckeditor/plugins/removeformat/lang/es.js | 7 + .../ckeditor/plugins/removeformat/lang/et.js | 7 + .../ckeditor/plugins/removeformat/lang/eu.js | 7 + .../ckeditor/plugins/removeformat/lang/fa.js | 7 + .../ckeditor/plugins/removeformat/lang/fi.js | 7 + .../ckeditor/plugins/removeformat/lang/fo.js | 7 + .../plugins/removeformat/lang/fr-ca.js | 7 + .../ckeditor/plugins/removeformat/lang/fr.js | 7 + .../ckeditor/plugins/removeformat/lang/gl.js | 7 + .../ckeditor/plugins/removeformat/lang/gu.js | 7 + .../ckeditor/plugins/removeformat/lang/he.js | 7 + .../ckeditor/plugins/removeformat/lang/hi.js | 7 + .../ckeditor/plugins/removeformat/lang/hr.js | 7 + .../ckeditor/plugins/removeformat/lang/hu.js | 7 + .../ckeditor/plugins/removeformat/lang/id.js | 7 + .../ckeditor/plugins/removeformat/lang/is.js | 7 + .../ckeditor/plugins/removeformat/lang/it.js | 7 + .../ckeditor/plugins/removeformat/lang/ja.js | 7 + .../ckeditor/plugins/removeformat/lang/ka.js | 7 + .../ckeditor/plugins/removeformat/lang/km.js | 7 + .../ckeditor/plugins/removeformat/lang/ko.js | 7 + .../ckeditor/plugins/removeformat/lang/ku.js | 7 + .../ckeditor/plugins/removeformat/lang/lt.js | 7 + .../ckeditor/plugins/removeformat/lang/lv.js | 7 + .../ckeditor/plugins/removeformat/lang/mk.js | 7 + .../ckeditor/plugins/removeformat/lang/mn.js | 7 + .../ckeditor/plugins/removeformat/lang/ms.js | 7 + .../ckeditor/plugins/removeformat/lang/nb.js | 7 + .../ckeditor/plugins/removeformat/lang/nl.js | 7 + .../ckeditor/plugins/removeformat/lang/no.js | 7 + .../ckeditor/plugins/removeformat/lang/pl.js | 7 + .../plugins/removeformat/lang/pt-br.js | 7 + .../ckeditor/plugins/removeformat/lang/pt.js | 7 + .../ckeditor/plugins/removeformat/lang/ro.js | 7 + .../ckeditor/plugins/removeformat/lang/ru.js | 7 + .../ckeditor/plugins/removeformat/lang/si.js | 7 + .../ckeditor/plugins/removeformat/lang/sk.js | 7 + .../ckeditor/plugins/removeformat/lang/sl.js | 7 + .../ckeditor/plugins/removeformat/lang/sq.js | 7 + .../plugins/removeformat/lang/sr-latn.js | 7 + .../ckeditor/plugins/removeformat/lang/sr.js | 7 + .../ckeditor/plugins/removeformat/lang/sv.js | 7 + .../ckeditor/plugins/removeformat/lang/th.js | 7 + .../ckeditor/plugins/removeformat/lang/tr.js | 7 + .../ckeditor/plugins/removeformat/lang/tt.js | 7 + .../ckeditor/plugins/removeformat/lang/ug.js | 7 + .../ckeditor/plugins/removeformat/lang/uk.js | 7 + .../ckeditor/plugins/removeformat/lang/vi.js | 7 + .../plugins/removeformat/lang/zh-cn.js | 7 + .../ckeditor/plugins/removeformat/lang/zh.js | 7 + .../ckeditor/plugins/removeformat/plugin.js | 193 + .../jQuery/ckeditor/plugins/resize/plugin.js | 169 + .../ckeditor/plugins/richcombo/plugin.js | 434 + .../ckeditor/plugins/sourcearea/lang/af.js | 7 + .../ckeditor/plugins/sourcearea/lang/ar.js | 7 + .../ckeditor/plugins/sourcearea/lang/bg.js | 7 + .../ckeditor/plugins/sourcearea/lang/bn.js | 7 + .../ckeditor/plugins/sourcearea/lang/bs.js | 7 + .../ckeditor/plugins/sourcearea/lang/ca.js | 7 + .../ckeditor/plugins/sourcearea/lang/cs.js | 7 + .../ckeditor/plugins/sourcearea/lang/cy.js | 7 + .../ckeditor/plugins/sourcearea/lang/da.js | 7 + .../ckeditor/plugins/sourcearea/lang/de.js | 7 + .../ckeditor/plugins/sourcearea/lang/el.js | 7 + .../ckeditor/plugins/sourcearea/lang/en-au.js | 7 + .../ckeditor/plugins/sourcearea/lang/en-ca.js | 7 + .../ckeditor/plugins/sourcearea/lang/en-gb.js | 7 + .../ckeditor/plugins/sourcearea/lang/en.js | 7 + .../ckeditor/plugins/sourcearea/lang/eo.js | 7 + .../ckeditor/plugins/sourcearea/lang/es.js | 7 + .../ckeditor/plugins/sourcearea/lang/et.js | 7 + .../ckeditor/plugins/sourcearea/lang/eu.js | 7 + .../ckeditor/plugins/sourcearea/lang/fa.js | 7 + .../ckeditor/plugins/sourcearea/lang/fi.js | 7 + .../ckeditor/plugins/sourcearea/lang/fo.js | 7 + .../ckeditor/plugins/sourcearea/lang/fr-ca.js | 7 + .../ckeditor/plugins/sourcearea/lang/fr.js | 7 + .../ckeditor/plugins/sourcearea/lang/gl.js | 7 + .../ckeditor/plugins/sourcearea/lang/gu.js | 7 + .../ckeditor/plugins/sourcearea/lang/he.js | 7 + .../ckeditor/plugins/sourcearea/lang/hi.js | 7 + .../ckeditor/plugins/sourcearea/lang/hr.js | 7 + .../ckeditor/plugins/sourcearea/lang/hu.js | 7 + .../ckeditor/plugins/sourcearea/lang/id.js | 7 + .../ckeditor/plugins/sourcearea/lang/is.js | 7 + .../ckeditor/plugins/sourcearea/lang/it.js | 7 + .../ckeditor/plugins/sourcearea/lang/ja.js | 7 + .../ckeditor/plugins/sourcearea/lang/ka.js | 7 + .../ckeditor/plugins/sourcearea/lang/km.js | 7 + .../ckeditor/plugins/sourcearea/lang/ko.js | 7 + .../ckeditor/plugins/sourcearea/lang/ku.js | 7 + .../ckeditor/plugins/sourcearea/lang/lt.js | 7 + .../ckeditor/plugins/sourcearea/lang/lv.js | 7 + .../ckeditor/plugins/sourcearea/lang/mk.js | 7 + .../ckeditor/plugins/sourcearea/lang/mn.js | 7 + .../ckeditor/plugins/sourcearea/lang/ms.js | 7 + .../ckeditor/plugins/sourcearea/lang/nb.js | 7 + .../ckeditor/plugins/sourcearea/lang/nl.js | 7 + .../ckeditor/plugins/sourcearea/lang/no.js | 7 + .../ckeditor/plugins/sourcearea/lang/pl.js | 7 + .../ckeditor/plugins/sourcearea/lang/pt-br.js | 7 + .../ckeditor/plugins/sourcearea/lang/pt.js | 7 + .../ckeditor/plugins/sourcearea/lang/ro.js | 7 + .../ckeditor/plugins/sourcearea/lang/ru.js | 7 + .../ckeditor/plugins/sourcearea/lang/si.js | 7 + .../ckeditor/plugins/sourcearea/lang/sk.js | 7 + .../ckeditor/plugins/sourcearea/lang/sl.js | 7 + .../ckeditor/plugins/sourcearea/lang/sq.js | 7 + .../plugins/sourcearea/lang/sr-latn.js | 7 + .../ckeditor/plugins/sourcearea/lang/sr.js | 7 + .../ckeditor/plugins/sourcearea/lang/sv.js | 7 + .../ckeditor/plugins/sourcearea/lang/th.js | 7 + .../ckeditor/plugins/sourcearea/lang/tr.js | 7 + .../ckeditor/plugins/sourcearea/lang/tt.js | 7 + .../ckeditor/plugins/sourcearea/lang/ug.js | 7 + .../ckeditor/plugins/sourcearea/lang/uk.js | 7 + .../ckeditor/plugins/sourcearea/lang/vi.js | 7 + .../ckeditor/plugins/sourcearea/lang/zh-cn.js | 7 + .../ckeditor/plugins/sourcearea/lang/zh.js | 7 + .../ckeditor/plugins/sourcearea/plugin.js | 168 + .../plugins/symbol/dialogs/lang/en.js | 181 + .../ckeditor/plugins/symbol/dialogs/symbol.js | 18 + .../jQuery/ckeditor/plugins/symbol/lang/en.js | 1 + .../jQuery/ckeditor/plugins/symbol/plugin.js | 15 + .../ckeditor/plugins/table/dialogs/table.js | 540 + .../jQuery/ckeditor/plugins/table/lang/af.js | 74 + .../jQuery/ckeditor/plugins/table/lang/ar.js | 74 + .../jQuery/ckeditor/plugins/table/lang/bg.js | 74 + .../jQuery/ckeditor/plugins/table/lang/bn.js | 74 + .../jQuery/ckeditor/plugins/table/lang/bs.js | 74 + .../jQuery/ckeditor/plugins/table/lang/ca.js | 74 + .../jQuery/ckeditor/plugins/table/lang/cs.js | 74 + .../jQuery/ckeditor/plugins/table/lang/cy.js | 74 + .../jQuery/ckeditor/plugins/table/lang/da.js | 74 + .../jQuery/ckeditor/plugins/table/lang/de.js | 74 + .../jQuery/ckeditor/plugins/table/lang/el.js | 74 + .../ckeditor/plugins/table/lang/en-au.js | 74 + .../ckeditor/plugins/table/lang/en-ca.js | 74 + .../ckeditor/plugins/table/lang/en-gb.js | 74 + .../jQuery/ckeditor/plugins/table/lang/en.js | 74 + .../jQuery/ckeditor/plugins/table/lang/eo.js | 74 + .../jQuery/ckeditor/plugins/table/lang/es.js | 74 + .../jQuery/ckeditor/plugins/table/lang/et.js | 74 + .../jQuery/ckeditor/plugins/table/lang/eu.js | 74 + .../jQuery/ckeditor/plugins/table/lang/fa.js | 74 + .../jQuery/ckeditor/plugins/table/lang/fi.js | 74 + .../jQuery/ckeditor/plugins/table/lang/fo.js | 74 + .../ckeditor/plugins/table/lang/fr-ca.js | 74 + .../jQuery/ckeditor/plugins/table/lang/fr.js | 74 + .../jQuery/ckeditor/plugins/table/lang/gl.js | 74 + .../jQuery/ckeditor/plugins/table/lang/gu.js | 74 + .../jQuery/ckeditor/plugins/table/lang/he.js | 74 + .../jQuery/ckeditor/plugins/table/lang/hi.js | 74 + .../jQuery/ckeditor/plugins/table/lang/hr.js | 74 + .../jQuery/ckeditor/plugins/table/lang/hu.js | 74 + .../jQuery/ckeditor/plugins/table/lang/id.js | 74 + .../jQuery/ckeditor/plugins/table/lang/is.js | 74 + .../jQuery/ckeditor/plugins/table/lang/it.js | 74 + .../jQuery/ckeditor/plugins/table/lang/ja.js | 74 + .../jQuery/ckeditor/plugins/table/lang/ka.js | 74 + .../jQuery/ckeditor/plugins/table/lang/km.js | 74 + .../jQuery/ckeditor/plugins/table/lang/ko.js | 74 + .../jQuery/ckeditor/plugins/table/lang/ku.js | 74 + .../jQuery/ckeditor/plugins/table/lang/lt.js | 74 + .../jQuery/ckeditor/plugins/table/lang/lv.js | 74 + .../jQuery/ckeditor/plugins/table/lang/mk.js | 74 + .../jQuery/ckeditor/plugins/table/lang/mn.js | 74 + .../jQuery/ckeditor/plugins/table/lang/ms.js | 74 + .../jQuery/ckeditor/plugins/table/lang/nb.js | 74 + .../jQuery/ckeditor/plugins/table/lang/nl.js | 74 + .../jQuery/ckeditor/plugins/table/lang/no.js | 74 + .../jQuery/ckeditor/plugins/table/lang/pl.js | 74 + .../ckeditor/plugins/table/lang/pt-br.js | 74 + .../jQuery/ckeditor/plugins/table/lang/pt.js | 74 + .../jQuery/ckeditor/plugins/table/lang/ro.js | 74 + .../jQuery/ckeditor/plugins/table/lang/ru.js | 74 + .../jQuery/ckeditor/plugins/table/lang/si.js | 74 + .../jQuery/ckeditor/plugins/table/lang/sk.js | 74 + .../jQuery/ckeditor/plugins/table/lang/sl.js | 74 + .../jQuery/ckeditor/plugins/table/lang/sq.js | 74 + .../ckeditor/plugins/table/lang/sr-latn.js | 74 + .../jQuery/ckeditor/plugins/table/lang/sr.js | 74 + .../jQuery/ckeditor/plugins/table/lang/sv.js | 74 + .../jQuery/ckeditor/plugins/table/lang/th.js | 74 + .../jQuery/ckeditor/plugins/table/lang/tr.js | 74 + .../jQuery/ckeditor/plugins/table/lang/tt.js | 74 + .../jQuery/ckeditor/plugins/table/lang/ug.js | 74 + .../jQuery/ckeditor/plugins/table/lang/uk.js | 74 + .../jQuery/ckeditor/plugins/table/lang/vi.js | 74 + .../ckeditor/plugins/table/lang/zh-cn.js | 74 + .../jQuery/ckeditor/plugins/table/lang/zh.js | 74 + .../jQuery/ckeditor/plugins/table/plugin.js | 109 + .../ckeditor/plugins/tableresize/plugin.js | 413 + .../plugins/tabletools/dialogs/tableCell.js | 474 + .../ckeditor/plugins/tabletools/plugin.js | 1005 + .../samples/assets/uilanguages/languages.js | 7 + .../plugins/dialog/assets/my_dialog.js | 48 + include/jQuery/ckeditor/samples/sample.js | 50 + .../jQuery/ckeditor/skins/moono_blue/skin.js | 10 + .../jQuery/ckeditor/skins/office2013/skin.js | 5 + include/jQuery/ckeditor/styles.js | 111 + include/jQuery/html-table-search.js | 35 + include/jQuery/jquery-1.11.2.min.js | 4 + include/jQuery/jquery-mask/jquery.mask.js | 479 + .../jQuery/jquery-ui-lite/jquery-1.12.4.js | 11008 +++ include/jQuery/jquery-ui-lite/jquery-ui.js | 18706 +++++ include/jQuery/jquery-ui/Gruntfile.js | 357 + .../datepicker/jquery.ui.datepicker-ar.js | 23 + .../datepicker/jquery.ui.datepicker-fr.js | 25 + .../datepicker/jquery.ui.datepicker-he.js | 23 + .../datepicker/jquery.ui.datepicker-zh-TW.js | 23 + .../external/globalize.culture.de-DE.js | 81 + .../external/globalize.culture.ja-JP.js | 100 + .../jQuery/jquery-ui/external/globalize.js | 1585 + .../jquery-ui/external/jquery.mousewheel.js | 101 + include/jQuery/jquery-ui/external/jshint.js | 4835 ++ include/jQuery/jquery-ui/external/qunit.js | 2152 + include/jQuery/jquery-ui/jquery-1.10.2.js | 9789 +++ include/jQuery/jquery-ui/tests/index.js | 10 + .../jQuery/jquery-ui/tests/jquery-1.10.0.js | 9800 +++ .../jQuery/jquery-ui/tests/jquery-1.10.1.js | 9807 +++ .../jQuery/jquery-ui/tests/jquery-1.10.2.js | 9789 +++ .../jQuery/jquery-ui/tests/jquery-1.6.1.js | 8936 +++ .../jQuery/jquery-ui/tests/jquery-1.6.2.js | 8981 +++ .../jQuery/jquery-ui/tests/jquery-1.6.3.js | 9044 +++ .../jQuery/jquery-ui/tests/jquery-1.6.4.js | 9046 +++ include/jQuery/jquery-ui/tests/jquery-1.6.js | 8865 +++ .../jQuery/jquery-ui/tests/jquery-1.7.1.js | 9266 +++ .../jQuery/jquery-ui/tests/jquery-1.7.2.js | 9404 +++ include/jQuery/jquery-ui/tests/jquery-1.7.js | 9300 +++ .../jQuery/jquery-ui/tests/jquery-1.8.0.js | 9227 +++ .../jQuery/jquery-ui/tests/jquery-1.8.1.js | 9301 +++ .../jQuery/jquery-ui/tests/jquery-1.8.2.js | 9440 +++ .../jQuery/jquery-ui/tests/jquery-1.8.3.js | 9472 +++ .../jQuery/jquery-ui/tests/jquery-1.9.0.js | 9555 +++ .../jQuery/jquery-ui/tests/jquery-1.9.1.js | 9597 +++ .../jQuery/jquery-ui/tests/jquery-2.0.0.js | 8755 +++ .../jQuery/jquery-ui/tests/jquery-2.0.1.js | 8837 +++ .../jQuery/jquery-ui/tests/jquery-2.0.2.js | 8842 +++ .../jQuery/jquery-ui/tests/jquery-2.0.3.js | 8829 +++ include/jQuery/jquery-ui/tests/jquery.js | 26 + .../jQuery/jquery-ui/tests/jquery.simulate.js | 324 + .../tests/unit/accordion/accordion_common.js | 20 + .../tests/unit/accordion/accordion_core.js | 117 + .../tests/unit/accordion/accordion_events.js | 169 + .../tests/unit/accordion/accordion_methods.js | 126 + .../tests/unit/accordion/accordion_options.js | 463 + .../unit/accordion/accordion_test_helpers.js | 27 + .../unit/autocomplete/autocomplete_common.js | 29 + .../unit/autocomplete/autocomplete_core.js | 270 + .../unit/autocomplete/autocomplete_events.js | 182 + .../unit/autocomplete/autocomplete_methods.js | 45 + .../unit/autocomplete/autocomplete_options.js | 278 + .../tests/unit/button/button_common.js | 14 + .../tests/unit/button/button_core.js | 212 + .../tests/unit/button/button_events.js | 36 + .../tests/unit/button/button_methods.js | 52 + .../tests/unit/button/button_options.js | 117 + .../jQuery/jquery-ui/tests/unit/core/core.js | 191 + .../jquery-ui/tests/unit/core/selector.js | 251 + .../unit/datepicker/datepicker_common.js | 7 + .../tests/unit/datepicker/datepicker_core.js | 524 + .../unit/datepicker/datepicker_events.js | 153 + .../unit/datepicker/datepicker_methods.js | 125 + .../unit/datepicker/datepicker_options.js | 1113 + .../datepicker/datepicker_test_helpers.js | 37 + .../tests/unit/dialog/dialog_common.js | 43 + .../tests/unit/dialog/dialog_core.js | 163 + .../tests/unit/dialog/dialog_deprecated.js | 63 + .../tests/unit/dialog/dialog_events.js | 370 + .../tests/unit/dialog/dialog_methods.js | 252 + .../tests/unit/dialog/dialog_options.js | 584 + .../tests/unit/dialog/dialog_test_helpers.js | 44 + .../tests/unit/draggable/draggable_common.js | 40 + .../tests/unit/draggable/draggable_core.js | 168 + .../tests/unit/draggable/draggable_events.js | 125 + .../tests/unit/draggable/draggable_methods.js | 99 + .../tests/unit/draggable/draggable_options.js | 1404 + .../unit/draggable/draggable_test_helpers.js | 79 + .../tests/unit/droppable/droppable_common.js | 20 + .../tests/unit/droppable/droppable_core.js | 29 + .../tests/unit/droppable/droppable_events.js | 63 + .../tests/unit/droppable/droppable_methods.js | 88 + .../tests/unit/droppable/droppable_options.js | 67 + .../unit/droppable/droppable_test_helpers.js | 10 + .../tests/unit/effects/effects_core.js | 274 + .../tests/unit/effects/effects_scale.js | 68 + .../jquery-ui/tests/unit/menu/menu_common.js | 20 + .../jquery-ui/tests/unit/menu/menu_core.js | 48 + .../jquery-ui/tests/unit/menu/menu_events.js | 637 + .../jquery-ui/tests/unit/menu/menu_methods.js | 117 + .../jquery-ui/tests/unit/menu/menu_options.js | 115 + .../tests/unit/menu/menu_test_helpers.js | 31 + .../tests/unit/position/position_core.js | 729 + .../unit/progressbar/progressbar_common.js | 12 + .../unit/progressbar/progressbar_core.js | 53 + .../unit/progressbar/progressbar_events.js | 51 + .../unit/progressbar/progressbar_methods.js | 25 + .../unit/progressbar/progressbar_options.js | 72 + .../jquery-ui/tests/unit/qunit-composite.js | 112 + .../tests/unit/resizable/resizable_common.js | 30 + .../tests/unit/resizable/resizable_core.js | 209 + .../tests/unit/resizable/resizable_events.js | 220 + .../tests/unit/resizable/resizable_methods.js | 12 + .../tests/unit/resizable/resizable_options.js | 291 + .../unit/resizable/resizable_test_helpers.js | 11 + .../unit/selectable/selectable_common.js | 21 + .../tests/unit/selectable/selectable_core.js | 3 + .../unit/selectable/selectable_events.js | 69 + .../unit/selectable/selectable_methods.js | 104 + .../unit/selectable/selectable_options.js | 65 + .../tests/unit/slider/slider_common.js | 23 + .../tests/unit/slider/slider_core.js | 297 + .../tests/unit/slider/slider_events.js | 152 + .../tests/unit/slider/slider_methods.js | 96 + .../tests/unit/slider/slider_options.js | 317 + .../tests/unit/sortable/sortable_common.js | 45 + .../tests/unit/sortable/sortable_core.js | 3 + .../tests/unit/sortable/sortable_events.js | 275 + .../tests/unit/sortable/sortable_methods.js | 92 + .../tests/unit/sortable/sortable_options.js | 460 + .../unit/sortable/sortable_test_helpers.js | 9 + .../tests/unit/spinner/spinner_common.js | 23 + .../tests/unit/spinner/spinner_core.js | 238 + .../tests/unit/spinner/spinner_events.js | 259 + .../tests/unit/spinner/spinner_methods.js | 174 + .../tests/unit/spinner/spinner_options.js | 262 + .../unit/spinner/spinner_test_helpers.js | 8 + .../jQuery/jquery-ui/tests/unit/subsuite.js | 25 + .../jquery-ui/tests/unit/swarminject.js | 10 + .../jquery-ui/tests/unit/tabs/tabs_common.js | 18 + .../jquery-ui/tests/unit/tabs/tabs_core.js | 615 + .../jquery-ui/tests/unit/tabs/tabs_events.js | 318 + .../jquery-ui/tests/unit/tabs/tabs_methods.js | 270 + .../jquery-ui/tests/unit/tabs/tabs_options.js | 345 + .../tests/unit/tabs/tabs_test_helpers.js | 67 + .../jQuery/jquery-ui/tests/unit/testsuite.js | 298 + .../tests/unit/tooltip/tooltip_common.js | 21 + .../tests/unit/tooltip/tooltip_core.js | 137 + .../tests/unit/tooltip/tooltip_events.js | 57 + .../tests/unit/tooltip/tooltip_methods.js | 94 + .../tests/unit/tooltip/tooltip_options.js | 171 + .../tests/unit/widget/widget_animation.js | 257 + .../tests/unit/widget/widget_core.js | 1459 + .../tests/unit/widget/widget_extend.js | 105 + .../jquery-ui/tests/visual/effects/effects.js | 107 + .../jquery-ui/ui/i18n/jquery-ui-i18n.js | 1793 + .../ui/i18n/jquery.ui.datepicker-af.js | 23 + .../ui/i18n/jquery.ui.datepicker-ar-DZ.js | 23 + .../ui/i18n/jquery.ui.datepicker-ar.js | 23 + .../ui/i18n/jquery.ui.datepicker-az.js | 23 + .../ui/i18n/jquery.ui.datepicker-be.js | 23 + .../ui/i18n/jquery.ui.datepicker-bg.js | 24 + .../ui/i18n/jquery.ui.datepicker-bs.js | 23 + .../ui/i18n/jquery.ui.datepicker-ca.js | 23 + .../ui/i18n/jquery.ui.datepicker-cs.js | 23 + .../ui/i18n/jquery.ui.datepicker-cy-GB.js | 23 + .../ui/i18n/jquery.ui.datepicker-da.js | 23 + .../ui/i18n/jquery.ui.datepicker-de.js | 23 + .../ui/i18n/jquery.ui.datepicker-el.js | 23 + .../ui/i18n/jquery.ui.datepicker-en-AU.js | 23 + .../ui/i18n/jquery.ui.datepicker-en-GB.js | 23 + .../ui/i18n/jquery.ui.datepicker-en-NZ.js | 23 + .../ui/i18n/jquery.ui.datepicker-eo.js | 23 + .../ui/i18n/jquery.ui.datepicker-es.js | 23 + .../ui/i18n/jquery.ui.datepicker-et.js | 23 + .../ui/i18n/jquery.ui.datepicker-eu.js | 23 + .../ui/i18n/jquery.ui.datepicker-fa.js | 59 + .../ui/i18n/jquery.ui.datepicker-fi.js | 23 + .../ui/i18n/jquery.ui.datepicker-fo.js | 23 + .../ui/i18n/jquery.ui.datepicker-fr-CA.js | 23 + .../ui/i18n/jquery.ui.datepicker-fr-CH.js | 23 + .../ui/i18n/jquery.ui.datepicker-fr.js | 25 + .../ui/i18n/jquery.ui.datepicker-gl.js | 23 + .../ui/i18n/jquery.ui.datepicker-he.js | 23 + .../ui/i18n/jquery.ui.datepicker-hi.js | 23 + .../ui/i18n/jquery.ui.datepicker-hr.js | 23 + .../ui/i18n/jquery.ui.datepicker-hu.js | 23 + .../ui/i18n/jquery.ui.datepicker-hy.js | 23 + .../ui/i18n/jquery.ui.datepicker-id.js | 23 + .../ui/i18n/jquery.ui.datepicker-is.js | 23 + .../ui/i18n/jquery.ui.datepicker-it.js | 23 + .../ui/i18n/jquery.ui.datepicker-ja.js | 23 + .../ui/i18n/jquery.ui.datepicker-ka.js | 21 + .../ui/i18n/jquery.ui.datepicker-kk.js | 23 + .../ui/i18n/jquery.ui.datepicker-km.js | 23 + .../ui/i18n/jquery.ui.datepicker-ko.js | 23 + .../ui/i18n/jquery.ui.datepicker-ky.js | 24 + .../ui/i18n/jquery.ui.datepicker-lb.js | 23 + .../ui/i18n/jquery.ui.datepicker-lt.js | 23 + .../ui/i18n/jquery.ui.datepicker-lv.js | 23 + .../ui/i18n/jquery.ui.datepicker-mk.js | 23 + .../ui/i18n/jquery.ui.datepicker-ml.js | 23 + .../ui/i18n/jquery.ui.datepicker-ms.js | 23 + .../ui/i18n/jquery.ui.datepicker-nb.js | 22 + .../ui/i18n/jquery.ui.datepicker-nl-BE.js | 23 + .../ui/i18n/jquery.ui.datepicker-nl.js | 23 + .../ui/i18n/jquery.ui.datepicker-nn.js | 22 + .../ui/i18n/jquery.ui.datepicker-no.js | 23 + .../ui/i18n/jquery.ui.datepicker-pl.js | 23 + .../ui/i18n/jquery.ui.datepicker-pt-BR.js | 23 + .../ui/i18n/jquery.ui.datepicker-pt.js | 22 + .../ui/i18n/jquery.ui.datepicker-rm.js | 21 + .../ui/i18n/jquery.ui.datepicker-ro.js | 26 + .../ui/i18n/jquery.ui.datepicker-ru.js | 23 + .../ui/i18n/jquery.ui.datepicker-sk.js | 23 + .../ui/i18n/jquery.ui.datepicker-sl.js | 24 + .../ui/i18n/jquery.ui.datepicker-sq.js | 23 + .../ui/i18n/jquery.ui.datepicker-sr-SR.js | 23 + .../ui/i18n/jquery.ui.datepicker-sr.js | 23 + .../ui/i18n/jquery.ui.datepicker-sv.js | 23 + .../ui/i18n/jquery.ui.datepicker-ta.js | 23 + .../ui/i18n/jquery.ui.datepicker-th.js | 23 + .../ui/i18n/jquery.ui.datepicker-tj.js | 23 + .../ui/i18n/jquery.ui.datepicker-tr.js | 23 + .../ui/i18n/jquery.ui.datepicker-uk.js | 24 + .../ui/i18n/jquery.ui.datepicker-vi.js | 23 + .../ui/i18n/jquery.ui.datepicker-zh-CN.js | 23 + .../ui/i18n/jquery.ui.datepicker-zh-HK.js | 23 + .../ui/i18n/jquery.ui.datepicker-zh-TW.js | 23 + include/jQuery/jquery-ui/ui/jquery-ui.js | 15040 ++++ .../jquery-ui/ui/jquery.ui.accordion.js | 570 + .../jquery-ui/ui/jquery.ui.autocomplete.js | 606 + .../jQuery/jquery-ui/ui/jquery.ui.button.js | 395 + include/jQuery/jquery-ui/ui/jquery.ui.core.js | 320 + .../jquery-ui/ui/jquery.ui.datepicker.js | 2038 + .../jQuery/jquery-ui/ui/jquery.ui.dialog.js | 823 + .../jquery-ui/ui/jquery.ui.draggable.js | 958 + .../jquery-ui/ui/jquery.ui.droppable.js | 389 + .../jquery-ui/ui/jquery.ui.effect-blind.js | 82 + .../jquery-ui/ui/jquery.ui.effect-bounce.js | 113 + .../jquery-ui/ui/jquery.ui.effect-clip.js | 67 + .../jquery-ui/ui/jquery.ui.effect-drop.js | 65 + .../jquery-ui/ui/jquery.ui.effect-explode.js | 97 + .../jquery-ui/ui/jquery.ui.effect-fade.js | 30 + .../jquery-ui/ui/jquery.ui.effect-fold.js | 76 + .../ui/jquery.ui.effect-highlight.js | 50 + .../jquery-ui/ui/jquery.ui.effect-pulsate.js | 63 + .../jquery-ui/ui/jquery.ui.effect-scale.js | 318 + .../jquery-ui/ui/jquery.ui.effect-shake.js | 74 + .../jquery-ui/ui/jquery.ui.effect-slide.js | 64 + .../jquery-ui/ui/jquery.ui.effect-transfer.js | 47 + .../jQuery/jquery-ui/ui/jquery.ui.effect.js | 1289 + include/jQuery/jquery-ui/ui/jquery.ui.menu.js | 627 + .../jQuery/jquery-ui/ui/jquery.ui.mouse.js | 169 + .../jQuery/jquery-ui/ui/jquery.ui.position.js | 501 + .../jquery-ui/ui/jquery.ui.progressbar.js | 145 + .../jquery-ui/ui/jquery.ui.resizable.js | 978 + .../jquery-ui/ui/jquery.ui.selectable.js | 277 + .../jQuery/jquery-ui/ui/jquery.ui.slider.js | 676 + .../jQuery/jquery-ui/ui/jquery.ui.sortable.js | 1289 + .../jQuery/jquery-ui/ui/jquery.ui.spinner.js | 497 + include/jQuery/jquery-ui/ui/jquery.ui.tabs.js | 849 + .../jQuery/jquery-ui/ui/jquery.ui.tooltip.js | 402 + .../jQuery/jquery-ui/ui/jquery.ui.widget.js | 521 + .../ui/minified/i18n/jquery-ui-i18n.min.js | 6 + .../i18n/jquery.ui.datepicker-af.min.js | 4 + .../i18n/jquery.ui.datepicker-ar-DZ.min.js | 4 + .../i18n/jquery.ui.datepicker-ar.min.js | 4 + .../i18n/jquery.ui.datepicker-az.min.js | 4 + .../i18n/jquery.ui.datepicker-be.min.js | 4 + .../i18n/jquery.ui.datepicker-bg.min.js | 4 + .../i18n/jquery.ui.datepicker-bs.min.js | 4 + .../i18n/jquery.ui.datepicker-ca.min.js | 4 + .../i18n/jquery.ui.datepicker-cs.min.js | 4 + .../i18n/jquery.ui.datepicker-cy-GB.min.js | 4 + .../i18n/jquery.ui.datepicker-da.min.js | 4 + .../i18n/jquery.ui.datepicker-de.min.js | 4 + .../i18n/jquery.ui.datepicker-el.min.js | 4 + .../i18n/jquery.ui.datepicker-en-AU.min.js | 4 + .../i18n/jquery.ui.datepicker-en-GB.min.js | 4 + .../i18n/jquery.ui.datepicker-en-NZ.min.js | 4 + .../i18n/jquery.ui.datepicker-eo.min.js | 4 + .../i18n/jquery.ui.datepicker-es.min.js | 4 + .../i18n/jquery.ui.datepicker-et.min.js | 4 + .../i18n/jquery.ui.datepicker-eu.min.js | 4 + .../i18n/jquery.ui.datepicker-fa.min.js | 4 + .../i18n/jquery.ui.datepicker-fi.min.js | 4 + .../i18n/jquery.ui.datepicker-fo.min.js | 4 + .../i18n/jquery.ui.datepicker-fr-CA.min.js | 4 + .../i18n/jquery.ui.datepicker-fr-CH.min.js | 4 + .../i18n/jquery.ui.datepicker-fr.min.js | 4 + .../i18n/jquery.ui.datepicker-gl.min.js | 4 + .../i18n/jquery.ui.datepicker-he.min.js | 4 + .../i18n/jquery.ui.datepicker-hi.min.js | 4 + .../i18n/jquery.ui.datepicker-hr.min.js | 4 + .../i18n/jquery.ui.datepicker-hu.min.js | 4 + .../i18n/jquery.ui.datepicker-hy.min.js | 4 + .../i18n/jquery.ui.datepicker-id.min.js | 4 + .../i18n/jquery.ui.datepicker-is.min.js | 4 + .../i18n/jquery.ui.datepicker-it.min.js | 4 + .../i18n/jquery.ui.datepicker-ja.min.js | 4 + .../i18n/jquery.ui.datepicker-ka.min.js | 4 + .../i18n/jquery.ui.datepicker-kk.min.js | 4 + .../i18n/jquery.ui.datepicker-km.min.js | 4 + .../i18n/jquery.ui.datepicker-ko.min.js | 4 + .../i18n/jquery.ui.datepicker-ky.min.js | 4 + .../i18n/jquery.ui.datepicker-lb.min.js | 4 + .../i18n/jquery.ui.datepicker-lt.min.js | 4 + .../i18n/jquery.ui.datepicker-lv.min.js | 4 + .../i18n/jquery.ui.datepicker-mk.min.js | 4 + .../i18n/jquery.ui.datepicker-ml.min.js | 4 + .../i18n/jquery.ui.datepicker-ms.min.js | 4 + .../i18n/jquery.ui.datepicker-nb.min.js | 4 + .../i18n/jquery.ui.datepicker-nl-BE.min.js | 4 + .../i18n/jquery.ui.datepicker-nl.min.js | 4 + .../i18n/jquery.ui.datepicker-nn.min.js | 4 + .../i18n/jquery.ui.datepicker-no.min.js | 4 + .../i18n/jquery.ui.datepicker-pl.min.js | 4 + .../i18n/jquery.ui.datepicker-pt-BR.min.js | 4 + .../i18n/jquery.ui.datepicker-pt.min.js | 4 + .../i18n/jquery.ui.datepicker-rm.min.js | 4 + .../i18n/jquery.ui.datepicker-ro.min.js | 4 + .../i18n/jquery.ui.datepicker-ru.min.js | 4 + .../i18n/jquery.ui.datepicker-sk.min.js | 4 + .../i18n/jquery.ui.datepicker-sl.min.js | 4 + .../i18n/jquery.ui.datepicker-sq.min.js | 4 + .../i18n/jquery.ui.datepicker-sr-SR.min.js | 4 + .../i18n/jquery.ui.datepicker-sr.min.js | 4 + .../i18n/jquery.ui.datepicker-sv.min.js | 4 + .../i18n/jquery.ui.datepicker-ta.min.js | 4 + .../i18n/jquery.ui.datepicker-th.min.js | 4 + .../i18n/jquery.ui.datepicker-tj.min.js | 4 + .../i18n/jquery.ui.datepicker-tr.min.js | 4 + .../i18n/jquery.ui.datepicker-uk.min.js | 4 + .../i18n/jquery.ui.datepicker-vi.min.js | 4 + .../i18n/jquery.ui.datepicker-zh-CN.min.js | 4 + .../i18n/jquery.ui.datepicker-zh-HK.min.js | 4 + .../i18n/jquery.ui.datepicker-zh-TW.min.js | 4 + .../jquery-ui/ui/minified/jquery-ui.min.js | 12 + .../ui/minified/jquery.ui.accordion.min.js | 4 + .../ui/minified/jquery.ui.autocomplete.min.js | 4 + .../ui/minified/jquery.ui.button.min.js | 4 + .../ui/minified/jquery.ui.core.min.js | 4 + .../ui/minified/jquery.ui.datepicker.min.js | 5 + .../ui/minified/jquery.ui.dialog.min.js | 4 + .../ui/minified/jquery.ui.draggable.min.js | 4 + .../ui/minified/jquery.ui.droppable.min.js | 4 + .../ui/minified/jquery.ui.effect-blind.min.js | 4 + .../minified/jquery.ui.effect-bounce.min.js | 4 + .../ui/minified/jquery.ui.effect-clip.min.js | 4 + .../ui/minified/jquery.ui.effect-drop.min.js | 4 + .../minified/jquery.ui.effect-explode.min.js | 4 + .../ui/minified/jquery.ui.effect-fade.min.js | 4 + .../ui/minified/jquery.ui.effect-fold.min.js | 4 + .../jquery.ui.effect-highlight.min.js | 4 + .../minified/jquery.ui.effect-pulsate.min.js | 4 + .../ui/minified/jquery.ui.effect-scale.min.js | 4 + .../ui/minified/jquery.ui.effect-shake.min.js | 4 + .../ui/minified/jquery.ui.effect-slide.min.js | 4 + .../minified/jquery.ui.effect-transfer.min.js | 4 + .../ui/minified/jquery.ui.effect.min.js | 4 + .../ui/minified/jquery.ui.menu.min.js | 4 + .../ui/minified/jquery.ui.mouse.min.js | 4 + .../ui/minified/jquery.ui.position.min.js | 4 + .../ui/minified/jquery.ui.progressbar.min.js | 4 + .../ui/minified/jquery.ui.resizable.min.js | 4 + .../ui/minified/jquery.ui.selectable.min.js | 4 + .../ui/minified/jquery.ui.slider.min.js | 4 + .../ui/minified/jquery.ui.sortable.min.js | 4 + .../ui/minified/jquery.ui.spinner.min.js | 4 + .../ui/minified/jquery.ui.tabs.min.js | 4 + .../ui/minified/jquery.ui.tooltip.min.js | 4 + .../ui/minified/jquery.ui.widget.min.js | 4 + .../jquery.appendGrid-1.5.1.js | 1572 + .../jquery.appendGrid-1.5.1.min.js | 13 + include/jQuery/jquery.blockUI.js | 619 + include/jQuery/jquery.tablesorter.js | 1031 + include/jQuery/jquery.tablesorter.pager.js | 184 + include/jQuery/languages.js | 989 + include/jQuery/numeral.js | 679 + include/jQuery/printerScripts.js | 62 + .../addons/pager/jquery.tablesorter.pager.js | 184 + .../jQuery/tablesorter/build/ParseMaster.js | 106 + include/jQuery/tablesorter/build/jsmin.js | 316 + include/jQuery/tablesorter/build/min.js | 5 + include/jQuery/tablesorter/build/pack.js | 5 + include/jQuery/tablesorter/build/packer.js | 316 + include/jQuery/tablesorter/build/writeFile.js | 19 + include/jQuery/tablesorter/docs/js/docs.js | 23 + .../jQuery/tablesorter/docs/js/examples.js | 29 + include/jQuery/tablesorter/jquery-latest.js | 154 + include/jQuery/tablesorter/jquery.metadata.js | 122 + .../jQuery/tablesorter/jquery.tablesorter.js | 1031 + .../tablesorter/jquery.tablesorter.min.js | 4 + include/javascript/cookie.js | 56 + include/javascript/dashlets.js | 37 + include/javascript/include.js | 18 + include/javascript/jquery-latest.js | 154 + include/javascript/jquery.tablesorter.js | 1046 + include/javascript/jsclass_async.js | 68 + include/javascript/jsclass_base.js | 149 + include/javascript/menu.js | 85 + include/javascript/overlibmws.js | 289 + include/javascript/overlibmws_iframe.js | 93 + include/javascript/popup_helper.js | 69 + include/javascript/popup_parent_helper.js | 83 + include/javascript/quickCompose.js | 22 + include/javascript/quicksearch.js | 47 + include/javascript/report_additionals.js | 402 + include/javascript/sugar_3.js | 561 + .../sugar_connection_event_listener.js | 37 + include/javascript/sugar_grp1.js | 968 + include/javascript/sugar_grp1_yui.js | 17453 +++++ include/javascript/sugar_grp_emails.js | 9907 +++ include/javascript/sugar_grp_overlib.js | 384 + include/javascript/sugar_grp_quickcomp.js | 5417 ++ include/javascript/sugar_grp_yui2.js | 31 + include/javascript/sugar_grp_yui_widgets.js | 152 + .../javascript/sugarwidgets/SugarYUILoader.js | 36 + .../sugarwidgets/SugarYUIWidgets.js | 78 + include/javascript/swfobject.js | 45 + include/javascript/tiny_mce/langs/en.js | 154 + .../tiny_mce/plugins/advhr/editor_plugin.js | 1 + .../plugins/advhr/editor_plugin_src.js | 54 + .../tiny_mce/plugins/advhr/js/rule.js | 43 + .../tiny_mce/plugins/advhr/langs/en_dlg.js | 5 + .../plugins/advimage/editor_plugin.js | 1 + .../plugins/advimage/editor_plugin_src.js | 47 + .../tiny_mce/plugins/advimage/js/image.js | 441 + .../tiny_mce/plugins/advimage/langs/en_dlg.js | 43 + .../tiny_mce/plugins/advlink/editor_plugin.js | 1 + .../plugins/advlink/editor_plugin_src.js | 58 + .../tiny_mce/plugins/advlink/js/advlink.js | 527 + .../tiny_mce/plugins/advlink/langs/en_dlg.js | 52 + .../plugins/autosave/editor_plugin.js | 1 + .../plugins/autosave/editor_plugin_src.js | 51 + .../tiny_mce/plugins/bbcode/editor_plugin.js | 1 + .../plugins/bbcode/editor_plugin_src.js | 117 + .../plugins/compat2x/editor_plugin.js | 1 + .../plugins/compat2x/editor_plugin_src.js | 616 + .../plugins/contextmenu/editor_plugin.js | 1 + .../plugins/contextmenu/editor_plugin_src.js | 95 + .../plugins/directionality/editor_plugin.js | 1 + .../directionality/editor_plugin_src.js | 79 + .../plugins/emotions/editor_plugin.js | 1 + .../plugins/emotions/editor_plugin_src.js | 40 + .../tiny_mce/plugins/emotions/js/emotions.js | 22 + .../tiny_mce/plugins/emotions/langs/en_dlg.js | 20 + .../tiny_mce/plugins/example/editor_plugin.js | 1 + .../plugins/example/editor_plugin_src.js | 81 + .../tiny_mce/plugins/example/js/dialog.js | 19 + .../tiny_mce/plugins/example/langs/en.js | 3 + .../tiny_mce/plugins/example/langs/en_dlg.js | 3 + .../plugins/fullpage/editor_plugin.js | 1 + .../plugins/fullpage/editor_plugin_src.js | 142 + .../tiny_mce/plugins/fullpage/js/fullpage.js | 461 + .../tiny_mce/plugins/fullpage/langs/en_dlg.js | 85 + .../plugins/fullscreen/editor_plugin.js | 1 + .../plugins/fullscreen/editor_plugin_src.js | 145 + .../tiny_mce/plugins/iespell/editor_plugin.js | 1 + .../plugins/iespell/editor_plugin_src.js | 51 + .../plugins/inlinepopups/editor_plugin.js | 1 + .../plugins/inlinepopups/editor_plugin_src.js | 632 + .../plugins/insertdatetime/editor_plugin.js | 1 + .../insertdatetime/editor_plugin_src.js | 80 + .../tiny_mce/plugins/layer/editor_plugin.js | 1 + .../plugins/layer/editor_plugin_src.js | 209 + .../tiny_mce/plugins/media/editor_plugin.js | 1 + .../plugins/media/editor_plugin_src.js | 400 + .../tiny_mce/plugins/media/js/embed.js | 73 + .../tiny_mce/plugins/media/js/media.js | 630 + .../tiny_mce/plugins/media/langs/en_dlg.js | 103 + .../plugins/nonbreaking/editor_plugin.js | 1 + .../plugins/nonbreaking/editor_plugin_src.js | 50 + .../plugins/noneditable/editor_plugin.js | 1 + .../plugins/noneditable/editor_plugin_src.js | 87 + .../plugins/pagebreak/editor_plugin.js | 1 + .../plugins/pagebreak/editor_plugin_src.js | 74 + .../tiny_mce/plugins/paste/editor_plugin.js | 1 + .../plugins/paste/editor_plugin_src.js | 394 + .../tiny_mce/plugins/paste/js/pastetext.js | 42 + .../tiny_mce/plugins/paste/js/pasteword.js | 56 + .../tiny_mce/plugins/paste/langs/en_dlg.js | 5 + .../tiny_mce/plugins/preview/editor_plugin.js | 1 + .../plugins/preview/editor_plugin_src.js | 50 + .../plugins/preview/jscripts/embed.js | 73 + .../tiny_mce/plugins/print/editor_plugin.js | 1 + .../plugins/print/editor_plugin_src.js | 31 + .../tiny_mce/plugins/safari/editor_plugin.js | 1 + .../plugins/safari/editor_plugin_src.js | 514 + .../tiny_mce/plugins/save/editor_plugin.js | 1 + .../plugins/save/editor_plugin_src.js | 98 + .../plugins/searchreplace/editor_plugin.js | 1 + .../searchreplace/editor_plugin_src.js | 54 + .../plugins/searchreplace/js/searchreplace.js | 126 + .../plugins/searchreplace/langs/en_dlg.js | 16 + .../plugins/spellchecker/editor_plugin.js | 1 + .../plugins/spellchecker/editor_plugin_src.js | 338 + .../tiny_mce/plugins/style/editor_plugin.js | 1 + .../plugins/style/editor_plugin_src.js | 52 + .../tiny_mce/plugins/style/js/props.js | 641 + .../tiny_mce/plugins/style/langs/en_dlg.js | 63 + .../tiny_mce/plugins/table/editor_plugin.js | 1 + .../plugins/table/editor_plugin_src.js | 1136 + .../tiny_mce/plugins/table/js/cell.js | 269 + .../tiny_mce/plugins/table/js/merge_cells.js | 29 + .../tiny_mce/plugins/table/js/row.js | 212 + .../tiny_mce/plugins/table/js/table.js | 413 + .../tiny_mce/plugins/table/langs/en_dlg.js | 74 + .../plugins/template/editor_plugin.js | 1 + .../plugins/template/editor_plugin_src.js | 156 + .../tiny_mce/plugins/template/js/template.js | 106 + .../tiny_mce/plugins/template/langs/en_dlg.js | 15 + .../plugins/visualchars/editor_plugin.js | 1 + .../plugins/visualchars/editor_plugin_src.js | 73 + .../plugins/xhtmlxtras/editor_plugin.js | 1 + .../plugins/xhtmlxtras/editor_plugin_src.js | 136 + .../tiny_mce/plugins/xhtmlxtras/js/abbr.js | 25 + .../tiny_mce/plugins/xhtmlxtras/js/acronym.js | 25 + .../plugins/xhtmlxtras/js/attributes.js | 123 + .../tiny_mce/plugins/xhtmlxtras/js/cite.js | 25 + .../tiny_mce/plugins/xhtmlxtras/js/del.js | 60 + .../plugins/xhtmlxtras/js/element_common.js | 231 + .../tiny_mce/plugins/xhtmlxtras/js/ins.js | 59 + .../plugins/xhtmlxtras/langs/en_dlg.js | 32 + .../themes/advanced/editor_template.js | 1 + .../themes/advanced/editor_template_src.js | 1153 + .../tiny_mce/themes/advanced/js/about.js | 72 + .../tiny_mce/themes/advanced/js/anchor.js | 37 + .../tiny_mce/themes/advanced/js/charmap.js | 325 + .../themes/advanced/js/color_picker.js | 253 + .../tiny_mce/themes/advanced/js/image.js | 245 + .../tiny_mce/themes/advanced/js/link.js | 155 + .../themes/advanced/js/source_editor.js | 62 + .../tiny_mce/themes/advanced/langs/en.js | 62 + .../tiny_mce/themes/advanced/langs/en_dlg.js | 51 + .../tiny_mce/themes/simple/editor_template.js | 1 + .../themes/simple/editor_template_src.js | 85 + .../tiny_mce/themes/simple/langs/en.js | 11 + include/javascript/tiny_mce/tiny_mce.js | 1 + include/javascript/tiny_mce/tiny_mce_popup.js | 294 + include/javascript/tiny_mce/tiny_mce_src.js | 11101 +++ .../tiny_mce/utils/editable_selects.js | 69 + .../javascript/tiny_mce/utils/form_utils.js | 199 + include/javascript/tiny_mce/utils/mctabs.js | 76 + include/javascript/tiny_mce/utils/validate.js | 219 + .../yui/build/animation/animation-min.js | 23 + .../yui/build/animation/animation.js | 1392 + .../build/autocomplete/autocomplete-min.js | 12 + .../yui/build/autocomplete/autocomplete.js | 2966 + .../javascript/yui/build/button/button-min.js | 11 + include/javascript/yui/build/button/button.js | 4633 ++ .../yui/build/calendar/calendar-min.js | 18 + .../javascript/yui/build/calendar/calendar.js | 7294 ++ .../yui/build/carousel/carousel-min.js | 12 + .../javascript/yui/build/carousel/carousel.js | 4349 ++ .../javascript/yui/build/charts/charts-min.js | 9 + include/javascript/yui/build/charts/charts.js | 2060 + .../yui/build/colorpicker/colorpicker-min.js | 9 + .../yui/build/colorpicker/colorpicker.js | 1763 + .../yui/build/connection/connection-min.js | 9 + .../yui/build/connection/connection.js | 1546 + .../build/connection/connection_core-debug.js | 980 + .../build/connection/connection_core-min.js | 8 + .../yui/build/connection/connection_core.js | 957 + .../yui/build/container/container-min.js | 19 + .../yui/build/container/container.js | 9052 +++ .../yui/build/container/container_core-min.js | 14 + .../javascript/yui/build/cookie/cookie-min.js | 7 + include/javascript/yui/build/cookie/cookie.js | 482 + .../yui/build/datasource/datasource-min.js | 12 + .../yui/build/datasource/datasource.js | 2996 + .../yui/build/datatable/datatable-min.js | 29 + .../yui/build/datatable/datatable.js | 17122 +++++ .../yui/build/datemath/datemath-debug.js | 408 + .../yui/build/datemath/datemath-min.js | 7 + .../javascript/yui/build/datemath/datemath.js | 408 + include/javascript/yui/build/dom/dom-min.js | 9 + include/javascript/yui/build/dom/dom.js | 1832 + .../yui/build/dragdrop/dragdrop-min.js | 10 + .../javascript/yui/build/dragdrop/dragdrop.js | 3601 + .../javascript/yui/build/editor/editor-min.js | 30 + include/javascript/yui/build/editor/editor.js | 9447 +++ .../yui/build/editor/simpleeditor-min.js | 24 + .../yui/build/editor/simpleeditor.js | 7406 ++ .../element-delegate-debug.js | 141 + .../element-delegate/element-delegate-min.js | 7 + .../element-delegate/element-delegate.js | 138 + .../yui/build/element/element-min.js | 8 + .../javascript/yui/build/element/element.js | 1090 + .../event-delegate/event-delegate-debug.js | 283 + .../event-delegate/event-delegate-min.js | 7 + .../build/event-delegate/event-delegate.js | 281 + .../event-mouseenter-debug.js | 219 + .../event-mouseenter/event-mouseenter-min.js | 7 + .../event-mouseenter/event-mouseenter.js | 219 + .../event-simulate/event-simulate-debug.js | 622 + .../event-simulate/event-simulate-min.js | 7 + .../build/event-simulate/event-simulate.js | 622 + .../javascript/yui/build/event/event-min.js | 11 + include/javascript/yui/build/event/event.js | 2500 + include/javascript/yui/build/get/get-min.js | 7 + include/javascript/yui/build/get/get.js | 755 + .../yui/build/history/history-min.js | 7 + .../javascript/yui/build/history/history.js | 803 + .../build/imagecropper/imagecropper-min.js | 8 + .../yui/build/imagecropper/imagecropper.js | 889 + .../yui/build/imageloader/imageloader-min.js | 7 + .../yui/build/imageloader/imageloader.js | 481 + include/javascript/yui/build/json/json-min.js | 7 + include/javascript/yui/build/json/json.js | 538 + .../javascript/yui/build/layout/layout-min.js | 11 + include/javascript/yui/build/layout/layout.js | 2290 + .../javascript/yui/build/logger/logger-min.js | 9 + include/javascript/yui/build/logger/logger.js | 2104 + include/javascript/yui/build/menu/menu-min.js | 16 + include/javascript/yui/build/menu/menu.js | 9823 +++ .../yui/build/paginator/paginator-min.js | 10 + .../yui/build/paginator/paginator.js | 2393 + .../yui/build/profiler/profiler-min.js | 7 + .../javascript/yui/build/profiler/profiler.js | 557 + .../profilerviewer/profilerviewer-min.js | 9 + .../build/profilerviewer/profilerviewer.js | 1192 + .../build/progressbar/progressbar-debug.js | 691 + .../yui/build/progressbar/progressbar-min.js | 8 + .../yui/build/progressbar/progressbar.js | 677 + .../javascript/yui/build/resize/resize-min.js | 10 + include/javascript/yui/build/resize/resize.js | 1689 + .../yui/build/selector/selector-min.js | 8 + .../javascript/yui/build/selector/selector.js | 644 + .../javascript/yui/build/slider/slider-min.js | 9 + include/javascript/yui/build/slider/slider.js | 2068 + .../yui/build/storage/storage-debug.js | 1185 + .../yui/build/storage/storage-min.js | 8 + .../javascript/yui/build/storage/storage.js | 1183 + .../yui/build/stylesheet/stylesheet-debug.js | 648 + .../yui/build/stylesheet/stylesheet-min.js | 7 + .../yui/build/stylesheet/stylesheet.js | 645 + include/javascript/yui/build/swf/swf-debug.js | 269 + include/javascript/yui/build/swf/swf-min.js | 7 + include/javascript/yui/build/swf/swf.js | 268 + .../yui/build/swfdetect/swfdetect-debug.js | 93 + .../yui/build/swfdetect/swfdetect-min.js | 7 + .../yui/build/swfdetect/swfdetect.js | 93 + include/javascript/yui/build/swfstore/swf.js | 238 + .../yui/build/swfstore/swfstore-debug.js | 470 + .../yui/build/swfstore/swfstore-min.js | 7 + .../javascript/yui/build/swfstore/swfstore.js | 453 + .../yui/build/tabview/tabview-min.js | 8 + .../javascript/yui/build/tabview/tabview.js | 987 + .../yui/build/treeview/treeview-min.js | 12 + .../javascript/yui/build/treeview/treeview.js | 3989 + .../yui/build/uploader/uploader-min.js | 15 + .../javascript/yui/build/uploader/uploader.js | 1069 + .../yui/build/utilities/utilities.js | 39 + .../build/yahoo-dom-event/yahoo-dom-event.js | 14 + .../javascript/yui/build/yahoo/yahoo-min.js | 7 + include/javascript/yui/build/yahoo/yahoo.js | 1075 + .../yuiloader-dom-event.js | 17 + .../yui/build/yuiloader/yuiloader-min.js | 10 + .../yui/build/yuiloader/yuiloader.js | 3879 + .../yui/build/yuitest/yuitest-min.js | 10 + .../javascript/yui/build/yuitest/yuitest.js | 2741 + .../yui/build/yuitest/yuitest_core-min.js | 9 + .../yui/build/yuitest/yuitest_core.js | 1976 + include/javascript/yui/ext/yui-ext.js | 13509 ++++ include/javascript/yui/ygDDList.js | 154 + .../yui3/assets/dpSyntaxHighlighter.js | 166 + include/javascript/yui3/assets/syntax.js | 3 + .../yui3/build/anim/anim-base-min.js | 8 + .../javascript/yui3/build/anim/anim-base.js | 25 + .../yui3/build/anim/anim-color-min.js | 8 + .../javascript/yui3/build/anim/anim-color.js | 9 + .../yui3/build/anim/anim-curve-min.js | 8 + .../javascript/yui3/build/anim/anim-curve.js | 10 + .../yui3/build/anim/anim-easing-min.js | 8 + .../javascript/yui3/build/anim/anim-easing.js | 33 + .../javascript/yui3/build/anim/anim-min.js | 8 + .../yui3/build/anim/anim-node-plugin-min.js | 8 + .../yui3/build/anim/anim-node-plugin.js | 8 + .../yui3/build/anim/anim-scroll-min.js | 8 + .../javascript/yui3/build/anim/anim-scroll.js | 10 + .../javascript/yui3/build/anim/anim-xy-min.js | 8 + include/javascript/yui3/build/anim/anim-xy.js | 8 + include/javascript/yui3/build/anim/anim.js | 55 + .../yui3/build/async-queue/async-queue-min.js | 8 + .../yui3/build/async-queue/async-queue.js | 19 + .../build/attribute/attribute-base-min.js | 8 + .../yui3/build/attribute/attribute-base.js | 37 + .../build/attribute/attribute-complex-min.js | 8 + .../yui3/build/attribute/attribute-complex.js | 11 + .../yui3/build/attribute/attribute-min.js | 8 + .../yui3/build/attribute/attribute.js | 40 + .../yui3/build/base/base-base-min.js | 8 + .../javascript/yui3/build/base/base-base.js | 24 + .../yui3/build/base/base-build-min.js | 8 + .../javascript/yui3/build/base/base-build.js | 19 + .../javascript/yui3/build/base/base-min.js | 8 + .../yui3/build/base/base-pluginhost-min.js | 8 + .../yui3/build/base/base-pluginhost.js | 8 + include/javascript/yui3/build/base/base.js | 35 + .../classnamemanager/classnamemanager-min.js | 8 + .../classnamemanager/classnamemanager.js | 9 + .../yui3/build/collection/collection-min.js | 8 + .../yui3/build/collection/collection.js | 14 + .../yui3/build/compat/compat-min.js | 8 + .../javascript/yui3/build/compat/compat.js | 45 + .../yui3/build/console/console-filters-min.js | 8 + .../yui3/build/console/console-filters.js | 19 + .../yui3/build/console/console-min.js | 8 + .../javascript/yui3/build/console/console.js | 28 + .../yui3/build/cookie/cookie-min.js | 8 + .../javascript/yui3/build/cookie/cookie.js | 28 + .../build/dataschema/dataschema-array-min.js | 8 + .../yui3/build/dataschema/dataschema-array.js | 15 + .../build/dataschema/dataschema-base-min.js | 8 + .../yui3/build/dataschema/dataschema-base.js | 10 + .../build/dataschema/dataschema-json-min.js | 8 + .../yui3/build/dataschema/dataschema-json.js | 30 + .../yui3/build/dataschema/dataschema-min.js | 8 + .../build/dataschema/dataschema-text-min.js | 8 + .../yui3/build/dataschema/dataschema-text.js | 14 + .../build/dataschema/dataschema-xml-min.js | 8 + .../yui3/build/dataschema/dataschema-xml.js | 18 + .../yui3/build/dataschema/dataschema.js | 55 + .../datasource/datasource-arrayschema-min.js | 8 + .../datasource/datasource-arrayschema.js | 9 + .../build/datasource/datasource-cache-min.js | 8 + .../yui3/build/datasource/datasource-cache.js | 8 + .../datasource/datasource-function-min.js | 8 + .../build/datasource/datasource-function.js | 11 + .../build/datasource/datasource-get-min.js | 8 + .../yui3/build/datasource/datasource-get.js | 10 + .../build/datasource/datasource-io-min.js | 8 + .../yui3/build/datasource/datasource-io.js | 10 + .../datasource/datasource-jsonschema-min.js | 8 + .../build/datasource/datasource-jsonschema.js | 9 + .../build/datasource/datasource-local-min.js | 8 + .../yui3/build/datasource/datasource-local.js | 10 + .../yui3/build/datasource/datasource-min.js | 8 + .../datasource/datasource-polling-min.js | 8 + .../build/datasource/datasource-polling.js | 8 + .../datasource/datasource-textschema-min.js | 8 + .../build/datasource/datasource-textschema.js | 9 + .../datasource/datasource-xmlschema-min.js | 8 + .../build/datasource/datasource-xmlschema.js | 9 + .../yui3/build/datasource/datasource.js | 21 + .../datatype/datatype-date-format-min.js | 8 + .../build/datatype/datatype-date-format.js | 22 + .../yui3/build/datatype/datatype-date-min.js | 8 + .../build/datatype/datatype-date-parse-min.js | 8 + .../build/datatype/datatype-date-parse.js | 11 + .../yui3/build/datatype/datatype-date.js | 25 + .../yui3/build/datatype/datatype-min.js | 8 + .../datatype/datatype-number-format-min.js | 8 + .../build/datatype/datatype-number-format.js | 14 + .../build/datatype/datatype-number-min.js | 8 + .../datatype/datatype-number-parse-min.js | 8 + .../build/datatype/datatype-number-parse.js | 9 + .../yui3/build/datatype/datatype-number.js | 15 + .../build/datatype/datatype-xml-format-min.js | 8 + .../build/datatype/datatype-xml-format.js | 10 + .../yui3/build/datatype/datatype-xml-min.js | 8 + .../build/datatype/datatype-xml-parse-min.js | 8 + .../yui3/build/datatype/datatype-xml-parse.js | 12 + .../yui3/build/datatype/datatype-xml.js | 14 + .../yui3/build/datatype/datatype.js | 38 + .../yui3/build/dd/dd-constrain-min.js | 8 + .../javascript/yui3/build/dd/dd-constrain.js | 29 + .../yui3/build/dd/dd-ddm-base-min.js | 8 + .../javascript/yui3/build/dd/dd-ddm-base.js | 15 + .../yui3/build/dd/dd-ddm-drop-min.js | 8 + .../javascript/yui3/build/dd/dd-ddm-drop.js | 13 + .../javascript/yui3/build/dd/dd-ddm-min.js | 8 + include/javascript/yui3/build/dd/dd-ddm.js | 11 + .../javascript/yui3/build/dd/dd-drag-min.js | 8 + include/javascript/yui3/build/dd/dd-drag.js | 35 + .../javascript/yui3/build/dd/dd-drop-min.js | 8 + .../yui3/build/dd/dd-drop-plugin-min.js | 8 + .../yui3/build/dd/dd-drop-plugin.js | 8 + include/javascript/yui3/build/dd/dd-drop.js | 24 + include/javascript/yui3/build/dd/dd-min.js | 8 + .../javascript/yui3/build/dd/dd-plugin-min.js | 8 + include/javascript/yui3/build/dd/dd-plugin.js | 8 + .../javascript/yui3/build/dd/dd-proxy-min.js | 8 + include/javascript/yui3/build/dd/dd-proxy.js | 16 + .../javascript/yui3/build/dd/dd-scroll-min.js | 8 + include/javascript/yui3/build/dd/dd-scroll.js | 20 + include/javascript/yui3/build/dd/dd.js | 107 + .../javascript/yui3/build/dom/dom-base-min.js | 8 + include/javascript/yui3/build/dom/dom-base.js | 40 + include/javascript/yui3/build/dom/dom-min.js | 8 + .../yui3/build/dom/dom-screen-min.js | 8 + .../javascript/yui3/build/dom/dom-screen.js | 30 + .../yui3/build/dom/dom-style-min.js | 8 + .../javascript/yui3/build/dom/dom-style.js | 36 + include/javascript/yui3/build/dom/dom.js | 130 + .../yui3/build/dom/selector-css2-min.js | 8 + .../yui3/build/dom/selector-css2.js | 34 + .../yui3/build/dom/selector-css3-min.js | 8 + .../yui3/build/dom/selector-css3.js | 12 + .../javascript/yui3/build/dom/selector-min.js | 8 + .../yui3/build/dom/selector-native-min.js | 8 + .../yui3/build/dom/selector-native.js | 22 + include/javascript/yui3/build/dom/selector.js | 48 + .../javascript/yui3/build/dump/dump-min.js | 8 + include/javascript/yui3/build/dump/dump.js | 16 + .../event-custom/event-custom-base-min.js | 8 + .../build/event-custom/event-custom-base.js | 54 + .../event-custom/event-custom-complex-min.js | 8 + .../event-custom/event-custom-complex.js | 22 + .../build/event-custom/event-custom-min.js | 8 + .../yui3/build/event-custom/event-custom.js | 68 + .../event-simulate/event-simulate-min.js | 8 + .../build/event-simulate/event-simulate.js | 42 + .../yui3/build/event/event-base-min.js | 8 + .../javascript/yui3/build/event/event-base.js | 54 + .../yui3/build/event/event-delegate-min.js | 8 + .../yui3/build/event/event-delegate.js | 21 + .../yui3/build/event/event-focus-min.js | 8 + .../yui3/build/event/event-focus.js | 8 + .../yui3/build/event/event-key-min.js | 8 + .../javascript/yui3/build/event/event-key.js | 11 + .../javascript/yui3/build/event/event-min.js | 8 + .../yui3/build/event/event-mouseenter-min.js | 8 + .../yui3/build/event/event-mouseenter.js | 10 + .../yui3/build/event/event-mousewheel-min.js | 8 + .../yui3/build/event/event-mousewheel.js | 10 + .../yui3/build/event/event-resize-min.js | 8 + .../yui3/build/event/event-resize.js | 10 + include/javascript/yui3/build/event/event.js | 76 + include/javascript/yui3/build/get/get-min.js | 8 + include/javascript/yui3/build/get/get.js | 33 + .../yui3/build/history/history-min.js | 8 + .../javascript/yui3/build/history/history.js | 39 + .../yui3/build/imageloader/imageloader-min.js | 8 + .../yui3/build/imageloader/imageloader.js | 33 + .../javascript/yui3/build/io/io-base-min.js | 8 + include/javascript/yui3/build/io/io-base.js | 56 + .../javascript/yui3/build/io/io-form-min.js | 8 + include/javascript/yui3/build/io/io-form.js | 13 + include/javascript/yui3/build/io/io-min.js | 8 + .../javascript/yui3/build/io/io-queue-min.js | 8 + include/javascript/yui3/build/io/io-queue.js | 15 + .../yui3/build/io/io-upload-iframe-min.js | 8 + .../yui3/build/io/io-upload-iframe.js | 26 + .../javascript/yui3/build/io/io-xdr-min.js | 8 + include/javascript/yui3/build/io/io-xdr.js | 20 + include/javascript/yui3/build/io/io.js | 98 + .../javascript/yui3/build/json/json-min.js | 8 + .../yui3/build/json/json-parse-min.js | 8 + .../javascript/yui3/build/json/json-parse.js | 10 + .../yui3/build/json/json-stringify-min.js | 8 + .../yui3/build/json/json-stringify.js | 31 + include/javascript/yui3/build/json/json.js | 33 + .../yui3/build/loader/loader-min.js | 8 + .../javascript/yui3/build/loader/loader.js | 72 + .../node-focusmanager-min.js | 8 + .../node-focusmanager/node-focusmanager.js | 47 + .../build/node-menunav/node-menunav-min.js | 8 + .../yui3/build/node-menunav/node-menunav.js | 74 + .../yui3/build/node/node-aria-min.js | 8 + .../javascript/yui3/build/node/node-aria.js | 9 + .../yui3/build/node/node-base-min.js | 8 + .../javascript/yui3/build/node/node-base.js | 54 + .../build/node/node-event-delegate-min.js | 8 + .../yui3/build/node/node-event-delegate.js | 8 + .../build/node/node-event-simulate-min.js | 8 + .../yui3/build/node/node-event-simulate.js | 8 + .../javascript/yui3/build/node/node-min.js | 8 + .../yui3/build/node/node-pluginhost-min.js | 8 + .../yui3/build/node/node-pluginhost.js | 8 + .../yui3/build/node/node-screen-min.js | 8 + .../javascript/yui3/build/node/node-screen.js | 11 + .../yui3/build/node/node-style-min.js | 8 + .../javascript/yui3/build/node/node-style.js | 8 + include/javascript/yui3/build/node/node.js | 57 + include/javascript/yui3/build/oop/oop-min.js | 8 + include/javascript/yui3/build/oop/oop.js | 20 + .../yui3/build/overlay/overlay-min.js | 8 + .../javascript/yui3/build/overlay/overlay.js | 8 + .../yui3/build/plugin/plugin-min.js | 8 + .../javascript/yui3/build/plugin/plugin.js | 11 + .../yui3/build/pluginhost/pluginhost-min.js | 8 + .../yui3/build/pluginhost/pluginhost.js | 19 + .../yui3/build/profiler/profiler-min.js | 8 + .../yui3/build/profiler/profiler.js | 18 + .../build/queue-promote/queue-promote-min.js | 8 + .../yui3/build/queue-promote/queue-promote.js | 8 + .../yui3/build/slider/slider-min.js | 8 + .../javascript/yui3/build/slider/slider.js | 23 + .../yui3/build/stylesheet/stylesheet-min.js | 8 + .../yui3/build/stylesheet/stylesheet.js | 36 + .../yui3/build/substitute/substitute-min.js | 8 + .../yui3/build/substitute/substitute.js | 16 + .../javascript/yui3/build/test/test-min.js | 8 + include/javascript/yui3/build/test/test.js | 62 + .../yui3/build/widget/widget-min.js | 8 + .../build/widget/widget-position-ext-min.js | 8 + .../yui3/build/widget/widget-position-ext.js | 15 + .../yui3/build/widget/widget-position-min.js | 8 + .../yui3/build/widget/widget-position.js | 9 + .../yui3/build/widget/widget-stack-min.js | 8 + .../yui3/build/widget/widget-stack.js | 12 + .../yui3/build/widget/widget-stdmod-min.js | 8 + .../yui3/build/widget/widget-stdmod.js | 21 + .../javascript/yui3/build/widget/widget.js | 36 + .../yui3/build/yui-base/yui-base-min.js | 8 + .../yui3/build/yui-base/yui-base.js | 65 + include/javascript/yui3/build/yui/get-min.js | 8 + include/javascript/yui3/build/yui/get.js | 33 + .../javascript/yui3/build/yui/yui-base-min.js | 8 + include/javascript/yui3/build/yui/yui-base.js | 62 + .../yui3/build/yui/yui-later-min.js | 8 + .../javascript/yui3/build/yui/yui-later.js | 10 + .../javascript/yui3/build/yui/yui-log-min.js | 8 + include/javascript/yui3/build/yui/yui-log.js | 12 + include/javascript/yui3/build/yui/yui-min.js | 8 + include/javascript/yui3/build/yui/yui.js | 93 + include/jsolait/init.js | 95 + include/jsolait/lib/codecs.js | 35 + include/jsolait/lib/crypto.js | 34 + include/jsolait/lib/jsonrpc.js | 71 + include/jsolait/lib/jsonrpclite.js | 71 + include/jsolait/lib/lang.js | 72 + include/jsolait/lib/langlite.js | 40 + include/jsolait/lib/urllib.js | 42 + include/jsolait/lib/xml.js | 34 + include/jsolait/lib/xmlrpc.js | 95 + include/jsolait/missingmixin.js | 43 + include/mailer/examples/scripts/XRegExp.js | 664 + .../mailer/examples/scripts/shAutoloader.js | 122 + include/mailer/examples/scripts/shBrushPhp.js | 72 + include/mailer/examples/scripts/shCore.js | 1 + include/mailer/examples/scripts/shLegacy.js | 141 + .../phpMailer2/examples/scripts/XRegExp.js | 664 + .../examples/scripts/shAutoloader.js | 122 + .../phpMailer2/examples/scripts/shBrushPhp.js | 72 + include/phpMailer2/examples/scripts/shCore.js | 1 + .../phpMailer2/examples/scripts/shLegacy.js | 140 + include/ytree/TreeView/HTMLNode.js | 6 + include/ytree/TreeView/MenuNode.js | 3 + include/ytree/TreeView/Node.js | 21 + include/ytree/TreeView/RootNode.js | 2 + include/ytree/TreeView/TaskNode.js | 28 + include/ytree/TreeView/TextNode.js | 9 + include/ytree/TreeView/TreeView.js | 79 + include/ytree/TreeView/anim/TVAnim.js | 2 + include/ytree/TreeView/anim/TVFadeIn.js | 2 + include/ytree/TreeView/anim/TVFadeOut.js | 2 + include/ytree/treeutil.js | 50 + install/dbConfig.js | 76 + install/installCommon.js | 47 + install/license.js | 61 + install/oc_convert.js | 40 + install/oc_install.js | 50 + install/register.js | 82 + install/siteConfig.js | 92 + jscalendar/calendar-setup_3.js | 45 + jscalendar/calendar.js | 181 + jscalendar/lang/calendar-af.js | 39 + jscalendar/lang/calendar-br.js | 45 + jscalendar/lang/calendar-ca.js | 45 + jscalendar/lang/calendar-cs-win.js | 34 + jscalendar/lang/calendar-da.js | 63 + jscalendar/lang/calendar-de.js | 101 + jscalendar/lang/calendar-du.js | 45 + jscalendar/lang/calendar-el.js | 89 + jscalendar/lang/calendar-en.js | 124 + jscalendar/lang/calendar-es.js | 130 + jscalendar/lang/calendar-fi.js | 98 + jscalendar/lang/calendar-fr.js | 122 + jscalendar/lang/calendar-hr-utf8.js | 49 + jscalendar/lang/calendar-hr.js | 49 + jscalendar/lang/calendar-hu.js | 45 + jscalendar/lang/calendar-it.js | 79 + jscalendar/lang/calendar-jp.js | 101 + jscalendar/lang/calendar-ko-utf8.js | 120 + jscalendar/lang/calendar-ko.js | 120 + jscalendar/lang/calendar-lt-utf8.js | 114 + jscalendar/lang/calendar-lt.js | 114 + jscalendar/lang/calendar-nl.js | 45 + jscalendar/lang/calendar-no.js | 45 + jscalendar/lang/calendar-pl-utf8.js | 93 + jscalendar/lang/calendar-pl.js | 97 + jscalendar/lang/calendar-pt.js | 45 + jscalendar/lang/calendar-ro.js | 66 + jscalendar/lang/calendar-ru.js | 45 + jscalendar/lang/calendar-si.js | 94 + jscalendar/lang/calendar-sk.js | 99 + jscalendar/lang/calendar-sp.js | 63 + jscalendar/lang/calendar-sv.js | 93 + jscalendar/lang/calendar-tr.js | 58 + jscalendar/lang/calendar-zh.js | 119 + jssource/src_files/include/JSON.js | 217 + .../include/MySugar/javascript/MySugar.js | 650 + .../include/SubPanel/SubPanelTiles.js | 715 + .../javascript/SugarDependentDropdown.js | 304 + .../SugarEmailAddress/SugarEmailAddress.js | 487 + .../Fields/Address/SugarFieldAddress.js | 101 + .../Fields/Collection/SugarFieldCollection.js | 589 + .../Fields/Datetimecombo/Datetimecombo.js | 229 + .../formatters/default/company_detail.js | 79 + .../src_files/include/javascript/cookie.js | 120 + .../src_files/include/javascript/dashlets.js | 81 + .../src_files/include/javascript/include.js | 301 + .../include/javascript/jsclass_async.js | 223 + .../include/javascript/jsclass_base.js | 774 + jssource/src_files/include/javascript/menu.js | 536 + .../include/javascript/overlibmws.js | 782 + .../include/javascript/overlibmws_iframe.js | 169 + .../include/javascript/popup_helper.js | 237 + .../include/javascript/popup_parent_helper.js | 209 + .../include/javascript/quickCompose.js | 290 + .../include/javascript/quicksearch.js | 248 + .../include/javascript/report_additionals.js | 2857 + .../src_files/include/javascript/sugar_3.js | 3821 + .../sugar_connection_event_listener.js | 48 + .../javascript/sugarwidgets/SugarYUILoader.js | 50 + .../sugarwidgets/SugarYUIWidgets.js | 676 + .../src_files/include/javascript/swfobject.js | 265 + .../yui3/assets/dpSyntaxHighlighter.js | 805 + .../include/javascript/yui3/assets/syntax.js | 56 + .../yui3/build/anim/anim-base-min.js | 8 + .../javascript/yui3/build/anim/anim-base.js | 602 + .../yui3/build/anim/anim-color-min.js | 8 + .../javascript/yui3/build/anim/anim-color.js | 55 + .../yui3/build/anim/anim-curve-min.js | 8 + .../javascript/yui3/build/anim/anim-curve.js | 64 + .../yui3/build/anim/anim-easing-min.js | 8 + .../javascript/yui3/build/anim/anim-easing.js | 355 + .../javascript/yui3/build/anim/anim-min.js | 9 + .../yui3/build/anim/anim-node-plugin-min.js | 8 + .../yui3/build/anim/anim-node-plugin.js | 33 + .../yui3/build/anim/anim-scroll-min.js | 8 + .../javascript/yui3/build/anim/anim-scroll.js | 45 + .../javascript/yui3/build/anim/anim-xy-min.js | 8 + .../javascript/yui3/build/anim/anim-xy.js | 33 + .../javascript/yui3/build/anim/anim.js | 1149 + .../yui3/build/async-queue/async-queue-min.js | 8 + .../yui3/build/async-queue/async-queue.js | 536 + .../build/attribute/attribute-base-min.js | 8 + .../yui3/build/attribute/attribute-base.js | 1064 + .../build/attribute/attribute-complex-min.js | 8 + .../yui3/build/attribute/attribute-complex.js | 120 + .../yui3/build/attribute/attribute-min.js | 9 + .../yui3/build/attribute/attribute.js | 1181 + .../yui3/build/base/base-base-min.js | 8 + .../javascript/yui3/build/base/base-base.js | 531 + .../yui3/build/base/base-build-min.js | 8 + .../javascript/yui3/build/base/base-build.js | 201 + .../javascript/yui3/build/base/base-min.js | 8 + .../yui3/build/base/base-pluginhost-min.js | 8 + .../yui3/build/base/base-pluginhost.js | 43 + .../javascript/yui3/build/base/base.js | 765 + .../classnamemanager/classnamemanager-min.js | 8 + .../classnamemanager/classnamemanager.js | 87 + .../yui3/build/collection/collection-min.js | 8 + .../yui3/build/collection/collection.js | 294 + .../yui3/build/compat/compat-min.js | 9 + .../javascript/yui3/build/compat/compat.js | 896 + .../yui3/build/console/console-filters-min.js | 8 + .../yui3/build/console/console-filters.js | 710 + .../yui3/build/console/console-min.js | 9 + .../javascript/yui3/build/console/console.js | 1478 + .../yui3/build/cookie/cookie-min.js | 8 + .../javascript/yui3/build/cookie/cookie.js | 491 + .../build/dataschema/dataschema-array-min.js | 8 + .../yui3/build/dataschema/dataschema-array.js | 107 + .../build/dataschema/dataschema-base-min.js | 8 + .../yui3/build/dataschema/dataschema-base.js | 73 + .../build/dataschema/dataschema-json-min.js | 8 + .../yui3/build/dataschema/dataschema-json.js | 294 + .../yui3/build/dataschema/dataschema-min.js | 8 + .../build/dataschema/dataschema-text-min.js | 8 + .../yui3/build/dataschema/dataschema-text.js | 116 + .../build/dataschema/dataschema-xml-min.js | 8 + .../yui3/build/dataschema/dataschema-xml.js | 164 + .../yui3/build/dataschema/dataschema.js | 735 + .../datasource/datasource-arrayschema-min.js | 8 + .../datasource/datasource-arrayschema.js | 113 + .../build/datasource/datasource-cache-min.js | 8 + .../yui3/build/datasource/datasource-cache.js | 136 + .../datasource/datasource-function-min.js | 8 + .../build/datasource/datasource-function.js | 115 + .../build/datasource/datasource-get-min.js | 8 + .../yui3/build/datasource/datasource-get.js | 226 + .../build/datasource/datasource-io-min.js | 8 + .../yui3/build/datasource/datasource-io.js | 154 + .../datasource/datasource-jsonschema-min.js | 8 + .../build/datasource/datasource-jsonschema.js | 113 + .../build/datasource/datasource-local-min.js | 8 + .../yui3/build/datasource/datasource-local.js | 336 + .../yui3/build/datasource/datasource-min.js | 9 + .../datasource/datasource-polling-min.js | 8 + .../build/datasource/datasource-polling.js | 93 + .../datasource/datasource-textschema-min.js | 8 + .../build/datasource/datasource-textschema.js | 113 + .../datasource/datasource-xmlschema-min.js | 8 + .../build/datasource/datasource-xmlschema.js | 113 + .../yui3/build/datasource/datasource.js | 1463 + .../datatype/datatype-date-format-min.js | 8 + .../build/datatype/datatype-date-format.js | 443 + .../yui3/build/datatype/datatype-date-min.js | 8 + .../build/datatype/datatype-date-parse-min.js | 8 + .../build/datatype/datatype-date-parse.js | 53 + .../yui3/build/datatype/datatype-date.js | 495 + .../yui3/build/datatype/datatype-min.js | 9 + .../datatype/datatype-number-format-min.js | 8 + .../build/datatype/datatype-number-format.js | 112 + .../build/datatype/datatype-number-min.js | 8 + .../datatype/datatype-number-parse-min.js | 8 + .../build/datatype/datatype-number-parse.js | 45 + .../yui3/build/datatype/datatype-number.js | 156 + .../build/datatype/datatype-xml-format-min.js | 8 + .../build/datatype/datatype-xml-format.js | 60 + .../yui3/build/datatype/datatype-xml-min.js | 8 + .../build/datatype/datatype-xml-parse-min.js | 8 + .../yui3/build/datatype/datatype-xml-parse.js | 62 + .../yui3/build/datatype/datatype-xml.js | 121 + .../yui3/build/datatype/datatype.js | 765 + .../yui3/build/dd/dd-constrain-min.js | 8 + .../javascript/yui3/build/dd/dd-constrain.js | 425 + .../yui3/build/dd/dd-ddm-base-min.js | 8 + .../javascript/yui3/build/dd/dd-ddm-base.js | 289 + .../yui3/build/dd/dd-ddm-drop-min.js | 8 + .../javascript/yui3/build/dd/dd-ddm-drop.js | 411 + .../javascript/yui3/build/dd/dd-ddm-min.js | 8 + .../javascript/yui3/build/dd/dd-ddm.js | 135 + .../javascript/yui3/build/dd/dd-drag-min.js | 9 + .../javascript/yui3/build/dd/dd-drag.js | 1100 + .../javascript/yui3/build/dd/dd-drop-min.js | 8 + .../yui3/build/dd/dd-drop-plugin-min.js | 8 + .../yui3/build/dd/dd-drop-plugin.js | 52 + .../javascript/yui3/build/dd/dd-drop.js | 485 + .../javascript/yui3/build/dd/dd-min.js | 12 + .../javascript/yui3/build/dd/dd-plugin-min.js | 8 + .../javascript/yui3/build/dd/dd-plugin.js | 53 + .../javascript/yui3/build/dd/dd-proxy-min.js | 8 + .../javascript/yui3/build/dd/dd-proxy.js | 225 + .../javascript/yui3/build/dd/dd-scroll-min.js | 8 + .../javascript/yui3/build/dd/dd-scroll.js | 413 + .../include/javascript/yui3/build/dd/dd.js | 3529 + .../javascript/yui3/build/dom/dom-base-min.js | 9 + .../javascript/yui3/build/dom/dom-base.js | 737 + .../javascript/yui3/build/dom/dom-min.js | 11 + .../yui3/build/dom/dom-screen-min.js | 8 + .../javascript/yui3/build/dom/dom-screen.js | 567 + .../yui3/build/dom/dom-style-min.js | 8 + .../javascript/yui3/build/dom/dom-style.js | 506 + .../include/javascript/yui3/build/dom/dom.js | 2466 + .../yui3/build/dom/selector-css2-min.js | 8 + .../yui3/build/dom/selector-css2.js | 449 + .../yui3/build/dom/selector-css3-min.js | 8 + .../yui3/build/dom/selector-css3.js | 151 + .../javascript/yui3/build/dom/selector-min.js | 9 + .../yui3/build/dom/selector-native-min.js | 8 + .../yui3/build/dom/selector-native.js | 227 + .../javascript/yui3/build/dom/selector.js | 673 + .../javascript/yui3/build/dump/dump-min.js | 8 + .../javascript/yui3/build/dump/dump.js | 119 + .../event-custom/event-custom-base-min.js | 9 + .../build/event-custom/event-custom-base.js | 1722 + .../event-custom/event-custom-complex-min.js | 8 + .../event-custom/event-custom-complex.js | 363 + .../build/event-custom/event-custom-min.js | 10 + .../yui3/build/event-custom/event-custom.js | 2082 + .../event-simulate/event-simulate-min.js | 8 + .../build/event-simulate/event-simulate.js | 490 + .../yui3/build/event/event-base-min.js | 11 + .../javascript/yui3/build/event/event-base.js | 1378 + .../yui3/build/event/event-delegate-min.js | 8 + .../yui3/build/event/event-delegate.js | 365 + .../yui3/build/event/event-focus-min.js | 8 + .../yui3/build/event/event-focus.js | 90 + .../yui3/build/event/event-key-min.js | 8 + .../javascript/yui3/build/event/event-key.js | 106 + .../javascript/yui3/build/event/event-min.js | 12 + .../yui3/build/event/event-mouseenter-min.js | 8 + .../yui3/build/event/event-mouseenter.js | 191 + .../yui3/build/event/event-mousewheel-min.js | 8 + .../yui3/build/event/event-mousewheel.js | 57 + .../yui3/build/event/event-resize-min.js | 8 + .../yui3/build/event/event-resize.js | 71 + .../javascript/yui3/build/event/event.js | 2220 + .../javascript/yui3/build/get/get-min.js | 8 + .../include/javascript/yui3/build/get/get.js | 734 + .../yui3/build/history/history-min.js | 8 + .../javascript/yui3/build/history/history.js | 680 + .../yui3/build/imageloader/imageloader-min.js | 8 + .../yui3/build/imageloader/imageloader.js | 623 + .../javascript/yui3/build/io/io-base-min.js | 8 + .../javascript/yui3/build/io/io-base.js | 743 + .../javascript/yui3/build/io/io-form-min.js | 8 + .../javascript/yui3/build/io/io-form.js | 101 + .../javascript/yui3/build/io/io-min.js | 9 + .../javascript/yui3/build/io/io-queue-min.js | 8 + .../javascript/yui3/build/io/io-queue.js | 222 + .../yui3/build/io/io-upload-iframe-min.js | 8 + .../yui3/build/io/io-upload-iframe.js | 283 + .../javascript/yui3/build/io/io-xdr-min.js | 8 + .../javascript/yui3/build/io/io-xdr.js | 291 + .../include/javascript/yui3/build/io/io.js | 1621 + .../javascript/yui3/build/json/json-min.js | 8 + .../yui3/build/json/json-parse-min.js | 8 + .../javascript/yui3/build/json/json-parse.js | 214 + .../yui3/build/json/json-stringify-min.js | 8 + .../yui3/build/json/json-stringify.js | 285 + .../javascript/yui3/build/json/json.js | 496 + .../yui3/build/loader/loader-min.js | 10 + .../javascript/yui3/build/loader/loader.js | 2129 + .../node-focusmanager-min.js | 8 + .../node-focusmanager/node-focusmanager.js | 1060 + .../build/node-menunav/node-menunav-min.js | 10 + .../yui3/build/node-menunav/node-menunav.js | 2165 + .../yui3/build/node/node-aria-min.js | 8 + .../javascript/yui3/build/node/node-aria.js | 32 + .../yui3/build/node/node-base-min.js | 9 + .../javascript/yui3/build/node/node-base.js | 1560 + .../build/node/node-event-delegate-min.js | 8 + .../yui3/build/node/node-event-delegate.js | 35 + .../build/node/node-event-simulate-min.js | 8 + .../yui3/build/node/node-event-simulate.js | 31 + .../javascript/yui3/build/node/node-min.js | 10 + .../yui3/build/node/node-pluginhost-min.js | 8 + .../yui3/build/node/node-pluginhost.js | 61 + .../yui3/build/node/node-screen-min.js | 8 + .../javascript/yui3/build/node/node-screen.js | 227 + .../yui3/build/node/node-style-min.js | 8 + .../javascript/yui3/build/node/node-style.js | 90 + .../javascript/yui3/build/node/node.js | 1949 + .../javascript/yui3/build/oop/oop-min.js | 8 + .../include/javascript/yui3/build/oop/oop.js | 367 + .../yui3/build/overlay/overlay-min.js | 8 + .../javascript/yui3/build/overlay/overlay.js | 36 + .../yui3/build/plugin/plugin-min.js | 8 + .../javascript/yui3/build/plugin/plugin.js | 170 + .../yui3/build/pluginhost/pluginhost-min.js | 8 + .../yui3/build/pluginhost/pluginhost.js | 296 + .../yui3/build/profiler/profiler-min.js | 8 + .../yui3/build/profiler/profiler.js | 555 + .../build/queue-promote/queue-promote-min.js | 8 + .../yui3/build/queue-promote/queue-promote.js | 60 + .../yui3/build/slider/slider-min.js | 9 + .../javascript/yui3/build/slider/slider.js | 1472 + .../yui3/build/stylesheet/stylesheet-min.js | 8 + .../yui3/build/stylesheet/stylesheet.js | 633 + .../yui3/build/substitute/substitute-min.js | 8 + .../yui3/build/substitute/substitute.js | 139 + .../javascript/yui3/build/test/test-min.js | 12 + .../javascript/yui3/build/test/test.js | 2796 + .../yui3/build/widget/widget-min.js | 9 + .../build/widget/widget-position-ext-min.js | 8 + .../yui3/build/widget/widget-position-ext.js | 407 + .../yui3/build/widget/widget-position-min.js | 8 + .../yui3/build/widget/widget-position.js | 272 + .../yui3/build/widget/widget-stack-min.js | 8 + .../yui3/build/widget/widget-stack.js | 403 + .../yui3/build/widget/widget-stdmod-min.js | 8 + .../yui3/build/widget/widget-stdmod.js | 755 + .../javascript/yui3/build/widget/widget.js | 1329 + .../yui3/build/yui-base/yui-base-min.js | 9 + .../yui3/build/yui-base/yui-base.js | 2136 + .../javascript/yui3/build/yui/get-min.js | 8 + .../include/javascript/yui3/build/yui/get.js | 734 + .../javascript/yui3/build/yui/yui-base-min.js | 9 + .../javascript/yui3/build/yui/yui-base.js | 2149 + .../yui3/build/yui/yui-later-min.js | 8 + .../javascript/yui3/build/yui/yui-later.js | 76 + .../javascript/yui3/build/yui/yui-log-min.js | 8 + .../javascript/yui3/build/yui/yui-log.js | 114 + .../javascript/yui3/build/yui/yui-min.js | 10 + .../include/javascript/yui3/build/yui/yui.js | 3056 + jssource/src_files/include/jsolait/init.js | 729 + .../src_files/include/jsolait/lib/codecs.js | 168 + .../src_files/include/jsolait/lib/crypto.js | 149 + .../src_files/include/jsolait/lib/jsonrpc.js | 401 + .../include/jsolait/lib/jsonrpclite.js | 406 + .../src_files/include/jsolait/lib/lang.js | 485 + .../src_files/include/jsolait/lib/langlite.js | 138 + .../src_files/include/jsolait/lib/urllib.js | 312 + jssource/src_files/include/jsolait/lib/xml.js | 247 + .../src_files/include/jsolait/lib/xmlrpc.js | 831 + .../src_files/include/jsolait/missingmixin.js | 151 + .../include/ytree/TreeView/HTMLNode.js | 114 + .../include/ytree/TreeView/MenuNode.js | 24 + .../src_files/include/ytree/TreeView/Node.js | 659 + .../include/ytree/TreeView/RootNode.js | 30 + .../include/ytree/TreeView/TaskNode.js | 276 + .../include/ytree/TreeView/TextNode.js | 135 + .../include/ytree/TreeView/TreeView.js | 2195 + .../include/ytree/TreeView/anim/TVAnim.js | 49 + .../include/ytree/TreeView/anim/TVFadeIn.js | 62 + .../include/ytree/TreeView/anim/TVFadeOut.js | 59 + jssource/src_files/include/ytree/treeutil.js | 187 + jssource/src_files/install/dbConfig.js | 76 + jssource/src_files/install/installCommon.js | 47 + jssource/src_files/install/license.js | 61 + jssource/src_files/install/oc_convert.js | 40 + jssource/src_files/install/oc_install.js | 50 + jssource/src_files/install/register.js | 82 + jssource/src_files/install/siteConfig.js | 92 + .../src_files/jscalendar/calendar-setup_3.js | 212 + jssource/src_files/jscalendar/calendar.js | 1744 + .../src_files/modules/ACLRoles/ACLRoles.js | 91 + .../src_files/modules/Accounts/Account.js | 89 + .../javascript/Administration.js | 135 + .../Administration/javascript/Async.js | 118 + .../src_files/modules/Campaigns/DetailView.js | 62 + .../src_files/modules/Campaigns/WebToLead.js | 225 + .../src_files/modules/Campaigns/wizard.js | 290 + .../src_files/modules/Connectors/Connector.js | 121 + .../src_files/modules/Contacts/Contact.js | 191 + .../src_files/modules/Currencies/EditView.js | 54 + .../src_files/modules/Documents/documents.js | 126 + .../modules/EmailTemplates/EmailTemplate.js | 163 + jssource/src_files/modules/Home/about.js | 64 + .../modules/InboundEmail/InboundEmail.js | 345 + jssource/src_files/modules/Leads/Lead.js | 107 + .../modules/Meetings/jsclass_scheduler.js | 618 + .../src_files/modules/MergeRecords/Merge.js | 403 + jssource/src_files/modules/Project/Project.js | 96 + .../modules/ProjectTask/ProjectTask.js | 65 + .../src_files/modules/Studio/JSTransaction.js | 78 + jssource/src_files/modules/Studio/studio.js | 548 + jssource/src_files/modules/Studio/studiodd.js | 218 + .../modules/Studio/studiotabgroups.js | 141 + .../modules/Studio/ygDDListStudio.js | 239 + .../modules/UpgradeWizard/upgradeWizard.js | 136 + .../src_files/modules/Users/DetailView.js | 132 + .../modules/Users/PasswordRequirementBox.js | 187 + jssource/src_files/modules/Users/User.js | 215 + jssource/src_files/modules/Users/login.js | 87 + jssource/src_files/service/utils/SugarRest.js | 243 + jssource/src_files/themes/Sugar5/js/style.js | 67 + jssource/src_files/themes/default/js/style.js | 44 + mailer/examples/scripts/XRegExp.js | 664 + mailer/examples/scripts/shAutoloader.js | 122 + mailer/examples/scripts/shBrushPhp.js | 72 + mailer/examples/scripts/shCore.js | 1 + mailer/examples/scripts/shLegacy.js | 141 + modules/ACLRoles/ACLRoles.js | 36 + modules/Accounts/Account.js | 98 + modules/Accounts/Addresses.js | 318 + modules/Accounts/Banks.js | 248 + modules/Accounts/Categories.js | 192 + modules/Accounts/Discounts.js | 224 + modules/Accounts/MailingGroups.js | 322 + modules/Accounts/MyTable.js | 2308 + modules/Accounts/Websites.js | 47 + modules/Accounts/jquery.min.js | 4 + modules/Accounts/jquery_ui.js | 13 + modules/Accounts/js/SalesChart.js | 57 + modules/Accounts/js/States.js | 29 + modules/Accounts/js/Telephones.js | 47 + modules/Accounts/js/Websites.js | 47 + modules/Accounts/js/showMap.js | 43 + modules/Accounts/paramsMT.js | 448 + .../javascript/Administration.js | 39 + modules/Administration/javascript/Async.js | 37 + modules/Campaigns/DetailView.js | 41 + modules/Campaigns/WebToLead.js | 63 + modules/Campaigns/wizard.js | 56 + modules/Connectors/Connector.js | 56 + modules/Contacts/Contact.js | 61 + modules/Contacts/js/States.js | 29 + modules/Currencies/EditView.js | 38 + modules/Documents/Categories.js | 198 + modules/Documents/documents.js | 48 + modules/Documents/js/Bim-it6.js | 1649 + modules/Documents/js/Documents13.js | 152 + modules/Documents/paramsMT.js | 448 + modules/Documents3/Categories.js | 198 + modules/Documents3/documents.js | 48 + modules/Documents3/js/Bim-it.js | 1482 + .../Documents3/js/DetailViewDocumentReady.js | 13 + modules/Documents3/js/Documents.js | 345 + modules/Documents3/js/EditViewTimeTable.js | 81 + modules/Documents3/paramsMT.js | 448 + .../EcmActions/js/DetailViewDocumentReady.js | 25 + .../EcmActions/js/EditViewDocumentReady.js | 375 + .../EcmActions/js/ListViewDocumentReady.js | 0 .../javascript/AgreementTemplates.js | 454 + .../EcmAgreements/javascript/EcmAgreements.js | 100 + .../javascript/EcmAgreementsDetail.js | 8 + .../javascript/EditViewPDFTemplate.js | 105 + .../EcmAgreements/javascript/bimit_table.js | 1761 + .../javascript/columndefs-detail.js | 71 + .../EcmAgreements/javascript/columndefs.js | 71 + modules/EcmCalendars/Calendar.js | 62 + modules/EcmCalendars/helper.js | 181 + modules/EcmCalls/DoCall.js | 31 + modules/EcmCalls/Hint.js | 257 + modules/EcmCalls/ListView.js | 184 + modules/EcmCalls/MyTable.js | 367 + modules/EcmCalls/Settings.js | 186 + modules/EcmCalls/SubPanel.js | 104 + modules/EcmCalls/anMenu/anMenu.js | 1 + modules/EcmCalls/formloader.js | 164 + .../2.6.0/build/container/container-debug.js | 8861 +++ .../2.6.0/build/container/container-min.js | 19 + .../yui/2.6.0/build/container/container.js | 8837 +++ .../build/container/container_core-debug.js | 5059 ++ .../build/container/container_core-min.js | 13 + .../2.6.0/build/container/container_core.js | 5049 ++ .../yui/2.6.0/build/menu/menu-debug.js | 9667 +++ .../EcmCalls/yui/2.6.0/build/menu/menu-min.js | 15 + modules/EcmCalls/yui/2.6.0/build/menu/menu.js | 9619 +++ .../build/yahoo-dom-event/yahoo-dom-event.js | 12 + modules/EcmDesigns/Categories.js | 200 + modules/EcmDesigns/MyTable.js | 2308 + modules/EcmDesigns/paramsMT.js | 448 + modules/EcmDevices/Email.js | 1018 + modules/EcmDevices/advajax.js | 480 + modules/EcmDevices/moo1.2.js | 5308 ++ modules/EcmDocs/ListFunctions.js | 52 + modules/EcmDocs/formloader.js | 164 + modules/EcmDocs/helper.js | 164 + modules/EcmDocs/mintajax.js | 2 + .../EcmDocumentTemplates.js | 76 + modules/EcmDocumentTemplates/formloader.js | 82 + modules/EcmDocuments/advajax.js | 480 + modules/EcmDocuments/dimensions.js | 655 + modules/EcmDocuments/dragresize.js | 14 + modules/EcmDocuments/dragresize_commented.js | 352 + modules/EcmDocuments/j123.drag.js | 70 + .../EcmDocuments/j123.drag.sortablelist.js | 79 + modules/EcmDocuments/j123.events.js | 63 + modules/EcmDocuments/j123.js | 129 + modules/EcmDocuments/jqDnR.js | 32 + modules/EcmDocuments/jquery.js | 32 + modules/EcmDocuments/mintajax.js | 2 + modules/EcmEmails/Email.js | 1013 + modules/EcmFkBooks/fkbooks.js | 48 + modules/EcmFkPackages/EcmFkPackages.js | 840 + .../EcmFkPackages/EcmFkPackagesDetailView.js | 1320 + .../EcmFkPackages/EcmFkPackagesEditView.js | 1669 + modules/EcmFkPackages/MyTable.js | 2419 + modules/EcmFkPackages/_EcmFkPackages.js | 1924 + modules/EcmFkPackages/fkpackages.js | 48 + modules/EcmFkPackages/formloader.js | 164 + modules/EcmFkVatKinds/EcmFkVatKinds.js | 1107 + .../EcmFkVatKinds/EcmFkVatKindsDetailView.js | 985 + .../EcmFkVatKinds/EcmFkVatKindsEditView.js | 1293 + modules/EcmFkVatKinds/MyTable.js | 2434 + modules/EcmFkVatKinds/fkbooks.js | 48 + .../EcmFkVatRegisters/EcmFkVatRegisters.js | 779 + .../EcmFkVatRegistersDetailView.js | 3357 + .../EcmFkVatRegistersEditView.js | 3952 + .../EcmFkVatRegistersListView.js | 135 + modules/EcmFkVatRegisters/MyTable.js | 2446 + .../Copy of EcmFkVatRegistersDetailView.js | 1993 + .../backup/_EcmFkVatRegistersEditView.js | 818 + .../backup/__EcmFkVatRegistersEditView.js | 1688 + .../backup/___EcmFkVatRegistersEditView.js | 816 + .../backup/____EcmFkVatRegistersEditView.js | 1603 + modules/EcmFkVatRegisters/fkbooks.js | 112 + modules/EcmFkVatRegisters/report.js | 190 + modules/EcmFkVatTables/EcmFkVatRegisters.js | 882 + .../EcmFkVatRegistersDetailView.js | 1079 + .../EcmFkVatRegistersEditView.js | 1077 + modules/EcmFkVatTables/MyTable.js | 2434 + .../_EcmFkVatRegistersEditView.js | 818 + .../__EcmFkVatRegistersEditView.js | 1688 + .../___EcmFkVatRegistersEditView.js | 816 + .../____EcmFkVatRegistersEditView.js | 1603 + modules/EcmFkVatTables/fkbooks.js | 48 + modules/EcmFkVats/EcmFkVats.js | 852 + modules/EcmFkVats/EcmFkVatsDetailView.js | 2 + modules/EcmFkVats/EcmFkVatsEditView.js | 31 + modules/EcmFkVats/fkbooks.js | 48 + .../AjaxSearch/AjaxSearch.js | 409 + modules/EcmInsideOrders.cp/CreateItem.js | 9 + modules/EcmInsideOrders.cp/EcmInsideOrders.js | 1307 + .../EcmInsideOrdersDetailView.js | 773 + modules/EcmInsideOrders.cp/Email.js | 1018 + modules/EcmInsideOrders.cp/ListView.js | 78 + modules/EcmInsideOrders.cp/MyTable.js | 2297 + modules/EcmInsideOrders.cp/PDFLanguages.js | 361 + modules/EcmInsideOrders.cp/PDFLanguagesMT.js | 371 + modules/EcmInsideOrders.cp/formloader.js | 164 + .../javascript/EcmInsideOrders.js | 124 + .../javascript/EcmInsideOrdersDetail.js | 7 + .../javascript/EcmStockDocMoves.js | 89 + .../javascript/EcmStockDocMovesDetail.js | 7 + .../EcmInsideOrders/javascript/bimit_table.js | 823 + .../javascript/columndefs-detail.js | 54 + .../EcmInsideOrders/javascript/columndefs.js | 73 + modules/EcmInsideOrders/javascript/helper.js | 117 + .../EcmInventorys/javascript/EcmInventorys.js | 926 + .../javascript/EcmInventorysDetail.js | 395 + .../javascript/searchcolumndefs.js | 4 + .../ecommerceInvoicesListView.js | 83 + .../lib/encoding-indexes.js | 47 + .../BimIT-eCommerceInvoices/lib/encoding.js | 3313 + .../lib/jquery.blockUI.js | 619 + .../BimIT-eCommerceInvoices/lib/jquery.js | 4 + .../lib/select2-3.4.6/select2.min.js | 22 + .../js/extras/jquery.dragtable.mod.min.js | 6 + .../dist/js/extras/jquery.metadata.min.js | 3 + .../js/extras/jquery.tablesorter.pager.min.js | 7 + .../dist/js/extras/semver-mod.min.js | 2 + .../dist/js/jquery.tablesorter.combined.js | 6093 ++ .../js/jquery.tablesorter.combined.min.js | 4 + .../dist/js/jquery.tablesorter.js | 2916 + .../dist/js/jquery.tablesorter.min.js | 1 + .../dist/js/jquery.tablesorter.widgets.js | 3178 + .../dist/js/jquery.tablesorter.widgets.min.js | 4 + .../js/parsers/parser-date-extract.min.js | 11 + .../js/parsers/parser-date-iso8601.min.js | 4 + .../dist/js/parsers/parser-date-month.min.js | 4 + .../dist/js/parsers/parser-date-range.min.js | 11 + .../parsers/parser-date-two-digit-year.min.js | 4 + .../js/parsers/parser-date-weekday.min.js | 4 + .../dist/js/parsers/parser-date.min.js | 7 + .../dist/js/parsers/parser-duration.min.js | 6 + .../parsers/parser-feet-inch-fraction.min.js | 4 + .../dist/js/parsers/parser-file-type.min.js | 4 + .../dist/js/parsers/parser-globalize.min.js | 7 + .../js/parsers/parser-huge-numbers.min.js | 4 + .../js/parsers/parser-ignore-articles.min.js | 4 + .../dist/js/parsers/parser-image.min.js | 4 + .../js/parsers/parser-input-select.min.js | 4 + .../js/parsers/parser-leading-zeros.min.js | 4 + .../dist/js/parsers/parser-metric.min.js | 4 + .../js/parsers/parser-named-numbers.min.js | 4 + .../dist/js/parsers/parser-network.min.js | 9 + .../dist/js/parsers/parser-roman.min.js | 4 + .../dist/js/widgets/widget-alignChar.min.js | 4 + .../dist/js/widgets/widget-build-table.min.js | 4 + .../dist/js/widgets/widget-chart.min.js | 3 + .../js/widgets/widget-columnSelector.min.js | 3 + .../dist/js/widgets/widget-columns.min.js | 4 + .../js/widgets/widget-cssStickyHeaders.min.js | 4 + .../dist/js/widgets/widget-currentSort.min.js | 4 + .../dist/js/widgets/widget-editable.min.js | 4 + .../widget-filter-formatter-html5.min.js | 4 + .../widget-filter-formatter-jui.min.js | 4 + .../widget-filter-formatter-select2.min.js | 4 + .../widget-filter-type-insideRange.min.js | 4 + .../dist/js/widgets/widget-filter.min.js | 4 + .../dist/js/widgets/widget-formatter.min.js | 4 + .../dist/js/widgets/widget-grouping.min.js | 4 + .../js/widgets/widget-headerTitles.min.js | 4 + .../dist/js/widgets/widget-lazyload.min.js | 19 + .../dist/js/widgets/widget-mark.min.js | 4 + .../dist/js/widgets/widget-math.min.js | 4 + .../dist/js/widgets/widget-output.min.js | 4 + .../dist/js/widgets/widget-pager.min.js | 4 + .../dist/js/widgets/widget-print.min.js | 3 + .../dist/js/widgets/widget-reflow.min.js | 3 + .../js/widgets/widget-repeatheaders.min.js | 4 + .../dist/js/widgets/widget-resizable.min.js | 4 + .../dist/js/widgets/widget-saveSort.min.js | 4 + .../dist/js/widgets/widget-scroller.min.js | 4 + .../dist/js/widgets/widget-sort2Hash.min.js | 4 + .../dist/js/widgets/widget-sortTbodies.min.js | 8 + .../dist/js/widgets/widget-staticRow.min.js | 4 + .../js/widgets/widget-stickyHeaders.min.js | 4 + .../dist/js/widgets/widget-storage.min.js | 4 + .../dist/js/widgets/widget-toggle.min.js | 7 + .../dist/js/widgets/widget-uitheme.min.js | 4 + .../js/widgets/widget-vertical-group.min.js | 4 + .../dist/js/widgets/widget-view.min.js | 3 + .../EcmInvoiceOuts/javascript/Consignments.js | 265 + .../javascript/EcmInvoiceOuts4.js | 327 + .../javascript/EcmInvoiceOutsDetail.js | 6 + .../EcmInvoiceOuts/javascript/bimit_table8.js | 1684 + .../javascript/columndefs-detail.js | 118 + .../EcmInvoiceOuts/javascript/columndefs.js | 159 + .../javascript/searchcolumndefs.js | 4 + .../javascript/EcmInvoiceOuts.js | 148 + .../javascript/EcmInvoiceOutsDetail.js | 7 + .../EcmInvoiceOuts2/javascript/bimit_table.js | 1276 + .../javascript/columndefs-detail.js | 125 + .../EcmInvoiceOuts2/javascript/columndefs.js | 138 + modules/EcmKpkw/AjaxSearch/AjaxSearch.js | 402 + modules/EcmKpkw/EcmKpkw.js | 921 + modules/EcmKpkw/EcmKpkwDetailView.js | 784 + modules/EcmKpkw/EcmKpkw_copy2.js | 839 + modules/EcmKpkw/EcmKpkw_pdf.js | 784 + modules/EcmKpkw/MyTable.js | 2317 + modules/EcmKpkw/copy_EcmKpkw.js | 2046 + modules/EcmKpkw/formloader.js | 164 + modules/EcmMailingMessages/ContactGroups.js | 305 + modules/EcmMailingMessages/MailingGroups.js | 305 + .../javascript/EcmNewInvoiceOuts.js | 135 + .../javascript/EcmNewInvoiceOutsDetail.js | 7 + .../javascript/bimit_table.js | 1158 + .../javascript/columndefs-detail.js | 125 + .../javascript/columndefs.js | 138 + .../EcmNewKpkws/javascript/EcmNewKpkws2.js | 138 + .../javascript/EcmNewKpkwsDetail.js | 6 + .../EcmNewKpkws/javascript/bimit_table2.js | 332 + .../javascript/columndefs-detail.js | 72 + modules/EcmNewKpkws/javascript/columndefs.js | 89 + modules/EcmNoteOuts/javascript/EcmNoteOuts.js | 168 + .../javascript/EcmNoteOutsDetail.js | 7 + modules/EcmNoteOuts/javascript/bimit_table.js | 1428 + .../javascript/columndefs-detail.js | 73 + modules/EcmNoteOuts/javascript/columndefs.js | 94 + .../javascript/searchcolumndefs.js | 4 + .../javascript/AccountPaymentStates2.js | 826 + .../javascript/interestEditView.js | 37 + .../javascript/interestLogic.js | 269 + .../EcmPaymentStates/javascript/multiMatch.js | 58 + .../EcmPaymentStates/javascript/summary.js | 113 + .../EcmPaymentStates/jquery/jquery-1.9.1.js | 9597 +++ modules/EcmPaymentStates/jquery/jquery-ui.js | 15008 ++++ .../javascript/EcmPrepaymentInvoices.js | 180 + .../javascript/EcmPrepaymentInvoicesDetail.js | 8 + .../javascript/ListNewSales.js | 150 + .../javascript/ProductSummary.js | 171 + .../javascript/bimit_table.js | 1105 + .../javascript/columndefs-detail.js | 106 + .../javascript/columndefs.js | 116 + .../javascript/searchcolumndefs.js | 4 + .../javascript/tablenavigator.js | 69 + .../EcmPrepaymentInvoices.js | 417 + .../EcmPrepaymentInvoicesDetailView.js | 154 + .../EcmPrepaymentInvoices.js | 417 + .../EcmPrepaymentInvoicesDetailView.js | 154 + modules/EcmPriceBooks/Email.js | 1018 + modules/EcmPriceBooks/advajax.js | 480 + modules/EcmPriceBooks/mintajax.js | 2 + modules/EcmPriceBooks/moo1.2.js | 5308 ++ modules/EcmPriceBooks2/Email.js | 1018 + modules/EcmPriceBooks2/advajax.js | 480 + modules/EcmPriceBooks2/mintajax.js | 2 + modules/EcmPriceBooks2/moo1.2.js | 5308 ++ modules/EcmPrices/Email.js | 1018 + modules/EcmPrices/advajax.js | 480 + modules/EcmPrices/mintajax.js | 2 + modules/EcmPrices/moo1.2.js | 5308 ++ modules/EcmPrivateDocuments/js/js.js | 3 + .../EcmProductB2Bs/AjaxSearch/AjaxSearch.js | 402 + modules/EcmProductB2Bs/Categories.js | 202 + modules/EcmProductB2Bs/Menu/ecmproducts.js | 98 + modules/EcmProductB2Bs/Menu/xaramenu.js | 1 + modules/EcmProductB2Bs/Prices.js | 172 + modules/EcmProductB2Bs/helper.js | 235 + .../javascript/EcmProductB2B.js | 1398 + .../javascript/EcmProductB2BDetailView.js | 1478 + modules/EcmProductB2Bs/javascript/MyTable.js | 2330 + .../EcmProductB2Bs/javascript/formloader.js | 164 + modules/EcmProductB2Bs/mintajax.js | 2 + modules/EcmProductB2Bs/paramsMT.js | 374 + modules/EcmProducts/AjaxSearch/AjaxSearch.js | 402 + modules/EcmProducts/Categories.js | 205 + modules/EcmProducts/Menu/ecmproducts.js | 98 + modules/EcmProducts/Menu/xaramenu.js | 1 + modules/EcmProducts/Prices.js | 172 + modules/EcmProducts/helper.js | 242 + .../javascript/DetailViewDocumentReady.js | 501 + modules/EcmProducts/javascript/EcmProduct.js | 1438 + .../javascript/EcmProductDetailView.js | 1478 + .../javascript/EcmProductQuickCreate.js | 1429 + .../javascript/EditViewDocumentReady44.js | 888 + modules/EcmProducts/javascript/MyTable.js | 910 + modules/EcmProducts/javascript/autoIndeks.js | 25 + modules/EcmProducts/javascript/formloader.js | 90 + modules/EcmProducts/mintajaxToDelete.js | 2 + modules/EcmProducts/paramsMT.js | 381 + .../javascript/EcmPurchaseOrders.js | 131 + .../javascript/EcmPurchaseOrdersDetail.js | 7 + .../javascript/bimit_table.js | 1140 + .../javascript/columndefs-detail.js | 99 + .../javascript/columndefs.js | 99 + .../EcmPurchaseOrders/javascript/helper.js | 117 + .../javascript/searchcolumndefs.js | 4 + modules/EcmQuotes/javascript/EcmQuotes.js | 154 + .../EcmQuotes/javascript/EcmQuotesDetail.js | 7 + modules/EcmQuotes/javascript/bimit_table2.js | 1040 + .../EcmQuotes/javascript/columndefs-detail.js | 115 + modules/EcmQuotes/javascript/columndefs.js | 123 + .../EcmQuotes/javascript/searchcolumndefs.js | 4 + modules/EcmReceipts/javascript/EcmReceipts.js | 166 + .../javascript/EcmReceiptsDetail.js | 8 + modules/EcmReceipts/javascript/bimit_table.js | 1350 + .../javascript/columndefs-detail.js | 91 + modules/EcmReceipts/javascript/columndefs.js | 111 + .../javascript/searchcolumndefs.js | 4 + modules/EcmReceipts2/AjaxSearch/AjaxSearch.js | 415 + modules/EcmReceipts2/EcmReceipts.js | 2843 + modules/EcmReceipts2/EcmReceiptsDetailView.js | 851 + modules/EcmReceipts2/Email.js | 1018 + modules/EcmReceipts2/MyTable.js | 2316 + modules/EcmReceipts2/PDFLanguages.js | 278 + modules/EcmReceipts2/PDFLanguagesMT.js | 371 + .../EcmReceipts2/_EcmRecepitsDetailView.js | 711 + modules/EcmReceipts2/formloader.js | 164 + modules/EcmRegisterTypes/js/detail_view.js | 76 + modules/EcmRegisterTypes/js/edit_view.js | 73 + modules/EcmReminders/helper.js | 164 + modules/EcmReminders/mintajax.js | 1 + modules/EcmReminders/mintajax2.js | 2 + modules/EcmReminders/reminder.js | 10 + .../TableSorter/js/jquery.metadata.js | 116 + .../EcmReports/TableSorter/js/jquery.min.js | 16 + .../TableSorter/js/jquery.tablesorter.js | 1593 + .../TableSorter/js/jquery.tablesorter.min.js | 5 + .../js/jquery.tablesorter.staticrow.js | 76 + .../js/jquery.tablesorter.staticrow.min.js | 1 + ...ry.tablesorter.widgets-filter-formatter.js | 929 + ...ablesorter.widgets-filter-formatter.min.js | 6 + .../js/jquery.tablesorter.widgets.js | 1215 + .../js/jquery.tablesorter.widgets.min.js | 16 + .../js/parsers/parser-date-iso8601.js | 34 + .../js/parsers/parser-date-month.js | 33 + .../js/parsers/parser-date-two-digit-year.js | 71 + .../js/parsers/parser-date-weekday.js | 33 + .../TableSorter/js/parsers/parser-date.js | 36 + .../js/parsers/parser-feet-inch-fraction.js | 63 + .../js/parsers/parser-file-type.js | 74 + .../js/parsers/parser-ignore-articles.js | 48 + .../js/parsers/parser-input-select.js | 78 + .../TableSorter/js/parsers/parser-ipv6.js | 76 + .../TableSorter/js/parsers/parser-metric.js | 77 + .../js/widgets/widget-build-table.js | 441 + .../TableSorter/js/widgets/widget-editable.js | 77 + .../TableSorter/js/widgets/widget-grouping.js | 159 + .../TableSorter/js/widgets/widget-pager.js | 748 + .../js/widgets/widget-repeatheaders.js | 50 + .../TableSorter/js/widgets/widget-scroller.js | 241 + .../addons/pager/jquery.tablesorter.pager.js | 958 + .../pager/jquery.tablesorter.pager.min.js | 2 + .../beta-testing/pager-custom-controls.js | 102 + .../beta-testing/widget-reorder.js | 182 + .../TableSorterNew/docs/js/bootstrap.min.js | 6 + .../docs/js/chili/jquery.chili-2.2.js | 704 + .../TableSorterNew/docs/js/chili/recipes.js | 229 + .../docs/js/demo-build-table.js | 175 + .../EcmReports/TableSorterNew/docs/js/docs.js | 208 + .../docs/js/jquery-1.2.6.min.js | 32 + .../docs/js/jquery-1.4.4.min.js | 167 + .../docs/js/jquery-latest.min.js | 4 + .../docs/js/jquery-ui-latest.min.js | 13 + .../docs/js/jquery.jui_theme_switch.min.js | 11 + .../docs/js/jquery.tipsy.min.js | 7 + .../TableSorterNew/docs/js/prettify.js | 28 + .../TableSorterNew/docs/js/search-ie.js | 28 + .../TableSorterNew/docs/js/search.js | 160 + .../docs/js/select2-3.4.6.min.js | 22 + .../TableSorterNew/docs/js/sugar.min.js | 132 + .../js/extras/jquery.quicksearch.js | 191 + .../TableSorterNew/js/extras/semver-mod.js | 1026 + .../TableSorterNew/js/extras/semver.js | 1011 + .../TableSorterNew/js/jquery.metadata.js | 116 + .../TableSorterNew/js/jquery.tablesorter.js | 1901 + .../js/jquery.tablesorter.min.js | 5 + ...sorter.widgets-filter-formatter-select2.js | 138 + ...ry.tablesorter.widgets-filter-formatter.js | 1145 + ...ablesorter.widgets-filter-formatter.min.js | 6 + .../js/jquery.tablesorter.widgets.js | 1912 + .../js/jquery.tablesorter.widgets.min.js | 17 + .../js/parsers/parser-date-extract.js | 81 + .../js/parsers/parser-date-iso8601.js | 34 + .../js/parsers/parser-date-month.js | 33 + .../js/parsers/parser-date-two-digit-year.js | 74 + .../js/parsers/parser-date-weekday.js | 33 + .../TableSorterNew/js/parsers/parser-date.js | 36 + .../js/parsers/parser-duration.js | 40 + .../js/parsers/parser-feet-inch-fraction.js | 63 + .../js/parsers/parser-file-type.js | 73 + .../js/parsers/parser-ignore-articles.js | 61 + .../TableSorterNew/js/parsers/parser-image.js | 20 + .../js/parsers/parser-input-select.js | 161 + .../TableSorterNew/js/parsers/parser-ipv6.js | 76 + .../js/parsers/parser-metric.js | 77 + .../TableSorterNew/js/parsers/parser-roman.js | 117 + .../TableSorterNew/js/widget-scroller.js | 957 + .../js/widgets/widget-alignChar.js | 145 + .../js/widgets/widget-build-table.js | 453 + .../js/widgets/widget-columnSelector.js | 317 + .../js/widgets/widget-cssStickyHeaders.js | 70 + .../js/widgets/widget-editable.js | 200 + .../js/widgets/widget-grouping.js | 249 + .../js/widgets/widget-headerTitles.js | 91 + .../TableSorterNew/js/widgets/widget-math.js | 413 + .../js/widgets/widget-output.js | 316 + .../TableSorterNew/js/widgets/widget-pager.js | 975 + .../TableSorterNew/js/widgets/widget-print.js | 123 + .../js/widgets/widget-reflow.js | 179 + .../js/widgets/widget-repeatheaders.js | 50 + .../js/widgets/widget-scroller.js | 218 + .../js/widgets/widget-staticRow.js | 124 + .../TableSorterNew/testing/jshint-2.4.4.js | 60570 ++++++++++++++++ .../TableSorterNew/testing/qunit-1.14.0.js | 2288 + .../TableSorterNew/testing/testing-ipv6.js | 590 + .../TableSorterNew/testing/testing-widgets.js | 369 + .../TableSorterNew/testing/testing.js | 765 + .../TableSorterNew/widget-resize.js | 0 .../EcmReports/javascript/AnalysisEcmQuote.js | 105 + modules/EcmReports/javascript/AnalysisPZ.js | 180 + .../javascript/AnalysisProductSale.js | 178 + .../javascript/ProductOperationHistory.js | 73 + .../EcmReports/javascript/RaportAktywnosci.js | 43 + modules/EcmReports/javascript/RaportMM.js | 74 + .../EcmReports/javascript/RaportZamowien.js | 405 + .../EcmReports/javascript/ReportBuyesByVat.js | 76 + modules/EcmReports/javascript/ReportSales.js | 281 + .../javascript/ReportSalesByContractor.js | 123 + .../javascript/ReportSalesByContractor2.js | 203 + .../javascript/ReportSalesByDocument.js | 156 + .../javascript/ReportSalesByGroup.js | 81 + .../javascript/ReportSalesByGroupChart.js | 73 + .../javascript/ReportSalesByProduct.js | 183 + .../javascript/ReportStockDocMoves.js | 136 + .../EcmReports/javascript/ReportStocksDoc.js | 205 + modules/EcmReports/javascript/SendSMS.js | 55 + .../EcmReports/javascript/jquery-latest.js | 154 + .../javascript/jquery.tablesorter.js | 1046 + .../EcmReports/javascript/mzVatPurchases.js | 196 + .../PhpExcell/Documentation/API/js/SVGPan.js | 232 + .../Documentation/API/js/bootstrap.js | 1722 + .../Documentation/API/js/bootstrap.min.js | 1 + .../Documentation/API/js/jquery-1.4.2.min.js | 154 + .../Documentation/API/js/jquery-1.7.1.min.js | 9270 +++ .../API/js/jquery-ui-1.8.2.custom.min.js | 1012 + .../Documentation/API/js/jquery.cookie.js | 104 + .../Documentation/API/js/jquery.iviewer.js | 1045 + .../API/js/jquery.iviewer.min.js | 42 + .../API/js/jquery.mousewheel.min.js | 13 + .../Documentation/API/js/jquery.panzoom.js | 467 + .../Documentation/API/js/jquery.splitter.js | 228 + .../Documentation/API/js/jquery.tools.min.js | 115 + .../Documentation/API/js/jquery.treeview.js | 256 + .../PhpExcell/Documentation/API/js/menu.js | 31 + .../API/js/prettify/lang-apollo.js | 2 + .../Documentation/API/js/prettify/lang-clj.js | 18 + .../Documentation/API/js/prettify/lang-css.js | 2 + .../Documentation/API/js/prettify/lang-go.js | 1 + .../Documentation/API/js/prettify/lang-hs.js | 2 + .../API/js/prettify/lang-lisp.js | 3 + .../Documentation/API/js/prettify/lang-lua.js | 2 + .../Documentation/API/js/prettify/lang-ml.js | 2 + .../Documentation/API/js/prettify/lang-n.js | 4 + .../API/js/prettify/lang-proto.js | 1 + .../API/js/prettify/lang-scala.js | 2 + .../Documentation/API/js/prettify/lang-sql.js | 2 + .../Documentation/API/js/prettify/lang-tex.js | 1 + .../Documentation/API/js/prettify/lang-vb.js | 2 + .../API/js/prettify/lang-vhdl.js | 3 + .../API/js/prettify/lang-wiki.js | 2 + .../Documentation/API/js/prettify/lang-xq.js | 3 + .../API/js/prettify/lang-yaml.js | 2 + .../API/js/prettify/prettify.min.js | 28 + .../PhpExcell/Documentation/API/js/sidebar.js | 45 + .../Documentation/API/js/template.js | 188 + .../TableSorter/js/jquery.metadata.js | 116 + .../TableSorter/js/jquery.min.js | 16 + .../TableSorter/js/jquery.tablesorter.js | 1593 + .../TableSorter/js/jquery.tablesorter.min.js | 5 + .../js/jquery.tablesorter.staticrow.js | 76 + .../js/jquery.tablesorter.staticrow.min.js | 1 + ...ry.tablesorter.widgets-filter-formatter.js | 929 + ...ablesorter.widgets-filter-formatter.min.js | 6 + .../js/jquery.tablesorter.widgets.js | 1215 + .../js/jquery.tablesorter.widgets.min.js | 16 + .../js/parsers/parser-date-iso8601.js | 34 + .../js/parsers/parser-date-month.js | 33 + .../js/parsers/parser-date-two-digit-year.js | 71 + .../js/parsers/parser-date-weekday.js | 33 + .../TableSorter/js/parsers/parser-date.js | 36 + .../js/parsers/parser-feet-inch-fraction.js | 63 + .../js/parsers/parser-file-type.js | 74 + .../js/parsers/parser-ignore-articles.js | 48 + .../js/parsers/parser-input-select.js | 78 + .../TableSorter/js/parsers/parser-ipv6.js | 76 + .../TableSorter/js/parsers/parser-metric.js | 77 + .../js/widgets/widget-build-table.js | 441 + .../TableSorter/js/widgets/widget-editable.js | 77 + .../TableSorter/js/widgets/widget-grouping.js | 159 + .../TableSorter/js/widgets/widget-pager.js | 748 + .../js/widgets/widget-repeatheaders.js | 50 + .../TableSorter/js/widgets/widget-scroller.js | 241 + .../addons/pager/jquery.tablesorter.pager.js | 958 + .../pager/jquery.tablesorter.pager.min.js | 2 + .../beta-testing/pager-custom-controls.js | 102 + .../beta-testing/widget-reorder.js | 182 + .../TableSorterNew/docs/js/bootstrap.min.js | 6 + .../docs/js/chili/jquery.chili-2.2.js | 704 + .../TableSorterNew/docs/js/chili/recipes.js | 229 + .../docs/js/demo-build-table.js | 175 + .../TableSorterNew/docs/js/docs.js | 208 + .../docs/js/jquery-1.2.6.min.js | 32 + .../docs/js/jquery-1.4.4.min.js | 167 + .../docs/js/jquery-latest.min.js | 4 + .../docs/js/jquery-ui-latest.min.js | 13 + .../docs/js/jquery.jui_theme_switch.min.js | 11 + .../docs/js/jquery.tipsy.min.js | 7 + .../TableSorterNew/docs/js/prettify.js | 28 + .../TableSorterNew/docs/js/search-ie.js | 28 + .../TableSorterNew/docs/js/search.js | 160 + .../docs/js/select2-3.4.6.min.js | 22 + .../TableSorterNew/docs/js/sugar.min.js | 132 + .../js/extras/jquery.quicksearch.js | 191 + .../TableSorterNew/js/extras/semver-mod.js | 1026 + .../TableSorterNew/js/extras/semver.js | 1011 + .../TableSorterNew/js/jquery.metadata.js | 116 + .../TableSorterNew/js/jquery.tablesorter.js | 1901 + .../js/jquery.tablesorter.min.js | 5 + ...sorter.widgets-filter-formatter-select2.js | 138 + ...ry.tablesorter.widgets-filter-formatter.js | 1145 + ...ablesorter.widgets-filter-formatter.min.js | 6 + .../js/jquery.tablesorter.widgets.js | 1912 + .../js/jquery.tablesorter.widgets.min.js | 17 + .../js/parsers/parser-date-extract.js | 81 + .../js/parsers/parser-date-iso8601.js | 34 + .../js/parsers/parser-date-month.js | 33 + .../js/parsers/parser-date-two-digit-year.js | 74 + .../js/parsers/parser-date-weekday.js | 33 + .../TableSorterNew/js/parsers/parser-date.js | 36 + .../js/parsers/parser-duration.js | 40 + .../js/parsers/parser-feet-inch-fraction.js | 63 + .../js/parsers/parser-file-type.js | 73 + .../js/parsers/parser-ignore-articles.js | 61 + .../TableSorterNew/js/parsers/parser-image.js | 20 + .../js/parsers/parser-input-select.js | 161 + .../TableSorterNew/js/parsers/parser-ipv6.js | 76 + .../js/parsers/parser-metric.js | 77 + .../TableSorterNew/js/parsers/parser-roman.js | 117 + .../js/widgets/widget-alignChar.js | 145 + .../js/widgets/widget-build-table.js | 453 + .../js/widgets/widget-columnSelector.js | 317 + .../js/widgets/widget-cssStickyHeaders.js | 70 + .../js/widgets/widget-editable.js | 200 + .../js/widgets/widget-grouping.js | 249 + .../js/widgets/widget-headerTitles.js | 91 + .../TableSorterNew/js/widgets/widget-math.js | 413 + .../js/widgets/widget-output.js | 316 + .../TableSorterNew/js/widgets/widget-pager.js | 975 + .../TableSorterNew/js/widgets/widget-print.js | 123 + .../js/widgets/widget-reflow.js | 179 + .../js/widgets/widget-repeatheaders.js | 50 + .../js/widgets/widget-scroller.js | 218 + .../js/widgets/widget-staticRow.js | 124 + .../TableSorterNew/testing/jshint-2.4.4.js | 60570 ++++++++++++++++ .../TableSorterNew/testing/qunit-1.14.0.js | 2288 + .../TableSorterNew/testing/testing-ipv6.js | 590 + .../TableSorterNew/testing/testing-widgets.js | 369 + .../TableSorterNew/testing/testing.js | 765 + .../javascript/AnalysisEcmQuote.js | 94 + .../javascript/AnalysisProductSale.js | 93 + .../javascript/ListDailySales.js | 140 + .../javascript/ReportAcceptance.js | 66 + .../javascript/ReportBuyesByVat.js | 76 + .../javascript/ReportEcmWorkCards.js | 63 + .../ReportEcmWorkCardsEcmProduct.js | 62 + .../javascript/ReportSales.js | 268 + .../javascript/ReportSalesByContractor.js | 195 + .../javascript/ReportStockDocMoves.js | 131 + .../javascript/ReportStocks.js | 213 + .../javascript/ReportValue.js | 87 + .../javascript/VatSalesRegister.js | 142 + .../javascript/detailProducts.js | 43 + .../javascript/jquery.blockUI.js | 619 + .../javascript/jquery.js | 4 + .../StockOperationsCheck.js | 65 + modules/EcmResourcess/js/detailView.js | 3 + modules/EcmResourcess/js/editView.js | 3 + modules/EcmReturns/javascript/EcmReturns.js | 104 + .../EcmReturns/javascript/EcmReturnsDetail.js | 7 + modules/EcmReturns/javascript/bimit_table.js | 829 + .../javascript/columndefs-detail.js | 75 + modules/EcmReturns/javascript/columndefs.js | 79 + modules/EcmSales/eCommerceZS/eCommerceZS.js | 0 modules/EcmSales/javascript/EcmSales3.js | 220 + modules/EcmSales/javascript/EcmSalesDetail.js | 8 + modules/EcmSales/javascript/ListNewSales.js | 197 + modules/EcmSales/javascript/ProductSummary.js | 171 + modules/EcmSales/javascript/bimit_table4.js | 1124 + .../EcmSales/javascript/columndefs-detail.js | 105 + modules/EcmSales/javascript/columndefs2.js | 117 + .../EcmSales/javascript/searchcolumndefs.js | 4 + modules/EcmSales/javascript/tablenavigator.js | 69 + modules/EcmSales/javascript/wzCreator.js | 10 + modules/EcmSalesC/javascript/EcmSales.js | 119 + .../EcmSalesC/javascript/EcmSalesDetail.js | 7 + modules/EcmSalesC/javascript/ListNewSales.js | 150 + .../EcmSalesC/javascript/ProductSummary.js | 171 + modules/EcmSalesC/javascript/bimit_table.js | 1120 + .../EcmSalesC/javascript/columndefs-detail.js | 115 + modules/EcmSalesC/javascript/columndefs.js | 122 + .../javascript/EcmServiceNews.js | 64 + .../javascript/EcmServiceNewsDetail.js | 10 + .../EcmServiceNews/javascript/bimit_table.js | 1112 + .../EcmServiceNews/javascript/columndefs.js | 157 + .../javascript/EcmStockDocCorrects.js | 113 + .../javascript/EcmStockDocCorrectsDetail.js | 7 + .../javascript/bimit_table.js | 785 + .../javascript/columndefs-detail.js | 72 + .../javascript/columndefs.js | 93 + .../javascript/searchcolumndefs.js | 4 + .../javascript/Consignments.js | 310 + .../javascript/EcmStockDocCorrects.js | 123 + .../javascript/EcmStockDocCorrectsDetail.js | 7 + .../javascript/bimit_table.js | 586 + .../javascript/columndefs-detail.js | 114 + .../javascript/columndefs.js | 184 + .../javascript/searchcolumndefs.js | 4 + .../EcmStockDocIns/javascript/Consignments.js | 258 + .../javascript/EcmStockDocIns.js | 191 + .../javascript/EcmStockDocInsDetail.js | 14 + .../EcmStockDocIns/javascript/bimit_table3.js | 816 + .../javascript/columndefs-detail.js | 92 + .../EcmStockDocIns/javascript/columndefs3.js | 143 + .../javascript/searchcolumndefs.js | 4 + .../javascript/Consignments.js | 258 + .../javascript/EcmStockDocInsideIns.js | 115 + .../javascript/EcmStockDocInsideInsDetail.js | 15 + .../javascript/bimit_table.js | 571 + .../javascript/columndefs-detail.js | 72 + .../javascript/columndefs.js | 103 + .../javascript/searchcolumndefs.js | 4 + .../javascript/Consignments.js | 258 + .../javascript/EcmStockDocInsideOuts.js | 111 + .../javascript/EcmStockDocInsideOutsDetail.js | 7 + .../javascript/bimit_table.js | 555 + .../javascript/columndefs-detail.js | 72 + .../javascript/columndefs.js | 85 + .../javascript/searchcolumndefs.js | 4 + .../javascript/EcmStockDocIns.js | 134 + .../javascript/EcmStockDocInsDetail.js | 7 + .../EcmStockDocInss/javascript/bimit_table.js | 1160 + .../javascript/columndefs-detail.js | 114 + .../EcmStockDocInss/javascript/columndefs.js | 134 + .../javascript/Consignments.js | 259 + .../javascript/EcmStockDocMoves.js | 116 + .../javascript/EcmStockDocMovesDetail.js | 7 + .../javascript/bimit_table.js | 459 + .../javascript/columndefs-detail.js | 72 + .../EcmStockDocMoves/javascript/columndefs.js | 85 + .../javascript/searchcolumndefs.js | 4 + .../javascript/Consignments.js | 259 + .../javascript/EcmStockDocOuts.js | 187 + .../javascript/EcmStockDocOutsDetail.js | 7 + .../javascript/bimit_table2.js | 1013 + .../javascript/columndefs-detail.js | 120 + .../EcmStockDocOuts/javascript/columndefs.js | 244 + .../javascript/searchcolumndefs.js | 4 + .../js/DetailViewDocumentReady.js | 79 + .../js/EditViewDocumentReady.js | 390 + modules/EcmSysInfos/js/firmInfo.js | 291 + modules/EcmSysInfos/js/headersDocuments.js | 111 + modules/EcmTransactions/js/DetailView.js | 5 + modules/EcmTransactions/js/EditView.js | 100 + modules/EcmTransactions/js/hidesearch.js | 5 + .../js/DetailViewDocumentReady.js | 396 + .../EcmWorkCards/js/EditViewDocumentReady.js | 483 + modules/EcmWorkers/js/detailView.js | 4 + modules/EcmWorkers/js/editView.js | 62 + modules/EmailTemplates/EmailTemplate.js | 52 + modules/Emails/javascript/Email.js | 1000 + modules/Emails/javascript/EmailUI.js | 3518 + modules/Emails/javascript/EmailUICompose.js | 2429 + modules/Emails/javascript/EmailUIShared.js | 89 + modules/Emails/javascript/ajax.js | 1604 + modules/Emails/javascript/complexLayout.js | 272 + .../Emails/javascript/composeEmailTemplate.js | 245 + .../javascript/composeEmailTemplate1.js | 276 + .../javascript/displayOneEmailTemplate.js | 88 + .../Emails/javascript/email_popup_helper.js | 153 + modules/Emails/javascript/grid.js | 649 + modules/Emails/javascript/init.js | 460 + .../Emails/javascript/prototypeOverloads.js | 595 + modules/Emails/javascript/vars.js | 52 + modules/Emails/javascript/viewPrintable.js | 104 + modules/Home/about.js | 35 + modules/InboundEmail/InboundEmail.js | 93 + modules/Leads/Lead.js | 48 + modules/Meetings/jsclass_scheduler.js | 111 + modules/MergeRecords/Merge.js | 93 + .../ModuleBuilder/javascript/JSTransaction.js | 78 + .../ModuleBuilder/javascript/ModuleBuilder.js | 1035 + .../ModuleBuilder/javascript/SimpleList.js | 304 + modules/ModuleBuilder/javascript/studio2.js | 840 + .../javascript/studio2FieldDD.js | 314 + .../ModuleBuilder/javascript/studio2ListDD.js | 189 + .../javascript/studio2PanelDD.js | 197 + .../ModuleBuilder/javascript/studio2RowDD.js | 184 + .../javascript/studiotabgroups.js | 196 + .../javascript/wizardTemplate.js | 36 + modules/Project/Project.js | 48 + modules/ProjectTask/ProjectTask.js | 42 + modules/Studio/JSTransaction.js | 40 + modules/Studio/studio.js | 79 + modules/Studio/studiodd.js | 55 + modules/Studio/studiotabgroups.js | 46 + modules/Studio/ygDDListStudio.js | 55 + modules/Tasks/javascript/EditView.js | 143 + modules/UpgradeWizard/upgradeWizard.js | 43 + modules/Users/DetailView.js | 54 + modules/Users/PasswordRequirementBox.js | 66 + modules/Users/User.js | 51 + modules/Users/login.js | 45 + modules/confirm_exit.js | 5 + .../EcmReports/javascript/AnalysisEcmQuote.js | 105 + .../javascript/AnalysisProductSale.js | 102 + .../javascript/ProductOperationHistory.js | 73 + .../EcmReports/javascript/RaportAktywnosci.js | 43 + .../javascript/ReportSalesByContractor.js | 123 + .../javascript/ReportSalesByDocument.js | 156 + .../javascript/ReportSalesByGroup.js | 33 + .../javascript/ReportSalesByGroupChart.js | 37 + .../javascript/ReportSalesByProduct.js | 136 + .../javascript/ReportStockDocMoves.js | 136 + .../EcmReports/javascript/ReportStocksDoc.js | 205 + port/js/bootstrap.js | 2317 + port/js/bootstrap.min.js | 7 + port/js/jquery.js | 4 + port/js/jquery.waypoints.js | 647 + port/js/jquery.waypoints.min.js | 7 + port/js/noframework.waypoints.js | 743 + port/js/noframework.waypoints.min.js | 7 + port/js/shortcuts/infinite.js | 84 + port/js/shortcuts/infinite.min.js | 7 + port/js/shortcuts/inview.js | 103 + port/js/shortcuts/inview.min.js | 7 + port/js/shortcuts/sticky.js | 65 + port/js/shortcuts/sticky.min.js | 7 + port/js/waypoints.debug.js | 46 + port/js/zepto.waypoints.js | 690 + port/js/zepto.waypoints.min.js | 7 + service/utils/SugarRest.js | 58 + themes/Sugar5/js/MyMenu.js | 49 + themes/Sugar5/js/style.js | 40 + themes/default/js/style.js | 37 + 3239 files changed, 1157078 insertions(+) create mode 100644 import/EcmPriceBooks/Email.js create mode 100644 import/EcmPriceBooks/advajax.js create mode 100644 import/EcmPriceBooks/mintajax.js create mode 100644 import/EcmPriceBooks/moo1.2.js create mode 100755 include/ECM/EcmDeleteDocument/EcmDeleteDocument.js create mode 100755 include/ECM/EcmDocumentNumberGenerator/EcmDocumentNumberGenerator.js create mode 100755 include/ECM/EcmDropdownEditor/EcmDropdownEditor.js create mode 100755 include/ECM/EcmMultiPdf/EcmMultiPdf.js create mode 100755 include/ECM/EcmNotifications/EcmNotifications.js create mode 100755 include/ECM/EcmNumberFunctions.js create mode 100755 include/ECM/EcmPreviewPDF/EcmPreviewPDF.js create mode 100755 include/ECM/EcmSendPdfButton/EcmSendPdfButton.js create mode 100644 include/ECM/SearchProductTable.js create mode 100755 include/ECM/comboselectbox.js create mode 100755 include/ECM/loadEcmJsFiles.js create mode 100755 include/ECM/open_flash_chart/js/swfobject.js create mode 100755 include/ECM/open_flash_chart2/dot-net-library/written-by-xiao-yifang/OpenFlashChart/swfobject.js create mode 100755 include/ECM/open_flash_chart2/dot-net-library/written-by-xiao-yifang/ofcWebTest/swfobject.js create mode 100755 include/ECM/open_flash_chart2/js-ofc-library/ofc.js create mode 100755 include/ECM/open_flash_chart2/js-ofc-library/open_flash_chart.js create mode 100755 include/ECM/open_flash_chart2/js-ofc-library/open_flash_chart.min.js create mode 100755 include/ECM/open_flash_chart2/js/json/json2.js create mode 100755 include/ECM/open_flash_chart2/js/swfobject.js create mode 100755 include/ECM/open_flash_chart2/perl-ofc-library/jquery-1.2.6.min.js create mode 100755 include/ECM/open_flash_chart2/perl-ofc-library/json/json2.js create mode 100755 include/ECM/open_flash_chart2/perl-ofc-library/swfobject.js create mode 100755 include/ECM/open_flash_chart2/python-ofc-library/static/swfobject.js create mode 100755 include/ECM/stopEnter.js create mode 100755 include/ECM/tablenavigator.js create mode 100755 include/JSON.js create mode 100755 include/MySugar/javascript/MySugar.js create mode 100755 include/SubPanel/SubPanelTiles.js create mode 100755 include/SugarDependentDropdown/javascript/SugarDependentDropdown.js create mode 100755 include/SugarEmailAddress/SugarEmailAddress.js create mode 100755 include/SugarFields/Fields/Address/SugarFieldAddress.js create mode 100755 include/SugarFields/Fields/Collection/SugarFieldCollection.js create mode 100755 include/SugarFields/Fields/Datetimecombo/Datetimecombo.js create mode 100755 include/SugarFields/Fields/File/jquery.form.js create mode 100755 include/asterisk/calendar/cal.js create mode 100755 include/asterisk/calendar/calx.js create mode 100755 include/asterisk/calendar/d.js create mode 100755 include/asterisk/calendar/e.js create mode 100755 include/asterisk/calendar/homw.js create mode 100755 include/asterisk/calendar/launcher.js create mode 100755 include/connectors/formatters/default/company_detail.js create mode 100755 include/jQuery/ckeditor/adapters/jquery.js create mode 100755 include/jQuery/ckeditor/build-config.js create mode 100755 include/jQuery/ckeditor/ckeditor.js create mode 100755 include/jQuery/ckeditor/config.js create mode 100755 include/jQuery/ckeditor/lang/af.js create mode 100755 include/jQuery/ckeditor/lang/ar.js create mode 100755 include/jQuery/ckeditor/lang/bg.js create mode 100755 include/jQuery/ckeditor/lang/bn.js create mode 100755 include/jQuery/ckeditor/lang/bs.js create mode 100755 include/jQuery/ckeditor/lang/ca.js create mode 100755 include/jQuery/ckeditor/lang/cs.js create mode 100755 include/jQuery/ckeditor/lang/cy.js create mode 100755 include/jQuery/ckeditor/lang/da.js create mode 100755 include/jQuery/ckeditor/lang/de.js create mode 100755 include/jQuery/ckeditor/lang/el.js create mode 100755 include/jQuery/ckeditor/lang/en-au.js create mode 100755 include/jQuery/ckeditor/lang/en-ca.js create mode 100755 include/jQuery/ckeditor/lang/en-gb.js create mode 100755 include/jQuery/ckeditor/lang/en.js create mode 100755 include/jQuery/ckeditor/lang/eo.js create mode 100755 include/jQuery/ckeditor/lang/es.js create mode 100755 include/jQuery/ckeditor/lang/et.js create mode 100755 include/jQuery/ckeditor/lang/eu.js create mode 100755 include/jQuery/ckeditor/lang/fa.js create mode 100755 include/jQuery/ckeditor/lang/fi.js create mode 100755 include/jQuery/ckeditor/lang/fo.js create mode 100755 include/jQuery/ckeditor/lang/fr-ca.js create mode 100755 include/jQuery/ckeditor/lang/fr.js create mode 100755 include/jQuery/ckeditor/lang/gl.js create mode 100755 include/jQuery/ckeditor/lang/gu.js create mode 100755 include/jQuery/ckeditor/lang/he.js create mode 100755 include/jQuery/ckeditor/lang/hi.js create mode 100755 include/jQuery/ckeditor/lang/hr.js create mode 100755 include/jQuery/ckeditor/lang/hu.js create mode 100755 include/jQuery/ckeditor/lang/id.js create mode 100755 include/jQuery/ckeditor/lang/is.js create mode 100755 include/jQuery/ckeditor/lang/it.js create mode 100755 include/jQuery/ckeditor/lang/ja.js create mode 100755 include/jQuery/ckeditor/lang/ka.js create mode 100755 include/jQuery/ckeditor/lang/km.js create mode 100755 include/jQuery/ckeditor/lang/ko.js create mode 100755 include/jQuery/ckeditor/lang/ku.js create mode 100755 include/jQuery/ckeditor/lang/lt.js create mode 100755 include/jQuery/ckeditor/lang/lv.js create mode 100755 include/jQuery/ckeditor/lang/mk.js create mode 100755 include/jQuery/ckeditor/lang/mn.js create mode 100755 include/jQuery/ckeditor/lang/ms.js create mode 100755 include/jQuery/ckeditor/lang/nb.js create mode 100755 include/jQuery/ckeditor/lang/nl.js create mode 100755 include/jQuery/ckeditor/lang/no.js create mode 100755 include/jQuery/ckeditor/lang/pl.js create mode 100755 include/jQuery/ckeditor/lang/pt-br.js create mode 100755 include/jQuery/ckeditor/lang/pt.js create mode 100755 include/jQuery/ckeditor/lang/ro.js create mode 100755 include/jQuery/ckeditor/lang/ru.js create mode 100755 include/jQuery/ckeditor/lang/si.js create mode 100755 include/jQuery/ckeditor/lang/sk.js create mode 100755 include/jQuery/ckeditor/lang/sl.js create mode 100755 include/jQuery/ckeditor/lang/sq.js create mode 100755 include/jQuery/ckeditor/lang/sr-latn.js create mode 100755 include/jQuery/ckeditor/lang/sr.js create mode 100755 include/jQuery/ckeditor/lang/sv.js create mode 100755 include/jQuery/ckeditor/lang/th.js create mode 100755 include/jQuery/ckeditor/lang/tr.js create mode 100755 include/jQuery/ckeditor/lang/tt.js create mode 100755 include/jQuery/ckeditor/lang/ug.js create mode 100755 include/jQuery/ckeditor/lang/uk.js create mode 100755 include/jQuery/ckeditor/lang/vi.js create mode 100755 include/jQuery/ckeditor/lang/zh-cn.js create mode 100755 include/jQuery/ckeditor/lang/zh.js create mode 100755 include/jQuery/ckeditor/plugins/about/dialogs/about.js create mode 100755 include/jQuery/ckeditor/plugins/autogrow/plugin.js create mode 100755 include/jQuery/ckeditor/plugins/blockquote/lang/af.js create mode 100755 include/jQuery/ckeditor/plugins/blockquote/lang/ar.js create mode 100755 include/jQuery/ckeditor/plugins/blockquote/lang/bg.js create mode 100755 include/jQuery/ckeditor/plugins/blockquote/lang/bn.js create mode 100755 include/jQuery/ckeditor/plugins/blockquote/lang/bs.js create mode 100755 include/jQuery/ckeditor/plugins/blockquote/lang/ca.js create mode 100755 include/jQuery/ckeditor/plugins/blockquote/lang/cs.js create mode 100755 include/jQuery/ckeditor/plugins/blockquote/lang/cy.js create mode 100755 include/jQuery/ckeditor/plugins/blockquote/lang/da.js create mode 100755 include/jQuery/ckeditor/plugins/blockquote/lang/de.js create mode 100755 include/jQuery/ckeditor/plugins/blockquote/lang/el.js create mode 100755 include/jQuery/ckeditor/plugins/blockquote/lang/en-au.js create mode 100755 include/jQuery/ckeditor/plugins/blockquote/lang/en-ca.js create mode 100755 include/jQuery/ckeditor/plugins/blockquote/lang/en-gb.js create mode 100755 include/jQuery/ckeditor/plugins/blockquote/lang/en.js create mode 100755 include/jQuery/ckeditor/plugins/blockquote/lang/eo.js create mode 100755 include/jQuery/ckeditor/plugins/blockquote/lang/es.js create mode 100755 include/jQuery/ckeditor/plugins/blockquote/lang/et.js create mode 100755 include/jQuery/ckeditor/plugins/blockquote/lang/eu.js create mode 100755 include/jQuery/ckeditor/plugins/blockquote/lang/fa.js create mode 100755 include/jQuery/ckeditor/plugins/blockquote/lang/fi.js create mode 100755 include/jQuery/ckeditor/plugins/blockquote/lang/fo.js create mode 100755 include/jQuery/ckeditor/plugins/blockquote/lang/fr-ca.js create mode 100755 include/jQuery/ckeditor/plugins/blockquote/lang/fr.js create mode 100755 include/jQuery/ckeditor/plugins/blockquote/lang/gl.js create mode 100755 include/jQuery/ckeditor/plugins/blockquote/lang/gu.js create mode 100755 include/jQuery/ckeditor/plugins/blockquote/lang/he.js create mode 100755 include/jQuery/ckeditor/plugins/blockquote/lang/hi.js create mode 100755 include/jQuery/ckeditor/plugins/blockquote/lang/hr.js create mode 100755 include/jQuery/ckeditor/plugins/blockquote/lang/hu.js create mode 100755 include/jQuery/ckeditor/plugins/blockquote/lang/id.js create mode 100755 include/jQuery/ckeditor/plugins/blockquote/lang/is.js create mode 100755 include/jQuery/ckeditor/plugins/blockquote/lang/it.js create mode 100755 include/jQuery/ckeditor/plugins/blockquote/lang/ja.js create mode 100755 include/jQuery/ckeditor/plugins/blockquote/lang/ka.js create mode 100755 include/jQuery/ckeditor/plugins/blockquote/lang/km.js create mode 100755 include/jQuery/ckeditor/plugins/blockquote/lang/ko.js create mode 100755 include/jQuery/ckeditor/plugins/blockquote/lang/ku.js create mode 100755 include/jQuery/ckeditor/plugins/blockquote/lang/lt.js create mode 100755 include/jQuery/ckeditor/plugins/blockquote/lang/lv.js create mode 100755 include/jQuery/ckeditor/plugins/blockquote/lang/mk.js create mode 100755 include/jQuery/ckeditor/plugins/blockquote/lang/mn.js create mode 100755 include/jQuery/ckeditor/plugins/blockquote/lang/ms.js create mode 100755 include/jQuery/ckeditor/plugins/blockquote/lang/nb.js create mode 100755 include/jQuery/ckeditor/plugins/blockquote/lang/nl.js create mode 100755 include/jQuery/ckeditor/plugins/blockquote/lang/no.js create mode 100755 include/jQuery/ckeditor/plugins/blockquote/lang/pl.js create mode 100755 include/jQuery/ckeditor/plugins/blockquote/lang/pt-br.js create mode 100755 include/jQuery/ckeditor/plugins/blockquote/lang/pt.js create mode 100755 include/jQuery/ckeditor/plugins/blockquote/lang/ro.js create mode 100755 include/jQuery/ckeditor/plugins/blockquote/lang/ru.js create mode 100755 include/jQuery/ckeditor/plugins/blockquote/lang/si.js create mode 100755 include/jQuery/ckeditor/plugins/blockquote/lang/sk.js create mode 100755 include/jQuery/ckeditor/plugins/blockquote/lang/sl.js create mode 100755 include/jQuery/ckeditor/plugins/blockquote/lang/sq.js create mode 100755 include/jQuery/ckeditor/plugins/blockquote/lang/sr-latn.js create mode 100755 include/jQuery/ckeditor/plugins/blockquote/lang/sr.js create mode 100755 include/jQuery/ckeditor/plugins/blockquote/lang/sv.js create mode 100755 include/jQuery/ckeditor/plugins/blockquote/lang/th.js create mode 100755 include/jQuery/ckeditor/plugins/blockquote/lang/tr.js create mode 100755 include/jQuery/ckeditor/plugins/blockquote/lang/tt.js create mode 100755 include/jQuery/ckeditor/plugins/blockquote/lang/ug.js create mode 100755 include/jQuery/ckeditor/plugins/blockquote/lang/uk.js create mode 100755 include/jQuery/ckeditor/plugins/blockquote/lang/vi.js create mode 100755 include/jQuery/ckeditor/plugins/blockquote/lang/zh-cn.js create mode 100755 include/jQuery/ckeditor/plugins/blockquote/lang/zh.js create mode 100755 include/jQuery/ckeditor/plugins/blockquote/plugin.js create mode 100755 include/jQuery/ckeditor/plugins/button/lang/af.js create mode 100755 include/jQuery/ckeditor/plugins/button/lang/ca.js create mode 100755 include/jQuery/ckeditor/plugins/button/lang/cs.js create mode 100755 include/jQuery/ckeditor/plugins/button/lang/da.js create mode 100755 include/jQuery/ckeditor/plugins/button/lang/de.js create mode 100755 include/jQuery/ckeditor/plugins/button/lang/el.js create mode 100755 include/jQuery/ckeditor/plugins/button/lang/en-gb.js create mode 100755 include/jQuery/ckeditor/plugins/button/lang/en.js create mode 100755 include/jQuery/ckeditor/plugins/button/lang/eo.js create mode 100755 include/jQuery/ckeditor/plugins/button/lang/fa.js create mode 100755 include/jQuery/ckeditor/plugins/button/lang/fi.js create mode 100755 include/jQuery/ckeditor/plugins/button/lang/fr.js create mode 100755 include/jQuery/ckeditor/plugins/button/lang/gl.js create mode 100755 include/jQuery/ckeditor/plugins/button/lang/he.js create mode 100755 include/jQuery/ckeditor/plugins/button/lang/hu.js create mode 100755 include/jQuery/ckeditor/plugins/button/lang/it.js create mode 100755 include/jQuery/ckeditor/plugins/button/lang/ja.js create mode 100755 include/jQuery/ckeditor/plugins/button/lang/km.js create mode 100755 include/jQuery/ckeditor/plugins/button/lang/ku.js create mode 100755 include/jQuery/ckeditor/plugins/button/lang/lt.js create mode 100755 include/jQuery/ckeditor/plugins/button/lang/nb.js create mode 100755 include/jQuery/ckeditor/plugins/button/lang/nl.js create mode 100755 include/jQuery/ckeditor/plugins/button/lang/pl.js create mode 100755 include/jQuery/ckeditor/plugins/button/lang/pt-br.js create mode 100755 include/jQuery/ckeditor/plugins/button/lang/pt.js create mode 100755 include/jQuery/ckeditor/plugins/button/lang/ro.js create mode 100755 include/jQuery/ckeditor/plugins/button/lang/ru.js create mode 100755 include/jQuery/ckeditor/plugins/button/lang/sk.js create mode 100755 include/jQuery/ckeditor/plugins/button/lang/sl.js create mode 100755 include/jQuery/ckeditor/plugins/button/lang/sq.js create mode 100755 include/jQuery/ckeditor/plugins/button/lang/sv.js create mode 100755 include/jQuery/ckeditor/plugins/button/lang/tr.js create mode 100755 include/jQuery/ckeditor/plugins/button/lang/tt.js create mode 100755 include/jQuery/ckeditor/plugins/button/lang/uk.js create mode 100755 include/jQuery/ckeditor/plugins/button/lang/vi.js create mode 100755 include/jQuery/ckeditor/plugins/button/lang/zh-cn.js create mode 100755 include/jQuery/ckeditor/plugins/button/lang/zh.js create mode 100755 include/jQuery/ckeditor/plugins/button/plugin.js create mode 100755 include/jQuery/ckeditor/plugins/clipboard/dialogs/paste.js create mode 100755 include/jQuery/ckeditor/plugins/colorbutton/lang/af.js create mode 100755 include/jQuery/ckeditor/plugins/colorbutton/lang/ar.js create mode 100755 include/jQuery/ckeditor/plugins/colorbutton/lang/bg.js create mode 100755 include/jQuery/ckeditor/plugins/colorbutton/lang/bn.js create mode 100755 include/jQuery/ckeditor/plugins/colorbutton/lang/bs.js create mode 100755 include/jQuery/ckeditor/plugins/colorbutton/lang/ca.js create mode 100755 include/jQuery/ckeditor/plugins/colorbutton/lang/cs.js create mode 100755 include/jQuery/ckeditor/plugins/colorbutton/lang/cy.js create mode 100755 include/jQuery/ckeditor/plugins/colorbutton/lang/da.js create mode 100755 include/jQuery/ckeditor/plugins/colorbutton/lang/de.js create mode 100755 include/jQuery/ckeditor/plugins/colorbutton/lang/el.js create mode 100755 include/jQuery/ckeditor/plugins/colorbutton/lang/en-au.js create mode 100755 include/jQuery/ckeditor/plugins/colorbutton/lang/en-ca.js create mode 100755 include/jQuery/ckeditor/plugins/colorbutton/lang/en-gb.js create mode 100755 include/jQuery/ckeditor/plugins/colorbutton/lang/en.js create mode 100755 include/jQuery/ckeditor/plugins/colorbutton/lang/eo.js create mode 100755 include/jQuery/ckeditor/plugins/colorbutton/lang/es.js create mode 100755 include/jQuery/ckeditor/plugins/colorbutton/lang/et.js create mode 100755 include/jQuery/ckeditor/plugins/colorbutton/lang/eu.js create mode 100755 include/jQuery/ckeditor/plugins/colorbutton/lang/fa.js create mode 100755 include/jQuery/ckeditor/plugins/colorbutton/lang/fi.js create mode 100755 include/jQuery/ckeditor/plugins/colorbutton/lang/fo.js create mode 100755 include/jQuery/ckeditor/plugins/colorbutton/lang/fr-ca.js create mode 100755 include/jQuery/ckeditor/plugins/colorbutton/lang/fr.js create mode 100755 include/jQuery/ckeditor/plugins/colorbutton/lang/gl.js create mode 100755 include/jQuery/ckeditor/plugins/colorbutton/lang/gu.js create mode 100755 include/jQuery/ckeditor/plugins/colorbutton/lang/he.js create mode 100755 include/jQuery/ckeditor/plugins/colorbutton/lang/hi.js create mode 100755 include/jQuery/ckeditor/plugins/colorbutton/lang/hr.js create mode 100755 include/jQuery/ckeditor/plugins/colorbutton/lang/hu.js create mode 100755 include/jQuery/ckeditor/plugins/colorbutton/lang/id.js create mode 100755 include/jQuery/ckeditor/plugins/colorbutton/lang/is.js create mode 100755 include/jQuery/ckeditor/plugins/colorbutton/lang/it.js create mode 100755 include/jQuery/ckeditor/plugins/colorbutton/lang/ja.js create mode 100755 include/jQuery/ckeditor/plugins/colorbutton/lang/ka.js create mode 100755 include/jQuery/ckeditor/plugins/colorbutton/lang/km.js create mode 100755 include/jQuery/ckeditor/plugins/colorbutton/lang/ko.js create mode 100755 include/jQuery/ckeditor/plugins/colorbutton/lang/ku.js create mode 100755 include/jQuery/ckeditor/plugins/colorbutton/lang/lt.js create mode 100755 include/jQuery/ckeditor/plugins/colorbutton/lang/lv.js create mode 100755 include/jQuery/ckeditor/plugins/colorbutton/lang/mk.js create mode 100755 include/jQuery/ckeditor/plugins/colorbutton/lang/mn.js create mode 100755 include/jQuery/ckeditor/plugins/colorbutton/lang/ms.js create mode 100755 include/jQuery/ckeditor/plugins/colorbutton/lang/nb.js create mode 100755 include/jQuery/ckeditor/plugins/colorbutton/lang/nl.js create mode 100755 include/jQuery/ckeditor/plugins/colorbutton/lang/no.js create mode 100755 include/jQuery/ckeditor/plugins/colorbutton/lang/pl.js create mode 100755 include/jQuery/ckeditor/plugins/colorbutton/lang/pt-br.js create mode 100755 include/jQuery/ckeditor/plugins/colorbutton/lang/pt.js create mode 100755 include/jQuery/ckeditor/plugins/colorbutton/lang/ro.js create mode 100755 include/jQuery/ckeditor/plugins/colorbutton/lang/ru.js create mode 100755 include/jQuery/ckeditor/plugins/colorbutton/lang/si.js create mode 100755 include/jQuery/ckeditor/plugins/colorbutton/lang/sk.js create mode 100755 include/jQuery/ckeditor/plugins/colorbutton/lang/sl.js create mode 100755 include/jQuery/ckeditor/plugins/colorbutton/lang/sq.js create mode 100755 include/jQuery/ckeditor/plugins/colorbutton/lang/sr-latn.js create mode 100755 include/jQuery/ckeditor/plugins/colorbutton/lang/sr.js create mode 100755 include/jQuery/ckeditor/plugins/colorbutton/lang/sv.js create mode 100755 include/jQuery/ckeditor/plugins/colorbutton/lang/th.js create mode 100755 include/jQuery/ckeditor/plugins/colorbutton/lang/tr.js create mode 100755 include/jQuery/ckeditor/plugins/colorbutton/lang/tt.js create mode 100755 include/jQuery/ckeditor/plugins/colorbutton/lang/ug.js create mode 100755 include/jQuery/ckeditor/plugins/colorbutton/lang/uk.js create mode 100755 include/jQuery/ckeditor/plugins/colorbutton/lang/vi.js create mode 100755 include/jQuery/ckeditor/plugins/colorbutton/lang/zh-cn.js create mode 100755 include/jQuery/ckeditor/plugins/colorbutton/lang/zh.js create mode 100755 include/jQuery/ckeditor/plugins/colorbutton/plugin.js create mode 100755 include/jQuery/ckeditor/plugins/colordialog/dialogs/colordialog.js create mode 100755 include/jQuery/ckeditor/plugins/colordialog/lang/af.js create mode 100755 include/jQuery/ckeditor/plugins/colordialog/lang/ar.js create mode 100755 include/jQuery/ckeditor/plugins/colordialog/lang/bg.js create mode 100755 include/jQuery/ckeditor/plugins/colordialog/lang/bn.js create mode 100755 include/jQuery/ckeditor/plugins/colordialog/lang/bs.js create mode 100755 include/jQuery/ckeditor/plugins/colordialog/lang/ca.js create mode 100755 include/jQuery/ckeditor/plugins/colordialog/lang/cs.js create mode 100755 include/jQuery/ckeditor/plugins/colordialog/lang/cy.js create mode 100755 include/jQuery/ckeditor/plugins/colordialog/lang/da.js create mode 100755 include/jQuery/ckeditor/plugins/colordialog/lang/de.js create mode 100755 include/jQuery/ckeditor/plugins/colordialog/lang/el.js create mode 100755 include/jQuery/ckeditor/plugins/colordialog/lang/en-au.js create mode 100755 include/jQuery/ckeditor/plugins/colordialog/lang/en-ca.js create mode 100755 include/jQuery/ckeditor/plugins/colordialog/lang/en-gb.js create mode 100755 include/jQuery/ckeditor/plugins/colordialog/lang/en.js create mode 100755 include/jQuery/ckeditor/plugins/colordialog/lang/eo.js create mode 100755 include/jQuery/ckeditor/plugins/colordialog/lang/es.js create mode 100755 include/jQuery/ckeditor/plugins/colordialog/lang/et.js create mode 100755 include/jQuery/ckeditor/plugins/colordialog/lang/eu.js create mode 100755 include/jQuery/ckeditor/plugins/colordialog/lang/fa.js create mode 100755 include/jQuery/ckeditor/plugins/colordialog/lang/fi.js create mode 100755 include/jQuery/ckeditor/plugins/colordialog/lang/fo.js create mode 100755 include/jQuery/ckeditor/plugins/colordialog/lang/fr-ca.js create mode 100755 include/jQuery/ckeditor/plugins/colordialog/lang/fr.js create mode 100755 include/jQuery/ckeditor/plugins/colordialog/lang/gl.js create mode 100755 include/jQuery/ckeditor/plugins/colordialog/lang/gu.js create mode 100755 include/jQuery/ckeditor/plugins/colordialog/lang/he.js create mode 100755 include/jQuery/ckeditor/plugins/colordialog/lang/hi.js create mode 100755 include/jQuery/ckeditor/plugins/colordialog/lang/hr.js create mode 100755 include/jQuery/ckeditor/plugins/colordialog/lang/hu.js create mode 100755 include/jQuery/ckeditor/plugins/colordialog/lang/is.js create mode 100755 include/jQuery/ckeditor/plugins/colordialog/lang/it.js create mode 100755 include/jQuery/ckeditor/plugins/colordialog/lang/ja.js create mode 100755 include/jQuery/ckeditor/plugins/colordialog/lang/ka.js create mode 100755 include/jQuery/ckeditor/plugins/colordialog/lang/km.js create mode 100755 include/jQuery/ckeditor/plugins/colordialog/lang/ko.js create mode 100755 include/jQuery/ckeditor/plugins/colordialog/lang/ku.js create mode 100755 include/jQuery/ckeditor/plugins/colordialog/lang/lt.js create mode 100755 include/jQuery/ckeditor/plugins/colordialog/lang/lv.js create mode 100755 include/jQuery/ckeditor/plugins/colordialog/lang/mk.js create mode 100755 include/jQuery/ckeditor/plugins/colordialog/lang/mn.js create mode 100755 include/jQuery/ckeditor/plugins/colordialog/lang/ms.js create mode 100755 include/jQuery/ckeditor/plugins/colordialog/lang/nb.js create mode 100755 include/jQuery/ckeditor/plugins/colordialog/lang/nl.js create mode 100755 include/jQuery/ckeditor/plugins/colordialog/lang/no.js create mode 100755 include/jQuery/ckeditor/plugins/colordialog/lang/pl.js create mode 100755 include/jQuery/ckeditor/plugins/colordialog/lang/pt-br.js create mode 100755 include/jQuery/ckeditor/plugins/colordialog/lang/pt.js create mode 100755 include/jQuery/ckeditor/plugins/colordialog/lang/ro.js create mode 100755 include/jQuery/ckeditor/plugins/colordialog/lang/ru.js create mode 100755 include/jQuery/ckeditor/plugins/colordialog/lang/si.js create mode 100755 include/jQuery/ckeditor/plugins/colordialog/lang/sk.js create mode 100755 include/jQuery/ckeditor/plugins/colordialog/lang/sl.js create mode 100755 include/jQuery/ckeditor/plugins/colordialog/lang/sq.js create mode 100755 include/jQuery/ckeditor/plugins/colordialog/lang/sr-latn.js create mode 100755 include/jQuery/ckeditor/plugins/colordialog/lang/sr.js create mode 100755 include/jQuery/ckeditor/plugins/colordialog/lang/sv.js create mode 100755 include/jQuery/ckeditor/plugins/colordialog/lang/th.js create mode 100755 include/jQuery/ckeditor/plugins/colordialog/lang/tr.js create mode 100755 include/jQuery/ckeditor/plugins/colordialog/lang/tt.js create mode 100755 include/jQuery/ckeditor/plugins/colordialog/lang/ug.js create mode 100755 include/jQuery/ckeditor/plugins/colordialog/lang/uk.js create mode 100755 include/jQuery/ckeditor/plugins/colordialog/lang/vi.js create mode 100755 include/jQuery/ckeditor/plugins/colordialog/lang/zh-cn.js create mode 100755 include/jQuery/ckeditor/plugins/colordialog/lang/zh.js create mode 100755 include/jQuery/ckeditor/plugins/colordialog/plugin.js create mode 100755 include/jQuery/ckeditor/plugins/contextmenu/lang/af.js create mode 100755 include/jQuery/ckeditor/plugins/contextmenu/lang/ar.js create mode 100755 include/jQuery/ckeditor/plugins/contextmenu/lang/bg.js create mode 100755 include/jQuery/ckeditor/plugins/contextmenu/lang/bn.js create mode 100755 include/jQuery/ckeditor/plugins/contextmenu/lang/bs.js create mode 100755 include/jQuery/ckeditor/plugins/contextmenu/lang/ca.js create mode 100755 include/jQuery/ckeditor/plugins/contextmenu/lang/cs.js create mode 100755 include/jQuery/ckeditor/plugins/contextmenu/lang/cy.js create mode 100755 include/jQuery/ckeditor/plugins/contextmenu/lang/da.js create mode 100755 include/jQuery/ckeditor/plugins/contextmenu/lang/de.js create mode 100755 include/jQuery/ckeditor/plugins/contextmenu/lang/el.js create mode 100755 include/jQuery/ckeditor/plugins/contextmenu/lang/en-au.js create mode 100755 include/jQuery/ckeditor/plugins/contextmenu/lang/en-ca.js create mode 100755 include/jQuery/ckeditor/plugins/contextmenu/lang/en-gb.js create mode 100755 include/jQuery/ckeditor/plugins/contextmenu/lang/en.js create mode 100755 include/jQuery/ckeditor/plugins/contextmenu/lang/eo.js create mode 100755 include/jQuery/ckeditor/plugins/contextmenu/lang/es.js create mode 100755 include/jQuery/ckeditor/plugins/contextmenu/lang/et.js create mode 100755 include/jQuery/ckeditor/plugins/contextmenu/lang/eu.js create mode 100755 include/jQuery/ckeditor/plugins/contextmenu/lang/fa.js create mode 100755 include/jQuery/ckeditor/plugins/contextmenu/lang/fi.js create mode 100755 include/jQuery/ckeditor/plugins/contextmenu/lang/fo.js create mode 100755 include/jQuery/ckeditor/plugins/contextmenu/lang/fr-ca.js create mode 100755 include/jQuery/ckeditor/plugins/contextmenu/lang/fr.js create mode 100755 include/jQuery/ckeditor/plugins/contextmenu/lang/gl.js create mode 100755 include/jQuery/ckeditor/plugins/contextmenu/lang/gu.js create mode 100755 include/jQuery/ckeditor/plugins/contextmenu/lang/he.js create mode 100755 include/jQuery/ckeditor/plugins/contextmenu/lang/hi.js create mode 100755 include/jQuery/ckeditor/plugins/contextmenu/lang/hr.js create mode 100755 include/jQuery/ckeditor/plugins/contextmenu/lang/hu.js create mode 100755 include/jQuery/ckeditor/plugins/contextmenu/lang/id.js create mode 100755 include/jQuery/ckeditor/plugins/contextmenu/lang/is.js create mode 100755 include/jQuery/ckeditor/plugins/contextmenu/lang/it.js create mode 100755 include/jQuery/ckeditor/plugins/contextmenu/lang/ja.js create mode 100755 include/jQuery/ckeditor/plugins/contextmenu/lang/ka.js create mode 100755 include/jQuery/ckeditor/plugins/contextmenu/lang/km.js create mode 100755 include/jQuery/ckeditor/plugins/contextmenu/lang/ko.js create mode 100755 include/jQuery/ckeditor/plugins/contextmenu/lang/ku.js create mode 100755 include/jQuery/ckeditor/plugins/contextmenu/lang/lt.js create mode 100755 include/jQuery/ckeditor/plugins/contextmenu/lang/lv.js create mode 100755 include/jQuery/ckeditor/plugins/contextmenu/lang/mk.js create mode 100755 include/jQuery/ckeditor/plugins/contextmenu/lang/mn.js create mode 100755 include/jQuery/ckeditor/plugins/contextmenu/lang/ms.js create mode 100755 include/jQuery/ckeditor/plugins/contextmenu/lang/nb.js create mode 100755 include/jQuery/ckeditor/plugins/contextmenu/lang/nl.js create mode 100755 include/jQuery/ckeditor/plugins/contextmenu/lang/no.js create mode 100755 include/jQuery/ckeditor/plugins/contextmenu/lang/pl.js create mode 100755 include/jQuery/ckeditor/plugins/contextmenu/lang/pt-br.js create mode 100755 include/jQuery/ckeditor/plugins/contextmenu/lang/pt.js create mode 100755 include/jQuery/ckeditor/plugins/contextmenu/lang/ro.js create mode 100755 include/jQuery/ckeditor/plugins/contextmenu/lang/ru.js create mode 100755 include/jQuery/ckeditor/plugins/contextmenu/lang/si.js create mode 100755 include/jQuery/ckeditor/plugins/contextmenu/lang/sk.js create mode 100755 include/jQuery/ckeditor/plugins/contextmenu/lang/sl.js create mode 100755 include/jQuery/ckeditor/plugins/contextmenu/lang/sq.js create mode 100755 include/jQuery/ckeditor/plugins/contextmenu/lang/sr-latn.js create mode 100755 include/jQuery/ckeditor/plugins/contextmenu/lang/sr.js create mode 100755 include/jQuery/ckeditor/plugins/contextmenu/lang/sv.js create mode 100755 include/jQuery/ckeditor/plugins/contextmenu/lang/th.js create mode 100755 include/jQuery/ckeditor/plugins/contextmenu/lang/tr.js create mode 100755 include/jQuery/ckeditor/plugins/contextmenu/lang/tt.js create mode 100755 include/jQuery/ckeditor/plugins/contextmenu/lang/ug.js create mode 100755 include/jQuery/ckeditor/plugins/contextmenu/lang/uk.js create mode 100755 include/jQuery/ckeditor/plugins/contextmenu/lang/vi.js create mode 100755 include/jQuery/ckeditor/plugins/contextmenu/lang/zh-cn.js create mode 100755 include/jQuery/ckeditor/plugins/contextmenu/lang/zh.js create mode 100755 include/jQuery/ckeditor/plugins/contextmenu/plugin.js create mode 100755 include/jQuery/ckeditor/plugins/dialog/dialogDefinition.js create mode 100755 include/jQuery/ckeditor/plugins/elementspath/lang/af.js create mode 100755 include/jQuery/ckeditor/plugins/elementspath/lang/ar.js create mode 100755 include/jQuery/ckeditor/plugins/elementspath/lang/bg.js create mode 100755 include/jQuery/ckeditor/plugins/elementspath/lang/bn.js create mode 100755 include/jQuery/ckeditor/plugins/elementspath/lang/bs.js create mode 100755 include/jQuery/ckeditor/plugins/elementspath/lang/ca.js create mode 100755 include/jQuery/ckeditor/plugins/elementspath/lang/cs.js create mode 100755 include/jQuery/ckeditor/plugins/elementspath/lang/cy.js create mode 100755 include/jQuery/ckeditor/plugins/elementspath/lang/da.js create mode 100755 include/jQuery/ckeditor/plugins/elementspath/lang/de.js create mode 100755 include/jQuery/ckeditor/plugins/elementspath/lang/el.js create mode 100755 include/jQuery/ckeditor/plugins/elementspath/lang/en-au.js create mode 100755 include/jQuery/ckeditor/plugins/elementspath/lang/en-ca.js create mode 100755 include/jQuery/ckeditor/plugins/elementspath/lang/en-gb.js create mode 100755 include/jQuery/ckeditor/plugins/elementspath/lang/en.js create mode 100755 include/jQuery/ckeditor/plugins/elementspath/lang/eo.js create mode 100755 include/jQuery/ckeditor/plugins/elementspath/lang/es.js create mode 100755 include/jQuery/ckeditor/plugins/elementspath/lang/et.js create mode 100755 include/jQuery/ckeditor/plugins/elementspath/lang/eu.js create mode 100755 include/jQuery/ckeditor/plugins/elementspath/lang/fa.js create mode 100755 include/jQuery/ckeditor/plugins/elementspath/lang/fi.js create mode 100755 include/jQuery/ckeditor/plugins/elementspath/lang/fo.js create mode 100755 include/jQuery/ckeditor/plugins/elementspath/lang/fr-ca.js create mode 100755 include/jQuery/ckeditor/plugins/elementspath/lang/fr.js create mode 100755 include/jQuery/ckeditor/plugins/elementspath/lang/gl.js create mode 100755 include/jQuery/ckeditor/plugins/elementspath/lang/gu.js create mode 100755 include/jQuery/ckeditor/plugins/elementspath/lang/he.js create mode 100755 include/jQuery/ckeditor/plugins/elementspath/lang/hi.js create mode 100755 include/jQuery/ckeditor/plugins/elementspath/lang/hr.js create mode 100755 include/jQuery/ckeditor/plugins/elementspath/lang/hu.js create mode 100755 include/jQuery/ckeditor/plugins/elementspath/lang/is.js create mode 100755 include/jQuery/ckeditor/plugins/elementspath/lang/it.js create mode 100755 include/jQuery/ckeditor/plugins/elementspath/lang/ja.js create mode 100755 include/jQuery/ckeditor/plugins/elementspath/lang/ka.js create mode 100755 include/jQuery/ckeditor/plugins/elementspath/lang/km.js create mode 100755 include/jQuery/ckeditor/plugins/elementspath/lang/ko.js create mode 100755 include/jQuery/ckeditor/plugins/elementspath/lang/ku.js create mode 100755 include/jQuery/ckeditor/plugins/elementspath/lang/lt.js create mode 100755 include/jQuery/ckeditor/plugins/elementspath/lang/lv.js create mode 100755 include/jQuery/ckeditor/plugins/elementspath/lang/mk.js create mode 100755 include/jQuery/ckeditor/plugins/elementspath/lang/mn.js create mode 100755 include/jQuery/ckeditor/plugins/elementspath/lang/ms.js create mode 100755 include/jQuery/ckeditor/plugins/elementspath/lang/nb.js create mode 100755 include/jQuery/ckeditor/plugins/elementspath/lang/nl.js create mode 100755 include/jQuery/ckeditor/plugins/elementspath/lang/no.js create mode 100755 include/jQuery/ckeditor/plugins/elementspath/lang/pl.js create mode 100755 include/jQuery/ckeditor/plugins/elementspath/lang/pt-br.js create mode 100755 include/jQuery/ckeditor/plugins/elementspath/lang/pt.js create mode 100755 include/jQuery/ckeditor/plugins/elementspath/lang/ro.js create mode 100755 include/jQuery/ckeditor/plugins/elementspath/lang/ru.js create mode 100755 include/jQuery/ckeditor/plugins/elementspath/lang/si.js create mode 100755 include/jQuery/ckeditor/plugins/elementspath/lang/sk.js create mode 100755 include/jQuery/ckeditor/plugins/elementspath/lang/sl.js create mode 100755 include/jQuery/ckeditor/plugins/elementspath/lang/sq.js create mode 100755 include/jQuery/ckeditor/plugins/elementspath/lang/sr-latn.js create mode 100755 include/jQuery/ckeditor/plugins/elementspath/lang/sr.js create mode 100755 include/jQuery/ckeditor/plugins/elementspath/lang/sv.js create mode 100755 include/jQuery/ckeditor/plugins/elementspath/lang/th.js create mode 100755 include/jQuery/ckeditor/plugins/elementspath/lang/tr.js create mode 100755 include/jQuery/ckeditor/plugins/elementspath/lang/tt.js create mode 100755 include/jQuery/ckeditor/plugins/elementspath/lang/ug.js create mode 100755 include/jQuery/ckeditor/plugins/elementspath/lang/uk.js create mode 100755 include/jQuery/ckeditor/plugins/elementspath/lang/vi.js create mode 100755 include/jQuery/ckeditor/plugins/elementspath/lang/zh-cn.js create mode 100755 include/jQuery/ckeditor/plugins/elementspath/lang/zh.js create mode 100755 include/jQuery/ckeditor/plugins/elementspath/plugin.js create mode 100755 include/jQuery/ckeditor/plugins/floatpanel/plugin.js create mode 100755 include/jQuery/ckeditor/plugins/font/lang/af.js create mode 100755 include/jQuery/ckeditor/plugins/font/lang/ar.js create mode 100755 include/jQuery/ckeditor/plugins/font/lang/bg.js create mode 100755 include/jQuery/ckeditor/plugins/font/lang/bn.js create mode 100755 include/jQuery/ckeditor/plugins/font/lang/bs.js create mode 100755 include/jQuery/ckeditor/plugins/font/lang/ca.js create mode 100755 include/jQuery/ckeditor/plugins/font/lang/cs.js create mode 100755 include/jQuery/ckeditor/plugins/font/lang/cy.js create mode 100755 include/jQuery/ckeditor/plugins/font/lang/da.js create mode 100755 include/jQuery/ckeditor/plugins/font/lang/de.js create mode 100755 include/jQuery/ckeditor/plugins/font/lang/el.js create mode 100755 include/jQuery/ckeditor/plugins/font/lang/en-au.js create mode 100755 include/jQuery/ckeditor/plugins/font/lang/en-ca.js create mode 100755 include/jQuery/ckeditor/plugins/font/lang/en-gb.js create mode 100755 include/jQuery/ckeditor/plugins/font/lang/en.js create mode 100755 include/jQuery/ckeditor/plugins/font/lang/eo.js create mode 100755 include/jQuery/ckeditor/plugins/font/lang/es.js create mode 100755 include/jQuery/ckeditor/plugins/font/lang/et.js create mode 100755 include/jQuery/ckeditor/plugins/font/lang/eu.js create mode 100755 include/jQuery/ckeditor/plugins/font/lang/fa.js create mode 100755 include/jQuery/ckeditor/plugins/font/lang/fi.js create mode 100755 include/jQuery/ckeditor/plugins/font/lang/fo.js create mode 100755 include/jQuery/ckeditor/plugins/font/lang/fr-ca.js create mode 100755 include/jQuery/ckeditor/plugins/font/lang/fr.js create mode 100755 include/jQuery/ckeditor/plugins/font/lang/gl.js create mode 100755 include/jQuery/ckeditor/plugins/font/lang/gu.js create mode 100755 include/jQuery/ckeditor/plugins/font/lang/he.js create mode 100755 include/jQuery/ckeditor/plugins/font/lang/hi.js create mode 100755 include/jQuery/ckeditor/plugins/font/lang/hr.js create mode 100755 include/jQuery/ckeditor/plugins/font/lang/hu.js create mode 100755 include/jQuery/ckeditor/plugins/font/lang/id.js create mode 100755 include/jQuery/ckeditor/plugins/font/lang/is.js create mode 100755 include/jQuery/ckeditor/plugins/font/lang/it.js create mode 100755 include/jQuery/ckeditor/plugins/font/lang/ja.js create mode 100755 include/jQuery/ckeditor/plugins/font/lang/ka.js create mode 100755 include/jQuery/ckeditor/plugins/font/lang/km.js create mode 100755 include/jQuery/ckeditor/plugins/font/lang/ko.js create mode 100755 include/jQuery/ckeditor/plugins/font/lang/ku.js create mode 100755 include/jQuery/ckeditor/plugins/font/lang/lt.js create mode 100755 include/jQuery/ckeditor/plugins/font/lang/lv.js create mode 100755 include/jQuery/ckeditor/plugins/font/lang/mk.js create mode 100755 include/jQuery/ckeditor/plugins/font/lang/mn.js create mode 100755 include/jQuery/ckeditor/plugins/font/lang/ms.js create mode 100755 include/jQuery/ckeditor/plugins/font/lang/nb.js create mode 100755 include/jQuery/ckeditor/plugins/font/lang/nl.js create mode 100755 include/jQuery/ckeditor/plugins/font/lang/no.js create mode 100755 include/jQuery/ckeditor/plugins/font/lang/pl.js create mode 100755 include/jQuery/ckeditor/plugins/font/lang/pt-br.js create mode 100755 include/jQuery/ckeditor/plugins/font/lang/pt.js create mode 100755 include/jQuery/ckeditor/plugins/font/lang/ro.js create mode 100755 include/jQuery/ckeditor/plugins/font/lang/ru.js create mode 100755 include/jQuery/ckeditor/plugins/font/lang/si.js create mode 100755 include/jQuery/ckeditor/plugins/font/lang/sk.js create mode 100755 include/jQuery/ckeditor/plugins/font/lang/sl.js create mode 100755 include/jQuery/ckeditor/plugins/font/lang/sq.js create mode 100755 include/jQuery/ckeditor/plugins/font/lang/sr-latn.js create mode 100755 include/jQuery/ckeditor/plugins/font/lang/sr.js create mode 100755 include/jQuery/ckeditor/plugins/font/lang/sv.js create mode 100755 include/jQuery/ckeditor/plugins/font/lang/th.js create mode 100755 include/jQuery/ckeditor/plugins/font/lang/tr.js create mode 100755 include/jQuery/ckeditor/plugins/font/lang/tt.js create mode 100755 include/jQuery/ckeditor/plugins/font/lang/ug.js create mode 100755 include/jQuery/ckeditor/plugins/font/lang/uk.js create mode 100755 include/jQuery/ckeditor/plugins/font/lang/vi.js create mode 100755 include/jQuery/ckeditor/plugins/font/lang/zh-cn.js create mode 100755 include/jQuery/ckeditor/plugins/font/lang/zh.js create mode 100755 include/jQuery/ckeditor/plugins/font/plugin.js create mode 100755 include/jQuery/ckeditor/plugins/format/lang/af.js create mode 100755 include/jQuery/ckeditor/plugins/format/lang/ar.js create mode 100755 include/jQuery/ckeditor/plugins/format/lang/bg.js create mode 100755 include/jQuery/ckeditor/plugins/format/lang/bn.js create mode 100755 include/jQuery/ckeditor/plugins/format/lang/bs.js create mode 100755 include/jQuery/ckeditor/plugins/format/lang/ca.js create mode 100755 include/jQuery/ckeditor/plugins/format/lang/cs.js create mode 100755 include/jQuery/ckeditor/plugins/format/lang/cy.js create mode 100755 include/jQuery/ckeditor/plugins/format/lang/da.js create mode 100755 include/jQuery/ckeditor/plugins/format/lang/de.js create mode 100755 include/jQuery/ckeditor/plugins/format/lang/el.js create mode 100755 include/jQuery/ckeditor/plugins/format/lang/en-au.js create mode 100755 include/jQuery/ckeditor/plugins/format/lang/en-ca.js create mode 100755 include/jQuery/ckeditor/plugins/format/lang/en-gb.js create mode 100755 include/jQuery/ckeditor/plugins/format/lang/en.js create mode 100755 include/jQuery/ckeditor/plugins/format/lang/eo.js create mode 100755 include/jQuery/ckeditor/plugins/format/lang/es.js create mode 100755 include/jQuery/ckeditor/plugins/format/lang/et.js create mode 100755 include/jQuery/ckeditor/plugins/format/lang/eu.js create mode 100755 include/jQuery/ckeditor/plugins/format/lang/fa.js create mode 100755 include/jQuery/ckeditor/plugins/format/lang/fi.js create mode 100755 include/jQuery/ckeditor/plugins/format/lang/fo.js create mode 100755 include/jQuery/ckeditor/plugins/format/lang/fr-ca.js create mode 100755 include/jQuery/ckeditor/plugins/format/lang/fr.js create mode 100755 include/jQuery/ckeditor/plugins/format/lang/gl.js create mode 100755 include/jQuery/ckeditor/plugins/format/lang/gu.js create mode 100755 include/jQuery/ckeditor/plugins/format/lang/he.js create mode 100755 include/jQuery/ckeditor/plugins/format/lang/hi.js create mode 100755 include/jQuery/ckeditor/plugins/format/lang/hr.js create mode 100755 include/jQuery/ckeditor/plugins/format/lang/hu.js create mode 100755 include/jQuery/ckeditor/plugins/format/lang/id.js create mode 100755 include/jQuery/ckeditor/plugins/format/lang/is.js create mode 100755 include/jQuery/ckeditor/plugins/format/lang/it.js create mode 100755 include/jQuery/ckeditor/plugins/format/lang/ja.js create mode 100755 include/jQuery/ckeditor/plugins/format/lang/ka.js create mode 100755 include/jQuery/ckeditor/plugins/format/lang/km.js create mode 100755 include/jQuery/ckeditor/plugins/format/lang/ko.js create mode 100755 include/jQuery/ckeditor/plugins/format/lang/ku.js create mode 100755 include/jQuery/ckeditor/plugins/format/lang/lt.js create mode 100755 include/jQuery/ckeditor/plugins/format/lang/lv.js create mode 100755 include/jQuery/ckeditor/plugins/format/lang/mk.js create mode 100755 include/jQuery/ckeditor/plugins/format/lang/mn.js create mode 100755 include/jQuery/ckeditor/plugins/format/lang/ms.js create mode 100755 include/jQuery/ckeditor/plugins/format/lang/nb.js create mode 100755 include/jQuery/ckeditor/plugins/format/lang/nl.js create mode 100755 include/jQuery/ckeditor/plugins/format/lang/no.js create mode 100755 include/jQuery/ckeditor/plugins/format/lang/pl.js create mode 100755 include/jQuery/ckeditor/plugins/format/lang/pt-br.js create mode 100755 include/jQuery/ckeditor/plugins/format/lang/pt.js create mode 100755 include/jQuery/ckeditor/plugins/format/lang/ro.js create mode 100755 include/jQuery/ckeditor/plugins/format/lang/ru.js create mode 100755 include/jQuery/ckeditor/plugins/format/lang/si.js create mode 100755 include/jQuery/ckeditor/plugins/format/lang/sk.js create mode 100755 include/jQuery/ckeditor/plugins/format/lang/sl.js create mode 100755 include/jQuery/ckeditor/plugins/format/lang/sq.js create mode 100755 include/jQuery/ckeditor/plugins/format/lang/sr-latn.js create mode 100755 include/jQuery/ckeditor/plugins/format/lang/sr.js create mode 100755 include/jQuery/ckeditor/plugins/format/lang/sv.js create mode 100755 include/jQuery/ckeditor/plugins/format/lang/th.js create mode 100755 include/jQuery/ckeditor/plugins/format/lang/tr.js create mode 100755 include/jQuery/ckeditor/plugins/format/lang/tt.js create mode 100755 include/jQuery/ckeditor/plugins/format/lang/ug.js create mode 100755 include/jQuery/ckeditor/plugins/format/lang/uk.js create mode 100755 include/jQuery/ckeditor/plugins/format/lang/vi.js create mode 100755 include/jQuery/ckeditor/plugins/format/lang/zh-cn.js create mode 100755 include/jQuery/ckeditor/plugins/format/lang/zh.js create mode 100755 include/jQuery/ckeditor/plugins/format/plugin.js create mode 100755 include/jQuery/ckeditor/plugins/horizontalrule/lang/af.js create mode 100755 include/jQuery/ckeditor/plugins/horizontalrule/lang/ar.js create mode 100755 include/jQuery/ckeditor/plugins/horizontalrule/lang/bg.js create mode 100755 include/jQuery/ckeditor/plugins/horizontalrule/lang/bn.js create mode 100755 include/jQuery/ckeditor/plugins/horizontalrule/lang/bs.js create mode 100755 include/jQuery/ckeditor/plugins/horizontalrule/lang/ca.js create mode 100755 include/jQuery/ckeditor/plugins/horizontalrule/lang/cs.js create mode 100755 include/jQuery/ckeditor/plugins/horizontalrule/lang/cy.js create mode 100755 include/jQuery/ckeditor/plugins/horizontalrule/lang/da.js create mode 100755 include/jQuery/ckeditor/plugins/horizontalrule/lang/de.js create mode 100755 include/jQuery/ckeditor/plugins/horizontalrule/lang/el.js create mode 100755 include/jQuery/ckeditor/plugins/horizontalrule/lang/en-au.js create mode 100755 include/jQuery/ckeditor/plugins/horizontalrule/lang/en-ca.js create mode 100755 include/jQuery/ckeditor/plugins/horizontalrule/lang/en-gb.js create mode 100755 include/jQuery/ckeditor/plugins/horizontalrule/lang/en.js create mode 100755 include/jQuery/ckeditor/plugins/horizontalrule/lang/eo.js create mode 100755 include/jQuery/ckeditor/plugins/horizontalrule/lang/es.js create mode 100755 include/jQuery/ckeditor/plugins/horizontalrule/lang/et.js create mode 100755 include/jQuery/ckeditor/plugins/horizontalrule/lang/eu.js create mode 100755 include/jQuery/ckeditor/plugins/horizontalrule/lang/fa.js create mode 100755 include/jQuery/ckeditor/plugins/horizontalrule/lang/fi.js create mode 100755 include/jQuery/ckeditor/plugins/horizontalrule/lang/fo.js create mode 100755 include/jQuery/ckeditor/plugins/horizontalrule/lang/fr-ca.js create mode 100755 include/jQuery/ckeditor/plugins/horizontalrule/lang/fr.js create mode 100755 include/jQuery/ckeditor/plugins/horizontalrule/lang/gl.js create mode 100755 include/jQuery/ckeditor/plugins/horizontalrule/lang/gu.js create mode 100755 include/jQuery/ckeditor/plugins/horizontalrule/lang/he.js create mode 100755 include/jQuery/ckeditor/plugins/horizontalrule/lang/hi.js create mode 100755 include/jQuery/ckeditor/plugins/horizontalrule/lang/hr.js create mode 100755 include/jQuery/ckeditor/plugins/horizontalrule/lang/hu.js create mode 100755 include/jQuery/ckeditor/plugins/horizontalrule/lang/id.js create mode 100755 include/jQuery/ckeditor/plugins/horizontalrule/lang/is.js create mode 100755 include/jQuery/ckeditor/plugins/horizontalrule/lang/it.js create mode 100755 include/jQuery/ckeditor/plugins/horizontalrule/lang/ja.js create mode 100755 include/jQuery/ckeditor/plugins/horizontalrule/lang/ka.js create mode 100755 include/jQuery/ckeditor/plugins/horizontalrule/lang/km.js create mode 100755 include/jQuery/ckeditor/plugins/horizontalrule/lang/ko.js create mode 100755 include/jQuery/ckeditor/plugins/horizontalrule/lang/ku.js create mode 100755 include/jQuery/ckeditor/plugins/horizontalrule/lang/lt.js create mode 100755 include/jQuery/ckeditor/plugins/horizontalrule/lang/lv.js create mode 100755 include/jQuery/ckeditor/plugins/horizontalrule/lang/mk.js create mode 100755 include/jQuery/ckeditor/plugins/horizontalrule/lang/mn.js create mode 100755 include/jQuery/ckeditor/plugins/horizontalrule/lang/ms.js create mode 100755 include/jQuery/ckeditor/plugins/horizontalrule/lang/nb.js create mode 100755 include/jQuery/ckeditor/plugins/horizontalrule/lang/nl.js create mode 100755 include/jQuery/ckeditor/plugins/horizontalrule/lang/no.js create mode 100755 include/jQuery/ckeditor/plugins/horizontalrule/lang/pl.js create mode 100755 include/jQuery/ckeditor/plugins/horizontalrule/lang/pt-br.js create mode 100755 include/jQuery/ckeditor/plugins/horizontalrule/lang/pt.js create mode 100755 include/jQuery/ckeditor/plugins/horizontalrule/lang/ro.js create mode 100755 include/jQuery/ckeditor/plugins/horizontalrule/lang/ru.js create mode 100755 include/jQuery/ckeditor/plugins/horizontalrule/lang/si.js create mode 100755 include/jQuery/ckeditor/plugins/horizontalrule/lang/sk.js create mode 100755 include/jQuery/ckeditor/plugins/horizontalrule/lang/sl.js create mode 100755 include/jQuery/ckeditor/plugins/horizontalrule/lang/sq.js create mode 100755 include/jQuery/ckeditor/plugins/horizontalrule/lang/sr-latn.js create mode 100755 include/jQuery/ckeditor/plugins/horizontalrule/lang/sr.js create mode 100755 include/jQuery/ckeditor/plugins/horizontalrule/lang/sv.js create mode 100755 include/jQuery/ckeditor/plugins/horizontalrule/lang/th.js create mode 100755 include/jQuery/ckeditor/plugins/horizontalrule/lang/tr.js create mode 100755 include/jQuery/ckeditor/plugins/horizontalrule/lang/tt.js create mode 100755 include/jQuery/ckeditor/plugins/horizontalrule/lang/ug.js create mode 100755 include/jQuery/ckeditor/plugins/horizontalrule/lang/uk.js create mode 100755 include/jQuery/ckeditor/plugins/horizontalrule/lang/vi.js create mode 100755 include/jQuery/ckeditor/plugins/horizontalrule/lang/zh-cn.js create mode 100755 include/jQuery/ckeditor/plugins/horizontalrule/lang/zh.js create mode 100755 include/jQuery/ckeditor/plugins/horizontalrule/plugin.js create mode 100755 include/jQuery/ckeditor/plugins/image/dialogs/image.js create mode 100755 include/jQuery/ckeditor/plugins/image/lang/af.js create mode 100755 include/jQuery/ckeditor/plugins/image/lang/ar.js create mode 100755 include/jQuery/ckeditor/plugins/image/lang/bg.js create mode 100755 include/jQuery/ckeditor/plugins/image/lang/bn.js create mode 100755 include/jQuery/ckeditor/plugins/image/lang/bs.js create mode 100755 include/jQuery/ckeditor/plugins/image/lang/ca.js create mode 100755 include/jQuery/ckeditor/plugins/image/lang/cs.js create mode 100755 include/jQuery/ckeditor/plugins/image/lang/cy.js create mode 100755 include/jQuery/ckeditor/plugins/image/lang/da.js create mode 100755 include/jQuery/ckeditor/plugins/image/lang/de.js create mode 100755 include/jQuery/ckeditor/plugins/image/lang/el.js create mode 100755 include/jQuery/ckeditor/plugins/image/lang/en-au.js create mode 100755 include/jQuery/ckeditor/plugins/image/lang/en-ca.js create mode 100755 include/jQuery/ckeditor/plugins/image/lang/en-gb.js create mode 100755 include/jQuery/ckeditor/plugins/image/lang/en.js create mode 100755 include/jQuery/ckeditor/plugins/image/lang/eo.js create mode 100755 include/jQuery/ckeditor/plugins/image/lang/es.js create mode 100755 include/jQuery/ckeditor/plugins/image/lang/et.js create mode 100755 include/jQuery/ckeditor/plugins/image/lang/eu.js create mode 100755 include/jQuery/ckeditor/plugins/image/lang/fa.js create mode 100755 include/jQuery/ckeditor/plugins/image/lang/fi.js create mode 100755 include/jQuery/ckeditor/plugins/image/lang/fo.js create mode 100755 include/jQuery/ckeditor/plugins/image/lang/fr-ca.js create mode 100755 include/jQuery/ckeditor/plugins/image/lang/fr.js create mode 100755 include/jQuery/ckeditor/plugins/image/lang/gl.js create mode 100755 include/jQuery/ckeditor/plugins/image/lang/gu.js create mode 100755 include/jQuery/ckeditor/plugins/image/lang/he.js create mode 100755 include/jQuery/ckeditor/plugins/image/lang/hi.js create mode 100755 include/jQuery/ckeditor/plugins/image/lang/hr.js create mode 100755 include/jQuery/ckeditor/plugins/image/lang/hu.js create mode 100755 include/jQuery/ckeditor/plugins/image/lang/id.js create mode 100755 include/jQuery/ckeditor/plugins/image/lang/is.js create mode 100755 include/jQuery/ckeditor/plugins/image/lang/it.js create mode 100755 include/jQuery/ckeditor/plugins/image/lang/ja.js create mode 100755 include/jQuery/ckeditor/plugins/image/lang/ka.js create mode 100755 include/jQuery/ckeditor/plugins/image/lang/km.js create mode 100755 include/jQuery/ckeditor/plugins/image/lang/ko.js create mode 100755 include/jQuery/ckeditor/plugins/image/lang/ku.js create mode 100755 include/jQuery/ckeditor/plugins/image/lang/lt.js create mode 100755 include/jQuery/ckeditor/plugins/image/lang/lv.js create mode 100755 include/jQuery/ckeditor/plugins/image/lang/mk.js create mode 100755 include/jQuery/ckeditor/plugins/image/lang/mn.js create mode 100755 include/jQuery/ckeditor/plugins/image/lang/ms.js create mode 100755 include/jQuery/ckeditor/plugins/image/lang/nb.js create mode 100755 include/jQuery/ckeditor/plugins/image/lang/nl.js create mode 100755 include/jQuery/ckeditor/plugins/image/lang/no.js create mode 100755 include/jQuery/ckeditor/plugins/image/lang/pl.js create mode 100755 include/jQuery/ckeditor/plugins/image/lang/pt-br.js create mode 100755 include/jQuery/ckeditor/plugins/image/lang/pt.js create mode 100755 include/jQuery/ckeditor/plugins/image/lang/ro.js create mode 100755 include/jQuery/ckeditor/plugins/image/lang/ru.js create mode 100755 include/jQuery/ckeditor/plugins/image/lang/si.js create mode 100755 include/jQuery/ckeditor/plugins/image/lang/sk.js create mode 100755 include/jQuery/ckeditor/plugins/image/lang/sl.js create mode 100755 include/jQuery/ckeditor/plugins/image/lang/sq.js create mode 100755 include/jQuery/ckeditor/plugins/image/lang/sr-latn.js create mode 100755 include/jQuery/ckeditor/plugins/image/lang/sr.js create mode 100755 include/jQuery/ckeditor/plugins/image/lang/sv.js create mode 100755 include/jQuery/ckeditor/plugins/image/lang/th.js create mode 100755 include/jQuery/ckeditor/plugins/image/lang/tr.js create mode 100755 include/jQuery/ckeditor/plugins/image/lang/tt.js create mode 100755 include/jQuery/ckeditor/plugins/image/lang/ug.js create mode 100755 include/jQuery/ckeditor/plugins/image/lang/uk.js create mode 100755 include/jQuery/ckeditor/plugins/image/lang/vi.js create mode 100755 include/jQuery/ckeditor/plugins/image/lang/zh-cn.js create mode 100755 include/jQuery/ckeditor/plugins/image/lang/zh.js create mode 100755 include/jQuery/ckeditor/plugins/image/plugin.js create mode 100755 include/jQuery/ckeditor/plugins/imagepaste/plugin.js create mode 100755 include/jQuery/ckeditor/plugins/imageresize/plugin.js create mode 100755 include/jQuery/ckeditor/plugins/justify/lang/af.js create mode 100755 include/jQuery/ckeditor/plugins/justify/lang/ar.js create mode 100755 include/jQuery/ckeditor/plugins/justify/lang/bg.js create mode 100755 include/jQuery/ckeditor/plugins/justify/lang/bn.js create mode 100755 include/jQuery/ckeditor/plugins/justify/lang/bs.js create mode 100755 include/jQuery/ckeditor/plugins/justify/lang/ca.js create mode 100755 include/jQuery/ckeditor/plugins/justify/lang/cs.js create mode 100755 include/jQuery/ckeditor/plugins/justify/lang/cy.js create mode 100755 include/jQuery/ckeditor/plugins/justify/lang/da.js create mode 100755 include/jQuery/ckeditor/plugins/justify/lang/de.js create mode 100755 include/jQuery/ckeditor/plugins/justify/lang/el.js create mode 100755 include/jQuery/ckeditor/plugins/justify/lang/en-au.js create mode 100755 include/jQuery/ckeditor/plugins/justify/lang/en-ca.js create mode 100755 include/jQuery/ckeditor/plugins/justify/lang/en-gb.js create mode 100755 include/jQuery/ckeditor/plugins/justify/lang/en.js create mode 100755 include/jQuery/ckeditor/plugins/justify/lang/eo.js create mode 100755 include/jQuery/ckeditor/plugins/justify/lang/es.js create mode 100755 include/jQuery/ckeditor/plugins/justify/lang/et.js create mode 100755 include/jQuery/ckeditor/plugins/justify/lang/eu.js create mode 100755 include/jQuery/ckeditor/plugins/justify/lang/fa.js create mode 100755 include/jQuery/ckeditor/plugins/justify/lang/fi.js create mode 100755 include/jQuery/ckeditor/plugins/justify/lang/fo.js create mode 100755 include/jQuery/ckeditor/plugins/justify/lang/fr-ca.js create mode 100755 include/jQuery/ckeditor/plugins/justify/lang/fr.js create mode 100755 include/jQuery/ckeditor/plugins/justify/lang/gl.js create mode 100755 include/jQuery/ckeditor/plugins/justify/lang/gu.js create mode 100755 include/jQuery/ckeditor/plugins/justify/lang/he.js create mode 100755 include/jQuery/ckeditor/plugins/justify/lang/hi.js create mode 100755 include/jQuery/ckeditor/plugins/justify/lang/hr.js create mode 100755 include/jQuery/ckeditor/plugins/justify/lang/hu.js create mode 100755 include/jQuery/ckeditor/plugins/justify/lang/id.js create mode 100755 include/jQuery/ckeditor/plugins/justify/lang/is.js create mode 100755 include/jQuery/ckeditor/plugins/justify/lang/it.js create mode 100755 include/jQuery/ckeditor/plugins/justify/lang/ja.js create mode 100755 include/jQuery/ckeditor/plugins/justify/lang/ka.js create mode 100755 include/jQuery/ckeditor/plugins/justify/lang/km.js create mode 100755 include/jQuery/ckeditor/plugins/justify/lang/ko.js create mode 100755 include/jQuery/ckeditor/plugins/justify/lang/ku.js create mode 100755 include/jQuery/ckeditor/plugins/justify/lang/lt.js create mode 100755 include/jQuery/ckeditor/plugins/justify/lang/lv.js create mode 100755 include/jQuery/ckeditor/plugins/justify/lang/mk.js create mode 100755 include/jQuery/ckeditor/plugins/justify/lang/mn.js create mode 100755 include/jQuery/ckeditor/plugins/justify/lang/ms.js create mode 100755 include/jQuery/ckeditor/plugins/justify/lang/nb.js create mode 100755 include/jQuery/ckeditor/plugins/justify/lang/nl.js create mode 100755 include/jQuery/ckeditor/plugins/justify/lang/no.js create mode 100755 include/jQuery/ckeditor/plugins/justify/lang/pl.js create mode 100755 include/jQuery/ckeditor/plugins/justify/lang/pt-br.js create mode 100755 include/jQuery/ckeditor/plugins/justify/lang/pt.js create mode 100755 include/jQuery/ckeditor/plugins/justify/lang/ro.js create mode 100755 include/jQuery/ckeditor/plugins/justify/lang/ru.js create mode 100755 include/jQuery/ckeditor/plugins/justify/lang/si.js create mode 100755 include/jQuery/ckeditor/plugins/justify/lang/sk.js create mode 100755 include/jQuery/ckeditor/plugins/justify/lang/sl.js create mode 100755 include/jQuery/ckeditor/plugins/justify/lang/sq.js create mode 100755 include/jQuery/ckeditor/plugins/justify/lang/sr-latn.js create mode 100755 include/jQuery/ckeditor/plugins/justify/lang/sr.js create mode 100755 include/jQuery/ckeditor/plugins/justify/lang/sv.js create mode 100755 include/jQuery/ckeditor/plugins/justify/lang/th.js create mode 100755 include/jQuery/ckeditor/plugins/justify/lang/tr.js create mode 100755 include/jQuery/ckeditor/plugins/justify/lang/tt.js create mode 100755 include/jQuery/ckeditor/plugins/justify/lang/ug.js create mode 100755 include/jQuery/ckeditor/plugins/justify/lang/uk.js create mode 100755 include/jQuery/ckeditor/plugins/justify/lang/vi.js create mode 100755 include/jQuery/ckeditor/plugins/justify/lang/zh-cn.js create mode 100755 include/jQuery/ckeditor/plugins/justify/lang/zh.js create mode 100755 include/jQuery/ckeditor/plugins/justify/plugin.js create mode 100755 include/jQuery/ckeditor/plugins/link/dialogs/anchor.js create mode 100755 include/jQuery/ckeditor/plugins/link/dialogs/link.js create mode 100755 include/jQuery/ckeditor/plugins/listblock/plugin.js create mode 100755 include/jQuery/ckeditor/plugins/menu/plugin.js create mode 100755 include/jQuery/ckeditor/plugins/panel/plugin.js create mode 100755 include/jQuery/ckeditor/plugins/panelbutton/plugin.js create mode 100755 include/jQuery/ckeditor/plugins/pastetext/lang/af.js create mode 100755 include/jQuery/ckeditor/plugins/pastetext/lang/ar.js create mode 100755 include/jQuery/ckeditor/plugins/pastetext/lang/bg.js create mode 100755 include/jQuery/ckeditor/plugins/pastetext/lang/bn.js create mode 100755 include/jQuery/ckeditor/plugins/pastetext/lang/bs.js create mode 100755 include/jQuery/ckeditor/plugins/pastetext/lang/ca.js create mode 100755 include/jQuery/ckeditor/plugins/pastetext/lang/cs.js create mode 100755 include/jQuery/ckeditor/plugins/pastetext/lang/cy.js create mode 100755 include/jQuery/ckeditor/plugins/pastetext/lang/da.js create mode 100755 include/jQuery/ckeditor/plugins/pastetext/lang/de.js create mode 100755 include/jQuery/ckeditor/plugins/pastetext/lang/el.js create mode 100755 include/jQuery/ckeditor/plugins/pastetext/lang/en-au.js create mode 100755 include/jQuery/ckeditor/plugins/pastetext/lang/en-ca.js create mode 100755 include/jQuery/ckeditor/plugins/pastetext/lang/en-gb.js create mode 100755 include/jQuery/ckeditor/plugins/pastetext/lang/en.js create mode 100755 include/jQuery/ckeditor/plugins/pastetext/lang/eo.js create mode 100755 include/jQuery/ckeditor/plugins/pastetext/lang/es.js create mode 100755 include/jQuery/ckeditor/plugins/pastetext/lang/et.js create mode 100755 include/jQuery/ckeditor/plugins/pastetext/lang/eu.js create mode 100755 include/jQuery/ckeditor/plugins/pastetext/lang/fa.js create mode 100755 include/jQuery/ckeditor/plugins/pastetext/lang/fi.js create mode 100755 include/jQuery/ckeditor/plugins/pastetext/lang/fo.js create mode 100755 include/jQuery/ckeditor/plugins/pastetext/lang/fr-ca.js create mode 100755 include/jQuery/ckeditor/plugins/pastetext/lang/fr.js create mode 100755 include/jQuery/ckeditor/plugins/pastetext/lang/gl.js create mode 100755 include/jQuery/ckeditor/plugins/pastetext/lang/gu.js create mode 100755 include/jQuery/ckeditor/plugins/pastetext/lang/he.js create mode 100755 include/jQuery/ckeditor/plugins/pastetext/lang/hi.js create mode 100755 include/jQuery/ckeditor/plugins/pastetext/lang/hr.js create mode 100755 include/jQuery/ckeditor/plugins/pastetext/lang/hu.js create mode 100755 include/jQuery/ckeditor/plugins/pastetext/lang/id.js create mode 100755 include/jQuery/ckeditor/plugins/pastetext/lang/is.js create mode 100755 include/jQuery/ckeditor/plugins/pastetext/lang/it.js create mode 100755 include/jQuery/ckeditor/plugins/pastetext/lang/ja.js create mode 100755 include/jQuery/ckeditor/plugins/pastetext/lang/ka.js create mode 100755 include/jQuery/ckeditor/plugins/pastetext/lang/km.js create mode 100755 include/jQuery/ckeditor/plugins/pastetext/lang/ko.js create mode 100755 include/jQuery/ckeditor/plugins/pastetext/lang/ku.js create mode 100755 include/jQuery/ckeditor/plugins/pastetext/lang/lt.js create mode 100755 include/jQuery/ckeditor/plugins/pastetext/lang/lv.js create mode 100755 include/jQuery/ckeditor/plugins/pastetext/lang/mk.js create mode 100755 include/jQuery/ckeditor/plugins/pastetext/lang/mn.js create mode 100755 include/jQuery/ckeditor/plugins/pastetext/lang/ms.js create mode 100755 include/jQuery/ckeditor/plugins/pastetext/lang/nb.js create mode 100755 include/jQuery/ckeditor/plugins/pastetext/lang/nl.js create mode 100755 include/jQuery/ckeditor/plugins/pastetext/lang/no.js create mode 100755 include/jQuery/ckeditor/plugins/pastetext/lang/pl.js create mode 100755 include/jQuery/ckeditor/plugins/pastetext/lang/pt-br.js create mode 100755 include/jQuery/ckeditor/plugins/pastetext/lang/pt.js create mode 100755 include/jQuery/ckeditor/plugins/pastetext/lang/ro.js create mode 100755 include/jQuery/ckeditor/plugins/pastetext/lang/ru.js create mode 100755 include/jQuery/ckeditor/plugins/pastetext/lang/si.js create mode 100755 include/jQuery/ckeditor/plugins/pastetext/lang/sk.js create mode 100755 include/jQuery/ckeditor/plugins/pastetext/lang/sl.js create mode 100755 include/jQuery/ckeditor/plugins/pastetext/lang/sq.js create mode 100755 include/jQuery/ckeditor/plugins/pastetext/lang/sr-latn.js create mode 100755 include/jQuery/ckeditor/plugins/pastetext/lang/sr.js create mode 100755 include/jQuery/ckeditor/plugins/pastetext/lang/sv.js create mode 100755 include/jQuery/ckeditor/plugins/pastetext/lang/th.js create mode 100755 include/jQuery/ckeditor/plugins/pastetext/lang/tr.js create mode 100755 include/jQuery/ckeditor/plugins/pastetext/lang/tt.js create mode 100755 include/jQuery/ckeditor/plugins/pastetext/lang/ug.js create mode 100755 include/jQuery/ckeditor/plugins/pastetext/lang/uk.js create mode 100755 include/jQuery/ckeditor/plugins/pastetext/lang/vi.js create mode 100755 include/jQuery/ckeditor/plugins/pastetext/lang/zh-cn.js create mode 100755 include/jQuery/ckeditor/plugins/pastetext/lang/zh.js create mode 100755 include/jQuery/ckeditor/plugins/pastetext/plugin.js create mode 100755 include/jQuery/ckeditor/plugins/removeformat/lang/af.js create mode 100755 include/jQuery/ckeditor/plugins/removeformat/lang/ar.js create mode 100755 include/jQuery/ckeditor/plugins/removeformat/lang/bg.js create mode 100755 include/jQuery/ckeditor/plugins/removeformat/lang/bn.js create mode 100755 include/jQuery/ckeditor/plugins/removeformat/lang/bs.js create mode 100755 include/jQuery/ckeditor/plugins/removeformat/lang/ca.js create mode 100755 include/jQuery/ckeditor/plugins/removeformat/lang/cs.js create mode 100755 include/jQuery/ckeditor/plugins/removeformat/lang/cy.js create mode 100755 include/jQuery/ckeditor/plugins/removeformat/lang/da.js create mode 100755 include/jQuery/ckeditor/plugins/removeformat/lang/de.js create mode 100755 include/jQuery/ckeditor/plugins/removeformat/lang/el.js create mode 100755 include/jQuery/ckeditor/plugins/removeformat/lang/en-au.js create mode 100755 include/jQuery/ckeditor/plugins/removeformat/lang/en-ca.js create mode 100755 include/jQuery/ckeditor/plugins/removeformat/lang/en-gb.js create mode 100755 include/jQuery/ckeditor/plugins/removeformat/lang/en.js create mode 100755 include/jQuery/ckeditor/plugins/removeformat/lang/eo.js create mode 100755 include/jQuery/ckeditor/plugins/removeformat/lang/es.js create mode 100755 include/jQuery/ckeditor/plugins/removeformat/lang/et.js create mode 100755 include/jQuery/ckeditor/plugins/removeformat/lang/eu.js create mode 100755 include/jQuery/ckeditor/plugins/removeformat/lang/fa.js create mode 100755 include/jQuery/ckeditor/plugins/removeformat/lang/fi.js create mode 100755 include/jQuery/ckeditor/plugins/removeformat/lang/fo.js create mode 100755 include/jQuery/ckeditor/plugins/removeformat/lang/fr-ca.js create mode 100755 include/jQuery/ckeditor/plugins/removeformat/lang/fr.js create mode 100755 include/jQuery/ckeditor/plugins/removeformat/lang/gl.js create mode 100755 include/jQuery/ckeditor/plugins/removeformat/lang/gu.js create mode 100755 include/jQuery/ckeditor/plugins/removeformat/lang/he.js create mode 100755 include/jQuery/ckeditor/plugins/removeformat/lang/hi.js create mode 100755 include/jQuery/ckeditor/plugins/removeformat/lang/hr.js create mode 100755 include/jQuery/ckeditor/plugins/removeformat/lang/hu.js create mode 100755 include/jQuery/ckeditor/plugins/removeformat/lang/id.js create mode 100755 include/jQuery/ckeditor/plugins/removeformat/lang/is.js create mode 100755 include/jQuery/ckeditor/plugins/removeformat/lang/it.js create mode 100755 include/jQuery/ckeditor/plugins/removeformat/lang/ja.js create mode 100755 include/jQuery/ckeditor/plugins/removeformat/lang/ka.js create mode 100755 include/jQuery/ckeditor/plugins/removeformat/lang/km.js create mode 100755 include/jQuery/ckeditor/plugins/removeformat/lang/ko.js create mode 100755 include/jQuery/ckeditor/plugins/removeformat/lang/ku.js create mode 100755 include/jQuery/ckeditor/plugins/removeformat/lang/lt.js create mode 100755 include/jQuery/ckeditor/plugins/removeformat/lang/lv.js create mode 100755 include/jQuery/ckeditor/plugins/removeformat/lang/mk.js create mode 100755 include/jQuery/ckeditor/plugins/removeformat/lang/mn.js create mode 100755 include/jQuery/ckeditor/plugins/removeformat/lang/ms.js create mode 100755 include/jQuery/ckeditor/plugins/removeformat/lang/nb.js create mode 100755 include/jQuery/ckeditor/plugins/removeformat/lang/nl.js create mode 100755 include/jQuery/ckeditor/plugins/removeformat/lang/no.js create mode 100755 include/jQuery/ckeditor/plugins/removeformat/lang/pl.js create mode 100755 include/jQuery/ckeditor/plugins/removeformat/lang/pt-br.js create mode 100755 include/jQuery/ckeditor/plugins/removeformat/lang/pt.js create mode 100755 include/jQuery/ckeditor/plugins/removeformat/lang/ro.js create mode 100755 include/jQuery/ckeditor/plugins/removeformat/lang/ru.js create mode 100755 include/jQuery/ckeditor/plugins/removeformat/lang/si.js create mode 100755 include/jQuery/ckeditor/plugins/removeformat/lang/sk.js create mode 100755 include/jQuery/ckeditor/plugins/removeformat/lang/sl.js create mode 100755 include/jQuery/ckeditor/plugins/removeformat/lang/sq.js create mode 100755 include/jQuery/ckeditor/plugins/removeformat/lang/sr-latn.js create mode 100755 include/jQuery/ckeditor/plugins/removeformat/lang/sr.js create mode 100755 include/jQuery/ckeditor/plugins/removeformat/lang/sv.js create mode 100755 include/jQuery/ckeditor/plugins/removeformat/lang/th.js create mode 100755 include/jQuery/ckeditor/plugins/removeformat/lang/tr.js create mode 100755 include/jQuery/ckeditor/plugins/removeformat/lang/tt.js create mode 100755 include/jQuery/ckeditor/plugins/removeformat/lang/ug.js create mode 100755 include/jQuery/ckeditor/plugins/removeformat/lang/uk.js create mode 100755 include/jQuery/ckeditor/plugins/removeformat/lang/vi.js create mode 100755 include/jQuery/ckeditor/plugins/removeformat/lang/zh-cn.js create mode 100755 include/jQuery/ckeditor/plugins/removeformat/lang/zh.js create mode 100755 include/jQuery/ckeditor/plugins/removeformat/plugin.js create mode 100755 include/jQuery/ckeditor/plugins/resize/plugin.js create mode 100755 include/jQuery/ckeditor/plugins/richcombo/plugin.js create mode 100755 include/jQuery/ckeditor/plugins/sourcearea/lang/af.js create mode 100755 include/jQuery/ckeditor/plugins/sourcearea/lang/ar.js create mode 100755 include/jQuery/ckeditor/plugins/sourcearea/lang/bg.js create mode 100755 include/jQuery/ckeditor/plugins/sourcearea/lang/bn.js create mode 100755 include/jQuery/ckeditor/plugins/sourcearea/lang/bs.js create mode 100755 include/jQuery/ckeditor/plugins/sourcearea/lang/ca.js create mode 100755 include/jQuery/ckeditor/plugins/sourcearea/lang/cs.js create mode 100755 include/jQuery/ckeditor/plugins/sourcearea/lang/cy.js create mode 100755 include/jQuery/ckeditor/plugins/sourcearea/lang/da.js create mode 100755 include/jQuery/ckeditor/plugins/sourcearea/lang/de.js create mode 100755 include/jQuery/ckeditor/plugins/sourcearea/lang/el.js create mode 100755 include/jQuery/ckeditor/plugins/sourcearea/lang/en-au.js create mode 100755 include/jQuery/ckeditor/plugins/sourcearea/lang/en-ca.js create mode 100755 include/jQuery/ckeditor/plugins/sourcearea/lang/en-gb.js create mode 100755 include/jQuery/ckeditor/plugins/sourcearea/lang/en.js create mode 100755 include/jQuery/ckeditor/plugins/sourcearea/lang/eo.js create mode 100755 include/jQuery/ckeditor/plugins/sourcearea/lang/es.js create mode 100755 include/jQuery/ckeditor/plugins/sourcearea/lang/et.js create mode 100755 include/jQuery/ckeditor/plugins/sourcearea/lang/eu.js create mode 100755 include/jQuery/ckeditor/plugins/sourcearea/lang/fa.js create mode 100755 include/jQuery/ckeditor/plugins/sourcearea/lang/fi.js create mode 100755 include/jQuery/ckeditor/plugins/sourcearea/lang/fo.js create mode 100755 include/jQuery/ckeditor/plugins/sourcearea/lang/fr-ca.js create mode 100755 include/jQuery/ckeditor/plugins/sourcearea/lang/fr.js create mode 100755 include/jQuery/ckeditor/plugins/sourcearea/lang/gl.js create mode 100755 include/jQuery/ckeditor/plugins/sourcearea/lang/gu.js create mode 100755 include/jQuery/ckeditor/plugins/sourcearea/lang/he.js create mode 100755 include/jQuery/ckeditor/plugins/sourcearea/lang/hi.js create mode 100755 include/jQuery/ckeditor/plugins/sourcearea/lang/hr.js create mode 100755 include/jQuery/ckeditor/plugins/sourcearea/lang/hu.js create mode 100755 include/jQuery/ckeditor/plugins/sourcearea/lang/id.js create mode 100755 include/jQuery/ckeditor/plugins/sourcearea/lang/is.js create mode 100755 include/jQuery/ckeditor/plugins/sourcearea/lang/it.js create mode 100755 include/jQuery/ckeditor/plugins/sourcearea/lang/ja.js create mode 100755 include/jQuery/ckeditor/plugins/sourcearea/lang/ka.js create mode 100755 include/jQuery/ckeditor/plugins/sourcearea/lang/km.js create mode 100755 include/jQuery/ckeditor/plugins/sourcearea/lang/ko.js create mode 100755 include/jQuery/ckeditor/plugins/sourcearea/lang/ku.js create mode 100755 include/jQuery/ckeditor/plugins/sourcearea/lang/lt.js create mode 100755 include/jQuery/ckeditor/plugins/sourcearea/lang/lv.js create mode 100755 include/jQuery/ckeditor/plugins/sourcearea/lang/mk.js create mode 100755 include/jQuery/ckeditor/plugins/sourcearea/lang/mn.js create mode 100755 include/jQuery/ckeditor/plugins/sourcearea/lang/ms.js create mode 100755 include/jQuery/ckeditor/plugins/sourcearea/lang/nb.js create mode 100755 include/jQuery/ckeditor/plugins/sourcearea/lang/nl.js create mode 100755 include/jQuery/ckeditor/plugins/sourcearea/lang/no.js create mode 100755 include/jQuery/ckeditor/plugins/sourcearea/lang/pl.js create mode 100755 include/jQuery/ckeditor/plugins/sourcearea/lang/pt-br.js create mode 100755 include/jQuery/ckeditor/plugins/sourcearea/lang/pt.js create mode 100755 include/jQuery/ckeditor/plugins/sourcearea/lang/ro.js create mode 100755 include/jQuery/ckeditor/plugins/sourcearea/lang/ru.js create mode 100755 include/jQuery/ckeditor/plugins/sourcearea/lang/si.js create mode 100755 include/jQuery/ckeditor/plugins/sourcearea/lang/sk.js create mode 100755 include/jQuery/ckeditor/plugins/sourcearea/lang/sl.js create mode 100755 include/jQuery/ckeditor/plugins/sourcearea/lang/sq.js create mode 100755 include/jQuery/ckeditor/plugins/sourcearea/lang/sr-latn.js create mode 100755 include/jQuery/ckeditor/plugins/sourcearea/lang/sr.js create mode 100755 include/jQuery/ckeditor/plugins/sourcearea/lang/sv.js create mode 100755 include/jQuery/ckeditor/plugins/sourcearea/lang/th.js create mode 100755 include/jQuery/ckeditor/plugins/sourcearea/lang/tr.js create mode 100755 include/jQuery/ckeditor/plugins/sourcearea/lang/tt.js create mode 100755 include/jQuery/ckeditor/plugins/sourcearea/lang/ug.js create mode 100755 include/jQuery/ckeditor/plugins/sourcearea/lang/uk.js create mode 100755 include/jQuery/ckeditor/plugins/sourcearea/lang/vi.js create mode 100755 include/jQuery/ckeditor/plugins/sourcearea/lang/zh-cn.js create mode 100755 include/jQuery/ckeditor/plugins/sourcearea/lang/zh.js create mode 100755 include/jQuery/ckeditor/plugins/sourcearea/plugin.js create mode 100755 include/jQuery/ckeditor/plugins/symbol/dialogs/lang/en.js create mode 100755 include/jQuery/ckeditor/plugins/symbol/dialogs/symbol.js create mode 100755 include/jQuery/ckeditor/plugins/symbol/lang/en.js create mode 100755 include/jQuery/ckeditor/plugins/symbol/plugin.js create mode 100755 include/jQuery/ckeditor/plugins/table/dialogs/table.js create mode 100755 include/jQuery/ckeditor/plugins/table/lang/af.js create mode 100755 include/jQuery/ckeditor/plugins/table/lang/ar.js create mode 100755 include/jQuery/ckeditor/plugins/table/lang/bg.js create mode 100755 include/jQuery/ckeditor/plugins/table/lang/bn.js create mode 100755 include/jQuery/ckeditor/plugins/table/lang/bs.js create mode 100755 include/jQuery/ckeditor/plugins/table/lang/ca.js create mode 100755 include/jQuery/ckeditor/plugins/table/lang/cs.js create mode 100755 include/jQuery/ckeditor/plugins/table/lang/cy.js create mode 100755 include/jQuery/ckeditor/plugins/table/lang/da.js create mode 100755 include/jQuery/ckeditor/plugins/table/lang/de.js create mode 100755 include/jQuery/ckeditor/plugins/table/lang/el.js create mode 100755 include/jQuery/ckeditor/plugins/table/lang/en-au.js create mode 100755 include/jQuery/ckeditor/plugins/table/lang/en-ca.js create mode 100755 include/jQuery/ckeditor/plugins/table/lang/en-gb.js create mode 100755 include/jQuery/ckeditor/plugins/table/lang/en.js create mode 100755 include/jQuery/ckeditor/plugins/table/lang/eo.js create mode 100755 include/jQuery/ckeditor/plugins/table/lang/es.js create mode 100755 include/jQuery/ckeditor/plugins/table/lang/et.js create mode 100755 include/jQuery/ckeditor/plugins/table/lang/eu.js create mode 100755 include/jQuery/ckeditor/plugins/table/lang/fa.js create mode 100755 include/jQuery/ckeditor/plugins/table/lang/fi.js create mode 100755 include/jQuery/ckeditor/plugins/table/lang/fo.js create mode 100755 include/jQuery/ckeditor/plugins/table/lang/fr-ca.js create mode 100755 include/jQuery/ckeditor/plugins/table/lang/fr.js create mode 100755 include/jQuery/ckeditor/plugins/table/lang/gl.js create mode 100755 include/jQuery/ckeditor/plugins/table/lang/gu.js create mode 100755 include/jQuery/ckeditor/plugins/table/lang/he.js create mode 100755 include/jQuery/ckeditor/plugins/table/lang/hi.js create mode 100755 include/jQuery/ckeditor/plugins/table/lang/hr.js create mode 100755 include/jQuery/ckeditor/plugins/table/lang/hu.js create mode 100755 include/jQuery/ckeditor/plugins/table/lang/id.js create mode 100755 include/jQuery/ckeditor/plugins/table/lang/is.js create mode 100755 include/jQuery/ckeditor/plugins/table/lang/it.js create mode 100755 include/jQuery/ckeditor/plugins/table/lang/ja.js create mode 100755 include/jQuery/ckeditor/plugins/table/lang/ka.js create mode 100755 include/jQuery/ckeditor/plugins/table/lang/km.js create mode 100755 include/jQuery/ckeditor/plugins/table/lang/ko.js create mode 100755 include/jQuery/ckeditor/plugins/table/lang/ku.js create mode 100755 include/jQuery/ckeditor/plugins/table/lang/lt.js create mode 100755 include/jQuery/ckeditor/plugins/table/lang/lv.js create mode 100755 include/jQuery/ckeditor/plugins/table/lang/mk.js create mode 100755 include/jQuery/ckeditor/plugins/table/lang/mn.js create mode 100755 include/jQuery/ckeditor/plugins/table/lang/ms.js create mode 100755 include/jQuery/ckeditor/plugins/table/lang/nb.js create mode 100755 include/jQuery/ckeditor/plugins/table/lang/nl.js create mode 100755 include/jQuery/ckeditor/plugins/table/lang/no.js create mode 100755 include/jQuery/ckeditor/plugins/table/lang/pl.js create mode 100755 include/jQuery/ckeditor/plugins/table/lang/pt-br.js create mode 100755 include/jQuery/ckeditor/plugins/table/lang/pt.js create mode 100755 include/jQuery/ckeditor/plugins/table/lang/ro.js create mode 100755 include/jQuery/ckeditor/plugins/table/lang/ru.js create mode 100755 include/jQuery/ckeditor/plugins/table/lang/si.js create mode 100755 include/jQuery/ckeditor/plugins/table/lang/sk.js create mode 100755 include/jQuery/ckeditor/plugins/table/lang/sl.js create mode 100755 include/jQuery/ckeditor/plugins/table/lang/sq.js create mode 100755 include/jQuery/ckeditor/plugins/table/lang/sr-latn.js create mode 100755 include/jQuery/ckeditor/plugins/table/lang/sr.js create mode 100755 include/jQuery/ckeditor/plugins/table/lang/sv.js create mode 100755 include/jQuery/ckeditor/plugins/table/lang/th.js create mode 100755 include/jQuery/ckeditor/plugins/table/lang/tr.js create mode 100755 include/jQuery/ckeditor/plugins/table/lang/tt.js create mode 100755 include/jQuery/ckeditor/plugins/table/lang/ug.js create mode 100755 include/jQuery/ckeditor/plugins/table/lang/uk.js create mode 100755 include/jQuery/ckeditor/plugins/table/lang/vi.js create mode 100755 include/jQuery/ckeditor/plugins/table/lang/zh-cn.js create mode 100755 include/jQuery/ckeditor/plugins/table/lang/zh.js create mode 100755 include/jQuery/ckeditor/plugins/table/plugin.js create mode 100755 include/jQuery/ckeditor/plugins/tableresize/plugin.js create mode 100755 include/jQuery/ckeditor/plugins/tabletools/dialogs/tableCell.js create mode 100755 include/jQuery/ckeditor/plugins/tabletools/plugin.js create mode 100755 include/jQuery/ckeditor/samples/assets/uilanguages/languages.js create mode 100755 include/jQuery/ckeditor/samples/plugins/dialog/assets/my_dialog.js create mode 100755 include/jQuery/ckeditor/samples/sample.js create mode 100755 include/jQuery/ckeditor/skins/moono_blue/skin.js create mode 100755 include/jQuery/ckeditor/skins/office2013/skin.js create mode 100755 include/jQuery/ckeditor/styles.js create mode 100755 include/jQuery/html-table-search.js create mode 100755 include/jQuery/jquery-1.11.2.min.js create mode 100755 include/jQuery/jquery-mask/jquery.mask.js create mode 100644 include/jQuery/jquery-ui-lite/jquery-1.12.4.js create mode 100644 include/jQuery/jquery-ui-lite/jquery-ui.js create mode 100755 include/jQuery/jquery-ui/Gruntfile.js create mode 100755 include/jQuery/jquery-ui/demos/datepicker/jquery.ui.datepicker-ar.js create mode 100755 include/jQuery/jquery-ui/demos/datepicker/jquery.ui.datepicker-fr.js create mode 100755 include/jQuery/jquery-ui/demos/datepicker/jquery.ui.datepicker-he.js create mode 100755 include/jQuery/jquery-ui/demos/datepicker/jquery.ui.datepicker-zh-TW.js create mode 100755 include/jQuery/jquery-ui/external/globalize.culture.de-DE.js create mode 100755 include/jQuery/jquery-ui/external/globalize.culture.ja-JP.js create mode 100755 include/jQuery/jquery-ui/external/globalize.js create mode 100755 include/jQuery/jquery-ui/external/jquery.mousewheel.js create mode 100755 include/jQuery/jquery-ui/external/jshint.js create mode 100755 include/jQuery/jquery-ui/external/qunit.js create mode 100755 include/jQuery/jquery-ui/jquery-1.10.2.js create mode 100755 include/jQuery/jquery-ui/tests/index.js create mode 100755 include/jQuery/jquery-ui/tests/jquery-1.10.0.js create mode 100755 include/jQuery/jquery-ui/tests/jquery-1.10.1.js create mode 100755 include/jQuery/jquery-ui/tests/jquery-1.10.2.js create mode 100755 include/jQuery/jquery-ui/tests/jquery-1.6.1.js create mode 100755 include/jQuery/jquery-ui/tests/jquery-1.6.2.js create mode 100755 include/jQuery/jquery-ui/tests/jquery-1.6.3.js create mode 100755 include/jQuery/jquery-ui/tests/jquery-1.6.4.js create mode 100755 include/jQuery/jquery-ui/tests/jquery-1.6.js create mode 100755 include/jQuery/jquery-ui/tests/jquery-1.7.1.js create mode 100755 include/jQuery/jquery-ui/tests/jquery-1.7.2.js create mode 100755 include/jQuery/jquery-ui/tests/jquery-1.7.js create mode 100755 include/jQuery/jquery-ui/tests/jquery-1.8.0.js create mode 100755 include/jQuery/jquery-ui/tests/jquery-1.8.1.js create mode 100755 include/jQuery/jquery-ui/tests/jquery-1.8.2.js create mode 100755 include/jQuery/jquery-ui/tests/jquery-1.8.3.js create mode 100755 include/jQuery/jquery-ui/tests/jquery-1.9.0.js create mode 100755 include/jQuery/jquery-ui/tests/jquery-1.9.1.js create mode 100755 include/jQuery/jquery-ui/tests/jquery-2.0.0.js create mode 100755 include/jQuery/jquery-ui/tests/jquery-2.0.1.js create mode 100755 include/jQuery/jquery-ui/tests/jquery-2.0.2.js create mode 100755 include/jQuery/jquery-ui/tests/jquery-2.0.3.js create mode 100755 include/jQuery/jquery-ui/tests/jquery.js create mode 100755 include/jQuery/jquery-ui/tests/jquery.simulate.js create mode 100755 include/jQuery/jquery-ui/tests/unit/accordion/accordion_common.js create mode 100755 include/jQuery/jquery-ui/tests/unit/accordion/accordion_core.js create mode 100755 include/jQuery/jquery-ui/tests/unit/accordion/accordion_events.js create mode 100755 include/jQuery/jquery-ui/tests/unit/accordion/accordion_methods.js create mode 100755 include/jQuery/jquery-ui/tests/unit/accordion/accordion_options.js create mode 100755 include/jQuery/jquery-ui/tests/unit/accordion/accordion_test_helpers.js create mode 100755 include/jQuery/jquery-ui/tests/unit/autocomplete/autocomplete_common.js create mode 100755 include/jQuery/jquery-ui/tests/unit/autocomplete/autocomplete_core.js create mode 100755 include/jQuery/jquery-ui/tests/unit/autocomplete/autocomplete_events.js create mode 100755 include/jQuery/jquery-ui/tests/unit/autocomplete/autocomplete_methods.js create mode 100755 include/jQuery/jquery-ui/tests/unit/autocomplete/autocomplete_options.js create mode 100755 include/jQuery/jquery-ui/tests/unit/button/button_common.js create mode 100755 include/jQuery/jquery-ui/tests/unit/button/button_core.js create mode 100755 include/jQuery/jquery-ui/tests/unit/button/button_events.js create mode 100755 include/jQuery/jquery-ui/tests/unit/button/button_methods.js create mode 100755 include/jQuery/jquery-ui/tests/unit/button/button_options.js create mode 100755 include/jQuery/jquery-ui/tests/unit/core/core.js create mode 100755 include/jQuery/jquery-ui/tests/unit/core/selector.js create mode 100755 include/jQuery/jquery-ui/tests/unit/datepicker/datepicker_common.js create mode 100755 include/jQuery/jquery-ui/tests/unit/datepicker/datepicker_core.js create mode 100755 include/jQuery/jquery-ui/tests/unit/datepicker/datepicker_events.js create mode 100755 include/jQuery/jquery-ui/tests/unit/datepicker/datepicker_methods.js create mode 100755 include/jQuery/jquery-ui/tests/unit/datepicker/datepicker_options.js create mode 100755 include/jQuery/jquery-ui/tests/unit/datepicker/datepicker_test_helpers.js create mode 100755 include/jQuery/jquery-ui/tests/unit/dialog/dialog_common.js create mode 100755 include/jQuery/jquery-ui/tests/unit/dialog/dialog_core.js create mode 100755 include/jQuery/jquery-ui/tests/unit/dialog/dialog_deprecated.js create mode 100755 include/jQuery/jquery-ui/tests/unit/dialog/dialog_events.js create mode 100755 include/jQuery/jquery-ui/tests/unit/dialog/dialog_methods.js create mode 100755 include/jQuery/jquery-ui/tests/unit/dialog/dialog_options.js create mode 100755 include/jQuery/jquery-ui/tests/unit/dialog/dialog_test_helpers.js create mode 100755 include/jQuery/jquery-ui/tests/unit/draggable/draggable_common.js create mode 100755 include/jQuery/jquery-ui/tests/unit/draggable/draggable_core.js create mode 100755 include/jQuery/jquery-ui/tests/unit/draggable/draggable_events.js create mode 100755 include/jQuery/jquery-ui/tests/unit/draggable/draggable_methods.js create mode 100755 include/jQuery/jquery-ui/tests/unit/draggable/draggable_options.js create mode 100755 include/jQuery/jquery-ui/tests/unit/draggable/draggable_test_helpers.js create mode 100755 include/jQuery/jquery-ui/tests/unit/droppable/droppable_common.js create mode 100755 include/jQuery/jquery-ui/tests/unit/droppable/droppable_core.js create mode 100755 include/jQuery/jquery-ui/tests/unit/droppable/droppable_events.js create mode 100755 include/jQuery/jquery-ui/tests/unit/droppable/droppable_methods.js create mode 100755 include/jQuery/jquery-ui/tests/unit/droppable/droppable_options.js create mode 100755 include/jQuery/jquery-ui/tests/unit/droppable/droppable_test_helpers.js create mode 100755 include/jQuery/jquery-ui/tests/unit/effects/effects_core.js create mode 100755 include/jQuery/jquery-ui/tests/unit/effects/effects_scale.js create mode 100755 include/jQuery/jquery-ui/tests/unit/menu/menu_common.js create mode 100755 include/jQuery/jquery-ui/tests/unit/menu/menu_core.js create mode 100755 include/jQuery/jquery-ui/tests/unit/menu/menu_events.js create mode 100755 include/jQuery/jquery-ui/tests/unit/menu/menu_methods.js create mode 100755 include/jQuery/jquery-ui/tests/unit/menu/menu_options.js create mode 100755 include/jQuery/jquery-ui/tests/unit/menu/menu_test_helpers.js create mode 100755 include/jQuery/jquery-ui/tests/unit/position/position_core.js create mode 100755 include/jQuery/jquery-ui/tests/unit/progressbar/progressbar_common.js create mode 100755 include/jQuery/jquery-ui/tests/unit/progressbar/progressbar_core.js create mode 100755 include/jQuery/jquery-ui/tests/unit/progressbar/progressbar_events.js create mode 100755 include/jQuery/jquery-ui/tests/unit/progressbar/progressbar_methods.js create mode 100755 include/jQuery/jquery-ui/tests/unit/progressbar/progressbar_options.js create mode 100755 include/jQuery/jquery-ui/tests/unit/qunit-composite.js create mode 100755 include/jQuery/jquery-ui/tests/unit/resizable/resizable_common.js create mode 100755 include/jQuery/jquery-ui/tests/unit/resizable/resizable_core.js create mode 100755 include/jQuery/jquery-ui/tests/unit/resizable/resizable_events.js create mode 100755 include/jQuery/jquery-ui/tests/unit/resizable/resizable_methods.js create mode 100755 include/jQuery/jquery-ui/tests/unit/resizable/resizable_options.js create mode 100755 include/jQuery/jquery-ui/tests/unit/resizable/resizable_test_helpers.js create mode 100755 include/jQuery/jquery-ui/tests/unit/selectable/selectable_common.js create mode 100755 include/jQuery/jquery-ui/tests/unit/selectable/selectable_core.js create mode 100755 include/jQuery/jquery-ui/tests/unit/selectable/selectable_events.js create mode 100755 include/jQuery/jquery-ui/tests/unit/selectable/selectable_methods.js create mode 100755 include/jQuery/jquery-ui/tests/unit/selectable/selectable_options.js create mode 100755 include/jQuery/jquery-ui/tests/unit/slider/slider_common.js create mode 100755 include/jQuery/jquery-ui/tests/unit/slider/slider_core.js create mode 100755 include/jQuery/jquery-ui/tests/unit/slider/slider_events.js create mode 100755 include/jQuery/jquery-ui/tests/unit/slider/slider_methods.js create mode 100755 include/jQuery/jquery-ui/tests/unit/slider/slider_options.js create mode 100755 include/jQuery/jquery-ui/tests/unit/sortable/sortable_common.js create mode 100755 include/jQuery/jquery-ui/tests/unit/sortable/sortable_core.js create mode 100755 include/jQuery/jquery-ui/tests/unit/sortable/sortable_events.js create mode 100755 include/jQuery/jquery-ui/tests/unit/sortable/sortable_methods.js create mode 100755 include/jQuery/jquery-ui/tests/unit/sortable/sortable_options.js create mode 100755 include/jQuery/jquery-ui/tests/unit/sortable/sortable_test_helpers.js create mode 100755 include/jQuery/jquery-ui/tests/unit/spinner/spinner_common.js create mode 100755 include/jQuery/jquery-ui/tests/unit/spinner/spinner_core.js create mode 100755 include/jQuery/jquery-ui/tests/unit/spinner/spinner_events.js create mode 100755 include/jQuery/jquery-ui/tests/unit/spinner/spinner_methods.js create mode 100755 include/jQuery/jquery-ui/tests/unit/spinner/spinner_options.js create mode 100755 include/jQuery/jquery-ui/tests/unit/spinner/spinner_test_helpers.js create mode 100755 include/jQuery/jquery-ui/tests/unit/subsuite.js create mode 100755 include/jQuery/jquery-ui/tests/unit/swarminject.js create mode 100755 include/jQuery/jquery-ui/tests/unit/tabs/tabs_common.js create mode 100755 include/jQuery/jquery-ui/tests/unit/tabs/tabs_core.js create mode 100755 include/jQuery/jquery-ui/tests/unit/tabs/tabs_events.js create mode 100755 include/jQuery/jquery-ui/tests/unit/tabs/tabs_methods.js create mode 100755 include/jQuery/jquery-ui/tests/unit/tabs/tabs_options.js create mode 100755 include/jQuery/jquery-ui/tests/unit/tabs/tabs_test_helpers.js create mode 100755 include/jQuery/jquery-ui/tests/unit/testsuite.js create mode 100755 include/jQuery/jquery-ui/tests/unit/tooltip/tooltip_common.js create mode 100755 include/jQuery/jquery-ui/tests/unit/tooltip/tooltip_core.js create mode 100755 include/jQuery/jquery-ui/tests/unit/tooltip/tooltip_events.js create mode 100755 include/jQuery/jquery-ui/tests/unit/tooltip/tooltip_methods.js create mode 100755 include/jQuery/jquery-ui/tests/unit/tooltip/tooltip_options.js create mode 100755 include/jQuery/jquery-ui/tests/unit/widget/widget_animation.js create mode 100755 include/jQuery/jquery-ui/tests/unit/widget/widget_core.js create mode 100755 include/jQuery/jquery-ui/tests/unit/widget/widget_extend.js create mode 100755 include/jQuery/jquery-ui/tests/visual/effects/effects.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery-ui-i18n.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-af.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-ar-DZ.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-ar.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-az.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-be.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-bg.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-bs.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-ca.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-cs.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-cy-GB.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-da.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-de.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-el.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-en-AU.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-en-GB.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-en-NZ.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-eo.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-es.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-et.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-eu.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-fa.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-fi.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-fo.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-fr-CA.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-fr-CH.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-fr.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-gl.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-he.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-hi.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-hr.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-hu.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-hy.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-id.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-is.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-it.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-ja.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-ka.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-kk.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-km.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-ko.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-ky.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-lb.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-lt.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-lv.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-mk.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-ml.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-ms.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-nb.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-nl-BE.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-nl.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-nn.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-no.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-pl.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-pt-BR.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-pt.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-rm.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-ro.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-ru.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-sk.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-sl.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-sq.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-sr-SR.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-sr.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-sv.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-ta.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-th.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-tj.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-tr.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-uk.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-vi.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-zh-CN.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-zh-HK.js create mode 100755 include/jQuery/jquery-ui/ui/i18n/jquery.ui.datepicker-zh-TW.js create mode 100755 include/jQuery/jquery-ui/ui/jquery-ui.js create mode 100755 include/jQuery/jquery-ui/ui/jquery.ui.accordion.js create mode 100755 include/jQuery/jquery-ui/ui/jquery.ui.autocomplete.js create mode 100755 include/jQuery/jquery-ui/ui/jquery.ui.button.js create mode 100755 include/jQuery/jquery-ui/ui/jquery.ui.core.js create mode 100755 include/jQuery/jquery-ui/ui/jquery.ui.datepicker.js create mode 100755 include/jQuery/jquery-ui/ui/jquery.ui.dialog.js create mode 100755 include/jQuery/jquery-ui/ui/jquery.ui.draggable.js create mode 100755 include/jQuery/jquery-ui/ui/jquery.ui.droppable.js create mode 100755 include/jQuery/jquery-ui/ui/jquery.ui.effect-blind.js create mode 100755 include/jQuery/jquery-ui/ui/jquery.ui.effect-bounce.js create mode 100755 include/jQuery/jquery-ui/ui/jquery.ui.effect-clip.js create mode 100755 include/jQuery/jquery-ui/ui/jquery.ui.effect-drop.js create mode 100755 include/jQuery/jquery-ui/ui/jquery.ui.effect-explode.js create mode 100755 include/jQuery/jquery-ui/ui/jquery.ui.effect-fade.js create mode 100755 include/jQuery/jquery-ui/ui/jquery.ui.effect-fold.js create mode 100755 include/jQuery/jquery-ui/ui/jquery.ui.effect-highlight.js create mode 100755 include/jQuery/jquery-ui/ui/jquery.ui.effect-pulsate.js create mode 100755 include/jQuery/jquery-ui/ui/jquery.ui.effect-scale.js create mode 100755 include/jQuery/jquery-ui/ui/jquery.ui.effect-shake.js create mode 100755 include/jQuery/jquery-ui/ui/jquery.ui.effect-slide.js create mode 100755 include/jQuery/jquery-ui/ui/jquery.ui.effect-transfer.js create mode 100755 include/jQuery/jquery-ui/ui/jquery.ui.effect.js create mode 100755 include/jQuery/jquery-ui/ui/jquery.ui.menu.js create mode 100755 include/jQuery/jquery-ui/ui/jquery.ui.mouse.js create mode 100755 include/jQuery/jquery-ui/ui/jquery.ui.position.js create mode 100755 include/jQuery/jquery-ui/ui/jquery.ui.progressbar.js create mode 100755 include/jQuery/jquery-ui/ui/jquery.ui.resizable.js create mode 100755 include/jQuery/jquery-ui/ui/jquery.ui.selectable.js create mode 100755 include/jQuery/jquery-ui/ui/jquery.ui.slider.js create mode 100755 include/jQuery/jquery-ui/ui/jquery.ui.sortable.js create mode 100755 include/jQuery/jquery-ui/ui/jquery.ui.spinner.js create mode 100755 include/jQuery/jquery-ui/ui/jquery.ui.tabs.js create mode 100755 include/jQuery/jquery-ui/ui/jquery.ui.tooltip.js create mode 100755 include/jQuery/jquery-ui/ui/jquery.ui.widget.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery-ui-i18n.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-af.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-ar-DZ.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-ar.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-az.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-be.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-bg.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-bs.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-ca.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-cs.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-cy-GB.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-da.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-de.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-el.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-en-AU.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-en-GB.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-en-NZ.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-eo.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-es.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-et.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-eu.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-fa.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-fi.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-fo.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-fr-CA.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-fr-CH.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-fr.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-gl.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-he.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-hi.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-hr.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-hu.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-hy.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-id.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-is.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-it.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-ja.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-ka.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-kk.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-km.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-ko.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-ky.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-lb.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-lt.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-lv.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-mk.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-ml.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-ms.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-nb.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-nl-BE.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-nl.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-nn.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-no.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-pl.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-pt-BR.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-pt.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-rm.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-ro.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-ru.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-sk.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-sl.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-sq.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-sr-SR.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-sr.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-sv.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-ta.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-th.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-tj.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-tr.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-uk.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-vi.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-zh-CN.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-zh-HK.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/i18n/jquery.ui.datepicker-zh-TW.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/jquery-ui.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/jquery.ui.accordion.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/jquery.ui.autocomplete.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/jquery.ui.button.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/jquery.ui.core.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/jquery.ui.datepicker.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/jquery.ui.dialog.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/jquery.ui.draggable.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/jquery.ui.droppable.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/jquery.ui.effect-blind.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/jquery.ui.effect-bounce.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/jquery.ui.effect-clip.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/jquery.ui.effect-drop.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/jquery.ui.effect-explode.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/jquery.ui.effect-fade.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/jquery.ui.effect-fold.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/jquery.ui.effect-highlight.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/jquery.ui.effect-pulsate.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/jquery.ui.effect-scale.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/jquery.ui.effect-shake.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/jquery.ui.effect-slide.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/jquery.ui.effect-transfer.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/jquery.ui.effect.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/jquery.ui.menu.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/jquery.ui.mouse.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/jquery.ui.position.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/jquery.ui.progressbar.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/jquery.ui.resizable.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/jquery.ui.selectable.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/jquery.ui.slider.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/jquery.ui.sortable.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/jquery.ui.spinner.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/jquery.ui.tabs.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/jquery.ui.tooltip.min.js create mode 100755 include/jQuery/jquery-ui/ui/minified/jquery.ui.widget.min.js create mode 100755 include/jQuery/jquery.appendGrid-master/jquery.appendGrid-1.5.1.js create mode 100755 include/jQuery/jquery.appendGrid-master/jquery.appendGrid-1.5.1.min.js create mode 100755 include/jQuery/jquery.blockUI.js create mode 100644 include/jQuery/jquery.tablesorter.js create mode 100644 include/jQuery/jquery.tablesorter.pager.js create mode 100644 include/jQuery/languages.js create mode 100644 include/jQuery/numeral.js create mode 100755 include/jQuery/printerScripts.js create mode 100755 include/jQuery/tablesorter/addons/pager/jquery.tablesorter.pager.js create mode 100755 include/jQuery/tablesorter/build/ParseMaster.js create mode 100755 include/jQuery/tablesorter/build/jsmin.js create mode 100755 include/jQuery/tablesorter/build/min.js create mode 100755 include/jQuery/tablesorter/build/pack.js create mode 100755 include/jQuery/tablesorter/build/packer.js create mode 100755 include/jQuery/tablesorter/build/writeFile.js create mode 100755 include/jQuery/tablesorter/docs/js/docs.js create mode 100755 include/jQuery/tablesorter/docs/js/examples.js create mode 100755 include/jQuery/tablesorter/jquery-latest.js create mode 100755 include/jQuery/tablesorter/jquery.metadata.js create mode 100755 include/jQuery/tablesorter/jquery.tablesorter.js create mode 100755 include/jQuery/tablesorter/jquery.tablesorter.min.js create mode 100755 include/javascript/cookie.js create mode 100755 include/javascript/dashlets.js create mode 100755 include/javascript/include.js create mode 100755 include/javascript/jquery-latest.js create mode 100755 include/javascript/jquery.tablesorter.js create mode 100755 include/javascript/jsclass_async.js create mode 100755 include/javascript/jsclass_base.js create mode 100755 include/javascript/menu.js create mode 100755 include/javascript/overlibmws.js create mode 100755 include/javascript/overlibmws_iframe.js create mode 100755 include/javascript/popup_helper.js create mode 100755 include/javascript/popup_parent_helper.js create mode 100755 include/javascript/quickCompose.js create mode 100755 include/javascript/quicksearch.js create mode 100755 include/javascript/report_additionals.js create mode 100755 include/javascript/sugar_3.js create mode 100755 include/javascript/sugar_connection_event_listener.js create mode 100755 include/javascript/sugar_grp1.js create mode 100755 include/javascript/sugar_grp1_yui.js create mode 100755 include/javascript/sugar_grp_emails.js create mode 100755 include/javascript/sugar_grp_overlib.js create mode 100755 include/javascript/sugar_grp_quickcomp.js create mode 100755 include/javascript/sugar_grp_yui2.js create mode 100755 include/javascript/sugar_grp_yui_widgets.js create mode 100755 include/javascript/sugarwidgets/SugarYUILoader.js create mode 100755 include/javascript/sugarwidgets/SugarYUIWidgets.js create mode 100755 include/javascript/swfobject.js create mode 100755 include/javascript/tiny_mce/langs/en.js create mode 100755 include/javascript/tiny_mce/plugins/advhr/editor_plugin.js create mode 100755 include/javascript/tiny_mce/plugins/advhr/editor_plugin_src.js create mode 100755 include/javascript/tiny_mce/plugins/advhr/js/rule.js create mode 100755 include/javascript/tiny_mce/plugins/advhr/langs/en_dlg.js create mode 100755 include/javascript/tiny_mce/plugins/advimage/editor_plugin.js create mode 100755 include/javascript/tiny_mce/plugins/advimage/editor_plugin_src.js create mode 100755 include/javascript/tiny_mce/plugins/advimage/js/image.js create mode 100755 include/javascript/tiny_mce/plugins/advimage/langs/en_dlg.js create mode 100755 include/javascript/tiny_mce/plugins/advlink/editor_plugin.js create mode 100755 include/javascript/tiny_mce/plugins/advlink/editor_plugin_src.js create mode 100755 include/javascript/tiny_mce/plugins/advlink/js/advlink.js create mode 100755 include/javascript/tiny_mce/plugins/advlink/langs/en_dlg.js create mode 100755 include/javascript/tiny_mce/plugins/autosave/editor_plugin.js create mode 100755 include/javascript/tiny_mce/plugins/autosave/editor_plugin_src.js create mode 100755 include/javascript/tiny_mce/plugins/bbcode/editor_plugin.js create mode 100755 include/javascript/tiny_mce/plugins/bbcode/editor_plugin_src.js create mode 100755 include/javascript/tiny_mce/plugins/compat2x/editor_plugin.js create mode 100755 include/javascript/tiny_mce/plugins/compat2x/editor_plugin_src.js create mode 100755 include/javascript/tiny_mce/plugins/contextmenu/editor_plugin.js create mode 100755 include/javascript/tiny_mce/plugins/contextmenu/editor_plugin_src.js create mode 100755 include/javascript/tiny_mce/plugins/directionality/editor_plugin.js create mode 100755 include/javascript/tiny_mce/plugins/directionality/editor_plugin_src.js create mode 100755 include/javascript/tiny_mce/plugins/emotions/editor_plugin.js create mode 100755 include/javascript/tiny_mce/plugins/emotions/editor_plugin_src.js create mode 100755 include/javascript/tiny_mce/plugins/emotions/js/emotions.js create mode 100755 include/javascript/tiny_mce/plugins/emotions/langs/en_dlg.js create mode 100755 include/javascript/tiny_mce/plugins/example/editor_plugin.js create mode 100755 include/javascript/tiny_mce/plugins/example/editor_plugin_src.js create mode 100755 include/javascript/tiny_mce/plugins/example/js/dialog.js create mode 100755 include/javascript/tiny_mce/plugins/example/langs/en.js create mode 100755 include/javascript/tiny_mce/plugins/example/langs/en_dlg.js create mode 100755 include/javascript/tiny_mce/plugins/fullpage/editor_plugin.js create mode 100755 include/javascript/tiny_mce/plugins/fullpage/editor_plugin_src.js create mode 100755 include/javascript/tiny_mce/plugins/fullpage/js/fullpage.js create mode 100755 include/javascript/tiny_mce/plugins/fullpage/langs/en_dlg.js create mode 100755 include/javascript/tiny_mce/plugins/fullscreen/editor_plugin.js create mode 100755 include/javascript/tiny_mce/plugins/fullscreen/editor_plugin_src.js create mode 100755 include/javascript/tiny_mce/plugins/iespell/editor_plugin.js create mode 100755 include/javascript/tiny_mce/plugins/iespell/editor_plugin_src.js create mode 100755 include/javascript/tiny_mce/plugins/inlinepopups/editor_plugin.js create mode 100755 include/javascript/tiny_mce/plugins/inlinepopups/editor_plugin_src.js create mode 100755 include/javascript/tiny_mce/plugins/insertdatetime/editor_plugin.js create mode 100755 include/javascript/tiny_mce/plugins/insertdatetime/editor_plugin_src.js create mode 100755 include/javascript/tiny_mce/plugins/layer/editor_plugin.js create mode 100755 include/javascript/tiny_mce/plugins/layer/editor_plugin_src.js create mode 100755 include/javascript/tiny_mce/plugins/media/editor_plugin.js create mode 100755 include/javascript/tiny_mce/plugins/media/editor_plugin_src.js create mode 100755 include/javascript/tiny_mce/plugins/media/js/embed.js create mode 100755 include/javascript/tiny_mce/plugins/media/js/media.js create mode 100755 include/javascript/tiny_mce/plugins/media/langs/en_dlg.js create mode 100755 include/javascript/tiny_mce/plugins/nonbreaking/editor_plugin.js create mode 100755 include/javascript/tiny_mce/plugins/nonbreaking/editor_plugin_src.js create mode 100755 include/javascript/tiny_mce/plugins/noneditable/editor_plugin.js create mode 100755 include/javascript/tiny_mce/plugins/noneditable/editor_plugin_src.js create mode 100755 include/javascript/tiny_mce/plugins/pagebreak/editor_plugin.js create mode 100755 include/javascript/tiny_mce/plugins/pagebreak/editor_plugin_src.js create mode 100755 include/javascript/tiny_mce/plugins/paste/editor_plugin.js create mode 100755 include/javascript/tiny_mce/plugins/paste/editor_plugin_src.js create mode 100755 include/javascript/tiny_mce/plugins/paste/js/pastetext.js create mode 100755 include/javascript/tiny_mce/plugins/paste/js/pasteword.js create mode 100755 include/javascript/tiny_mce/plugins/paste/langs/en_dlg.js create mode 100755 include/javascript/tiny_mce/plugins/preview/editor_plugin.js create mode 100755 include/javascript/tiny_mce/plugins/preview/editor_plugin_src.js create mode 100755 include/javascript/tiny_mce/plugins/preview/jscripts/embed.js create mode 100755 include/javascript/tiny_mce/plugins/print/editor_plugin.js create mode 100755 include/javascript/tiny_mce/plugins/print/editor_plugin_src.js create mode 100755 include/javascript/tiny_mce/plugins/safari/editor_plugin.js create mode 100755 include/javascript/tiny_mce/plugins/safari/editor_plugin_src.js create mode 100755 include/javascript/tiny_mce/plugins/save/editor_plugin.js create mode 100755 include/javascript/tiny_mce/plugins/save/editor_plugin_src.js create mode 100755 include/javascript/tiny_mce/plugins/searchreplace/editor_plugin.js create mode 100755 include/javascript/tiny_mce/plugins/searchreplace/editor_plugin_src.js create mode 100755 include/javascript/tiny_mce/plugins/searchreplace/js/searchreplace.js create mode 100755 include/javascript/tiny_mce/plugins/searchreplace/langs/en_dlg.js create mode 100755 include/javascript/tiny_mce/plugins/spellchecker/editor_plugin.js create mode 100755 include/javascript/tiny_mce/plugins/spellchecker/editor_plugin_src.js create mode 100755 include/javascript/tiny_mce/plugins/style/editor_plugin.js create mode 100755 include/javascript/tiny_mce/plugins/style/editor_plugin_src.js create mode 100755 include/javascript/tiny_mce/plugins/style/js/props.js create mode 100755 include/javascript/tiny_mce/plugins/style/langs/en_dlg.js create mode 100755 include/javascript/tiny_mce/plugins/table/editor_plugin.js create mode 100755 include/javascript/tiny_mce/plugins/table/editor_plugin_src.js create mode 100755 include/javascript/tiny_mce/plugins/table/js/cell.js create mode 100755 include/javascript/tiny_mce/plugins/table/js/merge_cells.js create mode 100755 include/javascript/tiny_mce/plugins/table/js/row.js create mode 100755 include/javascript/tiny_mce/plugins/table/js/table.js create mode 100755 include/javascript/tiny_mce/plugins/table/langs/en_dlg.js create mode 100755 include/javascript/tiny_mce/plugins/template/editor_plugin.js create mode 100755 include/javascript/tiny_mce/plugins/template/editor_plugin_src.js create mode 100755 include/javascript/tiny_mce/plugins/template/js/template.js create mode 100755 include/javascript/tiny_mce/plugins/template/langs/en_dlg.js create mode 100755 include/javascript/tiny_mce/plugins/visualchars/editor_plugin.js create mode 100755 include/javascript/tiny_mce/plugins/visualchars/editor_plugin_src.js create mode 100755 include/javascript/tiny_mce/plugins/xhtmlxtras/editor_plugin.js create mode 100755 include/javascript/tiny_mce/plugins/xhtmlxtras/editor_plugin_src.js create mode 100755 include/javascript/tiny_mce/plugins/xhtmlxtras/js/abbr.js create mode 100755 include/javascript/tiny_mce/plugins/xhtmlxtras/js/acronym.js create mode 100755 include/javascript/tiny_mce/plugins/xhtmlxtras/js/attributes.js create mode 100755 include/javascript/tiny_mce/plugins/xhtmlxtras/js/cite.js create mode 100755 include/javascript/tiny_mce/plugins/xhtmlxtras/js/del.js create mode 100755 include/javascript/tiny_mce/plugins/xhtmlxtras/js/element_common.js create mode 100755 include/javascript/tiny_mce/plugins/xhtmlxtras/js/ins.js create mode 100755 include/javascript/tiny_mce/plugins/xhtmlxtras/langs/en_dlg.js create mode 100755 include/javascript/tiny_mce/themes/advanced/editor_template.js create mode 100755 include/javascript/tiny_mce/themes/advanced/editor_template_src.js create mode 100755 include/javascript/tiny_mce/themes/advanced/js/about.js create mode 100755 include/javascript/tiny_mce/themes/advanced/js/anchor.js create mode 100755 include/javascript/tiny_mce/themes/advanced/js/charmap.js create mode 100755 include/javascript/tiny_mce/themes/advanced/js/color_picker.js create mode 100755 include/javascript/tiny_mce/themes/advanced/js/image.js create mode 100755 include/javascript/tiny_mce/themes/advanced/js/link.js create mode 100755 include/javascript/tiny_mce/themes/advanced/js/source_editor.js create mode 100755 include/javascript/tiny_mce/themes/advanced/langs/en.js create mode 100755 include/javascript/tiny_mce/themes/advanced/langs/en_dlg.js create mode 100755 include/javascript/tiny_mce/themes/simple/editor_template.js create mode 100755 include/javascript/tiny_mce/themes/simple/editor_template_src.js create mode 100755 include/javascript/tiny_mce/themes/simple/langs/en.js create mode 100755 include/javascript/tiny_mce/tiny_mce.js create mode 100755 include/javascript/tiny_mce/tiny_mce_popup.js create mode 100755 include/javascript/tiny_mce/tiny_mce_src.js create mode 100755 include/javascript/tiny_mce/utils/editable_selects.js create mode 100755 include/javascript/tiny_mce/utils/form_utils.js create mode 100755 include/javascript/tiny_mce/utils/mctabs.js create mode 100755 include/javascript/tiny_mce/utils/validate.js create mode 100755 include/javascript/yui/build/animation/animation-min.js create mode 100755 include/javascript/yui/build/animation/animation.js create mode 100755 include/javascript/yui/build/autocomplete/autocomplete-min.js create mode 100755 include/javascript/yui/build/autocomplete/autocomplete.js create mode 100755 include/javascript/yui/build/button/button-min.js create mode 100755 include/javascript/yui/build/button/button.js create mode 100755 include/javascript/yui/build/calendar/calendar-min.js create mode 100755 include/javascript/yui/build/calendar/calendar.js create mode 100755 include/javascript/yui/build/carousel/carousel-min.js create mode 100755 include/javascript/yui/build/carousel/carousel.js create mode 100755 include/javascript/yui/build/charts/charts-min.js create mode 100755 include/javascript/yui/build/charts/charts.js create mode 100755 include/javascript/yui/build/colorpicker/colorpicker-min.js create mode 100755 include/javascript/yui/build/colorpicker/colorpicker.js create mode 100755 include/javascript/yui/build/connection/connection-min.js create mode 100755 include/javascript/yui/build/connection/connection.js create mode 100755 include/javascript/yui/build/connection/connection_core-debug.js create mode 100755 include/javascript/yui/build/connection/connection_core-min.js create mode 100755 include/javascript/yui/build/connection/connection_core.js create mode 100755 include/javascript/yui/build/container/container-min.js create mode 100755 include/javascript/yui/build/container/container.js create mode 100755 include/javascript/yui/build/container/container_core-min.js create mode 100755 include/javascript/yui/build/cookie/cookie-min.js create mode 100755 include/javascript/yui/build/cookie/cookie.js create mode 100755 include/javascript/yui/build/datasource/datasource-min.js create mode 100755 include/javascript/yui/build/datasource/datasource.js create mode 100755 include/javascript/yui/build/datatable/datatable-min.js create mode 100755 include/javascript/yui/build/datatable/datatable.js create mode 100755 include/javascript/yui/build/datemath/datemath-debug.js create mode 100755 include/javascript/yui/build/datemath/datemath-min.js create mode 100755 include/javascript/yui/build/datemath/datemath.js create mode 100755 include/javascript/yui/build/dom/dom-min.js create mode 100755 include/javascript/yui/build/dom/dom.js create mode 100755 include/javascript/yui/build/dragdrop/dragdrop-min.js create mode 100755 include/javascript/yui/build/dragdrop/dragdrop.js create mode 100755 include/javascript/yui/build/editor/editor-min.js create mode 100755 include/javascript/yui/build/editor/editor.js create mode 100755 include/javascript/yui/build/editor/simpleeditor-min.js create mode 100755 include/javascript/yui/build/editor/simpleeditor.js create mode 100755 include/javascript/yui/build/element-delegate/element-delegate-debug.js create mode 100755 include/javascript/yui/build/element-delegate/element-delegate-min.js create mode 100755 include/javascript/yui/build/element-delegate/element-delegate.js create mode 100755 include/javascript/yui/build/element/element-min.js create mode 100755 include/javascript/yui/build/element/element.js create mode 100755 include/javascript/yui/build/event-delegate/event-delegate-debug.js create mode 100755 include/javascript/yui/build/event-delegate/event-delegate-min.js create mode 100755 include/javascript/yui/build/event-delegate/event-delegate.js create mode 100755 include/javascript/yui/build/event-mouseenter/event-mouseenter-debug.js create mode 100755 include/javascript/yui/build/event-mouseenter/event-mouseenter-min.js create mode 100755 include/javascript/yui/build/event-mouseenter/event-mouseenter.js create mode 100755 include/javascript/yui/build/event-simulate/event-simulate-debug.js create mode 100755 include/javascript/yui/build/event-simulate/event-simulate-min.js create mode 100755 include/javascript/yui/build/event-simulate/event-simulate.js create mode 100755 include/javascript/yui/build/event/event-min.js create mode 100755 include/javascript/yui/build/event/event.js create mode 100755 include/javascript/yui/build/get/get-min.js create mode 100755 include/javascript/yui/build/get/get.js create mode 100755 include/javascript/yui/build/history/history-min.js create mode 100755 include/javascript/yui/build/history/history.js create mode 100755 include/javascript/yui/build/imagecropper/imagecropper-min.js create mode 100755 include/javascript/yui/build/imagecropper/imagecropper.js create mode 100755 include/javascript/yui/build/imageloader/imageloader-min.js create mode 100755 include/javascript/yui/build/imageloader/imageloader.js create mode 100755 include/javascript/yui/build/json/json-min.js create mode 100755 include/javascript/yui/build/json/json.js create mode 100755 include/javascript/yui/build/layout/layout-min.js create mode 100755 include/javascript/yui/build/layout/layout.js create mode 100755 include/javascript/yui/build/logger/logger-min.js create mode 100755 include/javascript/yui/build/logger/logger.js create mode 100755 include/javascript/yui/build/menu/menu-min.js create mode 100755 include/javascript/yui/build/menu/menu.js create mode 100755 include/javascript/yui/build/paginator/paginator-min.js create mode 100755 include/javascript/yui/build/paginator/paginator.js create mode 100755 include/javascript/yui/build/profiler/profiler-min.js create mode 100755 include/javascript/yui/build/profiler/profiler.js create mode 100755 include/javascript/yui/build/profilerviewer/profilerviewer-min.js create mode 100755 include/javascript/yui/build/profilerviewer/profilerviewer.js create mode 100755 include/javascript/yui/build/progressbar/progressbar-debug.js create mode 100755 include/javascript/yui/build/progressbar/progressbar-min.js create mode 100755 include/javascript/yui/build/progressbar/progressbar.js create mode 100755 include/javascript/yui/build/resize/resize-min.js create mode 100755 include/javascript/yui/build/resize/resize.js create mode 100755 include/javascript/yui/build/selector/selector-min.js create mode 100755 include/javascript/yui/build/selector/selector.js create mode 100755 include/javascript/yui/build/slider/slider-min.js create mode 100755 include/javascript/yui/build/slider/slider.js create mode 100755 include/javascript/yui/build/storage/storage-debug.js create mode 100755 include/javascript/yui/build/storage/storage-min.js create mode 100755 include/javascript/yui/build/storage/storage.js create mode 100755 include/javascript/yui/build/stylesheet/stylesheet-debug.js create mode 100755 include/javascript/yui/build/stylesheet/stylesheet-min.js create mode 100755 include/javascript/yui/build/stylesheet/stylesheet.js create mode 100755 include/javascript/yui/build/swf/swf-debug.js create mode 100755 include/javascript/yui/build/swf/swf-min.js create mode 100755 include/javascript/yui/build/swf/swf.js create mode 100755 include/javascript/yui/build/swfdetect/swfdetect-debug.js create mode 100755 include/javascript/yui/build/swfdetect/swfdetect-min.js create mode 100755 include/javascript/yui/build/swfdetect/swfdetect.js create mode 100755 include/javascript/yui/build/swfstore/swf.js create mode 100755 include/javascript/yui/build/swfstore/swfstore-debug.js create mode 100755 include/javascript/yui/build/swfstore/swfstore-min.js create mode 100755 include/javascript/yui/build/swfstore/swfstore.js create mode 100755 include/javascript/yui/build/tabview/tabview-min.js create mode 100755 include/javascript/yui/build/tabview/tabview.js create mode 100755 include/javascript/yui/build/treeview/treeview-min.js create mode 100755 include/javascript/yui/build/treeview/treeview.js create mode 100755 include/javascript/yui/build/uploader/uploader-min.js create mode 100755 include/javascript/yui/build/uploader/uploader.js create mode 100755 include/javascript/yui/build/utilities/utilities.js create mode 100755 include/javascript/yui/build/yahoo-dom-event/yahoo-dom-event.js create mode 100755 include/javascript/yui/build/yahoo/yahoo-min.js create mode 100755 include/javascript/yui/build/yahoo/yahoo.js create mode 100755 include/javascript/yui/build/yuiloader-dom-event/yuiloader-dom-event.js create mode 100755 include/javascript/yui/build/yuiloader/yuiloader-min.js create mode 100755 include/javascript/yui/build/yuiloader/yuiloader.js create mode 100755 include/javascript/yui/build/yuitest/yuitest-min.js create mode 100755 include/javascript/yui/build/yuitest/yuitest.js create mode 100755 include/javascript/yui/build/yuitest/yuitest_core-min.js create mode 100755 include/javascript/yui/build/yuitest/yuitest_core.js create mode 100755 include/javascript/yui/ext/yui-ext.js create mode 100755 include/javascript/yui/ygDDList.js create mode 100755 include/javascript/yui3/assets/dpSyntaxHighlighter.js create mode 100755 include/javascript/yui3/assets/syntax.js create mode 100755 include/javascript/yui3/build/anim/anim-base-min.js create mode 100755 include/javascript/yui3/build/anim/anim-base.js create mode 100755 include/javascript/yui3/build/anim/anim-color-min.js create mode 100755 include/javascript/yui3/build/anim/anim-color.js create mode 100755 include/javascript/yui3/build/anim/anim-curve-min.js create mode 100755 include/javascript/yui3/build/anim/anim-curve.js create mode 100755 include/javascript/yui3/build/anim/anim-easing-min.js create mode 100755 include/javascript/yui3/build/anim/anim-easing.js create mode 100755 include/javascript/yui3/build/anim/anim-min.js create mode 100755 include/javascript/yui3/build/anim/anim-node-plugin-min.js create mode 100755 include/javascript/yui3/build/anim/anim-node-plugin.js create mode 100755 include/javascript/yui3/build/anim/anim-scroll-min.js create mode 100755 include/javascript/yui3/build/anim/anim-scroll.js create mode 100755 include/javascript/yui3/build/anim/anim-xy-min.js create mode 100755 include/javascript/yui3/build/anim/anim-xy.js create mode 100755 include/javascript/yui3/build/anim/anim.js create mode 100755 include/javascript/yui3/build/async-queue/async-queue-min.js create mode 100755 include/javascript/yui3/build/async-queue/async-queue.js create mode 100755 include/javascript/yui3/build/attribute/attribute-base-min.js create mode 100755 include/javascript/yui3/build/attribute/attribute-base.js create mode 100755 include/javascript/yui3/build/attribute/attribute-complex-min.js create mode 100755 include/javascript/yui3/build/attribute/attribute-complex.js create mode 100755 include/javascript/yui3/build/attribute/attribute-min.js create mode 100755 include/javascript/yui3/build/attribute/attribute.js create mode 100755 include/javascript/yui3/build/base/base-base-min.js create mode 100755 include/javascript/yui3/build/base/base-base.js create mode 100755 include/javascript/yui3/build/base/base-build-min.js create mode 100755 include/javascript/yui3/build/base/base-build.js create mode 100755 include/javascript/yui3/build/base/base-min.js create mode 100755 include/javascript/yui3/build/base/base-pluginhost-min.js create mode 100755 include/javascript/yui3/build/base/base-pluginhost.js create mode 100755 include/javascript/yui3/build/base/base.js create mode 100755 include/javascript/yui3/build/classnamemanager/classnamemanager-min.js create mode 100755 include/javascript/yui3/build/classnamemanager/classnamemanager.js create mode 100755 include/javascript/yui3/build/collection/collection-min.js create mode 100755 include/javascript/yui3/build/collection/collection.js create mode 100755 include/javascript/yui3/build/compat/compat-min.js create mode 100755 include/javascript/yui3/build/compat/compat.js create mode 100755 include/javascript/yui3/build/console/console-filters-min.js create mode 100755 include/javascript/yui3/build/console/console-filters.js create mode 100755 include/javascript/yui3/build/console/console-min.js create mode 100755 include/javascript/yui3/build/console/console.js create mode 100755 include/javascript/yui3/build/cookie/cookie-min.js create mode 100755 include/javascript/yui3/build/cookie/cookie.js create mode 100755 include/javascript/yui3/build/dataschema/dataschema-array-min.js create mode 100755 include/javascript/yui3/build/dataschema/dataschema-array.js create mode 100755 include/javascript/yui3/build/dataschema/dataschema-base-min.js create mode 100755 include/javascript/yui3/build/dataschema/dataschema-base.js create mode 100755 include/javascript/yui3/build/dataschema/dataschema-json-min.js create mode 100755 include/javascript/yui3/build/dataschema/dataschema-json.js create mode 100755 include/javascript/yui3/build/dataschema/dataschema-min.js create mode 100755 include/javascript/yui3/build/dataschema/dataschema-text-min.js create mode 100755 include/javascript/yui3/build/dataschema/dataschema-text.js create mode 100755 include/javascript/yui3/build/dataschema/dataschema-xml-min.js create mode 100755 include/javascript/yui3/build/dataschema/dataschema-xml.js create mode 100755 include/javascript/yui3/build/dataschema/dataschema.js create mode 100755 include/javascript/yui3/build/datasource/datasource-arrayschema-min.js create mode 100755 include/javascript/yui3/build/datasource/datasource-arrayschema.js create mode 100755 include/javascript/yui3/build/datasource/datasource-cache-min.js create mode 100755 include/javascript/yui3/build/datasource/datasource-cache.js create mode 100755 include/javascript/yui3/build/datasource/datasource-function-min.js create mode 100755 include/javascript/yui3/build/datasource/datasource-function.js create mode 100755 include/javascript/yui3/build/datasource/datasource-get-min.js create mode 100755 include/javascript/yui3/build/datasource/datasource-get.js create mode 100755 include/javascript/yui3/build/datasource/datasource-io-min.js create mode 100755 include/javascript/yui3/build/datasource/datasource-io.js create mode 100755 include/javascript/yui3/build/datasource/datasource-jsonschema-min.js create mode 100755 include/javascript/yui3/build/datasource/datasource-jsonschema.js create mode 100755 include/javascript/yui3/build/datasource/datasource-local-min.js create mode 100755 include/javascript/yui3/build/datasource/datasource-local.js create mode 100755 include/javascript/yui3/build/datasource/datasource-min.js create mode 100755 include/javascript/yui3/build/datasource/datasource-polling-min.js create mode 100755 include/javascript/yui3/build/datasource/datasource-polling.js create mode 100755 include/javascript/yui3/build/datasource/datasource-textschema-min.js create mode 100755 include/javascript/yui3/build/datasource/datasource-textschema.js create mode 100755 include/javascript/yui3/build/datasource/datasource-xmlschema-min.js create mode 100755 include/javascript/yui3/build/datasource/datasource-xmlschema.js create mode 100755 include/javascript/yui3/build/datasource/datasource.js create mode 100755 include/javascript/yui3/build/datatype/datatype-date-format-min.js create mode 100755 include/javascript/yui3/build/datatype/datatype-date-format.js create mode 100755 include/javascript/yui3/build/datatype/datatype-date-min.js create mode 100755 include/javascript/yui3/build/datatype/datatype-date-parse-min.js create mode 100755 include/javascript/yui3/build/datatype/datatype-date-parse.js create mode 100755 include/javascript/yui3/build/datatype/datatype-date.js create mode 100755 include/javascript/yui3/build/datatype/datatype-min.js create mode 100755 include/javascript/yui3/build/datatype/datatype-number-format-min.js create mode 100755 include/javascript/yui3/build/datatype/datatype-number-format.js create mode 100755 include/javascript/yui3/build/datatype/datatype-number-min.js create mode 100755 include/javascript/yui3/build/datatype/datatype-number-parse-min.js create mode 100755 include/javascript/yui3/build/datatype/datatype-number-parse.js create mode 100755 include/javascript/yui3/build/datatype/datatype-number.js create mode 100755 include/javascript/yui3/build/datatype/datatype-xml-format-min.js create mode 100755 include/javascript/yui3/build/datatype/datatype-xml-format.js create mode 100755 include/javascript/yui3/build/datatype/datatype-xml-min.js create mode 100755 include/javascript/yui3/build/datatype/datatype-xml-parse-min.js create mode 100755 include/javascript/yui3/build/datatype/datatype-xml-parse.js create mode 100755 include/javascript/yui3/build/datatype/datatype-xml.js create mode 100755 include/javascript/yui3/build/datatype/datatype.js create mode 100755 include/javascript/yui3/build/dd/dd-constrain-min.js create mode 100755 include/javascript/yui3/build/dd/dd-constrain.js create mode 100755 include/javascript/yui3/build/dd/dd-ddm-base-min.js create mode 100755 include/javascript/yui3/build/dd/dd-ddm-base.js create mode 100755 include/javascript/yui3/build/dd/dd-ddm-drop-min.js create mode 100755 include/javascript/yui3/build/dd/dd-ddm-drop.js create mode 100755 include/javascript/yui3/build/dd/dd-ddm-min.js create mode 100755 include/javascript/yui3/build/dd/dd-ddm.js create mode 100755 include/javascript/yui3/build/dd/dd-drag-min.js create mode 100755 include/javascript/yui3/build/dd/dd-drag.js create mode 100755 include/javascript/yui3/build/dd/dd-drop-min.js create mode 100755 include/javascript/yui3/build/dd/dd-drop-plugin-min.js create mode 100755 include/javascript/yui3/build/dd/dd-drop-plugin.js create mode 100755 include/javascript/yui3/build/dd/dd-drop.js create mode 100755 include/javascript/yui3/build/dd/dd-min.js create mode 100755 include/javascript/yui3/build/dd/dd-plugin-min.js create mode 100755 include/javascript/yui3/build/dd/dd-plugin.js create mode 100755 include/javascript/yui3/build/dd/dd-proxy-min.js create mode 100755 include/javascript/yui3/build/dd/dd-proxy.js create mode 100755 include/javascript/yui3/build/dd/dd-scroll-min.js create mode 100755 include/javascript/yui3/build/dd/dd-scroll.js create mode 100755 include/javascript/yui3/build/dd/dd.js create mode 100755 include/javascript/yui3/build/dom/dom-base-min.js create mode 100755 include/javascript/yui3/build/dom/dom-base.js create mode 100755 include/javascript/yui3/build/dom/dom-min.js create mode 100755 include/javascript/yui3/build/dom/dom-screen-min.js create mode 100755 include/javascript/yui3/build/dom/dom-screen.js create mode 100755 include/javascript/yui3/build/dom/dom-style-min.js create mode 100755 include/javascript/yui3/build/dom/dom-style.js create mode 100755 include/javascript/yui3/build/dom/dom.js create mode 100755 include/javascript/yui3/build/dom/selector-css2-min.js create mode 100755 include/javascript/yui3/build/dom/selector-css2.js create mode 100755 include/javascript/yui3/build/dom/selector-css3-min.js create mode 100755 include/javascript/yui3/build/dom/selector-css3.js create mode 100755 include/javascript/yui3/build/dom/selector-min.js create mode 100755 include/javascript/yui3/build/dom/selector-native-min.js create mode 100755 include/javascript/yui3/build/dom/selector-native.js create mode 100755 include/javascript/yui3/build/dom/selector.js create mode 100755 include/javascript/yui3/build/dump/dump-min.js create mode 100755 include/javascript/yui3/build/dump/dump.js create mode 100755 include/javascript/yui3/build/event-custom/event-custom-base-min.js create mode 100755 include/javascript/yui3/build/event-custom/event-custom-base.js create mode 100755 include/javascript/yui3/build/event-custom/event-custom-complex-min.js create mode 100755 include/javascript/yui3/build/event-custom/event-custom-complex.js create mode 100755 include/javascript/yui3/build/event-custom/event-custom-min.js create mode 100755 include/javascript/yui3/build/event-custom/event-custom.js create mode 100755 include/javascript/yui3/build/event-simulate/event-simulate-min.js create mode 100755 include/javascript/yui3/build/event-simulate/event-simulate.js create mode 100755 include/javascript/yui3/build/event/event-base-min.js create mode 100755 include/javascript/yui3/build/event/event-base.js create mode 100755 include/javascript/yui3/build/event/event-delegate-min.js create mode 100755 include/javascript/yui3/build/event/event-delegate.js create mode 100755 include/javascript/yui3/build/event/event-focus-min.js create mode 100755 include/javascript/yui3/build/event/event-focus.js create mode 100755 include/javascript/yui3/build/event/event-key-min.js create mode 100755 include/javascript/yui3/build/event/event-key.js create mode 100755 include/javascript/yui3/build/event/event-min.js create mode 100755 include/javascript/yui3/build/event/event-mouseenter-min.js create mode 100755 include/javascript/yui3/build/event/event-mouseenter.js create mode 100755 include/javascript/yui3/build/event/event-mousewheel-min.js create mode 100755 include/javascript/yui3/build/event/event-mousewheel.js create mode 100755 include/javascript/yui3/build/event/event-resize-min.js create mode 100755 include/javascript/yui3/build/event/event-resize.js create mode 100755 include/javascript/yui3/build/event/event.js create mode 100755 include/javascript/yui3/build/get/get-min.js create mode 100755 include/javascript/yui3/build/get/get.js create mode 100755 include/javascript/yui3/build/history/history-min.js create mode 100755 include/javascript/yui3/build/history/history.js create mode 100755 include/javascript/yui3/build/imageloader/imageloader-min.js create mode 100755 include/javascript/yui3/build/imageloader/imageloader.js create mode 100755 include/javascript/yui3/build/io/io-base-min.js create mode 100755 include/javascript/yui3/build/io/io-base.js create mode 100755 include/javascript/yui3/build/io/io-form-min.js create mode 100755 include/javascript/yui3/build/io/io-form.js create mode 100755 include/javascript/yui3/build/io/io-min.js create mode 100755 include/javascript/yui3/build/io/io-queue-min.js create mode 100755 include/javascript/yui3/build/io/io-queue.js create mode 100755 include/javascript/yui3/build/io/io-upload-iframe-min.js create mode 100755 include/javascript/yui3/build/io/io-upload-iframe.js create mode 100755 include/javascript/yui3/build/io/io-xdr-min.js create mode 100755 include/javascript/yui3/build/io/io-xdr.js create mode 100755 include/javascript/yui3/build/io/io.js create mode 100755 include/javascript/yui3/build/json/json-min.js create mode 100755 include/javascript/yui3/build/json/json-parse-min.js create mode 100755 include/javascript/yui3/build/json/json-parse.js create mode 100755 include/javascript/yui3/build/json/json-stringify-min.js create mode 100755 include/javascript/yui3/build/json/json-stringify.js create mode 100755 include/javascript/yui3/build/json/json.js create mode 100755 include/javascript/yui3/build/loader/loader-min.js create mode 100755 include/javascript/yui3/build/loader/loader.js create mode 100755 include/javascript/yui3/build/node-focusmanager/node-focusmanager-min.js create mode 100755 include/javascript/yui3/build/node-focusmanager/node-focusmanager.js create mode 100755 include/javascript/yui3/build/node-menunav/node-menunav-min.js create mode 100755 include/javascript/yui3/build/node-menunav/node-menunav.js create mode 100755 include/javascript/yui3/build/node/node-aria-min.js create mode 100755 include/javascript/yui3/build/node/node-aria.js create mode 100755 include/javascript/yui3/build/node/node-base-min.js create mode 100755 include/javascript/yui3/build/node/node-base.js create mode 100755 include/javascript/yui3/build/node/node-event-delegate-min.js create mode 100755 include/javascript/yui3/build/node/node-event-delegate.js create mode 100755 include/javascript/yui3/build/node/node-event-simulate-min.js create mode 100755 include/javascript/yui3/build/node/node-event-simulate.js create mode 100755 include/javascript/yui3/build/node/node-min.js create mode 100755 include/javascript/yui3/build/node/node-pluginhost-min.js create mode 100755 include/javascript/yui3/build/node/node-pluginhost.js create mode 100755 include/javascript/yui3/build/node/node-screen-min.js create mode 100755 include/javascript/yui3/build/node/node-screen.js create mode 100755 include/javascript/yui3/build/node/node-style-min.js create mode 100755 include/javascript/yui3/build/node/node-style.js create mode 100755 include/javascript/yui3/build/node/node.js create mode 100755 include/javascript/yui3/build/oop/oop-min.js create mode 100755 include/javascript/yui3/build/oop/oop.js create mode 100755 include/javascript/yui3/build/overlay/overlay-min.js create mode 100755 include/javascript/yui3/build/overlay/overlay.js create mode 100755 include/javascript/yui3/build/plugin/plugin-min.js create mode 100755 include/javascript/yui3/build/plugin/plugin.js create mode 100755 include/javascript/yui3/build/pluginhost/pluginhost-min.js create mode 100755 include/javascript/yui3/build/pluginhost/pluginhost.js create mode 100755 include/javascript/yui3/build/profiler/profiler-min.js create mode 100755 include/javascript/yui3/build/profiler/profiler.js create mode 100755 include/javascript/yui3/build/queue-promote/queue-promote-min.js create mode 100755 include/javascript/yui3/build/queue-promote/queue-promote.js create mode 100755 include/javascript/yui3/build/slider/slider-min.js create mode 100755 include/javascript/yui3/build/slider/slider.js create mode 100755 include/javascript/yui3/build/stylesheet/stylesheet-min.js create mode 100755 include/javascript/yui3/build/stylesheet/stylesheet.js create mode 100755 include/javascript/yui3/build/substitute/substitute-min.js create mode 100755 include/javascript/yui3/build/substitute/substitute.js create mode 100755 include/javascript/yui3/build/test/test-min.js create mode 100755 include/javascript/yui3/build/test/test.js create mode 100755 include/javascript/yui3/build/widget/widget-min.js create mode 100755 include/javascript/yui3/build/widget/widget-position-ext-min.js create mode 100755 include/javascript/yui3/build/widget/widget-position-ext.js create mode 100755 include/javascript/yui3/build/widget/widget-position-min.js create mode 100755 include/javascript/yui3/build/widget/widget-position.js create mode 100755 include/javascript/yui3/build/widget/widget-stack-min.js create mode 100755 include/javascript/yui3/build/widget/widget-stack.js create mode 100755 include/javascript/yui3/build/widget/widget-stdmod-min.js create mode 100755 include/javascript/yui3/build/widget/widget-stdmod.js create mode 100755 include/javascript/yui3/build/widget/widget.js create mode 100755 include/javascript/yui3/build/yui-base/yui-base-min.js create mode 100755 include/javascript/yui3/build/yui-base/yui-base.js create mode 100755 include/javascript/yui3/build/yui/get-min.js create mode 100755 include/javascript/yui3/build/yui/get.js create mode 100755 include/javascript/yui3/build/yui/yui-base-min.js create mode 100755 include/javascript/yui3/build/yui/yui-base.js create mode 100755 include/javascript/yui3/build/yui/yui-later-min.js create mode 100755 include/javascript/yui3/build/yui/yui-later.js create mode 100755 include/javascript/yui3/build/yui/yui-log-min.js create mode 100755 include/javascript/yui3/build/yui/yui-log.js create mode 100755 include/javascript/yui3/build/yui/yui-min.js create mode 100755 include/javascript/yui3/build/yui/yui.js create mode 100755 include/jsolait/init.js create mode 100755 include/jsolait/lib/codecs.js create mode 100755 include/jsolait/lib/crypto.js create mode 100755 include/jsolait/lib/jsonrpc.js create mode 100755 include/jsolait/lib/jsonrpclite.js create mode 100755 include/jsolait/lib/lang.js create mode 100755 include/jsolait/lib/langlite.js create mode 100755 include/jsolait/lib/urllib.js create mode 100755 include/jsolait/lib/xml.js create mode 100755 include/jsolait/lib/xmlrpc.js create mode 100755 include/jsolait/missingmixin.js create mode 100755 include/mailer/examples/scripts/XRegExp.js create mode 100755 include/mailer/examples/scripts/shAutoloader.js create mode 100755 include/mailer/examples/scripts/shBrushPhp.js create mode 100755 include/mailer/examples/scripts/shCore.js create mode 100755 include/mailer/examples/scripts/shLegacy.js create mode 100644 include/phpMailer2/examples/scripts/XRegExp.js create mode 100644 include/phpMailer2/examples/scripts/shAutoloader.js create mode 100644 include/phpMailer2/examples/scripts/shBrushPhp.js create mode 100644 include/phpMailer2/examples/scripts/shCore.js create mode 100644 include/phpMailer2/examples/scripts/shLegacy.js create mode 100755 include/ytree/TreeView/HTMLNode.js create mode 100755 include/ytree/TreeView/MenuNode.js create mode 100755 include/ytree/TreeView/Node.js create mode 100755 include/ytree/TreeView/RootNode.js create mode 100755 include/ytree/TreeView/TaskNode.js create mode 100755 include/ytree/TreeView/TextNode.js create mode 100755 include/ytree/TreeView/TreeView.js create mode 100755 include/ytree/TreeView/anim/TVAnim.js create mode 100755 include/ytree/TreeView/anim/TVFadeIn.js create mode 100755 include/ytree/TreeView/anim/TVFadeOut.js create mode 100755 include/ytree/treeutil.js create mode 100755 install/dbConfig.js create mode 100755 install/installCommon.js create mode 100755 install/license.js create mode 100755 install/oc_convert.js create mode 100755 install/oc_install.js create mode 100755 install/register.js create mode 100755 install/siteConfig.js create mode 100755 jscalendar/calendar-setup_3.js create mode 100755 jscalendar/calendar.js create mode 100755 jscalendar/lang/calendar-af.js create mode 100755 jscalendar/lang/calendar-br.js create mode 100755 jscalendar/lang/calendar-ca.js create mode 100755 jscalendar/lang/calendar-cs-win.js create mode 100755 jscalendar/lang/calendar-da.js create mode 100755 jscalendar/lang/calendar-de.js create mode 100755 jscalendar/lang/calendar-du.js create mode 100755 jscalendar/lang/calendar-el.js create mode 100755 jscalendar/lang/calendar-en.js create mode 100755 jscalendar/lang/calendar-es.js create mode 100755 jscalendar/lang/calendar-fi.js create mode 100755 jscalendar/lang/calendar-fr.js create mode 100755 jscalendar/lang/calendar-hr-utf8.js create mode 100755 jscalendar/lang/calendar-hr.js create mode 100755 jscalendar/lang/calendar-hu.js create mode 100755 jscalendar/lang/calendar-it.js create mode 100755 jscalendar/lang/calendar-jp.js create mode 100755 jscalendar/lang/calendar-ko-utf8.js create mode 100755 jscalendar/lang/calendar-ko.js create mode 100755 jscalendar/lang/calendar-lt-utf8.js create mode 100755 jscalendar/lang/calendar-lt.js create mode 100755 jscalendar/lang/calendar-nl.js create mode 100755 jscalendar/lang/calendar-no.js create mode 100755 jscalendar/lang/calendar-pl-utf8.js create mode 100755 jscalendar/lang/calendar-pl.js create mode 100755 jscalendar/lang/calendar-pt.js create mode 100755 jscalendar/lang/calendar-ro.js create mode 100755 jscalendar/lang/calendar-ru.js create mode 100755 jscalendar/lang/calendar-si.js create mode 100755 jscalendar/lang/calendar-sk.js create mode 100755 jscalendar/lang/calendar-sp.js create mode 100755 jscalendar/lang/calendar-sv.js create mode 100755 jscalendar/lang/calendar-tr.js create mode 100755 jscalendar/lang/calendar-zh.js create mode 100755 jssource/src_files/include/JSON.js create mode 100755 jssource/src_files/include/MySugar/javascript/MySugar.js create mode 100755 jssource/src_files/include/SubPanel/SubPanelTiles.js create mode 100755 jssource/src_files/include/SugarDependentDropdown/javascript/SugarDependentDropdown.js create mode 100755 jssource/src_files/include/SugarEmailAddress/SugarEmailAddress.js create mode 100755 jssource/src_files/include/SugarFields/Fields/Address/SugarFieldAddress.js create mode 100755 jssource/src_files/include/SugarFields/Fields/Collection/SugarFieldCollection.js create mode 100755 jssource/src_files/include/SugarFields/Fields/Datetimecombo/Datetimecombo.js create mode 100755 jssource/src_files/include/connectors/formatters/default/company_detail.js create mode 100755 jssource/src_files/include/javascript/cookie.js create mode 100755 jssource/src_files/include/javascript/dashlets.js create mode 100755 jssource/src_files/include/javascript/include.js create mode 100755 jssource/src_files/include/javascript/jsclass_async.js create mode 100755 jssource/src_files/include/javascript/jsclass_base.js create mode 100755 jssource/src_files/include/javascript/menu.js create mode 100755 jssource/src_files/include/javascript/overlibmws.js create mode 100755 jssource/src_files/include/javascript/overlibmws_iframe.js create mode 100755 jssource/src_files/include/javascript/popup_helper.js create mode 100755 jssource/src_files/include/javascript/popup_parent_helper.js create mode 100755 jssource/src_files/include/javascript/quickCompose.js create mode 100755 jssource/src_files/include/javascript/quicksearch.js create mode 100755 jssource/src_files/include/javascript/report_additionals.js create mode 100755 jssource/src_files/include/javascript/sugar_3.js create mode 100755 jssource/src_files/include/javascript/sugar_connection_event_listener.js create mode 100755 jssource/src_files/include/javascript/sugarwidgets/SugarYUILoader.js create mode 100755 jssource/src_files/include/javascript/sugarwidgets/SugarYUIWidgets.js create mode 100755 jssource/src_files/include/javascript/swfobject.js create mode 100755 jssource/src_files/include/javascript/yui3/assets/dpSyntaxHighlighter.js create mode 100755 jssource/src_files/include/javascript/yui3/assets/syntax.js create mode 100755 jssource/src_files/include/javascript/yui3/build/anim/anim-base-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/anim/anim-base.js create mode 100755 jssource/src_files/include/javascript/yui3/build/anim/anim-color-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/anim/anim-color.js create mode 100755 jssource/src_files/include/javascript/yui3/build/anim/anim-curve-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/anim/anim-curve.js create mode 100755 jssource/src_files/include/javascript/yui3/build/anim/anim-easing-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/anim/anim-easing.js create mode 100755 jssource/src_files/include/javascript/yui3/build/anim/anim-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/anim/anim-node-plugin-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/anim/anim-node-plugin.js create mode 100755 jssource/src_files/include/javascript/yui3/build/anim/anim-scroll-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/anim/anim-scroll.js create mode 100755 jssource/src_files/include/javascript/yui3/build/anim/anim-xy-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/anim/anim-xy.js create mode 100755 jssource/src_files/include/javascript/yui3/build/anim/anim.js create mode 100755 jssource/src_files/include/javascript/yui3/build/async-queue/async-queue-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/async-queue/async-queue.js create mode 100755 jssource/src_files/include/javascript/yui3/build/attribute/attribute-base-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/attribute/attribute-base.js create mode 100755 jssource/src_files/include/javascript/yui3/build/attribute/attribute-complex-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/attribute/attribute-complex.js create mode 100755 jssource/src_files/include/javascript/yui3/build/attribute/attribute-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/attribute/attribute.js create mode 100755 jssource/src_files/include/javascript/yui3/build/base/base-base-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/base/base-base.js create mode 100755 jssource/src_files/include/javascript/yui3/build/base/base-build-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/base/base-build.js create mode 100755 jssource/src_files/include/javascript/yui3/build/base/base-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/base/base-pluginhost-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/base/base-pluginhost.js create mode 100755 jssource/src_files/include/javascript/yui3/build/base/base.js create mode 100755 jssource/src_files/include/javascript/yui3/build/classnamemanager/classnamemanager-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/classnamemanager/classnamemanager.js create mode 100755 jssource/src_files/include/javascript/yui3/build/collection/collection-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/collection/collection.js create mode 100755 jssource/src_files/include/javascript/yui3/build/compat/compat-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/compat/compat.js create mode 100755 jssource/src_files/include/javascript/yui3/build/console/console-filters-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/console/console-filters.js create mode 100755 jssource/src_files/include/javascript/yui3/build/console/console-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/console/console.js create mode 100755 jssource/src_files/include/javascript/yui3/build/cookie/cookie-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/cookie/cookie.js create mode 100755 jssource/src_files/include/javascript/yui3/build/dataschema/dataschema-array-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/dataschema/dataschema-array.js create mode 100755 jssource/src_files/include/javascript/yui3/build/dataschema/dataschema-base-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/dataschema/dataschema-base.js create mode 100755 jssource/src_files/include/javascript/yui3/build/dataschema/dataschema-json-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/dataschema/dataschema-json.js create mode 100755 jssource/src_files/include/javascript/yui3/build/dataschema/dataschema-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/dataschema/dataschema-text-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/dataschema/dataschema-text.js create mode 100755 jssource/src_files/include/javascript/yui3/build/dataschema/dataschema-xml-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/dataschema/dataschema-xml.js create mode 100755 jssource/src_files/include/javascript/yui3/build/dataschema/dataschema.js create mode 100755 jssource/src_files/include/javascript/yui3/build/datasource/datasource-arrayschema-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/datasource/datasource-arrayschema.js create mode 100755 jssource/src_files/include/javascript/yui3/build/datasource/datasource-cache-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/datasource/datasource-cache.js create mode 100755 jssource/src_files/include/javascript/yui3/build/datasource/datasource-function-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/datasource/datasource-function.js create mode 100755 jssource/src_files/include/javascript/yui3/build/datasource/datasource-get-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/datasource/datasource-get.js create mode 100755 jssource/src_files/include/javascript/yui3/build/datasource/datasource-io-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/datasource/datasource-io.js create mode 100755 jssource/src_files/include/javascript/yui3/build/datasource/datasource-jsonschema-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/datasource/datasource-jsonschema.js create mode 100755 jssource/src_files/include/javascript/yui3/build/datasource/datasource-local-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/datasource/datasource-local.js create mode 100755 jssource/src_files/include/javascript/yui3/build/datasource/datasource-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/datasource/datasource-polling-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/datasource/datasource-polling.js create mode 100755 jssource/src_files/include/javascript/yui3/build/datasource/datasource-textschema-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/datasource/datasource-textschema.js create mode 100755 jssource/src_files/include/javascript/yui3/build/datasource/datasource-xmlschema-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/datasource/datasource-xmlschema.js create mode 100755 jssource/src_files/include/javascript/yui3/build/datasource/datasource.js create mode 100755 jssource/src_files/include/javascript/yui3/build/datatype/datatype-date-format-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/datatype/datatype-date-format.js create mode 100755 jssource/src_files/include/javascript/yui3/build/datatype/datatype-date-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/datatype/datatype-date-parse-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/datatype/datatype-date-parse.js create mode 100755 jssource/src_files/include/javascript/yui3/build/datatype/datatype-date.js create mode 100755 jssource/src_files/include/javascript/yui3/build/datatype/datatype-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/datatype/datatype-number-format-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/datatype/datatype-number-format.js create mode 100755 jssource/src_files/include/javascript/yui3/build/datatype/datatype-number-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/datatype/datatype-number-parse-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/datatype/datatype-number-parse.js create mode 100755 jssource/src_files/include/javascript/yui3/build/datatype/datatype-number.js create mode 100755 jssource/src_files/include/javascript/yui3/build/datatype/datatype-xml-format-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/datatype/datatype-xml-format.js create mode 100755 jssource/src_files/include/javascript/yui3/build/datatype/datatype-xml-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/datatype/datatype-xml-parse-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/datatype/datatype-xml-parse.js create mode 100755 jssource/src_files/include/javascript/yui3/build/datatype/datatype-xml.js create mode 100755 jssource/src_files/include/javascript/yui3/build/datatype/datatype.js create mode 100755 jssource/src_files/include/javascript/yui3/build/dd/dd-constrain-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/dd/dd-constrain.js create mode 100755 jssource/src_files/include/javascript/yui3/build/dd/dd-ddm-base-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/dd/dd-ddm-base.js create mode 100755 jssource/src_files/include/javascript/yui3/build/dd/dd-ddm-drop-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/dd/dd-ddm-drop.js create mode 100755 jssource/src_files/include/javascript/yui3/build/dd/dd-ddm-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/dd/dd-ddm.js create mode 100755 jssource/src_files/include/javascript/yui3/build/dd/dd-drag-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/dd/dd-drag.js create mode 100755 jssource/src_files/include/javascript/yui3/build/dd/dd-drop-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/dd/dd-drop-plugin-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/dd/dd-drop-plugin.js create mode 100755 jssource/src_files/include/javascript/yui3/build/dd/dd-drop.js create mode 100755 jssource/src_files/include/javascript/yui3/build/dd/dd-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/dd/dd-plugin-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/dd/dd-plugin.js create mode 100755 jssource/src_files/include/javascript/yui3/build/dd/dd-proxy-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/dd/dd-proxy.js create mode 100755 jssource/src_files/include/javascript/yui3/build/dd/dd-scroll-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/dd/dd-scroll.js create mode 100755 jssource/src_files/include/javascript/yui3/build/dd/dd.js create mode 100755 jssource/src_files/include/javascript/yui3/build/dom/dom-base-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/dom/dom-base.js create mode 100755 jssource/src_files/include/javascript/yui3/build/dom/dom-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/dom/dom-screen-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/dom/dom-screen.js create mode 100755 jssource/src_files/include/javascript/yui3/build/dom/dom-style-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/dom/dom-style.js create mode 100755 jssource/src_files/include/javascript/yui3/build/dom/dom.js create mode 100755 jssource/src_files/include/javascript/yui3/build/dom/selector-css2-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/dom/selector-css2.js create mode 100755 jssource/src_files/include/javascript/yui3/build/dom/selector-css3-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/dom/selector-css3.js create mode 100755 jssource/src_files/include/javascript/yui3/build/dom/selector-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/dom/selector-native-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/dom/selector-native.js create mode 100755 jssource/src_files/include/javascript/yui3/build/dom/selector.js create mode 100755 jssource/src_files/include/javascript/yui3/build/dump/dump-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/dump/dump.js create mode 100755 jssource/src_files/include/javascript/yui3/build/event-custom/event-custom-base-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/event-custom/event-custom-base.js create mode 100755 jssource/src_files/include/javascript/yui3/build/event-custom/event-custom-complex-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/event-custom/event-custom-complex.js create mode 100755 jssource/src_files/include/javascript/yui3/build/event-custom/event-custom-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/event-custom/event-custom.js create mode 100755 jssource/src_files/include/javascript/yui3/build/event-simulate/event-simulate-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/event-simulate/event-simulate.js create mode 100755 jssource/src_files/include/javascript/yui3/build/event/event-base-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/event/event-base.js create mode 100755 jssource/src_files/include/javascript/yui3/build/event/event-delegate-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/event/event-delegate.js create mode 100755 jssource/src_files/include/javascript/yui3/build/event/event-focus-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/event/event-focus.js create mode 100755 jssource/src_files/include/javascript/yui3/build/event/event-key-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/event/event-key.js create mode 100755 jssource/src_files/include/javascript/yui3/build/event/event-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/event/event-mouseenter-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/event/event-mouseenter.js create mode 100755 jssource/src_files/include/javascript/yui3/build/event/event-mousewheel-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/event/event-mousewheel.js create mode 100755 jssource/src_files/include/javascript/yui3/build/event/event-resize-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/event/event-resize.js create mode 100755 jssource/src_files/include/javascript/yui3/build/event/event.js create mode 100755 jssource/src_files/include/javascript/yui3/build/get/get-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/get/get.js create mode 100755 jssource/src_files/include/javascript/yui3/build/history/history-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/history/history.js create mode 100755 jssource/src_files/include/javascript/yui3/build/imageloader/imageloader-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/imageloader/imageloader.js create mode 100755 jssource/src_files/include/javascript/yui3/build/io/io-base-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/io/io-base.js create mode 100755 jssource/src_files/include/javascript/yui3/build/io/io-form-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/io/io-form.js create mode 100755 jssource/src_files/include/javascript/yui3/build/io/io-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/io/io-queue-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/io/io-queue.js create mode 100755 jssource/src_files/include/javascript/yui3/build/io/io-upload-iframe-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/io/io-upload-iframe.js create mode 100755 jssource/src_files/include/javascript/yui3/build/io/io-xdr-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/io/io-xdr.js create mode 100755 jssource/src_files/include/javascript/yui3/build/io/io.js create mode 100755 jssource/src_files/include/javascript/yui3/build/json/json-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/json/json-parse-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/json/json-parse.js create mode 100755 jssource/src_files/include/javascript/yui3/build/json/json-stringify-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/json/json-stringify.js create mode 100755 jssource/src_files/include/javascript/yui3/build/json/json.js create mode 100755 jssource/src_files/include/javascript/yui3/build/loader/loader-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/loader/loader.js create mode 100755 jssource/src_files/include/javascript/yui3/build/node-focusmanager/node-focusmanager-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/node-focusmanager/node-focusmanager.js create mode 100755 jssource/src_files/include/javascript/yui3/build/node-menunav/node-menunav-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/node-menunav/node-menunav.js create mode 100755 jssource/src_files/include/javascript/yui3/build/node/node-aria-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/node/node-aria.js create mode 100755 jssource/src_files/include/javascript/yui3/build/node/node-base-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/node/node-base.js create mode 100755 jssource/src_files/include/javascript/yui3/build/node/node-event-delegate-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/node/node-event-delegate.js create mode 100755 jssource/src_files/include/javascript/yui3/build/node/node-event-simulate-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/node/node-event-simulate.js create mode 100755 jssource/src_files/include/javascript/yui3/build/node/node-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/node/node-pluginhost-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/node/node-pluginhost.js create mode 100755 jssource/src_files/include/javascript/yui3/build/node/node-screen-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/node/node-screen.js create mode 100755 jssource/src_files/include/javascript/yui3/build/node/node-style-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/node/node-style.js create mode 100755 jssource/src_files/include/javascript/yui3/build/node/node.js create mode 100755 jssource/src_files/include/javascript/yui3/build/oop/oop-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/oop/oop.js create mode 100755 jssource/src_files/include/javascript/yui3/build/overlay/overlay-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/overlay/overlay.js create mode 100755 jssource/src_files/include/javascript/yui3/build/plugin/plugin-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/plugin/plugin.js create mode 100755 jssource/src_files/include/javascript/yui3/build/pluginhost/pluginhost-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/pluginhost/pluginhost.js create mode 100755 jssource/src_files/include/javascript/yui3/build/profiler/profiler-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/profiler/profiler.js create mode 100755 jssource/src_files/include/javascript/yui3/build/queue-promote/queue-promote-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/queue-promote/queue-promote.js create mode 100755 jssource/src_files/include/javascript/yui3/build/slider/slider-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/slider/slider.js create mode 100755 jssource/src_files/include/javascript/yui3/build/stylesheet/stylesheet-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/stylesheet/stylesheet.js create mode 100755 jssource/src_files/include/javascript/yui3/build/substitute/substitute-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/substitute/substitute.js create mode 100755 jssource/src_files/include/javascript/yui3/build/test/test-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/test/test.js create mode 100755 jssource/src_files/include/javascript/yui3/build/widget/widget-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/widget/widget-position-ext-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/widget/widget-position-ext.js create mode 100755 jssource/src_files/include/javascript/yui3/build/widget/widget-position-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/widget/widget-position.js create mode 100755 jssource/src_files/include/javascript/yui3/build/widget/widget-stack-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/widget/widget-stack.js create mode 100755 jssource/src_files/include/javascript/yui3/build/widget/widget-stdmod-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/widget/widget-stdmod.js create mode 100755 jssource/src_files/include/javascript/yui3/build/widget/widget.js create mode 100755 jssource/src_files/include/javascript/yui3/build/yui-base/yui-base-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/yui-base/yui-base.js create mode 100755 jssource/src_files/include/javascript/yui3/build/yui/get-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/yui/get.js create mode 100755 jssource/src_files/include/javascript/yui3/build/yui/yui-base-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/yui/yui-base.js create mode 100755 jssource/src_files/include/javascript/yui3/build/yui/yui-later-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/yui/yui-later.js create mode 100755 jssource/src_files/include/javascript/yui3/build/yui/yui-log-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/yui/yui-log.js create mode 100755 jssource/src_files/include/javascript/yui3/build/yui/yui-min.js create mode 100755 jssource/src_files/include/javascript/yui3/build/yui/yui.js create mode 100755 jssource/src_files/include/jsolait/init.js create mode 100755 jssource/src_files/include/jsolait/lib/codecs.js create mode 100755 jssource/src_files/include/jsolait/lib/crypto.js create mode 100755 jssource/src_files/include/jsolait/lib/jsonrpc.js create mode 100755 jssource/src_files/include/jsolait/lib/jsonrpclite.js create mode 100755 jssource/src_files/include/jsolait/lib/lang.js create mode 100755 jssource/src_files/include/jsolait/lib/langlite.js create mode 100755 jssource/src_files/include/jsolait/lib/urllib.js create mode 100755 jssource/src_files/include/jsolait/lib/xml.js create mode 100755 jssource/src_files/include/jsolait/lib/xmlrpc.js create mode 100755 jssource/src_files/include/jsolait/missingmixin.js create mode 100755 jssource/src_files/include/ytree/TreeView/HTMLNode.js create mode 100755 jssource/src_files/include/ytree/TreeView/MenuNode.js create mode 100755 jssource/src_files/include/ytree/TreeView/Node.js create mode 100755 jssource/src_files/include/ytree/TreeView/RootNode.js create mode 100755 jssource/src_files/include/ytree/TreeView/TaskNode.js create mode 100755 jssource/src_files/include/ytree/TreeView/TextNode.js create mode 100755 jssource/src_files/include/ytree/TreeView/TreeView.js create mode 100755 jssource/src_files/include/ytree/TreeView/anim/TVAnim.js create mode 100755 jssource/src_files/include/ytree/TreeView/anim/TVFadeIn.js create mode 100755 jssource/src_files/include/ytree/TreeView/anim/TVFadeOut.js create mode 100755 jssource/src_files/include/ytree/treeutil.js create mode 100755 jssource/src_files/install/dbConfig.js create mode 100755 jssource/src_files/install/installCommon.js create mode 100755 jssource/src_files/install/license.js create mode 100755 jssource/src_files/install/oc_convert.js create mode 100755 jssource/src_files/install/oc_install.js create mode 100755 jssource/src_files/install/register.js create mode 100755 jssource/src_files/install/siteConfig.js create mode 100755 jssource/src_files/jscalendar/calendar-setup_3.js create mode 100755 jssource/src_files/jscalendar/calendar.js create mode 100755 jssource/src_files/modules/ACLRoles/ACLRoles.js create mode 100755 jssource/src_files/modules/Accounts/Account.js create mode 100755 jssource/src_files/modules/Administration/javascript/Administration.js create mode 100755 jssource/src_files/modules/Administration/javascript/Async.js create mode 100755 jssource/src_files/modules/Campaigns/DetailView.js create mode 100755 jssource/src_files/modules/Campaigns/WebToLead.js create mode 100755 jssource/src_files/modules/Campaigns/wizard.js create mode 100755 jssource/src_files/modules/Connectors/Connector.js create mode 100755 jssource/src_files/modules/Contacts/Contact.js create mode 100755 jssource/src_files/modules/Currencies/EditView.js create mode 100755 jssource/src_files/modules/Documents/documents.js create mode 100755 jssource/src_files/modules/EmailTemplates/EmailTemplate.js create mode 100755 jssource/src_files/modules/Home/about.js create mode 100755 jssource/src_files/modules/InboundEmail/InboundEmail.js create mode 100755 jssource/src_files/modules/Leads/Lead.js create mode 100755 jssource/src_files/modules/Meetings/jsclass_scheduler.js create mode 100755 jssource/src_files/modules/MergeRecords/Merge.js create mode 100755 jssource/src_files/modules/Project/Project.js create mode 100755 jssource/src_files/modules/ProjectTask/ProjectTask.js create mode 100755 jssource/src_files/modules/Studio/JSTransaction.js create mode 100755 jssource/src_files/modules/Studio/studio.js create mode 100755 jssource/src_files/modules/Studio/studiodd.js create mode 100755 jssource/src_files/modules/Studio/studiotabgroups.js create mode 100755 jssource/src_files/modules/Studio/ygDDListStudio.js create mode 100755 jssource/src_files/modules/UpgradeWizard/upgradeWizard.js create mode 100755 jssource/src_files/modules/Users/DetailView.js create mode 100755 jssource/src_files/modules/Users/PasswordRequirementBox.js create mode 100755 jssource/src_files/modules/Users/User.js create mode 100755 jssource/src_files/modules/Users/login.js create mode 100755 jssource/src_files/service/utils/SugarRest.js create mode 100755 jssource/src_files/themes/Sugar5/js/style.js create mode 100755 jssource/src_files/themes/default/js/style.js create mode 100755 mailer/examples/scripts/XRegExp.js create mode 100755 mailer/examples/scripts/shAutoloader.js create mode 100755 mailer/examples/scripts/shBrushPhp.js create mode 100755 mailer/examples/scripts/shCore.js create mode 100755 mailer/examples/scripts/shLegacy.js create mode 100755 modules/ACLRoles/ACLRoles.js create mode 100644 modules/Accounts/Account.js create mode 100644 modules/Accounts/Addresses.js create mode 100644 modules/Accounts/Banks.js create mode 100644 modules/Accounts/Categories.js create mode 100644 modules/Accounts/Discounts.js create mode 100644 modules/Accounts/MailingGroups.js create mode 100644 modules/Accounts/MyTable.js create mode 100644 modules/Accounts/Websites.js create mode 100644 modules/Accounts/jquery.min.js create mode 100644 modules/Accounts/jquery_ui.js create mode 100644 modules/Accounts/js/SalesChart.js create mode 100644 modules/Accounts/js/States.js create mode 100644 modules/Accounts/js/Telephones.js create mode 100644 modules/Accounts/js/Websites.js create mode 100644 modules/Accounts/js/showMap.js create mode 100644 modules/Accounts/paramsMT.js create mode 100755 modules/Administration/javascript/Administration.js create mode 100755 modules/Administration/javascript/Async.js create mode 100755 modules/Campaigns/DetailView.js create mode 100755 modules/Campaigns/WebToLead.js create mode 100755 modules/Campaigns/wizard.js create mode 100755 modules/Connectors/Connector.js create mode 100755 modules/Contacts/Contact.js create mode 100755 modules/Contacts/js/States.js create mode 100755 modules/Currencies/EditView.js create mode 100644 modules/Documents/Categories.js create mode 100644 modules/Documents/documents.js create mode 100644 modules/Documents/js/Bim-it6.js create mode 100644 modules/Documents/js/Documents13.js create mode 100644 modules/Documents/paramsMT.js create mode 100755 modules/Documents3/Categories.js create mode 100755 modules/Documents3/documents.js create mode 100755 modules/Documents3/js/Bim-it.js create mode 100755 modules/Documents3/js/DetailViewDocumentReady.js create mode 100755 modules/Documents3/js/Documents.js create mode 100755 modules/Documents3/js/EditViewTimeTable.js create mode 100755 modules/Documents3/paramsMT.js create mode 100755 modules/EcmActions/js/DetailViewDocumentReady.js create mode 100755 modules/EcmActions/js/EditViewDocumentReady.js create mode 100755 modules/EcmActions/js/ListViewDocumentReady.js create mode 100755 modules/EcmAgreements/javascript/AgreementTemplates.js create mode 100755 modules/EcmAgreements/javascript/EcmAgreements.js create mode 100755 modules/EcmAgreements/javascript/EcmAgreementsDetail.js create mode 100755 modules/EcmAgreements/javascript/EditViewPDFTemplate.js create mode 100755 modules/EcmAgreements/javascript/bimit_table.js create mode 100755 modules/EcmAgreements/javascript/columndefs-detail.js create mode 100755 modules/EcmAgreements/javascript/columndefs.js create mode 100755 modules/EcmCalendars/Calendar.js create mode 100755 modules/EcmCalendars/helper.js create mode 100755 modules/EcmCalls/DoCall.js create mode 100755 modules/EcmCalls/Hint.js create mode 100755 modules/EcmCalls/ListView.js create mode 100755 modules/EcmCalls/MyTable.js create mode 100755 modules/EcmCalls/Settings.js create mode 100755 modules/EcmCalls/SubPanel.js create mode 100755 modules/EcmCalls/anMenu/anMenu.js create mode 100755 modules/EcmCalls/formloader.js create mode 100755 modules/EcmCalls/yui/2.6.0/build/container/container-debug.js create mode 100755 modules/EcmCalls/yui/2.6.0/build/container/container-min.js create mode 100755 modules/EcmCalls/yui/2.6.0/build/container/container.js create mode 100755 modules/EcmCalls/yui/2.6.0/build/container/container_core-debug.js create mode 100755 modules/EcmCalls/yui/2.6.0/build/container/container_core-min.js create mode 100755 modules/EcmCalls/yui/2.6.0/build/container/container_core.js create mode 100755 modules/EcmCalls/yui/2.6.0/build/menu/menu-debug.js create mode 100755 modules/EcmCalls/yui/2.6.0/build/menu/menu-min.js create mode 100755 modules/EcmCalls/yui/2.6.0/build/menu/menu.js create mode 100755 modules/EcmCalls/yui/2.6.0/build/yahoo-dom-event/yahoo-dom-event.js create mode 100755 modules/EcmDesigns/Categories.js create mode 100755 modules/EcmDesigns/MyTable.js create mode 100755 modules/EcmDesigns/paramsMT.js create mode 100755 modules/EcmDevices/Email.js create mode 100755 modules/EcmDevices/advajax.js create mode 100755 modules/EcmDevices/moo1.2.js create mode 100755 modules/EcmDocs/ListFunctions.js create mode 100755 modules/EcmDocs/formloader.js create mode 100755 modules/EcmDocs/helper.js create mode 100755 modules/EcmDocs/mintajax.js create mode 100755 modules/EcmDocumentTemplates/EcmDocumentTemplates.js create mode 100755 modules/EcmDocumentTemplates/formloader.js create mode 100755 modules/EcmDocuments/advajax.js create mode 100755 modules/EcmDocuments/dimensions.js create mode 100755 modules/EcmDocuments/dragresize.js create mode 100755 modules/EcmDocuments/dragresize_commented.js create mode 100755 modules/EcmDocuments/j123.drag.js create mode 100755 modules/EcmDocuments/j123.drag.sortablelist.js create mode 100755 modules/EcmDocuments/j123.events.js create mode 100755 modules/EcmDocuments/j123.js create mode 100755 modules/EcmDocuments/jqDnR.js create mode 100755 modules/EcmDocuments/jquery.js create mode 100755 modules/EcmDocuments/mintajax.js create mode 100755 modules/EcmEmails/Email.js create mode 100755 modules/EcmFkBooks/fkbooks.js create mode 100755 modules/EcmFkPackages/EcmFkPackages.js create mode 100755 modules/EcmFkPackages/EcmFkPackagesDetailView.js create mode 100755 modules/EcmFkPackages/EcmFkPackagesEditView.js create mode 100755 modules/EcmFkPackages/MyTable.js create mode 100755 modules/EcmFkPackages/_EcmFkPackages.js create mode 100755 modules/EcmFkPackages/fkpackages.js create mode 100755 modules/EcmFkPackages/formloader.js create mode 100755 modules/EcmFkVatKinds/EcmFkVatKinds.js create mode 100755 modules/EcmFkVatKinds/EcmFkVatKindsDetailView.js create mode 100755 modules/EcmFkVatKinds/EcmFkVatKindsEditView.js create mode 100755 modules/EcmFkVatKinds/MyTable.js create mode 100755 modules/EcmFkVatKinds/fkbooks.js create mode 100755 modules/EcmFkVatRegisters/EcmFkVatRegisters.js create mode 100755 modules/EcmFkVatRegisters/EcmFkVatRegistersDetailView.js create mode 100755 modules/EcmFkVatRegisters/EcmFkVatRegistersEditView.js create mode 100755 modules/EcmFkVatRegisters/EcmFkVatRegistersListView.js create mode 100755 modules/EcmFkVatRegisters/MyTable.js create mode 100755 modules/EcmFkVatRegisters/backup/Copy of EcmFkVatRegistersDetailView.js create mode 100755 modules/EcmFkVatRegisters/backup/_EcmFkVatRegistersEditView.js create mode 100755 modules/EcmFkVatRegisters/backup/__EcmFkVatRegistersEditView.js create mode 100755 modules/EcmFkVatRegisters/backup/___EcmFkVatRegistersEditView.js create mode 100755 modules/EcmFkVatRegisters/backup/____EcmFkVatRegistersEditView.js create mode 100755 modules/EcmFkVatRegisters/fkbooks.js create mode 100755 modules/EcmFkVatRegisters/report.js create mode 100755 modules/EcmFkVatTables/EcmFkVatRegisters.js create mode 100755 modules/EcmFkVatTables/EcmFkVatRegistersDetailView.js create mode 100755 modules/EcmFkVatTables/EcmFkVatRegistersEditView.js create mode 100755 modules/EcmFkVatTables/MyTable.js create mode 100755 modules/EcmFkVatTables/_EcmFkVatRegistersEditView.js create mode 100755 modules/EcmFkVatTables/__EcmFkVatRegistersEditView.js create mode 100755 modules/EcmFkVatTables/___EcmFkVatRegistersEditView.js create mode 100755 modules/EcmFkVatTables/____EcmFkVatRegistersEditView.js create mode 100755 modules/EcmFkVatTables/fkbooks.js create mode 100755 modules/EcmFkVats/EcmFkVats.js create mode 100755 modules/EcmFkVats/EcmFkVatsDetailView.js create mode 100755 modules/EcmFkVats/EcmFkVatsEditView.js create mode 100755 modules/EcmFkVats/fkbooks.js create mode 100755 modules/EcmInsideOrders.cp/AjaxSearch/AjaxSearch.js create mode 100755 modules/EcmInsideOrders.cp/CreateItem.js create mode 100755 modules/EcmInsideOrders.cp/EcmInsideOrders.js create mode 100755 modules/EcmInsideOrders.cp/EcmInsideOrdersDetailView.js create mode 100755 modules/EcmInsideOrders.cp/Email.js create mode 100755 modules/EcmInsideOrders.cp/ListView.js create mode 100755 modules/EcmInsideOrders.cp/MyTable.js create mode 100755 modules/EcmInsideOrders.cp/PDFLanguages.js create mode 100755 modules/EcmInsideOrders.cp/PDFLanguagesMT.js create mode 100755 modules/EcmInsideOrders.cp/formloader.js create mode 100644 modules/EcmInsideOrders/javascript/EcmInsideOrders.js create mode 100644 modules/EcmInsideOrders/javascript/EcmInsideOrdersDetail.js create mode 100644 modules/EcmInsideOrders/javascript/EcmStockDocMoves.js create mode 100644 modules/EcmInsideOrders/javascript/EcmStockDocMovesDetail.js create mode 100644 modules/EcmInsideOrders/javascript/bimit_table.js create mode 100644 modules/EcmInsideOrders/javascript/columndefs-detail.js create mode 100644 modules/EcmInsideOrders/javascript/columndefs.js create mode 100644 modules/EcmInsideOrders/javascript/helper.js create mode 100755 modules/EcmInventorys/javascript/EcmInventorys.js create mode 100755 modules/EcmInventorys/javascript/EcmInventorysDetail.js create mode 100755 modules/EcmInventorys/javascript/searchcolumndefs.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/ecommerceInvoicesListView.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/encoding-indexes.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/encoding.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/jquery.blockUI.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/jquery.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/select2-3.4.6/select2.min.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/tablesorter-2.31.3/dist/js/extras/jquery.dragtable.mod.min.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/tablesorter-2.31.3/dist/js/extras/jquery.metadata.min.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/tablesorter-2.31.3/dist/js/extras/jquery.tablesorter.pager.min.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/tablesorter-2.31.3/dist/js/extras/semver-mod.min.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/tablesorter-2.31.3/dist/js/jquery.tablesorter.combined.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/tablesorter-2.31.3/dist/js/jquery.tablesorter.combined.min.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/tablesorter-2.31.3/dist/js/jquery.tablesorter.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/tablesorter-2.31.3/dist/js/jquery.tablesorter.min.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/tablesorter-2.31.3/dist/js/jquery.tablesorter.widgets.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/tablesorter-2.31.3/dist/js/jquery.tablesorter.widgets.min.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/tablesorter-2.31.3/dist/js/parsers/parser-date-extract.min.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/tablesorter-2.31.3/dist/js/parsers/parser-date-iso8601.min.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/tablesorter-2.31.3/dist/js/parsers/parser-date-month.min.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/tablesorter-2.31.3/dist/js/parsers/parser-date-range.min.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/tablesorter-2.31.3/dist/js/parsers/parser-date-two-digit-year.min.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/tablesorter-2.31.3/dist/js/parsers/parser-date-weekday.min.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/tablesorter-2.31.3/dist/js/parsers/parser-date.min.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/tablesorter-2.31.3/dist/js/parsers/parser-duration.min.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/tablesorter-2.31.3/dist/js/parsers/parser-feet-inch-fraction.min.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/tablesorter-2.31.3/dist/js/parsers/parser-file-type.min.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/tablesorter-2.31.3/dist/js/parsers/parser-globalize.min.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/tablesorter-2.31.3/dist/js/parsers/parser-huge-numbers.min.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/tablesorter-2.31.3/dist/js/parsers/parser-ignore-articles.min.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/tablesorter-2.31.3/dist/js/parsers/parser-image.min.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/tablesorter-2.31.3/dist/js/parsers/parser-input-select.min.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/tablesorter-2.31.3/dist/js/parsers/parser-leading-zeros.min.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/tablesorter-2.31.3/dist/js/parsers/parser-metric.min.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/tablesorter-2.31.3/dist/js/parsers/parser-named-numbers.min.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/tablesorter-2.31.3/dist/js/parsers/parser-network.min.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/tablesorter-2.31.3/dist/js/parsers/parser-roman.min.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/tablesorter-2.31.3/dist/js/widgets/widget-alignChar.min.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/tablesorter-2.31.3/dist/js/widgets/widget-build-table.min.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/tablesorter-2.31.3/dist/js/widgets/widget-chart.min.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/tablesorter-2.31.3/dist/js/widgets/widget-columnSelector.min.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/tablesorter-2.31.3/dist/js/widgets/widget-columns.min.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/tablesorter-2.31.3/dist/js/widgets/widget-cssStickyHeaders.min.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/tablesorter-2.31.3/dist/js/widgets/widget-currentSort.min.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/tablesorter-2.31.3/dist/js/widgets/widget-editable.min.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/tablesorter-2.31.3/dist/js/widgets/widget-filter-formatter-html5.min.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/tablesorter-2.31.3/dist/js/widgets/widget-filter-formatter-jui.min.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/tablesorter-2.31.3/dist/js/widgets/widget-filter-formatter-select2.min.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/tablesorter-2.31.3/dist/js/widgets/widget-filter-type-insideRange.min.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/tablesorter-2.31.3/dist/js/widgets/widget-filter.min.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/tablesorter-2.31.3/dist/js/widgets/widget-formatter.min.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/tablesorter-2.31.3/dist/js/widgets/widget-grouping.min.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/tablesorter-2.31.3/dist/js/widgets/widget-headerTitles.min.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/tablesorter-2.31.3/dist/js/widgets/widget-lazyload.min.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/tablesorter-2.31.3/dist/js/widgets/widget-mark.min.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/tablesorter-2.31.3/dist/js/widgets/widget-math.min.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/tablesorter-2.31.3/dist/js/widgets/widget-output.min.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/tablesorter-2.31.3/dist/js/widgets/widget-pager.min.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/tablesorter-2.31.3/dist/js/widgets/widget-print.min.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/tablesorter-2.31.3/dist/js/widgets/widget-reflow.min.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/tablesorter-2.31.3/dist/js/widgets/widget-repeatheaders.min.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/tablesorter-2.31.3/dist/js/widgets/widget-resizable.min.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/tablesorter-2.31.3/dist/js/widgets/widget-saveSort.min.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/tablesorter-2.31.3/dist/js/widgets/widget-scroller.min.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/tablesorter-2.31.3/dist/js/widgets/widget-sort2Hash.min.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/tablesorter-2.31.3/dist/js/widgets/widget-sortTbodies.min.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/tablesorter-2.31.3/dist/js/widgets/widget-staticRow.min.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/tablesorter-2.31.3/dist/js/widgets/widget-stickyHeaders.min.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/tablesorter-2.31.3/dist/js/widgets/widget-storage.min.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/tablesorter-2.31.3/dist/js/widgets/widget-toggle.min.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/tablesorter-2.31.3/dist/js/widgets/widget-uitheme.min.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/tablesorter-2.31.3/dist/js/widgets/widget-vertical-group.min.js create mode 100644 modules/EcmInvoiceOuts/BimIT-eCommerceInvoices/lib/tablesorter-2.31.3/dist/js/widgets/widget-view.min.js create mode 100755 modules/EcmInvoiceOuts/javascript/Consignments.js create mode 100755 modules/EcmInvoiceOuts/javascript/EcmInvoiceOuts4.js create mode 100755 modules/EcmInvoiceOuts/javascript/EcmInvoiceOutsDetail.js create mode 100755 modules/EcmInvoiceOuts/javascript/bimit_table8.js create mode 100755 modules/EcmInvoiceOuts/javascript/columndefs-detail.js create mode 100755 modules/EcmInvoiceOuts/javascript/columndefs.js create mode 100755 modules/EcmInvoiceOuts/javascript/searchcolumndefs.js create mode 100755 modules/EcmInvoiceOuts2/javascript/EcmInvoiceOuts.js create mode 100755 modules/EcmInvoiceOuts2/javascript/EcmInvoiceOutsDetail.js create mode 100755 modules/EcmInvoiceOuts2/javascript/bimit_table.js create mode 100755 modules/EcmInvoiceOuts2/javascript/columndefs-detail.js create mode 100755 modules/EcmInvoiceOuts2/javascript/columndefs.js create mode 100755 modules/EcmKpkw/AjaxSearch/AjaxSearch.js create mode 100755 modules/EcmKpkw/EcmKpkw.js create mode 100755 modules/EcmKpkw/EcmKpkwDetailView.js create mode 100755 modules/EcmKpkw/EcmKpkw_copy2.js create mode 100755 modules/EcmKpkw/EcmKpkw_pdf.js create mode 100755 modules/EcmKpkw/MyTable.js create mode 100755 modules/EcmKpkw/copy_EcmKpkw.js create mode 100755 modules/EcmKpkw/formloader.js create mode 100644 modules/EcmMailingMessages/ContactGroups.js create mode 100644 modules/EcmMailingMessages/MailingGroups.js create mode 100755 modules/EcmNewInvoiceOuts/javascript/EcmNewInvoiceOuts.js create mode 100755 modules/EcmNewInvoiceOuts/javascript/EcmNewInvoiceOutsDetail.js create mode 100755 modules/EcmNewInvoiceOuts/javascript/bimit_table.js create mode 100755 modules/EcmNewInvoiceOuts/javascript/columndefs-detail.js create mode 100755 modules/EcmNewInvoiceOuts/javascript/columndefs.js create mode 100755 modules/EcmNewKpkws/javascript/EcmNewKpkws2.js create mode 100755 modules/EcmNewKpkws/javascript/EcmNewKpkwsDetail.js create mode 100755 modules/EcmNewKpkws/javascript/bimit_table2.js create mode 100755 modules/EcmNewKpkws/javascript/columndefs-detail.js create mode 100755 modules/EcmNewKpkws/javascript/columndefs.js create mode 100755 modules/EcmNoteOuts/javascript/EcmNoteOuts.js create mode 100755 modules/EcmNoteOuts/javascript/EcmNoteOutsDetail.js create mode 100755 modules/EcmNoteOuts/javascript/bimit_table.js create mode 100755 modules/EcmNoteOuts/javascript/columndefs-detail.js create mode 100755 modules/EcmNoteOuts/javascript/columndefs.js create mode 100755 modules/EcmNoteOuts/javascript/searchcolumndefs.js create mode 100755 modules/EcmPaymentStates/javascript/AccountPaymentStates2.js create mode 100755 modules/EcmPaymentStates/javascript/interestEditView.js create mode 100755 modules/EcmPaymentStates/javascript/interestLogic.js create mode 100755 modules/EcmPaymentStates/javascript/multiMatch.js create mode 100755 modules/EcmPaymentStates/javascript/summary.js create mode 100755 modules/EcmPaymentStates/jquery/jquery-1.9.1.js create mode 100755 modules/EcmPaymentStates/jquery/jquery-ui.js create mode 100755 modules/EcmPrepaymentInvoices/javascript/EcmPrepaymentInvoices.js create mode 100755 modules/EcmPrepaymentInvoices/javascript/EcmPrepaymentInvoicesDetail.js create mode 100755 modules/EcmPrepaymentInvoices/javascript/ListNewSales.js create mode 100755 modules/EcmPrepaymentInvoices/javascript/ProductSummary.js create mode 100755 modules/EcmPrepaymentInvoices/javascript/bimit_table.js create mode 100755 modules/EcmPrepaymentInvoices/javascript/columndefs-detail.js create mode 100755 modules/EcmPrepaymentInvoices/javascript/columndefs.js create mode 100755 modules/EcmPrepaymentInvoices/javascript/searchcolumndefs.js create mode 100755 modules/EcmPrepaymentInvoices/javascript/tablenavigator.js create mode 100755 modules/EcmPrepaymentInvoices2/EcmPrepaymentInvoices.js create mode 100755 modules/EcmPrepaymentInvoices2/EcmPrepaymentInvoicesDetailView.js create mode 100755 modules/EcmPrepaymentInvoices3/EcmPrepaymentInvoices.js create mode 100755 modules/EcmPrepaymentInvoices3/EcmPrepaymentInvoicesDetailView.js create mode 100644 modules/EcmPriceBooks/Email.js create mode 100644 modules/EcmPriceBooks/advajax.js create mode 100644 modules/EcmPriceBooks/mintajax.js create mode 100644 modules/EcmPriceBooks/moo1.2.js create mode 100755 modules/EcmPriceBooks2/Email.js create mode 100755 modules/EcmPriceBooks2/advajax.js create mode 100755 modules/EcmPriceBooks2/mintajax.js create mode 100755 modules/EcmPriceBooks2/moo1.2.js create mode 100755 modules/EcmPrices/Email.js create mode 100755 modules/EcmPrices/advajax.js create mode 100755 modules/EcmPrices/mintajax.js create mode 100755 modules/EcmPrices/moo1.2.js create mode 100755 modules/EcmPrivateDocuments/js/js.js create mode 100755 modules/EcmProductB2Bs/AjaxSearch/AjaxSearch.js create mode 100755 modules/EcmProductB2Bs/Categories.js create mode 100755 modules/EcmProductB2Bs/Menu/ecmproducts.js create mode 100755 modules/EcmProductB2Bs/Menu/xaramenu.js create mode 100755 modules/EcmProductB2Bs/Prices.js create mode 100755 modules/EcmProductB2Bs/helper.js create mode 100755 modules/EcmProductB2Bs/javascript/EcmProductB2B.js create mode 100755 modules/EcmProductB2Bs/javascript/EcmProductB2BDetailView.js create mode 100755 modules/EcmProductB2Bs/javascript/MyTable.js create mode 100755 modules/EcmProductB2Bs/javascript/formloader.js create mode 100755 modules/EcmProductB2Bs/mintajax.js create mode 100755 modules/EcmProductB2Bs/paramsMT.js create mode 100755 modules/EcmProducts/AjaxSearch/AjaxSearch.js create mode 100755 modules/EcmProducts/Categories.js create mode 100755 modules/EcmProducts/Menu/ecmproducts.js create mode 100755 modules/EcmProducts/Menu/xaramenu.js create mode 100755 modules/EcmProducts/Prices.js create mode 100755 modules/EcmProducts/helper.js create mode 100755 modules/EcmProducts/javascript/DetailViewDocumentReady.js create mode 100755 modules/EcmProducts/javascript/EcmProduct.js create mode 100755 modules/EcmProducts/javascript/EcmProductDetailView.js create mode 100755 modules/EcmProducts/javascript/EcmProductQuickCreate.js create mode 100755 modules/EcmProducts/javascript/EditViewDocumentReady44.js create mode 100755 modules/EcmProducts/javascript/MyTable.js create mode 100755 modules/EcmProducts/javascript/autoIndeks.js create mode 100755 modules/EcmProducts/javascript/formloader.js create mode 100755 modules/EcmProducts/mintajaxToDelete.js create mode 100755 modules/EcmProducts/paramsMT.js create mode 100755 modules/EcmPurchaseOrders/javascript/EcmPurchaseOrders.js create mode 100755 modules/EcmPurchaseOrders/javascript/EcmPurchaseOrdersDetail.js create mode 100755 modules/EcmPurchaseOrders/javascript/bimit_table.js create mode 100755 modules/EcmPurchaseOrders/javascript/columndefs-detail.js create mode 100755 modules/EcmPurchaseOrders/javascript/columndefs.js create mode 100755 modules/EcmPurchaseOrders/javascript/helper.js create mode 100755 modules/EcmPurchaseOrders/javascript/searchcolumndefs.js create mode 100755 modules/EcmQuotes/javascript/EcmQuotes.js create mode 100755 modules/EcmQuotes/javascript/EcmQuotesDetail.js create mode 100755 modules/EcmQuotes/javascript/bimit_table2.js create mode 100755 modules/EcmQuotes/javascript/columndefs-detail.js create mode 100755 modules/EcmQuotes/javascript/columndefs.js create mode 100755 modules/EcmQuotes/javascript/searchcolumndefs.js create mode 100755 modules/EcmReceipts/javascript/EcmReceipts.js create mode 100755 modules/EcmReceipts/javascript/EcmReceiptsDetail.js create mode 100755 modules/EcmReceipts/javascript/bimit_table.js create mode 100755 modules/EcmReceipts/javascript/columndefs-detail.js create mode 100755 modules/EcmReceipts/javascript/columndefs.js create mode 100755 modules/EcmReceipts/javascript/searchcolumndefs.js create mode 100755 modules/EcmReceipts2/AjaxSearch/AjaxSearch.js create mode 100755 modules/EcmReceipts2/EcmReceipts.js create mode 100755 modules/EcmReceipts2/EcmReceiptsDetailView.js create mode 100755 modules/EcmReceipts2/Email.js create mode 100755 modules/EcmReceipts2/MyTable.js create mode 100755 modules/EcmReceipts2/PDFLanguages.js create mode 100755 modules/EcmReceipts2/PDFLanguagesMT.js create mode 100755 modules/EcmReceipts2/_EcmRecepitsDetailView.js create mode 100755 modules/EcmReceipts2/formloader.js create mode 100755 modules/EcmRegisterTypes/js/detail_view.js create mode 100755 modules/EcmRegisterTypes/js/edit_view.js create mode 100755 modules/EcmReminders/helper.js create mode 100755 modules/EcmReminders/mintajax.js create mode 100755 modules/EcmReminders/mintajax2.js create mode 100755 modules/EcmReminders/reminder.js create mode 100755 modules/EcmReports/TableSorter/js/jquery.metadata.js create mode 100755 modules/EcmReports/TableSorter/js/jquery.min.js create mode 100755 modules/EcmReports/TableSorter/js/jquery.tablesorter.js create mode 100755 modules/EcmReports/TableSorter/js/jquery.tablesorter.min.js create mode 100755 modules/EcmReports/TableSorter/js/jquery.tablesorter.staticrow.js create mode 100755 modules/EcmReports/TableSorter/js/jquery.tablesorter.staticrow.min.js create mode 100755 modules/EcmReports/TableSorter/js/jquery.tablesorter.widgets-filter-formatter.js create mode 100755 modules/EcmReports/TableSorter/js/jquery.tablesorter.widgets-filter-formatter.min.js create mode 100755 modules/EcmReports/TableSorter/js/jquery.tablesorter.widgets.js create mode 100755 modules/EcmReports/TableSorter/js/jquery.tablesorter.widgets.min.js create mode 100755 modules/EcmReports/TableSorter/js/parsers/parser-date-iso8601.js create mode 100755 modules/EcmReports/TableSorter/js/parsers/parser-date-month.js create mode 100755 modules/EcmReports/TableSorter/js/parsers/parser-date-two-digit-year.js create mode 100755 modules/EcmReports/TableSorter/js/parsers/parser-date-weekday.js create mode 100755 modules/EcmReports/TableSorter/js/parsers/parser-date.js create mode 100755 modules/EcmReports/TableSorter/js/parsers/parser-feet-inch-fraction.js create mode 100755 modules/EcmReports/TableSorter/js/parsers/parser-file-type.js create mode 100755 modules/EcmReports/TableSorter/js/parsers/parser-ignore-articles.js create mode 100755 modules/EcmReports/TableSorter/js/parsers/parser-input-select.js create mode 100755 modules/EcmReports/TableSorter/js/parsers/parser-ipv6.js create mode 100755 modules/EcmReports/TableSorter/js/parsers/parser-metric.js create mode 100755 modules/EcmReports/TableSorter/js/widgets/widget-build-table.js create mode 100755 modules/EcmReports/TableSorter/js/widgets/widget-editable.js create mode 100755 modules/EcmReports/TableSorter/js/widgets/widget-grouping.js create mode 100755 modules/EcmReports/TableSorter/js/widgets/widget-pager.js create mode 100755 modules/EcmReports/TableSorter/js/widgets/widget-repeatheaders.js create mode 100755 modules/EcmReports/TableSorter/js/widgets/widget-scroller.js create mode 100644 modules/EcmReports/TableSorterNew/addons/pager/jquery.tablesorter.pager.js create mode 100644 modules/EcmReports/TableSorterNew/addons/pager/jquery.tablesorter.pager.min.js create mode 100644 modules/EcmReports/TableSorterNew/beta-testing/pager-custom-controls.js create mode 100644 modules/EcmReports/TableSorterNew/beta-testing/widget-reorder.js create mode 100644 modules/EcmReports/TableSorterNew/docs/js/bootstrap.min.js create mode 100644 modules/EcmReports/TableSorterNew/docs/js/chili/jquery.chili-2.2.js create mode 100644 modules/EcmReports/TableSorterNew/docs/js/chili/recipes.js create mode 100644 modules/EcmReports/TableSorterNew/docs/js/demo-build-table.js create mode 100644 modules/EcmReports/TableSorterNew/docs/js/docs.js create mode 100644 modules/EcmReports/TableSorterNew/docs/js/jquery-1.2.6.min.js create mode 100644 modules/EcmReports/TableSorterNew/docs/js/jquery-1.4.4.min.js create mode 100644 modules/EcmReports/TableSorterNew/docs/js/jquery-latest.min.js create mode 100644 modules/EcmReports/TableSorterNew/docs/js/jquery-ui-latest.min.js create mode 100644 modules/EcmReports/TableSorterNew/docs/js/jquery.jui_theme_switch.min.js create mode 100644 modules/EcmReports/TableSorterNew/docs/js/jquery.tipsy.min.js create mode 100644 modules/EcmReports/TableSorterNew/docs/js/prettify.js create mode 100644 modules/EcmReports/TableSorterNew/docs/js/search-ie.js create mode 100644 modules/EcmReports/TableSorterNew/docs/js/search.js create mode 100644 modules/EcmReports/TableSorterNew/docs/js/select2-3.4.6.min.js create mode 100644 modules/EcmReports/TableSorterNew/docs/js/sugar.min.js create mode 100644 modules/EcmReports/TableSorterNew/js/extras/jquery.quicksearch.js create mode 100644 modules/EcmReports/TableSorterNew/js/extras/semver-mod.js create mode 100644 modules/EcmReports/TableSorterNew/js/extras/semver.js create mode 100644 modules/EcmReports/TableSorterNew/js/jquery.metadata.js create mode 100644 modules/EcmReports/TableSorterNew/js/jquery.tablesorter.js create mode 100644 modules/EcmReports/TableSorterNew/js/jquery.tablesorter.min.js create mode 100644 modules/EcmReports/TableSorterNew/js/jquery.tablesorter.widgets-filter-formatter-select2.js create mode 100644 modules/EcmReports/TableSorterNew/js/jquery.tablesorter.widgets-filter-formatter.js create mode 100644 modules/EcmReports/TableSorterNew/js/jquery.tablesorter.widgets-filter-formatter.min.js create mode 100644 modules/EcmReports/TableSorterNew/js/jquery.tablesorter.widgets.js create mode 100644 modules/EcmReports/TableSorterNew/js/jquery.tablesorter.widgets.min.js create mode 100644 modules/EcmReports/TableSorterNew/js/parsers/parser-date-extract.js create mode 100644 modules/EcmReports/TableSorterNew/js/parsers/parser-date-iso8601.js create mode 100644 modules/EcmReports/TableSorterNew/js/parsers/parser-date-month.js create mode 100644 modules/EcmReports/TableSorterNew/js/parsers/parser-date-two-digit-year.js create mode 100644 modules/EcmReports/TableSorterNew/js/parsers/parser-date-weekday.js create mode 100644 modules/EcmReports/TableSorterNew/js/parsers/parser-date.js create mode 100644 modules/EcmReports/TableSorterNew/js/parsers/parser-duration.js create mode 100644 modules/EcmReports/TableSorterNew/js/parsers/parser-feet-inch-fraction.js create mode 100644 modules/EcmReports/TableSorterNew/js/parsers/parser-file-type.js create mode 100644 modules/EcmReports/TableSorterNew/js/parsers/parser-ignore-articles.js create mode 100644 modules/EcmReports/TableSorterNew/js/parsers/parser-image.js create mode 100644 modules/EcmReports/TableSorterNew/js/parsers/parser-input-select.js create mode 100644 modules/EcmReports/TableSorterNew/js/parsers/parser-ipv6.js create mode 100644 modules/EcmReports/TableSorterNew/js/parsers/parser-metric.js create mode 100644 modules/EcmReports/TableSorterNew/js/parsers/parser-roman.js create mode 100644 modules/EcmReports/TableSorterNew/js/widget-scroller.js create mode 100644 modules/EcmReports/TableSorterNew/js/widgets/widget-alignChar.js create mode 100644 modules/EcmReports/TableSorterNew/js/widgets/widget-build-table.js create mode 100644 modules/EcmReports/TableSorterNew/js/widgets/widget-columnSelector.js create mode 100644 modules/EcmReports/TableSorterNew/js/widgets/widget-cssStickyHeaders.js create mode 100644 modules/EcmReports/TableSorterNew/js/widgets/widget-editable.js create mode 100644 modules/EcmReports/TableSorterNew/js/widgets/widget-grouping.js create mode 100644 modules/EcmReports/TableSorterNew/js/widgets/widget-headerTitles.js create mode 100644 modules/EcmReports/TableSorterNew/js/widgets/widget-math.js create mode 100644 modules/EcmReports/TableSorterNew/js/widgets/widget-output.js create mode 100644 modules/EcmReports/TableSorterNew/js/widgets/widget-pager.js create mode 100644 modules/EcmReports/TableSorterNew/js/widgets/widget-print.js create mode 100644 modules/EcmReports/TableSorterNew/js/widgets/widget-reflow.js create mode 100644 modules/EcmReports/TableSorterNew/js/widgets/widget-repeatheaders.js create mode 100644 modules/EcmReports/TableSorterNew/js/widgets/widget-scroller.js create mode 100644 modules/EcmReports/TableSorterNew/js/widgets/widget-staticRow.js create mode 100644 modules/EcmReports/TableSorterNew/testing/jshint-2.4.4.js create mode 100644 modules/EcmReports/TableSorterNew/testing/qunit-1.14.0.js create mode 100644 modules/EcmReports/TableSorterNew/testing/testing-ipv6.js create mode 100644 modules/EcmReports/TableSorterNew/testing/testing-widgets.js create mode 100644 modules/EcmReports/TableSorterNew/testing/testing.js create mode 100644 modules/EcmReports/TableSorterNew/widget-resize.js create mode 100755 modules/EcmReports/javascript/AnalysisEcmQuote.js create mode 100644 modules/EcmReports/javascript/AnalysisPZ.js create mode 100755 modules/EcmReports/javascript/AnalysisProductSale.js create mode 100755 modules/EcmReports/javascript/ProductOperationHistory.js create mode 100644 modules/EcmReports/javascript/RaportAktywnosci.js create mode 100644 modules/EcmReports/javascript/RaportMM.js create mode 100644 modules/EcmReports/javascript/RaportZamowien.js create mode 100755 modules/EcmReports/javascript/ReportBuyesByVat.js create mode 100644 modules/EcmReports/javascript/ReportSales.js create mode 100644 modules/EcmReports/javascript/ReportSalesByContractor.js create mode 100644 modules/EcmReports/javascript/ReportSalesByContractor2.js create mode 100644 modules/EcmReports/javascript/ReportSalesByDocument.js create mode 100644 modules/EcmReports/javascript/ReportSalesByGroup.js create mode 100644 modules/EcmReports/javascript/ReportSalesByGroupChart.js create mode 100644 modules/EcmReports/javascript/ReportSalesByProduct.js create mode 100644 modules/EcmReports/javascript/ReportStockDocMoves.js create mode 100644 modules/EcmReports/javascript/ReportStocksDoc.js create mode 100644 modules/EcmReports/javascript/SendSMS.js create mode 100644 modules/EcmReports/javascript/jquery-latest.js create mode 100644 modules/EcmReports/javascript/jquery.tablesorter.js create mode 100644 modules/EcmReports/javascript/mzVatPurchases.js create mode 100755 modules/EcmReportsBackUp20151106/PhpExcell/Documentation/API/js/SVGPan.js create mode 100755 modules/EcmReportsBackUp20151106/PhpExcell/Documentation/API/js/bootstrap.js create mode 100755 modules/EcmReportsBackUp20151106/PhpExcell/Documentation/API/js/bootstrap.min.js create mode 100755 modules/EcmReportsBackUp20151106/PhpExcell/Documentation/API/js/jquery-1.4.2.min.js create mode 100755 modules/EcmReportsBackUp20151106/PhpExcell/Documentation/API/js/jquery-1.7.1.min.js create mode 100755 modules/EcmReportsBackUp20151106/PhpExcell/Documentation/API/js/jquery-ui-1.8.2.custom.min.js create mode 100755 modules/EcmReportsBackUp20151106/PhpExcell/Documentation/API/js/jquery.cookie.js create mode 100755 modules/EcmReportsBackUp20151106/PhpExcell/Documentation/API/js/jquery.iviewer.js create mode 100755 modules/EcmReportsBackUp20151106/PhpExcell/Documentation/API/js/jquery.iviewer.min.js create mode 100755 modules/EcmReportsBackUp20151106/PhpExcell/Documentation/API/js/jquery.mousewheel.min.js create mode 100755 modules/EcmReportsBackUp20151106/PhpExcell/Documentation/API/js/jquery.panzoom.js create mode 100755 modules/EcmReportsBackUp20151106/PhpExcell/Documentation/API/js/jquery.splitter.js create mode 100755 modules/EcmReportsBackUp20151106/PhpExcell/Documentation/API/js/jquery.tools.min.js create mode 100755 modules/EcmReportsBackUp20151106/PhpExcell/Documentation/API/js/jquery.treeview.js create mode 100755 modules/EcmReportsBackUp20151106/PhpExcell/Documentation/API/js/menu.js create mode 100755 modules/EcmReportsBackUp20151106/PhpExcell/Documentation/API/js/prettify/lang-apollo.js create mode 100755 modules/EcmReportsBackUp20151106/PhpExcell/Documentation/API/js/prettify/lang-clj.js create mode 100755 modules/EcmReportsBackUp20151106/PhpExcell/Documentation/API/js/prettify/lang-css.js create mode 100755 modules/EcmReportsBackUp20151106/PhpExcell/Documentation/API/js/prettify/lang-go.js create mode 100755 modules/EcmReportsBackUp20151106/PhpExcell/Documentation/API/js/prettify/lang-hs.js create mode 100755 modules/EcmReportsBackUp20151106/PhpExcell/Documentation/API/js/prettify/lang-lisp.js create mode 100755 modules/EcmReportsBackUp20151106/PhpExcell/Documentation/API/js/prettify/lang-lua.js create mode 100755 modules/EcmReportsBackUp20151106/PhpExcell/Documentation/API/js/prettify/lang-ml.js create mode 100755 modules/EcmReportsBackUp20151106/PhpExcell/Documentation/API/js/prettify/lang-n.js create mode 100755 modules/EcmReportsBackUp20151106/PhpExcell/Documentation/API/js/prettify/lang-proto.js create mode 100755 modules/EcmReportsBackUp20151106/PhpExcell/Documentation/API/js/prettify/lang-scala.js create mode 100755 modules/EcmReportsBackUp20151106/PhpExcell/Documentation/API/js/prettify/lang-sql.js create mode 100755 modules/EcmReportsBackUp20151106/PhpExcell/Documentation/API/js/prettify/lang-tex.js create mode 100755 modules/EcmReportsBackUp20151106/PhpExcell/Documentation/API/js/prettify/lang-vb.js create mode 100755 modules/EcmReportsBackUp20151106/PhpExcell/Documentation/API/js/prettify/lang-vhdl.js create mode 100755 modules/EcmReportsBackUp20151106/PhpExcell/Documentation/API/js/prettify/lang-wiki.js create mode 100755 modules/EcmReportsBackUp20151106/PhpExcell/Documentation/API/js/prettify/lang-xq.js create mode 100755 modules/EcmReportsBackUp20151106/PhpExcell/Documentation/API/js/prettify/lang-yaml.js create mode 100755 modules/EcmReportsBackUp20151106/PhpExcell/Documentation/API/js/prettify/prettify.min.js create mode 100755 modules/EcmReportsBackUp20151106/PhpExcell/Documentation/API/js/sidebar.js create mode 100755 modules/EcmReportsBackUp20151106/PhpExcell/Documentation/API/js/template.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorter/js/jquery.metadata.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorter/js/jquery.min.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorter/js/jquery.tablesorter.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorter/js/jquery.tablesorter.min.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorter/js/jquery.tablesorter.staticrow.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorter/js/jquery.tablesorter.staticrow.min.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorter/js/jquery.tablesorter.widgets-filter-formatter.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorter/js/jquery.tablesorter.widgets-filter-formatter.min.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorter/js/jquery.tablesorter.widgets.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorter/js/jquery.tablesorter.widgets.min.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorter/js/parsers/parser-date-iso8601.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorter/js/parsers/parser-date-month.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorter/js/parsers/parser-date-two-digit-year.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorter/js/parsers/parser-date-weekday.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorter/js/parsers/parser-date.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorter/js/parsers/parser-feet-inch-fraction.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorter/js/parsers/parser-file-type.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorter/js/parsers/parser-ignore-articles.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorter/js/parsers/parser-input-select.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorter/js/parsers/parser-ipv6.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorter/js/parsers/parser-metric.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorter/js/widgets/widget-build-table.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorter/js/widgets/widget-editable.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorter/js/widgets/widget-grouping.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorter/js/widgets/widget-pager.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorter/js/widgets/widget-repeatheaders.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorter/js/widgets/widget-scroller.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorterNew/addons/pager/jquery.tablesorter.pager.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorterNew/addons/pager/jquery.tablesorter.pager.min.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorterNew/beta-testing/pager-custom-controls.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorterNew/beta-testing/widget-reorder.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorterNew/docs/js/bootstrap.min.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorterNew/docs/js/chili/jquery.chili-2.2.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorterNew/docs/js/chili/recipes.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorterNew/docs/js/demo-build-table.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorterNew/docs/js/docs.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorterNew/docs/js/jquery-1.2.6.min.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorterNew/docs/js/jquery-1.4.4.min.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorterNew/docs/js/jquery-latest.min.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorterNew/docs/js/jquery-ui-latest.min.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorterNew/docs/js/jquery.jui_theme_switch.min.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorterNew/docs/js/jquery.tipsy.min.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorterNew/docs/js/prettify.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorterNew/docs/js/search-ie.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorterNew/docs/js/search.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorterNew/docs/js/select2-3.4.6.min.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorterNew/docs/js/sugar.min.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorterNew/js/extras/jquery.quicksearch.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorterNew/js/extras/semver-mod.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorterNew/js/extras/semver.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorterNew/js/jquery.metadata.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorterNew/js/jquery.tablesorter.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorterNew/js/jquery.tablesorter.min.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorterNew/js/jquery.tablesorter.widgets-filter-formatter-select2.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorterNew/js/jquery.tablesorter.widgets-filter-formatter.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorterNew/js/jquery.tablesorter.widgets-filter-formatter.min.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorterNew/js/jquery.tablesorter.widgets.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorterNew/js/jquery.tablesorter.widgets.min.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorterNew/js/parsers/parser-date-extract.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorterNew/js/parsers/parser-date-iso8601.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorterNew/js/parsers/parser-date-month.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorterNew/js/parsers/parser-date-two-digit-year.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorterNew/js/parsers/parser-date-weekday.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorterNew/js/parsers/parser-date.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorterNew/js/parsers/parser-duration.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorterNew/js/parsers/parser-feet-inch-fraction.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorterNew/js/parsers/parser-file-type.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorterNew/js/parsers/parser-ignore-articles.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorterNew/js/parsers/parser-image.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorterNew/js/parsers/parser-input-select.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorterNew/js/parsers/parser-ipv6.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorterNew/js/parsers/parser-metric.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorterNew/js/parsers/parser-roman.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorterNew/js/widgets/widget-alignChar.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorterNew/js/widgets/widget-build-table.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorterNew/js/widgets/widget-columnSelector.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorterNew/js/widgets/widget-cssStickyHeaders.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorterNew/js/widgets/widget-editable.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorterNew/js/widgets/widget-grouping.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorterNew/js/widgets/widget-headerTitles.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorterNew/js/widgets/widget-math.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorterNew/js/widgets/widget-output.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorterNew/js/widgets/widget-pager.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorterNew/js/widgets/widget-print.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorterNew/js/widgets/widget-reflow.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorterNew/js/widgets/widget-repeatheaders.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorterNew/js/widgets/widget-scroller.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorterNew/js/widgets/widget-staticRow.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorterNew/testing/jshint-2.4.4.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorterNew/testing/qunit-1.14.0.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorterNew/testing/testing-ipv6.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorterNew/testing/testing-widgets.js create mode 100755 modules/EcmReportsBackUp20151106/TableSorterNew/testing/testing.js create mode 100755 modules/EcmReportsBackUp20151106/javascript/AnalysisEcmQuote.js create mode 100755 modules/EcmReportsBackUp20151106/javascript/AnalysisProductSale.js create mode 100755 modules/EcmReportsBackUp20151106/javascript/ListDailySales.js create mode 100755 modules/EcmReportsBackUp20151106/javascript/ReportAcceptance.js create mode 100755 modules/EcmReportsBackUp20151106/javascript/ReportBuyesByVat.js create mode 100755 modules/EcmReportsBackUp20151106/javascript/ReportEcmWorkCards.js create mode 100755 modules/EcmReportsBackUp20151106/javascript/ReportEcmWorkCardsEcmProduct.js create mode 100755 modules/EcmReportsBackUp20151106/javascript/ReportSales.js create mode 100755 modules/EcmReportsBackUp20151106/javascript/ReportSalesByContractor.js create mode 100755 modules/EcmReportsBackUp20151106/javascript/ReportStockDocMoves.js create mode 100755 modules/EcmReportsBackUp20151106/javascript/ReportStocks.js create mode 100755 modules/EcmReportsBackUp20151106/javascript/ReportValue.js create mode 100755 modules/EcmReportsBackUp20151106/javascript/VatSalesRegister.js create mode 100755 modules/EcmReportsBackUp20151106/javascript/detailProducts.js create mode 100755 modules/EcmReportsBackUp20151106/javascript/jquery.blockUI.js create mode 100755 modules/EcmReportsBackUp20151106/javascript/jquery.js create mode 100755 modules/EcmReportsBackUp20151106/mz_tpl/StockOperationsCheck/StockOperationsCheck.js create mode 100755 modules/EcmResourcess/js/detailView.js create mode 100755 modules/EcmResourcess/js/editView.js create mode 100644 modules/EcmReturns/javascript/EcmReturns.js create mode 100644 modules/EcmReturns/javascript/EcmReturnsDetail.js create mode 100644 modules/EcmReturns/javascript/bimit_table.js create mode 100644 modules/EcmReturns/javascript/columndefs-detail.js create mode 100644 modules/EcmReturns/javascript/columndefs.js create mode 100644 modules/EcmSales/eCommerceZS/eCommerceZS.js create mode 100755 modules/EcmSales/javascript/EcmSales3.js create mode 100755 modules/EcmSales/javascript/EcmSalesDetail.js create mode 100755 modules/EcmSales/javascript/ListNewSales.js create mode 100755 modules/EcmSales/javascript/ProductSummary.js create mode 100755 modules/EcmSales/javascript/bimit_table4.js create mode 100755 modules/EcmSales/javascript/columndefs-detail.js create mode 100755 modules/EcmSales/javascript/columndefs2.js create mode 100755 modules/EcmSales/javascript/searchcolumndefs.js create mode 100755 modules/EcmSales/javascript/tablenavigator.js create mode 100644 modules/EcmSales/javascript/wzCreator.js create mode 100755 modules/EcmSalesC/javascript/EcmSales.js create mode 100755 modules/EcmSalesC/javascript/EcmSalesDetail.js create mode 100755 modules/EcmSalesC/javascript/ListNewSales.js create mode 100755 modules/EcmSalesC/javascript/ProductSummary.js create mode 100755 modules/EcmSalesC/javascript/bimit_table.js create mode 100755 modules/EcmSalesC/javascript/columndefs-detail.js create mode 100755 modules/EcmSalesC/javascript/columndefs.js create mode 100755 modules/EcmServiceNews/javascript/EcmServiceNews.js create mode 100755 modules/EcmServiceNews/javascript/EcmServiceNewsDetail.js create mode 100755 modules/EcmServiceNews/javascript/bimit_table.js create mode 100755 modules/EcmServiceNews/javascript/columndefs.js create mode 100755 modules/EcmStockDocCorrects.2/javascript/EcmStockDocCorrects.js create mode 100755 modules/EcmStockDocCorrects.2/javascript/EcmStockDocCorrectsDetail.js create mode 100755 modules/EcmStockDocCorrects.2/javascript/bimit_table.js create mode 100755 modules/EcmStockDocCorrects.2/javascript/columndefs-detail.js create mode 100755 modules/EcmStockDocCorrects.2/javascript/columndefs.js create mode 100755 modules/EcmStockDocCorrects.2/javascript/searchcolumndefs.js create mode 100644 modules/EcmStockDocCorrects/javascript/Consignments.js create mode 100755 modules/EcmStockDocCorrects/javascript/EcmStockDocCorrects.js create mode 100755 modules/EcmStockDocCorrects/javascript/EcmStockDocCorrectsDetail.js create mode 100644 modules/EcmStockDocCorrects/javascript/bimit_table.js create mode 100755 modules/EcmStockDocCorrects/javascript/columndefs-detail.js create mode 100644 modules/EcmStockDocCorrects/javascript/columndefs.js create mode 100755 modules/EcmStockDocCorrects/javascript/searchcolumndefs.js create mode 100755 modules/EcmStockDocIns/javascript/Consignments.js create mode 100755 modules/EcmStockDocIns/javascript/EcmStockDocIns.js create mode 100755 modules/EcmStockDocIns/javascript/EcmStockDocInsDetail.js create mode 100644 modules/EcmStockDocIns/javascript/bimit_table3.js create mode 100755 modules/EcmStockDocIns/javascript/columndefs-detail.js create mode 100755 modules/EcmStockDocIns/javascript/columndefs3.js create mode 100755 modules/EcmStockDocIns/javascript/searchcolumndefs.js create mode 100755 modules/EcmStockDocInsideIns/javascript/Consignments.js create mode 100755 modules/EcmStockDocInsideIns/javascript/EcmStockDocInsideIns.js create mode 100755 modules/EcmStockDocInsideIns/javascript/EcmStockDocInsideInsDetail.js create mode 100755 modules/EcmStockDocInsideIns/javascript/bimit_table.js create mode 100755 modules/EcmStockDocInsideIns/javascript/columndefs-detail.js create mode 100755 modules/EcmStockDocInsideIns/javascript/columndefs.js create mode 100755 modules/EcmStockDocInsideIns/javascript/searchcolumndefs.js create mode 100755 modules/EcmStockDocInsideOuts/javascript/Consignments.js create mode 100755 modules/EcmStockDocInsideOuts/javascript/EcmStockDocInsideOuts.js create mode 100755 modules/EcmStockDocInsideOuts/javascript/EcmStockDocInsideOutsDetail.js create mode 100755 modules/EcmStockDocInsideOuts/javascript/bimit_table.js create mode 100755 modules/EcmStockDocInsideOuts/javascript/columndefs-detail.js create mode 100755 modules/EcmStockDocInsideOuts/javascript/columndefs.js create mode 100755 modules/EcmStockDocInsideOuts/javascript/searchcolumndefs.js create mode 100755 modules/EcmStockDocInss/javascript/EcmStockDocIns.js create mode 100755 modules/EcmStockDocInss/javascript/EcmStockDocInsDetail.js create mode 100755 modules/EcmStockDocInss/javascript/bimit_table.js create mode 100755 modules/EcmStockDocInss/javascript/columndefs-detail.js create mode 100755 modules/EcmStockDocInss/javascript/columndefs.js create mode 100755 modules/EcmStockDocMoves/javascript/Consignments.js create mode 100755 modules/EcmStockDocMoves/javascript/EcmStockDocMoves.js create mode 100755 modules/EcmStockDocMoves/javascript/EcmStockDocMovesDetail.js create mode 100755 modules/EcmStockDocMoves/javascript/bimit_table.js create mode 100755 modules/EcmStockDocMoves/javascript/columndefs-detail.js create mode 100755 modules/EcmStockDocMoves/javascript/columndefs.js create mode 100755 modules/EcmStockDocMoves/javascript/searchcolumndefs.js create mode 100755 modules/EcmStockDocOuts/javascript/Consignments.js create mode 100755 modules/EcmStockDocOuts/javascript/EcmStockDocOuts.js create mode 100755 modules/EcmStockDocOuts/javascript/EcmStockDocOutsDetail.js create mode 100644 modules/EcmStockDocOuts/javascript/bimit_table2.js create mode 100755 modules/EcmStockDocOuts/javascript/columndefs-detail.js create mode 100755 modules/EcmStockDocOuts/javascript/columndefs.js create mode 100755 modules/EcmStockDocOuts/javascript/searchcolumndefs.js create mode 100755 modules/EcmSyntheticAccounts/js/DetailViewDocumentReady.js create mode 100755 modules/EcmSyntheticAccounts/js/EditViewDocumentReady.js create mode 100755 modules/EcmSysInfos/js/firmInfo.js create mode 100755 modules/EcmSysInfos/js/headersDocuments.js create mode 100755 modules/EcmTransactions/js/DetailView.js create mode 100755 modules/EcmTransactions/js/EditView.js create mode 100755 modules/EcmTransactions/js/hidesearch.js create mode 100755 modules/EcmWorkCards/js/DetailViewDocumentReady.js create mode 100755 modules/EcmWorkCards/js/EditViewDocumentReady.js create mode 100755 modules/EcmWorkers/js/detailView.js create mode 100755 modules/EcmWorkers/js/editView.js create mode 100755 modules/EmailTemplates/EmailTemplate.js create mode 100755 modules/Emails/javascript/Email.js create mode 100755 modules/Emails/javascript/EmailUI.js create mode 100755 modules/Emails/javascript/EmailUICompose.js create mode 100755 modules/Emails/javascript/EmailUIShared.js create mode 100755 modules/Emails/javascript/ajax.js create mode 100755 modules/Emails/javascript/complexLayout.js create mode 100755 modules/Emails/javascript/composeEmailTemplate.js create mode 100755 modules/Emails/javascript/composeEmailTemplate1.js create mode 100755 modules/Emails/javascript/displayOneEmailTemplate.js create mode 100755 modules/Emails/javascript/email_popup_helper.js create mode 100755 modules/Emails/javascript/grid.js create mode 100755 modules/Emails/javascript/init.js create mode 100755 modules/Emails/javascript/prototypeOverloads.js create mode 100755 modules/Emails/javascript/vars.js create mode 100755 modules/Emails/javascript/viewPrintable.js create mode 100755 modules/Home/about.js create mode 100755 modules/InboundEmail/InboundEmail.js create mode 100755 modules/Leads/Lead.js create mode 100755 modules/Meetings/jsclass_scheduler.js create mode 100755 modules/MergeRecords/Merge.js create mode 100755 modules/ModuleBuilder/javascript/JSTransaction.js create mode 100755 modules/ModuleBuilder/javascript/ModuleBuilder.js create mode 100755 modules/ModuleBuilder/javascript/SimpleList.js create mode 100755 modules/ModuleBuilder/javascript/studio2.js create mode 100755 modules/ModuleBuilder/javascript/studio2FieldDD.js create mode 100755 modules/ModuleBuilder/javascript/studio2ListDD.js create mode 100755 modules/ModuleBuilder/javascript/studio2PanelDD.js create mode 100755 modules/ModuleBuilder/javascript/studio2RowDD.js create mode 100755 modules/ModuleBuilder/javascript/studiotabgroups.js create mode 100755 modules/ModuleBuilder/javascript/wizardTemplate.js create mode 100755 modules/Project/Project.js create mode 100755 modules/ProjectTask/ProjectTask.js create mode 100755 modules/Studio/JSTransaction.js create mode 100755 modules/Studio/studio.js create mode 100755 modules/Studio/studiodd.js create mode 100755 modules/Studio/studiotabgroups.js create mode 100755 modules/Studio/ygDDListStudio.js create mode 100644 modules/Tasks/javascript/EditView.js create mode 100755 modules/UpgradeWizard/upgradeWizard.js create mode 100755 modules/Users/DetailView.js create mode 100755 modules/Users/PasswordRequirementBox.js create mode 100755 modules/Users/User.js create mode 100755 modules/Users/login.js create mode 100755 modules/confirm_exit.js create mode 100644 modules/var/www/html/system/modules/EcmReports/javascript/AnalysisEcmQuote.js create mode 100644 modules/var/www/html/system/modules/EcmReports/javascript/AnalysisProductSale.js create mode 100644 modules/var/www/html/system/modules/EcmReports/javascript/ProductOperationHistory.js create mode 100644 modules/var/www/html/system/modules/EcmReports/javascript/RaportAktywnosci.js create mode 100644 modules/var/www/html/system/modules/EcmReports/javascript/ReportSalesByContractor.js create mode 100644 modules/var/www/html/system/modules/EcmReports/javascript/ReportSalesByDocument.js create mode 100644 modules/var/www/html/system/modules/EcmReports/javascript/ReportSalesByGroup.js create mode 100644 modules/var/www/html/system/modules/EcmReports/javascript/ReportSalesByGroupChart.js create mode 100644 modules/var/www/html/system/modules/EcmReports/javascript/ReportSalesByProduct.js create mode 100644 modules/var/www/html/system/modules/EcmReports/javascript/ReportStockDocMoves.js create mode 100644 modules/var/www/html/system/modules/EcmReports/javascript/ReportStocksDoc.js create mode 100755 port/js/bootstrap.js create mode 100755 port/js/bootstrap.min.js create mode 100755 port/js/jquery.js create mode 100755 port/js/jquery.waypoints.js create mode 100755 port/js/jquery.waypoints.min.js create mode 100755 port/js/noframework.waypoints.js create mode 100755 port/js/noframework.waypoints.min.js create mode 100755 port/js/shortcuts/infinite.js create mode 100755 port/js/shortcuts/infinite.min.js create mode 100755 port/js/shortcuts/inview.js create mode 100755 port/js/shortcuts/inview.min.js create mode 100755 port/js/shortcuts/sticky.js create mode 100755 port/js/shortcuts/sticky.min.js create mode 100755 port/js/waypoints.debug.js create mode 100755 port/js/zepto.waypoints.js create mode 100755 port/js/zepto.waypoints.min.js create mode 100755 service/utils/SugarRest.js create mode 100755 themes/Sugar5/js/MyMenu.js create mode 100755 themes/Sugar5/js/style.js create mode 100755 themes/default/js/style.js diff --git a/.gitignore b/.gitignore index f3b016e4..348529ee 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ !.gitignore !*.php !*.html +!*.js # ...even if they are in subdirectories !*/ diff --git a/import/EcmPriceBooks/Email.js b/import/EcmPriceBooks/Email.js new file mode 100644 index 00000000..1685ac49 --- /dev/null +++ b/import/EcmPriceBooks/Email.js @@ -0,0 +1,1018 @@ +/** + * EditView javascript for Email + * + * SugarCRM is a customer relationship management program developed by + * SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc. + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License version 3 as published by the + * Free Software Foundation with the addition of the following permission added + * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK + * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY + * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS. + * + * 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, see http://www.gnu.org/licenses or write to the Free + * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301 USA. + * + * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road, + * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com. + * + * The interactive user interfaces in modified source and object code versions + * of this program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU General Public License version 3. + * + * In accordance with Section 7(b) of the GNU General Public License version 3, + * these Appropriate Legal Notices must retain the display of the "Powered by + * SugarCRM" logo. If the display of the logo is not reasonably feasible for + * technical reasons, the Appropriate Legal Notices must display the words + * "Powered by SugarCRM". + */ + + + +var uploads_arr=new Array(); +var uploads_count_map=new Object(); +var uploads_count = -1; +var current_uploads_id = -1; +var append = false; // Ed has method InsertHTML which inserts at cursor point - plain does not +//following varaibles store references to input fields grouped with the clicked email selection button (select). +var current_contact = ''; +var current_contact_id = ''; +var current_contact_email = ''; +var current_contact_name = ''; +var uploadIndex = 0; +var select_image = SUGAR.language.get('app_strings', 'LBL_ONLY_IMAGE_ATTACHMENT'); +var lbl_remove = SUGAR.language.get('app_strings', 'LBL_REMOVE'); + +function toggleRawEmail() { + var raw = document.getElementById('rawEmail'); + var button = document.getElementById('rawButton'); + + if(raw.style.display == '') { + raw.style.display = 'none'; + button.value = showRaw; + } else { + raw.style.display = ''; + button.value = hideRaw; + } +} + +/////////////////////////////////////////////////////////////////////////////// +//// DOCUMENT HANDLING HELPERS + +function deletePriorAttachment(id) { + var rem = document.getElementById('removeAttachment'); + + if(rem.value != '') { + rem.value += "::"; + } + rem.value += id; + + document.getElementById('noteDiv'+id).style.display = 'none'; +} + +function setDocument(target, documentId, documentName, docRevId) { + if(window.opener.SUGAR.email2) { + var idx = window.opener.SUGAR.email2.composeLayout.currentInstanceId; + window.opener.SUGAR.email2.composeLayout.setDocument(idx, target, documentId, documentName, docRevId); + } else { + var docId = window.opener.document.getElementById('documentId' + target); + var docName = window.opener.document.getElementById('documentName' + target); + var docRevisionId = window.opener.document.getElementById('document' + target); + docId.value = documentId; + docName.value = documentName; + docRevisionId.value = docRevId; + } + window.close(); +} + +function setDocumentToCampaignTemplate(target, documentId, documentName,docRevId, documentType) { +// var docId = eval("window.opener.document.forms.EditView.documentId" + target); + var docId = window.opener.document.getElementById('documentId' + target); + //var docName = eval("window.opener.document.EditView.documentName" + target); + var docName = window.opener.document.getElementById('documentName' + target); + var docType = window.opener.document.getElementById('documentType' + target); + + var docId = window.opener.document.getElementById('documentId'); + var docName = window.opener.document.getElementById('documentName'); + var docRevisionId = window.opener.document.getElementById('docRevId'); + var docType = window.opener.document.getElementById('documentType'); + + docId.value = documentId; + //docId.onchange('docUpload(); form_reset_doc();'); + docName.value = documentName; + docRevisionId.value = docRevId; + docType.value = documentType; + docName.onchange('docUpload(); form_reset_doc();'); + //alert(docName.onchange); + window.close(); +} + +function selectDocument(target) { + URL="index.php?module=Emails&action=PopupDocuments&to_pdf=true&target=" + target; + windowName = 'selectDocument'; + windowFeatures = 'width=800' + ',height=600' + ',resizable=1,scrollbars=1'; + + win = window.open(URL, windowName, windowFeatures); + if(window.focus) { + // put the focus on the popup if the browser supports the focus() method + win.focus(); + } +} + +function addDocument() { + for(var i=0;i<10;i++) { + var elem = document.getElementById('document'+i); + if(elem.style.display == 'none') { + elem.style.display='block'; + break; + } + } +} + +function deleteDocument(index) { + var elem = document.getElementById('document'+index); + document.getElementById('documentId'+index).value = ""; + document.getElementById('documentName'+index).value = ""; + elem.style.display='none'; +} + +// attachment functions below +function deleteFile(index) { + //get div element + var elem = document.getElementById('file'+index); + //get upload widget + var ea_input = document.getElementById('email_attachment'+index); + + //get the parent node + var Parent = ea_input.parentNode; + //create replacement node + var ea = document.createElement('input'); + ea.setAttribute('id', 'email_attachment' + index); + ea.setAttribute('name', 'email_attachment' + index); + ea.setAttribute('tabindex', '120'); + ea.setAttribute('size', '40'); + ea.setAttribute('type', 'file'); + + //replace the old node with the new one + Parent.replaceChild(ea, ea_input); + + //hide the div element + elem.style.display='none'; + +} + +function addFile() { + for(var i=0;i<10;i++) { + var elem = document.getElementById('file'+i); + if(elem.style.display == 'none') { + elem.style.display='block'; + break; + } + } +} +//// END DOCUMENT HANDLING HELPERS +/////////////////////////////////////////////////////////////////////////////// + +///// New file upload code + +function multiFiles( list_target){ + // Where to write the list + this.list_target = list_target; + //this.list_target = document.getElementById(list_target); + // How many elements? + this.count = 0; + // How many elements? + this.id = 0; + // Is there a maximum? + + //alert("test"); + /** + * Add a new file input element + */ + this.addElement = function( element ){ + // Make sure it's a file input element + if( element.tagName == 'INPUT' && element.type == 'file' ){ + var currCount =this.id++; + // Element name -- what number am I? + //element.name = 'file_' + this.id++; + element.name = 'email_attachment' + currCount; + element.id = 'email_attachment' + currCount; + + // Add reference to this object + element.multi_selector = this; + // What to do when a file is selected + + element.onchange = function(){ + + //AJAX call begins + var callback = { + upload:function(r) { + //console.log("response object: %o", r); + var rets = JSON.parse(r.responseText); + } + } + + var url ='index.php?module=EmailTemplates&action=AttachFiles'; + YAHOO.util.Connect.setForm(document.getElementById("upload_form"), true,true); + YAHOO.util.Connect.asyncRequest('POST', url, callback,null); + //AJAX call ends + + //var theForm = document.getElementById('upload_form'); + var theForm = document.getElementById('EditView'); + + + // New file input + var new_element = document.createElement( 'input' ); + new_element.type = 'file'; + // new_element.name = 'email_attachment' +up++; + + // Add new element + this.parentNode.insertBefore( new_element, this ); + // Apply 'update' to element + this.multi_selector.addElement( new_element ); + // Update list + this.multi_selector.addListRow( this ); + // Hide this: we can't use display:none because Safari doesn't like it + //this.style.display='none'; + //display none works fine for FF and IE + this.style.display = 'none'; + //later for Safari add following + //this.style.position = 'absolute'; + //this.style.left = '-5000px'; + }; + // File element counter + this.count++; + // Most recent element + this.current_element = element; + + } else { + // This can only be applied to file input elements! + alert( 'Error: not a file input element' ); + }; + }; + + /** + * Add a new row to the list of files + */ + this.addListRow = function( element ){ + // Row div + var new_row = document.createElement( 'div' ); + + // Delete button + var new_row_button_remove = document.createElement( 'input' ); + new_row_button_remove.type = 'button'; + new_row_button_remove.value = lbl_remove; + + var new_row_file_name = document.createElement( 'input' ); + new_row_file_name.type = 'text'; + new_row_file_name.size = '40'; + new_row_file_name.disabled=true; + + var new_row_chk_box = document.createElement( 'input' ); + new_row_chk_box.setAttribute('id','checkBoxFile[]'); + new_row_chk_box.setAttribute('name','checkBoxFile[]'); + new_row_chk_box.type = 'checkbox'; + new_row_chk_box.checked =false; + new_row_chk_box.disabled =true; + + var new_row_attach_file = document.createElement( 'input' ); + new_row_attach_file.type = 'image'; + new_row_attach_file.value ='/themes/Sugar/images/company_logo.png'; + new_row_attach_file.disabled ='true'; + + var imgElement = document.createElement("img"); + imgElement.setAttribute("src", "themes/default/images/Accounts.gif"); + imgElement.setAttribute("align","absmiddle"); + imgElement.setAttribute("alt","File"); + imgElement.setAttribute("border","0"); + imgElement.setAttribute("height","16"); + imgElement.setAttribute("width","16"); + + var new_row_button_embed = document.createElement("img"); + new_row_button_embed.setAttribute("src", "themes/default/images/attachment.gif"); + new_row_button_embed.setAttribute("align","absmiddle"); + new_row_button_embed.setAttribute("alt","Embed"); + new_row_button_embed.setAttribute("border","0"); + new_row_button_embed.setAttribute("height","16"); + new_row_button_embed.setAttribute("width","16"); + + + + /* + var new_row_button_embed = document.createElement( 'input' ); + new_row_button_embed.type = 'button'; + new_row_button_embed.value = 'Embed'; + */ + // References + new_row.element = element; + element.size='40'; + // Delete function + new_row_button_remove.onclick= function(){ + // Remove element from form + this.parentNode.element.parentNode.removeChild( this.parentNode.element ); + var filename = this.parentNode.element.value; + var filename = filename.replace(/\\/g,'/'); + var text = filename.split("/"); + nbr_elements = text.length; + if(text[nbr_elements-1].indexOf('gif')>=0 || text[nbr_elements-1].indexOf('bmp') >= 0 || text[nbr_elements-1].indexOf('png') >= 0 + || text[nbr_elements-1].indexOf('jpg') >= 0 || text[nbr_elements-1].indexOf('GIF')>=0 || text[nbr_elements-1].indexOf('BMP') >= 0 + || text[nbr_elements-1].indexOf('PNG') >= 0 || text[nbr_elements-1].indexOf('JPG') >= 0) + { + //var imglocation = unescape(document.location.pathname.substr(1)); + //imglocation = imglocation.substring(0,imglocation.lastIndexOf('/')+1); + var tiny = tinyMCE.getInstanceById('body_text'); + var currValTiny = tiny.getHTML(); + while(currValTiny.indexOf(unescape(text[nbr_elements-1])) != -1){ + //check where the space is and keep replacing with $#32 + currValTiny = currValTiny.replace(unescape(text[nbr_elements-1]),'QW%%^%%WQ'); + currValTiny = currValTiny.replace(/]*>?/,' '); + } + tiny.setHTML(currValTiny); + } + // Remove this row from the list + this.parentNode.parentNode.removeChild( this.parentNode ); + + // Decrement counter + this.parentNode.element.multi_selector.count--; + // Re-enable input element (if it's disabled) + this.parentNode.element.multi_selector.current_element.disabled = false; + + // Appease Safari + // without it Safari wants to reload the browser window + // which nixes your already queued uploads + + return false; + }; + + new_row_button_embed.onclick= function(){ + + var filename = element.value.replace(/\\/g,'/') + var text = filename.split("/"); + nbr_elements = text.length; + + //check if the file name has a space + text[nbr_elements-1]=text[nbr_elements-1].replace(/ /g,' '); + + if(text[nbr_elements-1].indexOf('gif')>=0 || text[nbr_elements-1].indexOf('bmp') >= 0 || text[nbr_elements-1].indexOf('png') >= 0 + || text[nbr_elements-1].indexOf('jpg') >= 0 || text[nbr_elements-1].indexOf('GIF')>=0 || text[nbr_elements-1].indexOf('BMP') >= 0 + || text[nbr_elements-1].indexOf('PNG') >= 0 || text[nbr_elements-1].indexOf('JPG') >= 0) + { + cid='cid:'+text[nbr_elements-1]; + var imglocation = unescape(document.location.pathname.substr(1)); + imglocation = imglocation.substring(0,imglocation.lastIndexOf('/')+1); + imglocation='/'+imglocation+'cache/images/'; + embedImage="'; + //insert_variable(embedImage1); + insert_variable(embedImage); + + this.parentNode.childNodes[2].checked='true'; + } + else{ + alert(select_image); + } + + }; + + // Set row value + /* + var oas = new ActiveXObject("Scripting.FileSystemObject"); + var d = document.a.b.value; + var e = oas.getFile(d); + var f = e.size; + alert(f + " bytes"); + alert(element); + */ + //new_row_file_name.value =element.value; + new_row_file_name_tab = element.value.split("\\"); + //alert(new_row_file_name_tab); + nbr_elements = new_row_file_name_tab.length; + new_row_file_name.value = new_row_file_name_tab[nbr_elements-1]; + + //new_row.innerHTML = element.value; + //add all the elements + //new_row.appendChild(new_row_attach_file); + new_row.appendChild(imgElement); + new_row.appendChild(new_row_button_embed); + new_row.appendChild(new_row_chk_box); + new_row.appendChild( new_row_file_name); + // Add button + new_row.appendChild( new_row_button_remove); + // Add it to the list + this.list_target.appendChild( new_row ); + //document.getElementById(list_target).appendChild(new_row); + }; +}; + + +function docUpload() { + + //var theForm = document.getElementById('EditView'); + //var theForm = document.getElementById('upload_form'); + //AJAX call begins + var rets =''; + var callback = { + upload:function(r) { + //console.log("response object: %o", r); + rets = JSON.parse(r.responseText); + } + } + + var url ='index.php?module=EmailTemplates&action=AttachDocuments'; + //YAHOO.util.Connect.setForm(document.getElementById("upload_form"), true,true); + YAHOO.util.Connect.asyncRequest('POST', url, callback,null); + //AJAX call ends + + var element = document.getElementById('documentName'); + //alert(element.value); + var element1 = document.getElementById('documentId'); + var element2 = document.getElementById('docRevId'); + var element3 = document.getElementById('documentType'); + var elm = document.createElement('div'); + elm.setAttribute('id','file'+uploadIndex); + + var sugarDoc = document.createElement('input'); + sugarDoc.setAttribute('type', 'label'); + sugarDoc.setAttribute('disabled', 'true'); + sugarDoc.setAttribute('font', 'bold'); + sugarDoc.setAttribute('value',"Sugar Document"); + + + var new_row_button_embed_doc = document.createElement( 'input' ); + new_row_button_embed_doc.type = 'button'; + new_row_button_embed_doc.value = 'Embed'; + + var new_row_chk_box = document.createElement( 'input' ); + new_row_chk_box.setAttribute('id','checkBoxDoc'+uploadIndex); + new_row_chk_box.setAttribute('name','checkBoxDoc'+uploadIndex); + new_row_chk_box.type = 'checkbox'; + new_row_chk_box.checked =false; + new_row_chk_box.disabled='true'; + + + var eah = document.createElement('input'); + eah.setAttribute('id', 'documentId'+uploadIndex); + eah.setAttribute('name', 'documentId'+uploadIndex); + eah.setAttribute('tabindex', '120'); + eah.setAttribute('type', 'hidden'); + eah.setAttribute('value',element1.value); + + + var attId = document.createElement('input'); + attId.setAttribute('id', 'docRevId'+uploadIndex); + attId.setAttribute('name', 'docRevId'+uploadIndex); + attId.setAttribute('tabindex', '120'); + attId.setAttribute('type', 'hidden'); + attId.setAttribute('value',element2.value); + + + var attType = document.createElement('input'); + attType.setAttribute('id', 'documentType'+uploadIndex); + attType.setAttribute('name', 'documentType'+uploadIndex); + attType.setAttribute('tabindex', '120'); + attType.setAttribute('type', 'hidden'); + attType.setAttribute('value',element3.value); + + + var ea = document.createElement('input'); + ea.setAttribute('id', 'document[]'); + ea.setAttribute('name', 'document[]'); + ea.setAttribute('tabindex', '120'); + ea.setAttribute('size', '40'); + ea.setAttribute('type', 'text'); + ea.setAttribute('disabled',true); + ea.setAttribute('value',element.value); + + var eai = document.createElement('input'); + eai.setAttribute('type', 'button'); + //eai.setAttribute('onclick', 'deleteFile('+uploadIndex+');'); + eai.setAttribute('value', lbl_remove); + eai.onclick=function(){ + var filename = this.parentNode.childNodes[4].value; + if(filename != null){ + var tiny = tinyMCE.getInstanceById('body_text'); + var currValTiny = tinyMCE.getContent('body_text'); + while(currValTiny.indexOf(unescape(filename)) != -1){ + currValTiny = currValTiny.replace(unescape(filename),'QW%%^%%WQ'); + currValTiny = currValTiny.replace(/]*>?/,' '); + } + tiny.setHTML(currValTiny); + } + this.parentNode.parentNode.removeChild(this.parentNode); + } + + + var new_row_button_embed = document.createElement("img"); + new_row_button_embed.setAttribute("src", "themes/default/images/attachment.gif"); + new_row_button_embed.setAttribute("align","absmiddle"); + new_row_button_embed.setAttribute("alt","Embed"); + new_row_button_embed.setAttribute("border","0"); + new_row_button_embed.setAttribute("height","16"); + new_row_button_embed.setAttribute("width","16"); + new_row_button_embed.onclick= function(){ + //retrieve the documentid + this.parentNode.childNodes[2].checked='true'; + var documentRevisionId = this.parentNode.childNodes[4].value; + var mime_type = this.parentNode.childNodes[5].value; + if(mime_type == "image/gif" || mime_type == "image/bmp" || mime_type == "image/png" + || mime_type == "image/jpg") + { + var imglocation = unescape(document.location.pathname.substr(1)); + imglocation = imglocation.substring(0,imglocation.lastIndexOf('/')+1); + imglocation='/'+imglocation+'cache/upload/'; + embedImage=''; + // var tiny = tinyMCE.getInstanceById('body_text'); + embedImage1=''; + //insert_variable(embedImage1); + insert_variable(embedImage); + } + else{ + new_row_chk_box.checked =false; + alert(select_image); + } + }; + + var SugarDoc = document.createElement("img"); + SugarDoc.setAttribute("src", "themes/default/images/sugar_document.png"); + SugarDoc.setAttribute("align","absmiddle"); + SugarDoc.setAttribute("alt","Embed"); + SugarDoc.setAttribute("border","0"); + SugarDoc.setAttribute("height","16"); + SugarDoc.setAttribute("width","16"); + + + //elm.appendChild(eah); + elm.appendChild(SugarDoc); + elm.appendChild(new_row_button_embed); + elm.appendChild(new_row_chk_box); + elm.appendChild(eah); + elm.appendChild(attId); + elm.appendChild(attType); + elm.appendChild(ea); + elm.appendChild(eai); + elm.style.display = 'block'; + + var rN= document.getElementById('attachments_div'); + rN.appendChild(elm); + uploadIndex++; +} + +function addUploadFiles(form_name) { + var chForm = document.getElementById('upload_div'); + var theForm = document.getElementById(form_name); + var elems = chForm.getElementsByTagName("input"); + //get the count of all the email_attachment file elements + var count = 0; + //Use the count to add the documents + count=this.multi_selector.id; + for (var i=0; i=0 || el.id=='document[]') { + theForm.appendChild(el); + } + } + } + +function form_reset_doc() { + // var theForm = document.getElementById('upload_form'); + var theForm = document.getElementById('upload_div'); + var elems = theForm.getElementsByTagName("input"); + for (var i=0; i'); + tiny.setHTML(plainText); + } else { + // toggling into Plain Text ONLY + html.style.display = 'none'; + plain.style.display = 'block'; + altText.style.display = 'none'; + + if(tiny.getHTML()) { + var htmlText = new String(tiny.getHTML()); + htmlText = htmlText.replace(/
/gi, "\n"); + htmlText = htmlText.replace(/>/gi, ">"); + htmlText = htmlText.replace(/</gi, "<"); + htmlText = htmlText.replace(/ /gi, " "); + desc.value = stripTags(htmlText); + } + } +} + +function stripTags(str) { + var theText = new String(str); + + if(theText != 'undefined') { + return theText.replace(/<\/?[^>]+>/gi, ''); + } +} + +function toggle_textarea() { + var checkbox = document.getElementById('toggle_textarea_elem'); + var plain = document.getElementById('text_div'); + + if (checkbox.checked == false) { + plain.style.display = 'none'; + } else { + plain.style.display = 'block'; + } +} +//// END HTML/PLAIN EDITOR FUNCTIONS +/////////////////////////////////////////////////////////////////////////////// + + + + +/////////////////////////////////////////////////////////////////////////////// +//// EMAIL TEMPLATE CODE +function fill_email(id) { + var where = "parent_id='" + id + "'"; + var order = ''; + + if(id == '') { + // query based on template, contact_id0,related_to + if(!append) { + var clear; + if(document.forms.EditView.setEditor.checked == true) { + clear = true; + document.forms.EditView.setEditor.checked = false; toggle_textonly(); + } + document.EditView.name.value = ''; + document.EditView.description.value = ''; + document.EditView.description_html.value = ''; + document.forms.EditView.email_template.value = ''; + if(clear) { + clear = false; + document.forms.EditView.setEditor.checked = true; toggle_textonly(); + } + } + return; + } + call_json_method('EmailTemplates','retrieve','record='+id,'email_template_object', appendEmailTemplateJSON); + args = {"module":"Notes","where":where, "order":order}; + + if(typeof(global_rpcClient) == 'undefined') { + global_rpcClient = new SugarRPCClient(); + } + + req_id = global_rpcClient.call_method('get_full_list', args); + global_request_registry[req_id] = [ejo, 'display']; +} + +function appendEmailTemplateJSON() { + // query based on template, contact_id0,related_to + if(document.EditView.name.value == '') { // cn: bug 7743, don't stomp populated Subject Line + document.EditView.name.value = decodeURI(encodeURI(json_objects['email_template_object']['fields']['subject'])); + } + + document.EditView.description.value += decodeURI(encodeURI(json_objects['email_template_object']['fields']['body'])).replace(/
/ig, '\n'); + var tiny = tinyMCE.getInstanceById("description_html"); + var tinyHtml = tiny.getHTML(true); + + // cn: bug 10985 - IE6/7 will show inline image at top of screen if we set this with no valid target + if(document.getElementById('setEditor').checked == true) { + var descHtml = decodeURI(encodeURI(json_objects['email_template_object']['fields']['body_html'])).replace(/</gi,'<').replace(/>/gi,'>').replace(/
/ig, '\n').replace(/'/gi,'\'').replace(/"/gi,'"'); + + // cn: bug 13376 - leave & to last to preserve certain HTML-entities for TinyMCE editor + descHtml = descHtml.replace(/&/gi,'&'); + + tiny.setHTML(tinyHtml + descHtml); + } + + var htmlDiv = document.getElementById('html_div'); + + // hide the HTML editor if this is Plain-text only + if((tinyHtml == '' || tinyHtml == '
') && htmlDiv.style.display == '') { + var desc = document.getElementById('description'); + var plainText = new String(desc.value); + plainText = plainText.replace(/\n/gi, '
'); + tiny.setHTML(plainText); + + // cn: bug 6212 + // if the template is plain-text, then uncheck "Send HTML Email" + document.getElementById('setEditor').checked = false; + setEditor(); + } +} + +if(typeof SugarClass == "object") { + SugarClass.inherit("EmailJsonObj","SugarClass"); +} +function EmailJsonObj() { +} +EmailJsonObj.prototype.display = function(result) { + var bean; + var block = document.getElementById('template_attachments'); + var target = block.innerHTML; + var full_file_path; + + for(i in result) { + if(typeof result[i] == 'object') { + bean = result[i]; + full_file_path = file_path + bean['id']+bean['filename']; + target += '\n'; + target += '\n '+ lnk_remove + '  '; + target += '' + bean['filename'] + '
'; + } + } + block.innerHTML = target; +} + +ejo = new EmailJsonObj(); +//// END EMAIL TEMPLATE CODE +/////////////////////////////////////////////////////////////////////////////// + + +function fill_form(type, error_text) { + if(document.getElementById('subjectfield').value == '') { + var sendAnyways = confirm(lbl_send_anyways); + if(sendAnyways == false) { return false; } + } + + if(type == 'out' && document.EditView.to_addrs.value == '' && + document.EditView.cc_addrs.value == '' && + document.EditView.bcc_addrs.value == '') { + + alert(error_text); + return false; + } + + var the_form = document.EditView; + var inputs = the_form.getElementsByTagName('input'); + + // this detects if browser needs the following hack or not.. + if(inputs.length > 0) { + // no need to appendChild to EditView to get file uploads to work + return check_form('EditView'); + } + if(! check_form('EditView')) { + return false; + } + return true; +} + +function setLabels(uploads_arr) { +} + + + +//this function appends the selected email address to the aggregated email address fields. +function set_current_parent(id,email,name,value) { + current_contact_id.value += id+";"; + current_contact_email.value += email+";"; + current_contact_name.value += name+";"; + + if(current_contact.value != '') { + current_contact.value += "; "; + } + + current_contact.value += name + " <" + email + ">"; +// current_contact.value += value; +} + +function set_email_return(popup_reply_data) { + var form_name = popup_reply_data.form_name; + var name_to_value_array = popup_reply_data.name_to_value_array; + if (typeof name_to_value_array == "object" ) { + update_email_addresses(form_name,name_to_value_array); + } else { + for(var i in name_to_value_array) { + update_email_addresses(form_name,name_to_value_array[i]); + } + } +} + +function update_email_addresses(form_name,name_to_value) { + for(var the_key in name_to_value) { + if(the_key == 'toJSON') { + /* just ignore */ + } else { + var displayValue = name_to_value[the_key]; + displayValue=displayValue.replace(''',"'"); //restore escaped single invoiceout. + displayValue=displayValue.replace('&',"&"); //restore escaped &. + displayValue=displayValue.replace('>',">"); //restore escaped >. + displayValue=displayValue.replace('<',"<"); //restore escaped <. + displayValue=displayValue.replace('" ',"\""); //restore escaped ". + + window.document.forms[form_name].elements[the_key].value += displayValue + '; '; + } + } +} + +//create references to input fields associated with the select email address button. +//Clicked button is passed as the parameter to the function. +function button_change_onclick(obj) { + var prefix = 'to_'; + if(obj.name.match(/^cc_/i)) { + prefix = 'cc_'; + } else if(obj.name.match(/^bcc_/i)) { + prefix = 'bcc_'; + } + + for(var i = 0; i < obj.form.length;i++) { + child = obj.form[i]; + if(child.name.indexOf(prefix) != 0) { + continue; + } + + if(child.name.match(/addrs_emails$/i)) { + current_contact_email = child; + } else if(child.name.match(/addrs_ids$/i)) { + current_contact_id = child; + } else if(child.name.match(/addrs_names$/i)) { + current_contact_name = child; + } else if(child.name.match(/addrs$/i)) { + current_contact = child; + } + } + + var filter = ''; + var acct_name = ''; + + if(document.EditView.parent_type.value == 'Accounts' && typeof(document.EditView.parent_name.value) != 'undefined' && document.EditView.parent_name.value != '') { + filter = "&form_submit=false&query=true&html=Email_picker&account_name=" + escape(document.EditView.parent_name.value); + acct_name = document.EditView.parent_name.value; + } + + var popup_request_data = + { + "call_back_function" : "set_email_return", + "form_name" : "EditView", + "field_to_name_array" : + { + "id" : prefix + "addrs_ids", + "email1" : prefix + "addrs_emails", + "name" : prefix + "addrs_names", + "email_and_name1" : prefix + "addrs_field" + } + }; + + return open_popup("Contacts", 600, 400, filter, true, false, popup_request_data, 'MultiSelect', false, 'popupdefsEmail'); +} + +//this function clear the value stored in the aggregated email address fields(nodes). +//it relies on the references set by the button_change_onclick method +function clear_email_addresses() { + + if(current_contact != '') { + current_contact.value = ''; + } + if(current_contact_id != '') { + current_contact_id.value = ''; + } + if(current_contact_email != '') { + current_contact_email.value = ''; + } + if(current_contact_name != '') { + current_contact_name.value = ''; + } +} + +function quick_create_overlib(id, theme) { + return overlib('' + + "" + SUGAR.language.get('Emails', 'LBL_LIST_CASE') + '' + + "" + + "" + + SUGAR.language.get('Emails', 'LBL_LIST_LEAD') + "" + + "" + + "" + + SUGAR.language.get('Emails', 'LBL_LIST_CONTACT') + "" + + ""+ + "" + + SUGAR.language.get('Emails', 'LBL_LIST_BUG') + "" + + "" + + "" + + SUGAR.language.get('Emails', 'LBL_LIST_TASK') + "" + , CAPTION, SUGAR.language.get('Emails', 'LBL_QUICK_CREATE') + , STICKY, MOUSEOFF, 3000, CLOSETEXT, '', WIDTH, 150, CLOSETITLE, SUGAR.language.get('app_strings', 'LBL_ADDITIONAL_DETAILS_CLOSE_TITLE'), CLOSECLICK, FGCLASS, 'olOptionsFgClass', + CGCLASS, 'olOptionsCgClass', BGCLASS, 'olBgClass', TEXTFONTCLASS, 'olFontClass', CAPTIONFONTCLASS, 'olOptionsCapFontClass', CLOSEFONTCLASS, 'olOptionsCloseFontClass'); +} + + diff --git a/import/EcmPriceBooks/advajax.js b/import/EcmPriceBooks/advajax.js new file mode 100644 index 00000000..e5fd1d34 --- /dev/null +++ b/import/EcmPriceBooks/advajax.js @@ -0,0 +1,480 @@ +/* + * AdvancedAJAX 1.1.2 + * (c) 2005-2006 Lukasz Lach + * mail: anakin@php5.pl + * www: http://advajax.anakin.us/ + * http://anakin.us/ + * http://creativecommons.org/licenses/LGPL/2.1/ + * + */ + +function advAJAX() { + + var obj = new Object(); + + obj.url = window.location.href; + obj.method = "GET"; + obj.parameters = new Object(); + obj.jsonParameters = new Object(); + obj.headers = new Object(); + obj.async = true; + obj.mimeType = "text/xml"; + obj.username = null; + obj.password = null; + obj.form = null; + obj.disableForm = true; + + obj.unique = true; + obj.uniqueParameter = "_uniqid"; + + obj.requestDone = false; + obj.queryString = ""; + obj.responseText = null; + obj.responseXML = null; + obj.status = null; + obj.statusText = null; + obj.aborted = false; + obj.timeout = 0; + obj.retryCount = 0; + obj.retryDelay = 1000; + obj.tag = null; + obj.group = null; + obj.progressTimerInterval = 50; + + obj.xmlHttpRequest = null; + + obj.onInitialization = null; + obj.onFinalization = null; + obj.onReadyStateChange = null; + obj.onLoading = null; + obj.onLoaded = null; + obj.onInteractive = null; + obj.onComplete = null; + obj.onProgress = null; + obj.onSuccess = null; + obj.onFatalError = null; + obj.onError = null; + obj.onTimeout = null; + obj.onRetryDelay = null; + obj.onRetry = null; + obj.onGroupEnter = null; + obj.onGroupLeave = null; + + obj.createXmlHttpRequest = function() { + + if (typeof XMLHttpRequest != "undefined") + return new XMLHttpRequest(); + var xhrVersion = [ "MSXML2.XMLHttp.5.0", "MSXML2.XMLHttp.4.0","MSXML2.XMLHttp.3.0", + "MSXML2.XMLHttp","Microsoft.XMLHttp" ]; + for (var i = 0; i < xhrVersion.length; i++) { + try { + var xhrObj = new ActiveXObject(xhrVersion[i]); + return xhrObj; + } catch (e) { } + } + obj.raiseEvent("FatalError"); + return null; + }; + + obj._oldResponseLength = null; + obj._progressTimer = null; + obj._progressStarted = navigator.userAgent.indexOf('Opera') == -1; + obj._onProgress = function() { + + if (typeof obj.onProgress == "function" && + typeof obj.xmlHttpRequest.getResponseHeader == "function") { + var contentLength = obj.xmlHttpRequest.getResponseHeader("Content-length"); + if (contentLength != null && contentLength != '') { + var responseLength = obj.xmlHttpRequest.responseText.length; + if (responseLength != obj._oldResponseLength) { + obj.raiseEvent("Progress", obj, responseLength, contentLength); + obj._oldResponseLength = obj.xmlHttpRequest.responseText.length; + } + } + } + if (obj._progressStarted) return; + obj._progressStarted = true; + var _obj = this; + this.__onProgress = function() { + obj._onProgress(); + obj._progressTimer = window.setTimeout(_obj.__onProgress, obj.progressTimerInterval); + } + _obj.__onProgress(); + } + + obj._onInitializationHandled = false; + obj._initObject = function() { + + if (obj.xmlHttpRequest != null) { + delete obj.xmlHttpRequest["onreadystatechange"]; + obj.xmlHttpRequest = null; + } + if ((obj.xmlHttpRequest = obj.createXmlHttpRequest()) == null) + return null; + if (typeof obj.xmlHttpRequest.overrideMimeType != "undefined") + obj.xmlHttpRequest.overrideMimeType(obj.mimeType); + obj.xmlHttpRequest.onreadystatechange = function() { + + if (obj == null || obj.xmlHttpRequest == null) + return; + obj.raiseEvent("ReadyStateChange", obj, obj.xmlHttpRequest.readyState); + obj._onProgress(); + switch (obj.xmlHttpRequest.readyState) { + case 1: obj._onLoading(); break; + case 2: obj._onLoaded(); break; + case 3: obj._onInteractive(); break; + case 4: obj._onComplete(); break; + } + }; + obj._onLoadingHandled = + obj._onLoadedHandled = + obj._onInteractiveHandled = + obj._onCompleteHandled = false; + }; + + obj._onLoading = function() { + + if (obj._onLoadingHandled) + return; + if (!obj._retry && obj.group != null) { + if (typeof advAJAX._groupData[obj.group] == "undefined") + advAJAX._groupData[obj.group] = 0; + advAJAX._groupData[obj.group]++; + if (typeof obj.onGroupEnter == "function" && advAJAX._groupData[obj.group] == 1) + obj.onGroupEnter(obj); + } + obj.raiseEvent("Loading", obj); + obj._onLoadingHandled = true; + }; + obj._onLoaded = function() { + + if (obj._onLoadedHandled) + return; + obj.raiseEvent("Loaded", obj); + obj._onLoadedHandled = true; + }; + obj._onInteractive = function() { + + if (obj._onInteractiveHandled) + return; + obj.raiseEvent("Interactive", obj); + obj._onInteractiveHandled = true; + if (!obj._progressStarted) + obj._onProgress(); + }; + obj._onComplete = function() { + + if (obj._onCompleteHandled || obj.aborted) + return; + if (obj._progressStarted) { + window.clearInterval(obj._progressTimer); + obj._progressStarted = false; + } + obj.requestDone = true; + with (obj.xmlHttpRequest) { + obj.responseText = responseText; + obj.responseXML = responseXML; + if (typeof status != "undefined") + obj.status = status; + if (typeof statusText != "undefined") + obj.statusText = statusText; + } + obj.raiseEvent("Complete", obj); + obj._onCompleteHandled = true; + if (obj.status == 200) + obj.raiseEvent("Success", obj); else + obj.raiseEvent("Error", obj); + delete obj.xmlHttpRequest['onreadystatechange']; + obj.xmlHttpRequest = null; + if (obj.disableForm) + obj.switchForm(true); + obj._groupLeave(); + obj.raiseEvent("Finalization", obj); + }; + + obj._groupLeave = function() { + + if (obj.group != null) { + advAJAX._groupData[obj.group]--; + if (advAJAX._groupData[obj.group] == 0) + obj.raiseEvent("GroupLeave", obj); + } + }; + + obj._retry = false; + obj._retryNo = 0; + obj._onTimeout = function() { + + if (obj == null || obj.xmlHttpRequest == null || obj._onCompleteHandled) + return; + obj.aborted = true; + obj.xmlHttpRequest.abort(); + obj.raiseEvent("Timeout", obj); + obj._retry = true; + if (obj._retryNo != obj.retryCount) { + obj._initObject(); + if (obj.retryDelay > 0) { + obj.raiseEvent("RetryDelay", obj); + startTime = new Date().getTime(); + while (new Date().getTime() - startTime < obj.retryDelay); + } + obj._retryNo++; + obj.raiseEvent("Retry", obj, obj._retryNo); + obj.run(); + } else { + delete obj.xmlHttpRequest["onreadystatechange"]; + obj.xmlHttpRequest = null; + if (obj.disableForm) + obj.switchForm(true); + obj._groupLeave(); + obj.raiseEvent("Finalization", obj); + } + }; + + obj.run = function() { + + obj._initObject(); + if (obj.xmlHttpRequest == null) + return false; + obj.aborted = false; + if (!obj._onInitializationHandled) { + obj.raiseEvent("Initialization", obj); + obj._onInitializationHandled = true; + } + if (obj.method == "GET" && obj.unique) + obj.parameters[encodeURIComponent(obj.uniqueParameter)] = + new Date().getTime().toString().substr(5) + Math.floor(Math.random() * 100).toString(); + if (!obj._retry) { + for (var a in obj.parameters) { + if (obj.queryString.length > 0) + obj.queryString += "&"; + if (typeof obj.parameters[a] != "object") + obj.queryString += encodeURIComponent(a) + "=" + encodeURIComponent(obj.parameters[a]); else { + for (var i = 0; i < obj.parameters[a].length; i++) + obj.queryString += encodeURIComponent(a) + "=" + encodeURIComponent(obj.parameters[a][i]) + "&"; + obj.queryString = obj.queryString.slice(0, -1); + } + } + for (var a in obj.jsonParameters) { + var useJson = typeof [].toJSONString == 'function'; + if (obj.queryString.length > 0) + obj.queryString += "&"; + obj.queryString += encodeURIComponent(a) + "="; + if (useJson) + obj.queryString += encodeURIComponent(obj.jsonParameters[a].toJSONString()); else + obj.queryString += encodeURIComponent(obj.jsonParameters[a]); + } + if (obj.method == "GET" && obj.queryString.length > 0) + obj.url += (obj.url.indexOf("?") != -1 ? "&" : "?") + obj.queryString; + } + if (obj.disableForm) + obj.switchForm(false); + try { + obj.xmlHttpRequest.open(obj.method, obj.url, obj.async, obj.username || '', obj.password || ''); + } catch (e) { + obj.raiseEvent("FatalError", obj, e); + return; + } + if (obj.timeout > 0) + setTimeout(obj._onTimeout, obj.timeout); + if (typeof obj.xmlHttpRequest.setRequestHeader != "undefined") + for (var a in obj.headers) + obj.xmlHttpRequest.setRequestHeader(encodeURIComponent(a), encodeURIComponent(obj.headers[a])); + if (obj.method == "POST" && typeof obj.xmlHttpRequest.setRequestHeader != "undefined") { + obj.xmlHttpRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); + obj.xmlHttpRequest.send(obj.queryString); + } else if (obj.method == "GET") + obj.xmlHttpRequest.send(''); + }; + + obj.handleArguments = function(args) { + + if (typeof args.form == "object" && args.form != null) { + obj.form = args.form; + obj.appendForm(); + } + for (a in args) { + if (typeof obj[a] == "undefined") + obj.parameters[a] = args[a]; else { + if (a != "parameters" && a != "headers") + obj[a] = args[a]; else + for (b in args[a]) + obj[a][b] = args[a][b]; + } + } + obj.method = obj.method.toUpperCase(); + }; + + obj.switchForm = function(enable) { + + if (typeof obj.form != "object" || obj.form == null) + return; + with (obj.form) + for (var nr = 0; nr < elements.length; nr++) + if (!enable) { + if (elements[nr]["disabled"]) + elements[nr]["_disabled"] = true; else + elements[nr]["disabled"] = "disabled"; + } else + if (typeof elements[nr]["_disabled"] == "undefined") + elements[nr].removeAttribute("disabled"); + }; + + obj.appendForm = function() { + + with (obj.form) { + obj.method = getAttribute("method").toUpperCase(); + obj.url = getAttribute("action"); + for (var nr = 0; nr < elements.length; nr++) { + var e = elements[nr]; + if (e.disabled) + continue; + switch (e.type) { + case "text": + case "password": + case "hidden": + case "textarea": + obj.addParameter(e.name, e.value); + break; + case "select-one": + if (e.selectedIndex >= 0) + obj.addParameter(e.name, e.options[e.selectedIndex].value); + break; + case "select-multiple": + for (var nr2 = 0; nr2 < e.options.length; nr2++) + if (e.options[nr2].selected) + obj.addParameter(e.name, e.options[nr2].value); + break; + case "checkbox": + case "radio": + if (e.checked) + obj.addParameter(e.name, e.value); + break; + } + } + } + }; + + obj.addParameter = function(name, value) { + if (typeof obj.parameters[name] == "undefined") + obj.parameters[name] = value; else + if (typeof obj.parameters[name] != "object") + obj.parameters[name] = [ obj.parameters[name], value ]; else + obj.parameters[name][obj.parameters[name].length] = value; + }; + obj.delParameter = function(name) { + + delete obj.parameters[name]; + }; + obj.raiseEvent = function(name) { + var args = []; + for (var i = 1; i < arguments.length; i++) + args.push(arguments[i]); + if (typeof obj["on" + name] == "function") + obj["on" + name].apply(null, args); + if (name == "FatalError") + obj.raiseEvent("Finalization", obj); + } + + if (typeof advAJAX._defaultParameters != "undefined") + obj.handleArguments(advAJAX._defaultParameters); + return obj; +} + +advAJAX.get = function(args) { + + return advAJAX.handleRequest("GET", args); +}; + +advAJAX.post = function(args) { + + return advAJAX.handleRequest("POST", args); +}; + +advAJAX.head = function(args) { + + return advAJAX.handleRequest("HEAD", args); +}; + +advAJAX.submit = function(form, args) { + + if (typeof args == "undefined" || args == null) + return -1; + if (typeof form != "object" || form == null) + return -2; + var request = new advAJAX(); + args["form"] = form; + request.handleArguments(args); + return request.run(); +}; + +advAJAX.assign = function(form, args) { + + if (typeof args == "undefined" || args == null) + return -1; + if (typeof form != "object" || form == null) + return -2; + if (typeof form["onsubmit"] == "function") + form["_onsubmit"] = form["onsubmit"]; + form["advajax_args"] = args; + form["onsubmit"] = function() { + if (typeof this["_onsubmit"] != "undefined" && this["_onsubmit"]() === false) + return false; + if (advAJAX.submit(this, this["advajax_args"]) == false) + return true; + return false; + } + return true; +}; + +advAJAX.download = function(targetObj, url) { + + if (typeof targetObj == "string") + targetObj = document.getElementById(targetObj); + if (!targetObj) + return -1; + advAJAX.get({ + url: url, + onSuccess : function(obj) { + targetObj.innerHTML = obj.responseText; + } + }); +}; + +advAJAX.scan = function() { + + var obj = document.getElementsByTagName("a"); + for (var i = 0; i < obj.length;) { + if (obj[i].getAttribute("rel") == "advancedajax" && obj[i].getAttribute("href") !== null) { + var url = obj[i].getAttribute("href"); + var div = document.createElement("div"); + div.innerHTML = obj[i].innerHTML; + div.className = obj[i].className; + var parent = obj[i].parentNode; + parent.insertBefore(div, obj[i]); + parent.removeChild(obj[i]); + advAJAX.download(div, url); + } else i++; + } +}; + +advAJAX.handleRequest = function(requestType, args) { + + if (typeof args == "undefined" || args == null) + return -1; + var request = new advAJAX(); + window.advajax_obj = request; + request.method = requestType; + request.handleArguments(args); + return request.run(); +}; + +advAJAX._defaultParameters = new Object(); +advAJAX.setDefaultParameters = function(args) { + + advAJAX._defaultParameters = new Object(); + for (a in args) + advAJAX._defaultParameters[a] = args[a]; +}; + +advAJAX._groupData = new Object(); \ No newline at end of file diff --git a/import/EcmPriceBooks/mintajax.js b/import/EcmPriceBooks/mintajax.js new file mode 100644 index 00000000..1b367437 --- /dev/null +++ b/import/EcmPriceBooks/mintajax.js @@ -0,0 +1,2 @@ +eval(function(p,a,c,k,e,d){e=function(c){return(c35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)d[e(c)]=k[c]||e(c);k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('u P=1H dH();P.6n=l(5r,7C,5t,5s){u 3M={1b:B,1Z:B,3C:B,2K:B,4W:K,aZ:L,aY:L,2o:1H 3R(),1o:1H 3R(),1t:B,1Y:B,7M:L,2Q:"dG",7J:"dF-8",b5:"3i/dE",7L:"",7K:"",2B:B,7D:L,3O:B,7I:B,4z:K,5w:0,7F:3,aS:dD,b4:l(){},b3:l(){},b2:l(){},b1:l(){},b0:l(){},3q:l(){},2U:l(){},aT:l(){},aU:l(){},aV:l(){},61:l(){},2J:l(7N,7H){f.4z=K;k(2C.bb){f.1b=1H bb()}F{k(2C.7O){3u{f.1b=1H 7O("dC.ba")}3t(e){f.1b=1H 7O("dB.ba")}}}u 3N="";I(u i 1e f.2o){k(i!=0){3N+="&"}3N+=b9(f.2o[i].O)+"="+b9(f.2o[i].N)}k(7N){f.1Y=7N}k(f.2Q.1D()=="5v"){f.1b.23(f.2Q.b8(),f.1Y,f.7M,f.7L,f.7K)}F{f.1b.23(f.2Q.b8(),f.1Y+(!/\\?/.18(f.1Y)?"?"+3N:"&dA;"+3N),f.7M,f.7L,f.7K)}I(u i 1e f.1o){f.1b.5x(f.1o[i].O,f.1o[i].N)}k(f.2Q.1D()=="5v"){f.1b.5x("b7-b6","dz/x-dy-2B-dx"+(f.7J?"; dw="+f.7J:""))}F{f.1b.5x("b7-b6",f.b5)}f.1b.5x("dv-du-dt","ds, 11 dr dq 4F:4F:4F dp");u J=f;f.1b.aW=l(){J.b4();5n(J.1b.do){1S 1:J.b3();1f;1S 2:J.b2();1f;1S 3:J.b1();1f;1S 4:J.b0();3u{k(J.1b.3O>=dn&&J.1b.3O0&&q.N>q.U)||(q.1T<0&&q.N=0;q=g.q[--i]){q.2m(q.j);q.N+=q.1T;k((q.1T>0&&q.N>q.U)||(q.1T<0&&q.N=0;q=g.q[--i]){q.E=="1v"?4J(q.j,q.N):q.j.E[q.E]=q.N+"1d"}k(g.ag++==g.7o){g.d0=0;g.1a=K;g.20(g)}F{g.1a=3e(l(){P.q.$3L(g)},g.2A)}},5o:l(j,2O,7l,7k,7j,af,ae,ad){j=$D(j);k(!j.$q){j.$q={}}k(f.2t(j,2O)){j.$q[2O].1C()}j.$q[2O]={U:{},ab:7k,N:{},1T:{},2A:af/7j,38:0,1a:B,2m:ae||l(){},20:ad||l(){},1C:l(){k(f.1a){7n(f.1a)}f.1a=B}};u q=j.$q[2O];k(!7l){u 7m=1q(j,2O=="5k"?"a8":2O);k(/^ac\\( ?(\\d{1,3}), ?(\\d{1,3}), ?(\\d{1,3})\\)$/.18(7m)){q.N={r:1c(4R.$1),g:1c(4R.$2),b:1c(4R.$3)}}F{q.N=4H(7m)}}F{q.N=4H(7l)}q.U=4H(7k);I(u c 1e q.N){q.1T[c]=(q.U[c]-q.N[c])/7j}P.q.$5o(j,q,2O)},$5o:l(j,q,4x){q.2m(j);q.38+=q.2A;I(u c 1e q.N){q.N[c]+=q.1T[c];k((q.1T[c]>0&&q.N[c]>q.U[c])||(q.1T[c]<0&&q.N[c]0?1q(j,"a8"):B;k(1R){c.E.4w="2v 2y";c.E.5k=1R;c.E.7f="4v"}F{c.E.4w="2v"}j.E.2d=(j.cW)+"1d";j.E.a7="2v";j.E.cV="cU";j.E.4w="2v";3k(j.2H){c.19(j.2H)}k(1J){I(u i=0;i2c.7d(d.5h,2)){3W(d.j,3Y(d.j),3X(d.j));d.j.E.2N="3D";d.73(d.j);d.4r=L}k(!d.9S){k(d.3H!==B&&e.2l-f.4td.3G){3V(d.j,d.3G-3T(d.j))}F{3V(d.j,e.2l-f.4t)}}}k(!d.9R){k(d.3F!==B&&e.2k-f.4sd.3E){3U(d.j,d.3E-2D(d.j))}F{3U(d.j,e.2k-f.4s)}}}I(u i=f.2j.G-1,z=f.2j[i];i>=0;--i){k(4I(z.j,e.2l,e.2k,L)){k((z.36&&$(d.j).4Q(z.36))||(!z.36&&z.70(d.j))){k(!z.35){$(z.j).2f(z.29);z.35=d;z.9J(d.j)}k(!z.1A&&(z.1A=5J(z.j,e.2l,e.2k,L))){k(z.9N){k(z.1B){z.j.9A(z.1B)}z.1B=d.j.cL(K);z.1B.E.2N="9G";k(z.6Y){z.1B.E.9F="21";z.1B.E.9E="2q"}z.71?z.1B.14=z.71:z.1B.E.cK="4g";z.j.3n(z.1B,z.1A);z.1A=z.1B}F{$(z.1A).2f(z.6W);z.9H(d.j,z.1A)}}F{k(z.1A!=5J(z.j,e.2l,e.2k,L)){z.5f()}F{k(!z.1B){z.9I(d.j,z.1A)}}}z.9K(d.j);v L}}F{k(z.35){z.5f();z.6V()}}}}v L},9Z:l(e){k(f.1F){u d=f.1F;I(u i=f.2j.G-1,z=f.2j[i];i>=0;--i,z=f.2j[i]){k(4I(z.j,e.2l,e.2k)){k((z.36&&$(d.j).4Q(z.36))||(!z.36&&z.70(d.j))){d.2i=z;z.1A&&z.9M?z.5c(d.j,z.1A):z.5c(d.j);z.5f();z.6V()}1f}}$(d.j).2e(d.74);d.9P(d.j);f.1F.4r=K;f.1F=B}},75:l(j){$D(j).E.7c=f.37.10($D(j))+f.4u},9X:l(j){I(u i=$D(j).E.7c-1-f.4u;i0){I(u i=0;i<1h.G;++i){f.6l(1h[i])}}F{I(u i=0;i0){f.j.6k.19(f.j.1m[0])}}k(!f.j.6j&&f.8G){f.j.19($C("6j"));k(f.j.1p[0].1m.G>0){f.j.6j.19(f.j.1m[f.j.1m.G-1])}}},8F:l(){u Q=f.4U;u 2s=[];I(u r=0;rb){v 1}}3t(4Y){}v 0}}F{k(/^\\d\\d\\d\\d\\D\\d\\d\\D\\d\\d$/.18(4b)){u 3s=l(a,b){3u{a=a.1z[Q.1i].1g.2S(/\\D/).4X().4P("");b=b.1z[Q.1i].1g.2S(/\\D/).4X().4P("");a=a.3f(/^(\\d\\d)(\\d\\d)(\\d\\d\\d\\d)$/,"$3$2$1");b=b.3f(/^(\\d\\d)(\\d\\d)(\\d\\d\\d\\d)$/,"$3$2$1");k(ab){v 1}}3t(4Y){}v 0}}F{k(!4Z(1c(4b))){u 3s=l(a,b){v 8D(a.1z[Q.1i].1g)-8D(b.1z[Q.1i].1g)}}F{k(1I 4b=="3Q"){u 3s=l(a,b){3u{a=a.1z[Q.1i].1g;b=b.1z[Q.1i].1g;k(Q.6h){u 22=[cg,cf,ce,cd,cc,4a,cb,ca,49];u 2W=[97,99,c9,c8,c7,c6,c5,8C,8C]}k(Q.8B){k(Q.6h){22=[c4,c3,c2,c1,c0,bZ,bY,bX,bW].8A(22);2W=[65,67,69,76,78,79,83,90,90].8A(2W)}}F{a.1D();b.1D()}k(!a||!b){v 0}u 8z=a.G>b.G?a.G:b.G;I(u i=0;i<8z;i++){k(4Z(a.X(i))){v-1}k(4Z(b.X(i))){v 1}k(a.X(i)==b.X(i)){bV}k(a.X(i)>4a&&a.X(i)<49&&b.X(i)>4a&&b.X(i)<49){I(u c 1e 22){k(a.X(i)==22[c]){v-1}k(b.X(i)==22[c]){v 1}}}F{k((a.X(i)>4a&&a.X(i)<49)||(b.X(i)>4a&&b.X(i)<49)){I(u c 1e 22){k((a.X(i)==22[c]&&2W[c]a.X(i))){v-1}F{k((a.X(i)==22[c]&&2W[c]>b.X(i))||(b.X(i)==22[c]&&2W[c]b.X(i)){v 1}}}3t(4Y){}v 0}}F{u 3s=l(a,b){3u{a=a.1z[Q.1i].1g.1D();b=b.1z[Q.1i].1g.1D();k(ab){v 1}}3t(4Y){}v 0}}}}}2s.bU(3s);k(Q.3r){2s.4X()}Q.3r?Q.8y(Q.1i):Q.8x(Q.1i);Q.3r=!Q.3r;Q.6g(Q.1i);I(u r=0;r<2s.G;r++){Q.j.1p[0].19(2s[r])}},bT:l(1Y){u 2V=f;f.1n.3q=l(){u 6f=f.1Z.2S(2V.8w);I(u r 1e 6f){2V.64(6f[r].2S(2V.8v))}k(2V.44){2V.4T()}2V.6e(f.1Z)};f.1n.2U=f.6d;f.1n.4W=K;f.1n.2J(1Y);f.6c()},bS:l(1Y){u 48=f;f.1n.3q=l(){I(u d 1e f.2K){48.64(f.2K[d])}k(48.44){48.4T()}48.6e(f.2K)};f.1n.2U=f.6d;f.1n.4W=L;f.1n.2J(1Y);f.6c()},1X:l(1y){r=f.3m(1y);k(r.2I===L){v}r.2I=L;$(r).2f(f.6b);f.1W.10(r);f.46(r)},2r:l(1y){r=f.3m(1y);k(r.2I===K){v}I(u i 1e f.1W){k(f.1W[i]==r){f.1W.2E(i,1);1f}}r.2I=K;$(r).2e(f.6b);f.6a(r)},bR:l(){I(u i=0;i=0;i--){f.2r(f.1W[i])}},4T:l(){f.44=L;f.47?f.47.G=0:f.47=[];k(1h.G>0){I(u i=0;i<1h.G;i++){f.47.10(1h[i])}}I(u r=0,1y=f.j.1p[0].1m[0];r=f.j.1p[0].1m.G){v B}v(1I 3o=="68")?f.j.1p[0].1m[3o]:3o},bN:l(){v f.1W},66:l(1y){r=f.3m(1y);f.8s(r);k(r.2I){f.2r(r)}f.j.bM(r.bL)},bK:l(){I(u i=f.1W.G-1;i>=0;--i){f.66(f.1W[i])}},bJ:l(){I(u i=f.j.1p[0].1m.G-1;i>0;--i){f.66(f.j.1p[0].1m[i])}},64:l(63){v f.8r(B,1I 63=="8q"?63:1h)},8r:l(62,45){u 1L=$C("1L");f.j.1p[0].3n(1L,62?f.3m(62):B);k(1I 45=="8q"&&45.G){I(u i=0;i<45.G;i++){1L.8p(-1).19(Y.5T(45[i]))}}F{I(u i=1;i<1h.G;i++){1L.8p(-1).19(Y.5T(1h[i]))}}k(f.44){f.4T()}f.61(1L);v 1L}};w.8o();f.8n.10(w);v w}};P.43.8m();l $(1K){k(!1K){v B}e=1I 1K=="3Q"?Y.8l(1K):1K;e.5Y=l(1x){v f.bI?f.7Z.1D():B};e.1V=l(1x,5Z){u 1V=f.8k;I(u i=0;1V;1V=1V.8k){k(!$(1V).4O()&&((1x&&$(1V)&&$(1V).5Y()==1x)||(!1x&&$(1V)))){k(!5Z||++i==5Z){1f}}}v $(1V)};e.2g=l(1x,5X){u 2g=f.8j;I(u i=0;2g;2g=2g.8j){k(!$(2g).4O()&&((1x&&$(2g)&&$(2g).5Y()==1x)||(!1x&&$(2g)))){k(!5X||++i==5X){1f}}}v $(2g)};e.bH=l(){v f.5W};e.bG=l(1x,4S){u 2T=f.2H;k(1x||4S){2T=$(2T).1V(1x,4S)}3k($(2T).4O()){2T=$(2T).1V(1x,4S)}v 2T};e.bF=l(8i,1x){u r=[];u n=f.5V(1x||"*");u p=1H 4R("(^|\\\\s)"+8i+"(\\\\s|$)");I(u i=0;ix&&1w.yy){v L}v K}l 5J(j,x,y,7Y){u 3h=$D(j).bs;I(u i=3h.G-1,ch=3h[0];i>=0;i--){k(3h[i].7Z!="#3i"&&4I(3h[i],x,y,7Y)){v 3h[i]}}v B}l 4H(3g){3g=3g.3f(/#/,"");v{r:1c(3g.4A(0,2),16),g:1c(3g.4A(2,4),16),b:1c(3g.4A(4,6),16)}}l bq(r,g,b){v 4G(r)+4G(g)+4G(b)}l 4G(n){k(!n){v"4F"}n=2c.5I(2c.bp(2c.5H(0,1c(n)),bo));v"7X".5G((n-n%16)/16)+"7X".5G(n%16)}l 1q(j,3S){j=$D(j);k(3S=="1v"){v 7W(j)}k(j.4E){v j.4E[3S]}F{k(2C.4D){v 4D(j,"").7V(3S.3f(/[A-Z]/g,l(j,ch){v"-"+3S.5G(ch).1D()}))}}}l 1U(j,5F,7U){j=$D(j);k(j.4E){v j.4E[5F]}F{k(2C.4D){v 4D(j,"").7V(7U||5F)}}}l bn(7T,7S){u 3P=1H 3R();I(u i=2;i<1h.G;i++){k(1I(1h[i])=="3Q"){3P.10("\'"+1h[i]+"\'")}F{k(!1h[i]){3P.10("B")}F{3P.10(1h[i])}}}v 3e(7T+"("+3P.5E()+")",7S)}l 7P(O,7R,5B,4B,5z,5y){k(5B){u 4C=1H 5D();4C.bm(4C.5C()+(5B*24*60*60*bk));u 5A="; bj="+4C.bi()}F{u 5A=""}Y.3d=O+"="+bh(7R)+5A+(4B?"; 4B="+4B:"")+(5z?"; bg="+5z:"")+(5y?"; bf="+5y:"")}l be(O){k(Y.3d.G>0){u 3c=Y.3d.7Q(O+"=");k(3c!=-1){3c=3c+O.G+1;u U=Y.3d.7Q(";",3c);k(U==-1){U=Y.3d.G}v bd(Y.3d.4A(3c,U))}}v""}l bc(O){7P(O,"",-1)}',62,850,'|||||||||||||||this||||obj|if|function|||||fx||||var|return||||||null|||style|else|length|_d0|for|_a|false|true|target|value|name|mint|_e6|height||area|end|_6c|img|charCodeAt|document||push|||type|className|||AddEvent|test|appendChild|timeoutID|xmlHttpRequest|parseInt|px|in|break|innerHTML|arguments|sortIndex|activeItem|_6b|display|rows|req|header|tBodies|GetStyle|items|_cc|group|_10|opacity|pos|tag|row|cells|over|dummyNode|Stop|toLowerCase|liveWidget|dragObject|rt|new|typeof|top|id|tr|Style|_dd|itemImage|itemClass|_ce|_76|case|step|GetStyleFast|next|selRows|Select|url|responseText|OnDone|left|pl|open|||_de|content|link|hoverClass|cache|_c4|Math|width|removeClass|addClass|prev|AddItem|dropZone|dropZones|clientY|clientX|OnStep|_51|params|on|none|Deselect|_e7|IsRunning|_dc|0px|src|fold|1px|all|stepTime|form|window|GetHeight|splice|events|_style|firstChild|gridSelect|Send|responseJSON|liveItem|_ca|position|_5c|_3f|method|size|split|_11f|OnError|_fb|en|fading|Update|useImage|useClass|itemSelectImage|itemSelectClass|UpdateItem|AddParam|hover|acceptClass|stack|elapsedTime|Add|_37|_2f|_180|cookie|setTimeout|replace|hex|_165|text|GetPos|while|hide|GetRow|insertBefore|_10a|mousedown|OnSuccess|desc|_ea|catch|try|_e3|GetElapsedTime|prevItem|GetLiveData|imageClass|_b8|OnUpdate|responseXML|absolute|maxY|minY|maxX|minX|bottom|backgroundColor|tl|Group|_5|_8|status|_175|string|Array|_16d|GetWidth|SetY|SetX|SetPos|GetY|GetX|marginTop|margin|_136|createElement|gui|selective|_110|OnSelect|exclude|_ff|380|243|_e9|slideDuration|slideSteps|paddingBottom|paddingTop|hidden|unfoldImage|unfoldClass|foldImage|foldClass|hasChildNodes|parent|inactiveImage|useCache|_a6|dragObjects|isDragged|dragOffsetY|dragOffsetX|stackOffset|solid|borderWidth|_68|_26|reqDone|substring|path|date|getComputedStyle|currentStyle|00|ToHex|HexToRGB|IsInside|SetOpacity|100|marginLeft|_13d|_138|isWhitespace|join|hasClass|RegExp|_11e|SetSelective|gridWidget|selectstart|getJSON|reverse|error|isNaN|click|Open|Close|staticHeight|_da|selectFirstItem|overflow|div|LiveWidget|block|alwaysUpdate|imagePosition|InsertItem|_b9|Fade|ResetOverState|stopPropagation|threshold|getSelection|_73|borderColor|borderLeftWidth|_6d|switch|Color|_49|isRunning|_1|_4|_3|options|post|retryCount|setRequestHeader|_17c|_17b|_17e|days|getTime|Date|toString|_171|charAt|max|round|GetChildAtPos|GetSize|zoom|_15b|filter|SetHeight|_143|RemoveEvent|_137|_130|createTextNode|show|getElementsByTagName|parentNode|_11a|getTagName|_116||OnInsert|_10f|_10e|InsertRow||DeleteRow||number||OnDeselect|selectClass|OnRemoteLoading|OnRemoteError|OnRemoteDone|_fc|OnSort|supportPolishChars|gridSortIndex|tFoot|tHead|AddSortCell|_e2|Request|openClass|scrollHeight|mouseout|mouseover|_d8|_d7|_d6|areaClass|unfoldSelectImage|unfoldSelectClass|foldSelectImage|foldSelectClass|Unfold|foldDuration|foldSteps|foldAnimation|Fold|selectBeforeOpen|tree|_c5|_c7|_c6|activeClass|activeImage|fadeDuration|fadeSteps|_ad|itemParam|widgetParam|autoTextUpdate|_a8|_a2|_97|ResetHoverState|overClass|body|autoInline|_93|OnAccept|dummyNodeClass|DragStart|OnDragStart|dragClass|AddToStack||OnMouseMove|||dragStartY|dragStartX|zIndex|pow|_79|borderStyle|hb|ht|default|_5f|_5e|_5d|_64|clearTimeout|steps|Run|_56|_52|_4b|_4c|_42|_46|_40|_2a|_29|_24|_22|_1d|_2|disableForm|elements|retryNum|_c|_7|statusText|encoding|password|username|async|_6|ActiveXObject|SetCookie|indexOf|_178|time|func|_172|getPropertyValue|GetOpacity|0123456789ABCDEF|_164|nodeName||_15f|_158||_156|SetWidth|_154|_153|clientHeight|clientWidth|_147|_145|offsetTop|offsetLeft|_141|_13c|eventHandler|_135|_120|previousSibling|nextSibling|getElementById|Init|gridWidgets|FixTable|insertCell|object|InsertBefore|OnDelete|multiSelect|gridSelective|remoteDataSeparator|remoteRowSeparator|OnAscSort|OnDescSort|_f5|concat|caseSensitive|122|parseFloat|OnStopSort|Sort|excludeLastRow|excludeFirstRow|_e0|accordionWidgets|slideWait|OnClose|OnOpen|alwaysOpen|_db|item|_d5|_d4|_d2|_d1|treeWidgets|_cb|newItemUnfold|indent|middle|verticalAlign||_c8|GetItem|_c3|_c2|_c1|_c0||_bf||500|_ba|_bd|_bc|_bb|tabWidgets|_b7|_b6|_b5|_b1|_b0|_af|OnRetrieve|useHash|_aa|_a4|_a3|_a1|LiveItem|_9e|_9d|_9c|_99|_98|OnHoverOut|OnOverOut|removeChild|OnRemove|RemoveItem|OnAdd|clear|cssFloat|static|OnOverIn|OnOver|OnHoverIn|OnHover|OnDrag|insertInside|useDummyNode|dragstart|OnDragStop|moveOnTop|lockY|lockX|right|MoveOnTop|preventDefault|_86|RemoveFromStack|pop|OnMouseUp|selection|removeAllRanges|_7b|html|_7a|borderRightWidth|marginRight|padding|borderLeftColor|paddingRight|paddingLeft|endHex|rgb|_62|_61|_60|stepCount|_4f|_55|_54|_4e|_4d|_4a|_45|_44|_43|_3d|_3c|_3b|_3a|_39|_36|_35|_34|_33|_2e|_2d|_2c|_2b|fade|OnStart|_1b|_1a|_19|_17|_16|_15|_14|_13|select|disabled|_f|_e|_d|timeout|OnAbort|OnRetry|OnTimeout|onreadystatechange|send|clearHeader|clearParams|OnComplete|OnInteractive|OnLoaded|OnLoading|OnStateChange|contentType|Type|Content|toUpperCase|encodeURIComponent|XMLHTTP|XMLHttpRequest|DeleteCookie|unescape|GetCookie|secure|domain|escape|toGMTString|expires|1000||setTime|Timeout|255|min|RGBToHex||childNodes||alpha|01|exec|SetSize|offsetParent|GenerateID|call|event|IsF|nodeValue|toggle|getElementsByClass|down|up|tagName|DeleteAllRows|DeleteSelRows|rowIndex|deleteRow|GetSelRows|index|IsSelected|DeselectAll|SelectAll|LoadJSONData|LoadTextData|sort|continue|379|377|346|211|323|321|280|262|260|115|111|110|108|101|378|347|324|322|281|263|261||tBody|_e4|AddSortCells||CreateGridWidget|marginBottom|450|CreateAccordionWidget|onerror|onload|CreateTreeWidget|AddTab|CreateTabWidget|xml|json|hash|location|_a9|widget|UnregisterDropZone|OnDrop|RegisterDropZone|UnregisterDragObject|RemoveBBox|SetBBox|RegisterDragObject|cancelBubble|SetStackOffset|visibility|cloneNode|empty|mouseup|mousemove|borderBottom|borderBottomWidth|lastChild|borderTop|borderTopWidth|transparent|background|offsetWidth|medium|large|Round|stepsElapsed|Clear|duration|Move|Size|move|RequestGroup|RemoveHeader|AddHeader|RemoveParam|Set|selected|multiple|selectedIndex|one|checked|checkbox|radio|action|SendForm|abort|eval|300|200|readyState|GMT|1977|Jan|Sat|Since|Modified|If|charset|urlencoded|www|application|amp|Microsoft|Msxml2|5000|plain|utf|GET|Object'.split('|'),0,{})) + diff --git a/import/EcmPriceBooks/moo1.2.js b/import/EcmPriceBooks/moo1.2.js new file mode 100644 index 00000000..2fbac1de --- /dev/null +++ b/import/EcmPriceBooks/moo1.2.js @@ -0,0 +1,5308 @@ +/* +Script: Core.js + MooTools - My Object Oriented JavaScript Tools. + +License: + MIT-style license. + +Copyright: + Copyright (c) 2006-2007 [Valerio Proietti](http://mad4milk.net/). + +Code & Documentation: + [The MooTools production team](http://mootools.net/developers/). + +Inspiration: + - Class implementation inspired by [Base.js](http://dean.edwards.name/weblog/2006/03/base/) Copyright (c) 2006 Dean Edwards, [GNU Lesser General Public License](http://opensource.org/licenses/lgpl-license.php) + - Some functionality inspired by [Prototype.js](http://prototypejs.org) Copyright (c) 2005-2007 Sam Stephenson, [MIT License](http://opensource.org/licenses/mit-license.php) +*/ + +var MooTools = { + 'version': '1.2.0', + 'build': '' +}; + +var Native = function(options){ + options = options || {}; + + var afterImplement = options.afterImplement || function(){}; + var generics = options.generics; + generics = (generics !== false); + var legacy = options.legacy; + var initialize = options.initialize; + var protect = options.protect; + var name = options.name; + + var object = initialize || legacy; + + object.constructor = Native; + object.$family = {name: 'native'}; + if (legacy && initialize) object.prototype = legacy.prototype; + object.prototype.constructor = object; + + if (name){ + var family = name.toLowerCase(); + object.prototype.$family = {name: family}; + Native.typize(object, family); + } + + var add = function(obj, name, method, force){ + if (!protect || force || !obj.prototype[name]) obj.prototype[name] = method; + if (generics) Native.genericize(obj, name, protect); + afterImplement.call(obj, name, method); + return obj; + }; + + object.implement = function(a1, a2, a3){ + if (typeof a1 == 'string') return add(this, a1, a2, a3); + for (var p in a1) add(this, p, a1[p], a2); + return this; + }; + + object.alias = function(a1, a2, a3){ + if (typeof a1 == 'string'){ + a1 = this.prototype[a1]; + if (a1) add(this, a2, a1, a3); + } else { + for (var a in a1) this.alias(a, a1[a], a2); + } + return this; + }; + + return object; +}; + +Native.implement = function(objects, properties){ + for (var i = 0, l = objects.length; i < l; i++) objects[i].implement(properties); +}; + +Native.genericize = function(object, property, check){ + if ((!check || !object[property]) && typeof object.prototype[property] == 'function') object[property] = function(){ + var args = Array.prototype.slice.call(arguments); + return object.prototype[property].apply(args.shift(), args); + }; +}; + +Native.typize = function(object, family){ + if (!object.type) object.type = function(item){ + return ($type(item) === family); + }; +}; + +Native.alias = function(objects, a1, a2, a3){ + for (var i = 0, j = objects.length; i < j; i++) objects[i].alias(a1, a2, a3); +}; + +(function(objects){ + for (var name in objects) Native.typize(objects[name], name); +})({'boolean': Boolean, 'native': Native, 'object': Object}); + +(function(objects){ + for (var name in objects) new Native({name: name, initialize: objects[name], protect: true}); +})({'String': String, 'Function': Function, 'Number': Number, 'Array': Array, 'RegExp': RegExp, 'Date': Date}); + +(function(object, methods){ + for (var i = methods.length; i--; i) Native.genericize(object, methods[i], true); + return arguments.callee; +}) +(Array, ['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift', 'concat', 'join', 'slice', 'toString', 'valueOf', 'indexOf', 'lastIndexOf']) +(String, ['charAt', 'charCodeAt', 'concat', 'indexOf', 'lastIndexOf', 'match', 'replace', 'search', 'slice', 'split', 'substr', 'substring', 'toLowerCase', 'toUpperCase', 'valueOf']); + +function $chk(obj){ + return !!(obj || obj === 0); +}; + +function $clear(timer){ + clearTimeout(timer); + clearInterval(timer); + return null; +}; + +function $defined(obj){ + return (obj != undefined); +}; + +function $empty(){}; + +function $arguments(i){ + return function(){ + return arguments[i]; + }; +}; + +function $lambda(value){ + return (typeof value == 'function') ? value : function(){ + return value; + }; +}; + +function $extend(original, extended){ + for (var key in (extended || {})) original[key] = extended[key]; + return original; +}; + +function $unlink(object){ + var unlinked; + + switch ($type(object)){ + case 'object': + unlinked = {}; + for (var p in object) unlinked[p] = $unlink(object[p]); + break; + case 'hash': + unlinked = $unlink(object.getClean()); + break; + case 'array': + unlinked = []; + for (var i = 0, l = object.length; i < l; i++) unlinked[i] = $unlink(object[i]); + break; + default: return object; + } + + return unlinked; +}; + +function $merge(){ + var mix = {}; + for (var i = 0, l = arguments.length; i < l; i++){ + var object = arguments[i]; + if ($type(object) != 'object') continue; + for (var key in object){ + var op = object[key], mp = mix[key]; + mix[key] = (mp && $type(op) == 'object' && $type(mp) == 'object') ? $merge(mp, op) : $unlink(op); + } + } + return mix; +}; + +function $pick(){ + for (var i = 0, l = arguments.length; i < l; i++){ + if (arguments[i] != undefined) return arguments[i]; + } + return null; +}; + +function $random(min, max){ + return Math.floor(Math.random() * (max - min + 1) + min); +}; + +function $splat(obj){ + var type = $type(obj); + return (type) ? ((type != 'array' && type != 'arguments') ? [obj] : obj) : []; +}; + +var $time = Date.now || function(){ + return new Date().getTime(); +}; + +function $try(){ + for (var i = 0, l = arguments.length; i < l; i++){ + try { + return arguments[i](); + } catch(e){} + } + return null; +}; + +function $type(obj){ + if (obj == undefined) return false; + if (obj.$family) return (obj.$family.name == 'number' && !isFinite(obj)) ? false : obj.$family.name; + if (obj.nodeName){ + switch (obj.nodeType){ + case 1: return 'element'; + case 3: return (/\S/).test(obj.nodeValue) ? 'textnode' : 'whitespace'; + } + } else if (typeof obj.length == 'number'){ + if (obj.callee) return 'arguments'; + else if (obj.item) return 'collection'; + } + return typeof obj; +}; + +var Hash = new Native({ + + name: 'Hash', + + initialize: function(object){ + if ($type(object) == 'hash') object = $unlink(object.getClean()); + for (var key in object) this[key] = object[key]; + return this; + } + +}); + +Hash.implement({ + + getLength: function(){ + var length = 0; + for (var key in this){ + if (this.hasOwnProperty(key)) length++; + } + return length; + }, + + forEach: function(fn, bind){ + for (var key in this){ + if (this.hasOwnProperty(key)) fn.call(bind, this[key], key, this); + } + }, + + getClean: function(){ + var clean = {}; + for (var key in this){ + if (this.hasOwnProperty(key)) clean[key] = this[key]; + } + return clean; + } + +}); + +Hash.alias('forEach', 'each'); + +function $H(object){ + return new Hash(object); +}; + +Array.implement({ + + forEach: function(fn, bind){ + for (var i = 0, l = this.length; i < l; i++) fn.call(bind, this[i], i, this); + } + +}); + +Array.alias('forEach', 'each'); + +function $A(iterable){ + if (iterable.item){ + var array = []; + for (var i = 0, l = iterable.length; i < l; i++) array[i] = iterable[i]; + return array; + } + return Array.prototype.slice.call(iterable); +}; + +function $each(iterable, fn, bind){ + var type = $type(iterable); + ((type == 'arguments' || type == 'collection' || type == 'array') ? Array : Hash).each(iterable, fn, bind); +}; + + +/* +Script: Browser.js + The Browser Core. Contains Browser initialization, Window and Document, and the Browser Hash. + +License: + MIT-style license. +*/ + +var Browser = new Hash({ + Engine: {name: 'unknown', version: ''}, + Platform: {name: (navigator.platform.match(/mac|win|linux/i) || ['other'])[0].toLowerCase()}, + Features: {xpath: !!(document.evaluate), air: !!(window.runtime)}, + Plugins: {} +}); + +if (window.opera) Browser.Engine = {name: 'presto', version: (document.getElementsByClassName) ? 950 : 925}; +else if (window.ActiveXObject) Browser.Engine = {name: 'trident', version: (window.XMLHttpRequest) ? 5 : 4}; +else if (!navigator.taintEnabled) Browser.Engine = {name: 'webkit', version: (Browser.Features.xpath) ? 420 : 419}; +else if (document.getBoxObjectFor != null) Browser.Engine = {name: 'gecko', version: (document.getElementsByClassName) ? 19 : 18}; +Browser.Engine[Browser.Engine.name] = Browser.Engine[Browser.Engine.name + Browser.Engine.version] = true; + +if (window.orientation != undefined) Browser.Platform.name = 'ipod'; + +Browser.Platform[Browser.Platform.name] = true; + +Browser.Request = function(){ + return $try(function(){ + return new XMLHttpRequest(); + }, function(){ + return new ActiveXObject('MSXML2.XMLHTTP'); + }); +}; + +Browser.Features.xhr = !!(Browser.Request()); + +Browser.Plugins.Flash = (function(){ + var version = ($try(function(){ + return navigator.plugins['Shockwave Flash'].description; + }, function(){ + return new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version'); + }) || '0 r0').match(/\d+/g); + return {version: parseInt(version[0] || 0 + '.' + version[1] || 0), build: parseInt(version[2] || 0)}; +})(); + +function $exec(text){ + if (!text) return text; + if (window.execScript){ + window.execScript(text); + } else { + var script = document.createElement('script'); + script.setAttribute('type', 'text/javascript'); + script.text = text; + document.head.appendChild(script); + document.head.removeChild(script); + } + return text; +}; + +Native.UID = 1; + +var $uid = (Browser.Engine.trident) ? function(item){ + return (item.uid || (item.uid = [Native.UID++]))[0]; +} : function(item){ + return item.uid || (item.uid = Native.UID++); +}; + +var Window = new Native({ + + name: 'Window', + + legacy: (Browser.Engine.trident) ? null: window.Window, + + initialize: function(win){ + $uid(win); + if (!win.Element){ + win.Element = $empty; + if (Browser.Engine.webkit) win.document.createElement("iframe"); //fixes safari 2 + win.Element.prototype = (Browser.Engine.webkit) ? window["[[DOMElement.prototype]]"] : {}; + } + return $extend(win, Window.Prototype); + }, + + afterImplement: function(property, value){ + window[property] = Window.Prototype[property] = value; + } + +}); + +Window.Prototype = {$family: {name: 'window'}}; + +new Window(window); + +var Document = new Native({ + + name: 'Document', + + legacy: (Browser.Engine.trident) ? null: window.Document, + + initialize: function(doc){ + $uid(doc); + doc.head = doc.getElementsByTagName('head')[0]; + doc.html = doc.getElementsByTagName('html')[0]; + doc.window = doc.defaultView || doc.parentWindow; + if (Browser.Engine.trident4) $try(function(){ + doc.execCommand("BackgroundImageCache", false, true); + }); + return $extend(doc, Document.Prototype); + }, + + afterImplement: function(property, value){ + document[property] = Document.Prototype[property] = value; + } + +}); + +Document.Prototype = {$family: {name: 'document'}}; + +new Document(document); + +/* +Script: Array.js + Contains Array Prototypes like copy, each, contains, and remove. + +License: + MIT-style license. +*/ + +Array.implement({ + + every: function(fn, bind){ + for (var i = 0, l = this.length; i < l; i++){ + if (!fn.call(bind, this[i], i, this)) return false; + } + return true; + }, + + filter: function(fn, bind){ + var results = []; + for (var i = 0, l = this.length; i < l; i++){ + if (fn.call(bind, this[i], i, this)) results.push(this[i]); + } + return results; + }, + + clean: function() { + return this.filter($defined); + }, + + indexOf: function(item, from){ + var len = this.length; + for (var i = (from < 0) ? Math.max(0, len + from) : from || 0; i < len; i++){ + if (this[i] === item) return i; + } + return -1; + }, + + map: function(fn, bind){ + var results = []; + for (var i = 0, l = this.length; i < l; i++) results[i] = fn.call(bind, this[i], i, this); + return results; + }, + + some: function(fn, bind){ + for (var i = 0, l = this.length; i < l; i++){ + if (fn.call(bind, this[i], i, this)) return true; + } + return false; + }, + + associate: function(keys){ + var obj = {}, length = Math.min(this.length, keys.length); + for (var i = 0; i < length; i++) obj[keys[i]] = this[i]; + return obj; + }, + + link: function(object){ + var result = {}; + for (var i = 0, l = this.length; i < l; i++){ + for (var key in object){ + if (object[key](this[i])){ + result[key] = this[i]; + delete object[key]; + break; + } + } + } + return result; + }, + + contains: function(item, from){ + return this.indexOf(item, from) != -1; + }, + + extend: function(array){ + for (var i = 0, j = array.length; i < j; i++) this.push(array[i]); + return this; + }, + + getLast: function(){ + return (this.length) ? this[this.length - 1] : null; + }, + + getRandom: function(){ + return (this.length) ? this[$random(0, this.length - 1)] : null; + }, + + include: function(item){ + if (!this.contains(item)) this.push(item); + return this; + }, + + combine: function(array){ + for (var i = 0, l = array.length; i < l; i++) this.include(array[i]); + return this; + }, + + erase: function(item){ + for (var i = this.length; i--; i){ + if (this[i] === item) this.splice(i, 1); + } + return this; + }, + + empty: function(){ + this.length = 0; + return this; + }, + + flatten: function(){ + var array = []; + for (var i = 0, l = this.length; i < l; i++){ + var type = $type(this[i]); + if (!type) continue; + array = array.concat((type == 'array' || type == 'collection' || type == 'arguments') ? Array.flatten(this[i]) : this[i]); + } + return array; + }, + + hexToRgb: function(array){ + if (this.length != 3) return null; + var rgb = this.map(function(value){ + if (value.length == 1) value += value; + return value.toInt(16); + }); + return (array) ? rgb : 'rgb(' + rgb + ')'; + }, + + rgbToHex: function(array){ + if (this.length < 3) return null; + if (this.length == 4 && this[3] == 0 && !array) return 'transparent'; + var hex = []; + for (var i = 0; i < 3; i++){ + var bit = (this[i] - 0).toString(16); + hex.push((bit.length == 1) ? '0' + bit : bit); + } + return (array) ? hex : '#' + hex.join(''); + } + +}); + +/* +Script: Function.js + Contains Function Prototypes like create, bind, pass, and delay. + +License: + MIT-style license. +*/ + +Function.implement({ + + extend: function(properties){ + for (var property in properties) this[property] = properties[property]; + return this; + }, + + create: function(options){ + var self = this; + options = options || {}; + return function(event){ + var args = options.arguments; + args = (args != undefined) ? $splat(args) : Array.slice(arguments, (options.event) ? 1 : 0); + if (options.event) args = [event || window.event].extend(args); + var returns = function(){ + return self.apply(options.bind || null, args); + }; + if (options.delay) return setTimeout(returns, options.delay); + if (options.periodical) return setInterval(returns, options.periodical); + if (options.attempt) return $try(returns); + return returns(); + }; + }, + + pass: function(args, bind){ + return this.create({arguments: args, bind: bind}); + }, + + attempt: function(args, bind){ + return this.create({arguments: args, bind: bind, attempt: true})(); + }, + + bind: function(bind, args){ + return this.create({bind: bind, arguments: args}); + }, + + bindWithEvent: function(bind, args){ + return this.create({bind: bind, event: true, arguments: args}); + }, + + delay: function(delay, bind, args){ + return this.create({delay: delay, bind: bind, arguments: args})(); + }, + + periodical: function(interval, bind, args){ + return this.create({periodical: interval, bind: bind, arguments: args})(); + }, + + run: function(args, bind){ + return this.apply(bind, $splat(args)); + } + +}); + +/* +Script: Number.js + Contains Number Prototypes like limit, round, times, and ceil. + +License: + MIT-style license. +*/ + +Number.implement({ + + limit: function(min, max){ + return Math.min(max, Math.max(min, this)); + }, + + round: function(precision){ + precision = Math.pow(10, precision || 0); + return Math.round(this * precision) / precision; + }, + + times: function(fn, bind){ + for (var i = 0; i < this; i++) fn.call(bind, i, this); + }, + + toFloat: function(){ + return parseFloat(this); + }, + + toInt: function(base){ + return parseInt(this, base || 10); + } + +}); + +Number.alias('times', 'each'); + +(function(math){ + var methods = {}; + math.each(function(name){ + if (!Number[name]) methods[name] = function(){ + return Math[name].apply(null, [this].concat($A(arguments))); + }; + }); + Number.implement(methods); +})(['abs', 'acos', 'asin', 'atan', 'atan2', 'ceil', 'cos', 'exp', 'floor', 'log', 'max', 'min', 'pow', 'sin', 'sqrt', 'tan']); + +/* +Script: String.js + Contains String Prototypes like camelCase, capitalize, test, and toInt. + +License: + MIT-style license. +*/ + +String.implement({ + + test: function(regex, params){ + return ((typeof regex == 'string') ? new RegExp(regex, params) : regex).test(this); + }, + + contains: function(string, separator){ + return (separator) ? (separator + this + separator).indexOf(separator + string + separator) > -1 : this.indexOf(string) > -1; + }, + + trim: function(){ + return this.replace(/^\s+|\s+$/g, ''); + }, + + clean: function(){ + return this.replace(/\s+/g, ' ').trim(); + }, + + camelCase: function(){ + return this.replace(/-\D/g, function(match){ + return match.charAt(1).toUpperCase(); + }); + }, + + hyphenate: function(){ + return this.replace(/[A-Z]/g, function(match){ + return ('-' + match.charAt(0).toLowerCase()); + }); + }, + + capitalize: function(){ + return this.replace(/\b[a-z]/g, function(match){ + return match.toUpperCase(); + }); + }, + + escapeRegExp: function(){ + return this.replace(/([-.*+?^${}()|[\]\/\\])/g, '\\$1'); + }, + + toInt: function(base){ + return parseInt(this, base || 10); + }, + + toFloat: function(){ + return parseFloat(this); + }, + + hexToRgb: function(array){ + var hex = this.match(/^#?(\w{1,2})(\w{1,2})(\w{1,2})$/); + return (hex) ? hex.slice(1).hexToRgb(array) : null; + }, + + rgbToHex: function(array){ + var rgb = this.match(/\d{1,3}/g); + return (rgb) ? rgb.rgbToHex(array) : null; + }, + + stripScripts: function(option){ + var scripts = ''; + var text = this.replace(/]*>([\s\S]*?)<\/script>/gi, function(){ + scripts += arguments[1] + '\n'; + return ''; + }); + if (option === true) $exec(scripts); + else if ($type(option) == 'function') option(scripts, text); + return text; + }, + + substitute: function(object, regexp){ + return this.replace(regexp || (/\\?\{([^}]+)\}/g), function(match, name){ + if (match.charAt(0) == '\\') return match.slice(1); + return (object[name] != undefined) ? object[name] : ''; + }); + } + +}); + +/* +Script: Hash.js + Contains Hash Prototypes. Provides a means for overcoming the JavaScript practical impossibility of extending native Objects. + +License: + MIT-style license. +*/ + +Hash.implement({ + + has: Object.prototype.hasOwnProperty, + + keyOf: function(value){ + for (var key in this){ + if (this.hasOwnProperty(key) && this[key] === value) return key; + } + return null; + }, + + hasValue: function(value){ + return (Hash.keyOf(this, value) !== null); + }, + + extend: function(properties){ + Hash.each(properties, function(value, key){ + Hash.set(this, key, value); + }, this); + return this; + }, + + combine: function(properties){ + Hash.each(properties, function(value, key){ + Hash.include(this, key, value); + }, this); + return this; + }, + + erase: function(key){ + if (this.hasOwnProperty(key)) delete this[key]; + return this; + }, + + get: function(key){ + return (this.hasOwnProperty(key)) ? this[key] : null; + }, + + set: function(key, value){ + if (!this[key] || this.hasOwnProperty(key)) this[key] = value; + return this; + }, + + empty: function(){ + Hash.each(this, function(value, key){ + delete this[key]; + }, this); + return this; + }, + + include: function(key, value){ + var k = this[key]; + if (k == undefined) this[key] = value; + return this; + }, + + map: function(fn, bind){ + var results = new Hash; + Hash.each(this, function(value, key){ + results.set(key, fn.call(bind, value, key, this)); + }, this); + return results; + }, + + filter: function(fn, bind){ + var results = new Hash; + Hash.each(this, function(value, key){ + if (fn.call(bind, value, key, this)) results.set(key, value); + }, this); + return results; + }, + + every: function(fn, bind){ + for (var key in this){ + if (this.hasOwnProperty(key) && !fn.call(bind, this[key], key)) return false; + } + return true; + }, + + some: function(fn, bind){ + for (var key in this){ + if (this.hasOwnProperty(key) && fn.call(bind, this[key], key)) return true; + } + return false; + }, + + getKeys: function(){ + var keys = []; + Hash.each(this, function(value, key){ + keys.push(key); + }); + return keys; + }, + + getValues: function(){ + var values = []; + Hash.each(this, function(value){ + values.push(value); + }); + return values; + }, + + toQueryString: function(base){ + var queryString = []; + Hash.each(this, function(value, key){ + if (base) key = base + '[' + key + ']'; + var result; + switch ($type(value)){ + case 'object': result = Hash.toQueryString(value, key); break; + case 'array': + var qs = {}; + value.each(function(val, i){ + qs[i] = val; + }); + result = Hash.toQueryString(qs, key); + break; + default: result = key + '=' + encodeURIComponent(value); + } + if (value != undefined) queryString.push(result); + }); + + return queryString.join('&'); + } + +}); + +Hash.alias({keyOf: 'indexOf', hasValue: 'contains'}); + +/* +Script: Event.js + Contains the Event Native, to make the event object completely crossbrowser. + +License: + MIT-style license. +*/ + +var Event = new Native({ + + name: 'Event', + + initialize: function(event, win){ + win = win || window; + var doc = win.document; + event = event || win.event; + if (event.$extended) return event; + this.$extended = true; + var type = event.type; + var target = event.target || event.srcElement; + while (target && target.nodeType == 3) target = target.parentNode; + + if (type.test(/key/)){ + var code = event.which || event.keyCode; + var key = Event.Keys.keyOf(code); + if (type == 'keydown'){ + var fKey = code - 111; + if (fKey > 0 && fKey < 13) key = 'f' + fKey; + } + key = key || String.fromCharCode(code).toLowerCase(); + } else if (type.match(/(click|mouse|menu)/i)){ + doc = (!doc.compatMode || doc.compatMode == 'CSS1Compat') ? doc.html : doc.body; + var page = { + x: event.pageX || event.clientX + doc.scrollLeft, + y: event.pageY || event.clientY + doc.scrollTop + }; + var client = { + x: (event.pageX) ? event.pageX - win.pageXOffset : event.clientX, + y: (event.pageY) ? event.pageY - win.pageYOffset : event.clientY + }; + if (type.match(/DOMMouseScroll|mousewheel/)){ + var wheel = (event.wheelDelta) ? event.wheelDelta / 120 : -(event.detail || 0) / 3; + } + var rightClick = (event.which == 3) || (event.button == 2); + var related = null; + if (type.match(/over|out/)){ + switch (type){ + case 'mouseover': related = event.relatedTarget || event.fromElement; break; + case 'mouseout': related = event.relatedTarget || event.toElement; + } + if (!(function(){ + while (related && related.nodeType == 3) related = related.parentNode; + return true; + }).create({attempt: Browser.Engine.gecko})()) related = false; + } + } + + return $extend(this, { + event: event, + type: type, + + page: page, + client: client, + rightClick: rightClick, + + wheel: wheel, + + relatedTarget: related, + target: target, + + code: code, + key: key, + + shift: event.shiftKey, + control: event.ctrlKey, + alt: event.altKey, + meta: event.metaKey + }); + } + +}); + +Event.Keys = new Hash({ + 'enter': 13, + 'up': 38, + 'down': 40, + 'left': 37, + 'right': 39, + 'esc': 27, + 'space': 32, + 'backspace': 8, + 'tab': 9, + 'delete': 46 +}); + +Event.implement({ + + stop: function(){ + return this.stopPropagation().preventDefault(); + }, + + stopPropagation: function(){ + if (this.event.stopPropagation) this.event.stopPropagation(); + else this.event.cancelBubble = true; + return this; + }, + + preventDefault: function(){ + if (this.event.preventDefault) this.event.preventDefault(); + else this.event.returnValue = false; + return this; + } + +}); + +/* +Script: Class.js + Contains the Class Function for easily creating, extending, and implementing reusable Classes. + +License: + MIT-style license. +*/ + +var Class = new Native({ + + name: 'Class', + + initialize: function(properties){ + properties = properties || {}; + var klass = function(empty){ + for (var key in this) this[key] = $unlink(this[key]); + for (var mutator in Class.Mutators){ + if (!this[mutator]) continue; + Class.Mutators[mutator](this, this[mutator]); + delete this[mutator]; + } + + this.constructor = klass; + if (empty === $empty) return this; + + var self = (this.initialize) ? this.initialize.apply(this, arguments) : this; + if (this.options && this.options.initialize) this.options.initialize.call(this); + return self; + }; + + $extend(klass, this); + klass.constructor = Class; + klass.prototype = properties; + return klass; + } + +}); + +Class.implement({ + + implement: function(){ + Class.Mutators.Implements(this.prototype, Array.slice(arguments)); + return this; + } + +}); + +Class.Mutators = { + + Implements: function(self, klasses){ + $splat(klasses).each(function(klass){ + $extend(self, ($type(klass) == 'class') ? new klass($empty) : klass); + }); + }, + + Extends: function(self, klass){ + var instance = new klass($empty); + delete instance.parent; + delete instance.parentOf; + + for (var key in instance){ + var current = self[key], previous = instance[key]; + if (current == undefined){ + self[key] = previous; + continue; + } + + var ctype = $type(current), ptype = $type(previous); + if (ctype != ptype) continue; + + switch (ctype){ + case 'function': + // this code will be only executed if the current browser does not support function.caller (currently only opera). + // we replace the function code with brute force. Not pretty, but it will only be executed if function.caller is not supported. + + if (!arguments.callee.caller) self[key] = eval('(' + String(current).replace(/\bthis\.parent\(\s*(\))?/g, function(full, close){ + return 'arguments.callee._parent_.call(this' + (close || ', '); + }) + ')'); + + // end "opera" code + self[key]._parent_ = previous; + break; + case 'object': self[key] = $merge(previous, current); + } + + } + + self.parent = function(){ + return arguments.callee.caller._parent_.apply(this, arguments); + }; + + self.parentOf = function(descendant){ + return descendant._parent_.apply(this, Array.slice(arguments, 1)); + }; + } + +}; + + +/* +Script: Class.Extras.js + Contains Utility Classes that can be implemented into your own Classes to ease the execution of many common tasks. + +License: + MIT-style license. +*/ + +var Chain = new Class({ + + chain: function(){ + this.$chain = (this.$chain || []).extend(arguments); + return this; + }, + + callChain: function(){ + return (this.$chain && this.$chain.length) ? this.$chain.shift().apply(this, arguments) : false; + }, + + clearChain: function(){ + if (this.$chain) this.$chain.empty(); + return this; + } + +}); + +var Events = new Class({ + + addEvent: function(type, fn, internal){ + type = Events.removeOn(type); + if (fn != $empty){ + this.$events = this.$events || {}; + this.$events[type] = this.$events[type] || []; + this.$events[type].include(fn); + if (internal) fn.internal = true; + } + return this; + }, + + addEvents: function(events){ + for (var type in events) this.addEvent(type, events[type]); + return this; + }, + + fireEvent: function(type, args, delay){ + type = Events.removeOn(type); + if (!this.$events || !this.$events[type]) return this; + this.$events[type].each(function(fn){ + fn.create({'bind': this, 'delay': delay, 'arguments': args})(); + }, this); + return this; + }, + + removeEvent: function(type, fn){ + type = Events.removeOn(type); + if (!this.$events || !this.$events[type]) return this; + if (!fn.internal) this.$events[type].erase(fn); + return this; + }, + + removeEvents: function(type){ + for (var e in this.$events){ + if (type && type != e) continue; + var fns = this.$events[e]; + for (var i = fns.length; i--; i) this.removeEvent(e, fns[i]); + } + return this; + } + +}); + +Events.removeOn = function(string){ + return string.replace(/^on([A-Z])/, function(full, first) { + return first.toLowerCase(); + }); +}; + +var Options = new Class({ + + setOptions: function(){ + this.options = $merge.run([this.options].extend(arguments)); + if (!this.addEvent) return this; + for (var option in this.options){ + if ($type(this.options[option]) != 'function' || !(/^on[A-Z]/).test(option)) continue; + this.addEvent(option, this.options[option]); + delete this.options[option]; + } + return this; + } + +}); + +/* +Script: Element.js + One of the most important items in MooTools. Contains the dollar function, the dollars function, and an handful of cross-browser, + time-saver methods to let you easily work with HTML Elements. + +License: + MIT-style license. +*/ + +Document.implement({ + + newElement: function(tag, props){ + if (Browser.Engine.trident && props){ + ['name', 'type', 'checked'].each(function(attribute){ + if (!props[attribute]) return; + tag += ' ' + attribute + '="' + props[attribute] + '"'; + if (attribute != 'checked') delete props[attribute]; + }); + tag = '<' + tag + '>'; + } + return $.element(this.createElement(tag)).set(props); + }, + + newTextNode: function(text){ + return this.createTextNode(text); + }, + + getDocument: function(){ + return this; + }, + + getWindow: function(){ + return this.defaultView || this.parentWindow; + }, + + purge: function(){ + var elements = this.getElementsByTagName('*'); + for (var i = 0, l = elements.length; i < l; i++) Browser.freeMem(elements[i]); + } + +}); + +var Element = new Native({ + + name: 'Element', + + legacy: window.Element, + + initialize: function(tag, props){ + var konstructor = Element.Constructors.get(tag); + if (konstructor) return konstructor(props); + if (typeof tag == 'string') return document.newElement(tag, props); + return $(tag).set(props); + }, + + afterImplement: function(key, value){ + if (!Array[key]) Elements.implement(key, Elements.multi(key)); + Element.Prototype[key] = value; + } + +}); + +Element.Prototype = {$family: {name: 'element'}}; + +Element.Constructors = new Hash; + +var IFrame = new Native({ + + name: 'IFrame', + + generics: false, + + initialize: function(){ + var params = Array.link(arguments, {properties: Object.type, iframe: $defined}); + var props = params.properties || {}; + var iframe = $(params.iframe) || false; + var onload = props.onload || $empty; + delete props.onload; + props.id = props.name = $pick(props.id, props.name, iframe.id, iframe.name, 'IFrame_' + $time()); + iframe = new Element(iframe || 'iframe', props); + var onFrameLoad = function(){ + var host = $try(function(){ + return iframe.contentWindow.location.host; + }); + if (host && host == window.location.host){ + var win = new Window(iframe.contentWindow); + var doc = new Document(iframe.contentWindow.document); + $extend(win.Element.prototype, Element.Prototype); + } + onload.call(iframe.contentWindow, iframe.contentWindow.document); + }; + (!window.frames[props.id]) ? iframe.addListener('load', onFrameLoad) : onFrameLoad(); + return iframe; + } + +}); + +var Elements = new Native({ + + initialize: function(elements, options){ + options = $extend({ddup: true, cash: true}, options); + elements = elements || []; + if (options.ddup || options.cash){ + var uniques = {}, returned = []; + for (var i = 0, l = elements.length; i < l; i++){ + var el = $.element(elements[i], !options.cash); + if (options.ddup){ + if (uniques[el.uid]) continue; + uniques[el.uid] = true; + } + returned.push(el); + } + elements = returned; + } + return (options.cash) ? $extend(elements, this) : elements; + } + +}); + +Elements.implement({ + + filter: function(filter, bind){ + if (!filter) return this; + return new Elements(Array.filter(this, (typeof filter == 'string') ? function(item){ + return item.match(filter); + } : filter, bind)); + } + +}); + +Elements.multi = function(property){ + return function(){ + var items = []; + var elements = true; + for (var i = 0, j = this.length; i < j; i++){ + var returns = this[i][property].apply(this[i], arguments); + items.push(returns); + if (elements) elements = ($type(returns) == 'element'); + } + return (elements) ? new Elements(items) : items; + }; +}; + +Window.implement({ + + $: function(el, nocash){ + if (el && el.$family && el.uid) return el; + var type = $type(el); + return ($[type]) ? $[type](el, nocash, this.document) : null; + }, + + $$: function(selector){ + if (arguments.length == 1 && typeof selector == 'string') return this.document.getElements(selector); + var elements = []; + var args = Array.flatten(arguments); + for (var i = 0, l = args.length; i < l; i++){ + var item = args[i]; + switch ($type(item)){ + case 'element': item = [item]; break; + case 'string': item = this.document.getElements(item, true); break; + default: item = false; + } + if (item) elements.extend(item); + } + return new Elements(elements); + }, + + getDocument: function(){ + return this.document; + }, + + getWindow: function(){ + return this; + } + +}); + +$.string = function(id, nocash, doc){ + id = doc.getElementById(id); + return (id) ? $.element(id, nocash) : null; +}; + +$.element = function(el, nocash){ + $uid(el); + if (!nocash && !el.$family && !(/^object|embed$/i).test(el.tagName)){ + var proto = Element.Prototype; + for (var p in proto) el[p] = proto[p]; + }; + return el; +}; + +$.object = function(obj, nocash, doc){ + if (obj.toElement) return $.element(obj.toElement(doc), nocash); + return null; +}; + +$.textnode = $.whitespace = $.window = $.document = $arguments(0); + +Native.implement([Element, Document], { + + getElement: function(selector, nocash){ + return $(this.getElements(selector, true)[0] || null, nocash); + }, + + getElements: function(tags, nocash){ + tags = tags.split(','); + var elements = []; + var ddup = (tags.length > 1); + tags.each(function(tag){ + var partial = this.getElementsByTagName(tag.trim()); + (ddup) ? elements.extend(partial) : elements = partial; + }, this); + return new Elements(elements, {ddup: ddup, cash: !nocash}); + } + +}); + +Element.Storage = { + + get: function(uid){ + return (this[uid] || (this[uid] = {})); + } + +}; + +Element.Inserters = new Hash({ + + before: function(context, element){ + if (element.parentNode) element.parentNode.insertBefore(context, element); + }, + + after: function(context, element){ + if (!element.parentNode) return; + var next = element.nextSibling; + (next) ? element.parentNode.insertBefore(context, next) : element.parentNode.appendChild(context); + }, + + bottom: function(context, element){ + element.appendChild(context); + }, + + top: function(context, element){ + var first = element.firstChild; + (first) ? element.insertBefore(context, first) : element.appendChild(context); + } + +}); + +Element.Inserters.inside = Element.Inserters.bottom; + +Element.Inserters.each(function(value, key){ + + var Key = key.capitalize(); + + Element.implement('inject' + Key, function(el){ + value(this, $(el, true)); + return this; + }); + + Element.implement('grab' + Key, function(el){ + value($(el, true), this); + return this; + }); + +}); + +Element.implement({ + + getDocument: function(){ + return this.ownerDocument; + }, + + getWindow: function(){ + return this.ownerDocument.getWindow(); + }, + + getElementById: function(id, nocash){ + var el = this.ownerDocument.getElementById(id); + if (!el) return null; + for (var parent = el.parentNode; parent != this; parent = parent.parentNode){ + if (!parent) return null; + } + return $.element(el, nocash); + }, + + set: function(prop, value){ + switch ($type(prop)){ + case 'object': + for (var p in prop) this.set(p, prop[p]); + break; + case 'string': + var property = Element.Properties.get(prop); + (property && property.set) ? property.set.apply(this, Array.slice(arguments, 1)) : this.setProperty(prop, value); + } + return this; + }, + + get: function(prop){ + var property = Element.Properties.get(prop); + return (property && property.get) ? property.get.apply(this, Array.slice(arguments, 1)) : this.getProperty(prop); + }, + + erase: function(prop){ + var property = Element.Properties.get(prop); + (property && property.erase) ? property.erase.apply(this, Array.slice(arguments, 1)) : this.removeProperty(prop); + return this; + }, + + match: function(tag){ + return (!tag || Element.get(this, 'tag') == tag); + }, + + inject: function(el, where){ + Element.Inserters.get(where || 'bottom')(this, $(el, true)); + return this; + }, + + wraps: function(el, where){ + el = $(el, true); + return this.replaces(el).grab(el, where); + }, + + grab: function(el, where){ + Element.Inserters.get(where || 'bottom')($(el, true), this); + return this; + }, + + appendText: function(text, where){ + return this.grab(this.getDocument().newTextNode(text), where); + }, + + adopt: function(){ + Array.flatten(arguments).each(function(element){ + element = $(element, true); + if (element) this.appendChild(element); + }, this); + return this; + }, + + dispose: function(){ + return (this.parentNode) ? this.parentNode.removeChild(this) : this; + }, + + clone: function(contents, keepid){ + switch ($type(this)){ + case 'element': + var attributes = {}; + for (var j = 0, l = this.attributes.length; j < l; j++){ + var attribute = this.attributes[j], key = attribute.nodeName.toLowerCase(); + if (Browser.Engine.trident && (/input/i).test(this.tagName) && (/width|height/).test(key)) continue; + var value = (key == 'style' && this.style) ? this.style.cssText : attribute.nodeValue; + if (!$chk(value) || key == 'uid' || (key == 'id' && !keepid)) continue; + if (value != 'inherit' && ['string', 'number'].contains($type(value))) attributes[key] = value; + } + var element = new Element(this.nodeName.toLowerCase(), attributes); + if (contents !== false){ + for (var i = 0, k = this.childNodes.length; i < k; i++){ + var child = Element.clone(this.childNodes[i], true, keepid); + if (child) element.grab(child); + } + } + return element; + case 'textnode': return document.newTextNode(this.nodeValue); + } + return null; + }, + + replaces: function(el){ + el = $(el, true); + el.parentNode.replaceChild(this, el); + return this; + }, + + hasClass: function(className){ + return this.className.contains(className, ' '); + }, + + addClass: function(className){ + if (!this.hasClass(className)) this.className = (this.className + ' ' + className).clean(); + return this; + }, + + removeClass: function(className){ + this.className = this.className.replace(new RegExp('(^|\\s)' + className + '(?:\\s|$)'), '$1').clean(); + return this; + }, + + toggleClass: function(className){ + return this.hasClass(className) ? this.removeClass(className) : this.addClass(className); + }, + + getComputedStyle: function(property){ + if (this.currentStyle) return this.currentStyle[property.camelCase()]; + var computed = this.getWindow().getComputedStyle(this, null); + return (computed) ? computed.getPropertyValue([property.hyphenate()]) : null; + }, + + empty: function(){ + $A(this.childNodes).each(function(node){ + Browser.freeMem(node); + Element.empty(node); + Element.dispose(node); + }, this); + return this; + }, + + destroy: function(){ + Browser.freeMem(this.empty().dispose()); + return null; + }, + + getSelected: function(){ + return new Elements($A(this.options).filter(function(option){ + return option.selected; + })); + }, + + toQueryString: function(){ + var queryString = []; + this.getElements('input, select, textarea').each(function(el){ + if (!el.name || el.disabled) return; + var value = (el.tagName.toLowerCase() == 'select') ? Element.getSelected(el).map(function(opt){ + return opt.value; + }) : ((el.type == 'radio' || el.type == 'checkbox') && !el.checked) ? null : el.value; + $splat(value).each(function(val){ + if (val) queryString.push(el.name + '=' + encodeURIComponent(val)); + }); + }); + return queryString.join('&'); + }, + + getProperty: function(attribute){ + var EA = Element.Attributes, key = EA.Props[attribute]; + var value = (key) ? this[key] : this.getAttribute(attribute, 2); + return (EA.Bools[attribute]) ? !!value : (key) ? value : value || null; + }, + + getProperties: function(){ + var args = $A(arguments); + return args.map(function(attr){ + return this.getProperty(attr); + }, this).associate(args); + }, + + setProperty: function(attribute, value){ + var EA = Element.Attributes, key = EA.Props[attribute], hasValue = $defined(value); + if (key && EA.Bools[attribute]) value = (value || !hasValue) ? true : false; + else if (!hasValue) return this.removeProperty(attribute); + (key) ? this[key] = value : this.setAttribute(attribute, value); + return this; + }, + + setProperties: function(attributes){ + for (var attribute in attributes) this.setProperty(attribute, attributes[attribute]); + return this; + }, + + removeProperty: function(attribute){ + var EA = Element.Attributes, key = EA.Props[attribute], isBool = (key && EA.Bools[attribute]); + (key) ? this[key] = (isBool) ? false : '' : this.removeAttribute(attribute); + return this; + }, + + removeProperties: function(){ + Array.each(arguments, this.removeProperty, this); + return this; + } + +}); + +(function(){ + +var walk = function(element, walk, start, match, all, nocash){ + var el = element[start || walk]; + var elements = []; + while (el){ + if (el.nodeType == 1 && (!match || Element.match(el, match))){ + elements.push(el); + if (!all) break; + } + el = el[walk]; + } + return (all) ? new Elements(elements, {ddup: false, cash: !nocash}) : $(elements[0], nocash); +}; + +Element.implement({ + + getPrevious: function(match, nocash){ + return walk(this, 'previousSibling', null, match, false, nocash); + }, + + getAllPrevious: function(match, nocash){ + return walk(this, 'previousSibling', null, match, true, nocash); + }, + + getNext: function(match, nocash){ + return walk(this, 'nextSibling', null, match, false, nocash); + }, + + getAllNext: function(match, nocash){ + return walk(this, 'nextSibling', null, match, true, nocash); + }, + + getFirst: function(match, nocash){ + return walk(this, 'nextSibling', 'firstChild', match, false, nocash); + }, + + getLast: function(match, nocash){ + return walk(this, 'previousSibling', 'lastChild', match, false, nocash); + }, + + getParent: function(match, nocash){ + return walk(this, 'parentNode', null, match, false, nocash); + }, + + getParents: function(match, nocash){ + return walk(this, 'parentNode', null, match, true, nocash); + }, + + getChildren: function(match, nocash){ + return walk(this, 'nextSibling', 'firstChild', match, true, nocash); + }, + + hasChild: function(el){ + el = $(el, true); + return (!!el && $A(this.getElementsByTagName(el.tagName)).contains(el)); + } + +}); + +})(); + +Element.Properties = new Hash; + +Element.Properties.style = { + + set: function(style){ + this.style.cssText = style; + }, + + get: function(){ + return this.style.cssText; + }, + + erase: function(){ + this.style.cssText = ''; + } + +}; + +Element.Properties.tag = {get: function(){ + return this.tagName.toLowerCase(); +}}; + +Element.Properties.href = {get: function(){ + return (!this.href) ? null : this.href.replace(new RegExp('^' + document.location.protocol + '\/\/' + document.location.host), ''); +}}; + +Element.Properties.html = {set: function(){ + return this.innerHTML = Array.flatten(arguments).join(''); +}}; + +Native.implement([Element, Window, Document], { + + addListener: function(type, fn){ + if (this.addEventListener) this.addEventListener(type, fn, false); + else this.attachEvent('on' + type, fn); + return this; + }, + + removeListener: function(type, fn){ + if (this.removeEventListener) this.removeEventListener(type, fn, false); + else this.detachEvent('on' + type, fn); + return this; + }, + + retrieve: function(property, dflt){ + var storage = Element.Storage.get(this.uid); + var prop = storage[property]; + if ($defined(dflt) && !$defined(prop)) prop = storage[property] = dflt; + return $pick(prop); + }, + + store: function(property, value){ + var storage = Element.Storage.get(this.uid); + storage[property] = value; + return this; + }, + + eliminate: function(property){ + var storage = Element.Storage.get(this.uid); + delete storage[property]; + return this; + } + +}); + +Element.Attributes = new Hash({ + Props: {'html': 'innerHTML', 'class': 'className', 'for': 'htmlFor', 'text': (Browser.Engine.trident) ? 'innerText' : 'textContent'}, + Bools: ['compact', 'nowrap', 'ismap', 'declare', 'noshade', 'checked', 'disabled', 'readonly', 'multiple', 'selected', 'noresize', 'defer'], + Camels: ['value', 'accessKey', 'cellPadding', 'cellSpacing', 'colSpan', 'frameBorder', 'maxLength', 'readOnly', 'rowSpan', 'tabIndex', 'useMap'] +}); + +Browser.freeMem = function(item){ + if (!item) return; + if (Browser.Engine.trident && (/object/i).test(item.tagName)){ + for (var p in item){ + if (typeof item[p] == 'function') item[p] = $empty; + } + Element.dispose(item); + } + if (item.uid && item.removeEvents) item.removeEvents(); +}; + +(function(EA){ + + var EAB = EA.Bools, EAC = EA.Camels; + EA.Bools = EAB = EAB.associate(EAB); + Hash.extend(Hash.combine(EA.Props, EAB), EAC.associate(EAC.map(function(v){ + return v.toLowerCase(); + }))); + EA.erase('Camels'); + +})(Element.Attributes); + +window.addListener('unload', function(){ + window.removeListener('unload', arguments.callee); + document.purge(); + if (Browser.Engine.trident) CollectGarbage(); +}); + +/* +Script: Element.Event.js + Contains Element methods for dealing with events, and custom Events. + +License: + MIT-style license. +*/ + +Element.Properties.events = {set: function(events){ + this.addEvents(events); +}}; + +Native.implement([Element, Window, Document], { + + addEvent: function(type, fn){ + var events = this.retrieve('events', {}); + events[type] = events[type] || {'keys': [], 'values': []}; + if (events[type].keys.contains(fn)) return this; + events[type].keys.push(fn); + var realType = type, custom = Element.Events.get(type), condition = fn, self = this; + if (custom){ + if (custom.onAdd) custom.onAdd.call(this, fn); + if (custom.condition){ + condition = function(event){ + if (custom.condition.call(this, event)) return fn.call(this, event); + return false; + }; + } + realType = custom.base || realType; + } + var defn = function(){ + return fn.call(self); + }; + var nativeEvent = Element.NativeEvents[realType] || 0; + if (nativeEvent){ + if (nativeEvent == 2){ + defn = function(event){ + event = new Event(event, self.getWindow()); + if (condition.call(self, event) === false) event.stop(); + }; + } + this.addListener(realType, defn); + } + events[type].values.push(defn); + return this; + }, + + removeEvent: function(type, fn){ + var events = this.retrieve('events'); + if (!events || !events[type]) return this; + var pos = events[type].keys.indexOf(fn); + if (pos == -1) return this; + var key = events[type].keys.splice(pos, 1)[0]; + var value = events[type].values.splice(pos, 1)[0]; + var custom = Element.Events.get(type); + if (custom){ + if (custom.onRemove) custom.onRemove.call(this, fn); + type = custom.base || type; + } + return (Element.NativeEvents[type]) ? this.removeListener(type, value) : this; + }, + + addEvents: function(events){ + for (var event in events) this.addEvent(event, events[event]); + return this; + }, + + removeEvents: function(type){ + var events = this.retrieve('events'); + if (!events) return this; + if (!type){ + for (var evType in events) this.removeEvents(evType); + events = null; + } else if (events[type]){ + while (events[type].keys[0]) this.removeEvent(type, events[type].keys[0]); + events[type] = null; + } + return this; + }, + + fireEvent: function(type, args, delay){ + var events = this.retrieve('events'); + if (!events || !events[type]) return this; + events[type].keys.each(function(fn){ + fn.create({'bind': this, 'delay': delay, 'arguments': args})(); + }, this); + return this; + }, + + cloneEvents: function(from, type){ + from = $(from); + var fevents = from.retrieve('events'); + if (!fevents) return this; + if (!type){ + for (var evType in fevents) this.cloneEvents(from, evType); + } else if (fevents[type]){ + fevents[type].keys.each(function(fn){ + this.addEvent(type, fn); + }, this); + } + return this; + } + +}); + +Element.NativeEvents = { + click: 2, dblclick: 2, mouseup: 2, mousedown: 2, contextmenu: 2, //mouse buttons + mousewheel: 2, DOMMouseScroll: 2, //mouse wheel + mouseover: 2, mouseout: 2, mousemove: 2, selectstart: 2, selectend: 2, //mouse movement + keydown: 2, keypress: 2, keyup: 2, //keyboard + focus: 2, blur: 2, change: 2, reset: 2, select: 2, submit: 2, //form elements + load: 1, unload: 1, beforeunload: 2, resize: 1, move: 1, DOMContentLoaded: 1, readystatechange: 1, //window + error: 1, abort: 1, scroll: 1 //misc +}; + +(function(){ + +var $check = function(event){ + var related = event.relatedTarget; + if (related == undefined) return true; + if (related === false) return false; + return ($type(this) != 'document' && related != this && related.prefix != 'xul' && !this.hasChild(related)); +}; + +Element.Events = new Hash({ + + mouseenter: { + base: 'mouseover', + condition: $check + }, + + mouseleave: { + base: 'mouseout', + condition: $check + }, + + mousewheel: { + base: (Browser.Engine.gecko) ? 'DOMMouseScroll' : 'mousewheel' + } + +}); + +})(); + +/* +Script: Element.Style.js + Contains methods for interacting with the styles of Elements in a fashionable way. + +License: + MIT-style license. +*/ + +Element.Properties.styles = {set: function(styles){ + this.setStyles(styles); +}}; + +Element.Properties.opacity = { + + set: function(opacity, novisibility){ + if (!novisibility){ + if (opacity == 0){ + if (this.style.visibility != 'hidden') this.style.visibility = 'hidden'; + } else { + if (this.style.visibility != 'visible') this.style.visibility = 'visible'; + } + } + if (!this.currentStyle || !this.currentStyle.hasLayout) this.style.zoom = 1; + if (Browser.Engine.trident) this.style.filter = (opacity == 1) ? '' : 'alpha(opacity=' + opacity * 100 + ')'; + this.style.opacity = opacity; + this.store('opacity', opacity); + }, + + get: function(){ + return this.retrieve('opacity', 1); + } + +}; + +Element.implement({ + + setOpacity: function(value){ + return this.set('opacity', value, true); + }, + + getOpacity: function(){ + return this.get('opacity'); + }, + + setStyle: function(property, value){ + switch (property){ + case 'opacity': return this.set('opacity', parseFloat(value)); + case 'float': property = (Browser.Engine.trident) ? 'styleFloat' : 'cssFloat'; + } + property = property.camelCase(); + if ($type(value) != 'string'){ + var map = (Element.Styles.get(property) || '@').split(' '); + value = $splat(value).map(function(val, i){ + if (!map[i]) return ''; + return ($type(val) == 'number') ? map[i].replace('@', Math.round(val)) : val; + }).join(' '); + } else if (value == String(Number(value))){ + value = Math.round(value); + } + this.style[property] = value; + return this; + }, + + getStyle: function(property){ + switch (property){ + case 'opacity': return this.get('opacity'); + case 'float': property = (Browser.Engine.trident) ? 'styleFloat' : 'cssFloat'; + } + property = property.camelCase(); + var result = this.style[property]; + if (!$chk(result)){ + result = []; + for (var style in Element.ShortStyles){ + if (property != style) continue; + for (var s in Element.ShortStyles[style]) result.push(this.getStyle(s)); + return result.join(' '); + } + result = this.getComputedStyle(property); + } + if (result){ + result = String(result); + var color = result.match(/rgba?\([\d\s,]+\)/); + if (color) result = result.replace(color[0], color[0].rgbToHex()); + } + if (Browser.Engine.presto || (Browser.Engine.trident && !$chk(parseInt(result)))){ + if (property.test(/^(height|width)$/)){ + var values = (property == 'width') ? ['left', 'right'] : ['top', 'bottom'], size = 0; + values.each(function(value){ + size += this.getStyle('border-' + value + '-width').toInt() + this.getStyle('padding-' + value).toInt(); + }, this); + return this['offset' + property.capitalize()] - size + 'px'; + } + if (Browser.Engine.presto && String(result).test('px')) return result; + if (property.test(/(border(.+)Width|margin|padding)/)) return '0px'; + } + return result; + }, + + setStyles: function(styles){ + for (var style in styles) this.setStyle(style, styles[style]); + return this; + }, + + getStyles: function(){ + var result = {}; + Array.each(arguments, function(key){ + result[key] = this.getStyle(key); + }, this); + return result; + } + +}); + +Element.Styles = new Hash({ + left: '@px', top: '@px', bottom: '@px', right: '@px', + width: '@px', height: '@px', maxWidth: '@px', maxHeight: '@px', minWidth: '@px', minHeight: '@px', + backgroundColor: 'rgb(@, @, @)', backgroundPosition: '@px @px', color: 'rgb(@, @, @)', + fontSize: '@px', letterSpacing: '@px', lineHeight: '@px', clip: 'rect(@px @px @px @px)', + margin: '@px @px @px @px', padding: '@px @px @px @px', border: '@px @ rgb(@, @, @) @px @ rgb(@, @, @) @px @ rgb(@, @, @)', + borderWidth: '@px @px @px @px', borderStyle: '@ @ @ @', borderColor: 'rgb(@, @, @) rgb(@, @, @) rgb(@, @, @) rgb(@, @, @)', + zIndex: '@', 'zoom': '@', fontWeight: '@', textIndent: '@px', opacity: '@' +}); + +Element.ShortStyles = {margin: {}, padding: {}, border: {}, borderWidth: {}, borderStyle: {}, borderColor: {}}; + +['Top', 'Right', 'Bottom', 'Left'].each(function(direction){ + var Short = Element.ShortStyles; + var All = Element.Styles; + ['margin', 'padding'].each(function(style){ + var sd = style + direction; + Short[style][sd] = All[sd] = '@px'; + }); + var bd = 'border' + direction; + Short.border[bd] = All[bd] = '@px @ rgb(@, @, @)'; + var bdw = bd + 'Width', bds = bd + 'Style', bdc = bd + 'Color'; + Short[bd] = {}; + Short.borderWidth[bdw] = Short[bd][bdw] = All[bdw] = '@px'; + Short.borderStyle[bds] = Short[bd][bds] = All[bds] = '@'; + Short.borderColor[bdc] = Short[bd][bdc] = All[bdc] = 'rgb(@, @, @)'; +}); + + +/* +Script: Element.Dimensions.js + Contains methods to work with size, scroll, or positioning of Elements and the window object. + +License: + MIT-style license. + +Credits: + - Element positioning based on the [qooxdoo](http://qooxdoo.org/) code and smart browser fixes, [LGPL License](http://www.gnu.org/licenses/lgpl.html). + - Viewport dimensions based on [YUI](http://developer.yahoo.com/yui/) code, [BSD License](http://developer.yahoo.com/yui/license.html). +*/ + +(function(){ + +Element.implement({ + + scrollTo: function(x, y){ + if (isBody(this)){ + this.getWindow().scrollTo(x, y); + } else { + this.scrollLeft = x; + this.scrollTop = y; + } + return this; + }, + + getSize: function(){ + if (isBody(this)) return this.getWindow().getSize(); + return {x: this.offsetWidth, y: this.offsetHeight}; + }, + + getScrollSize: function(){ + if (isBody(this)) return this.getWindow().getScrollSize(); + return {x: this.scrollWidth, y: this.scrollHeight}; + }, + + getScroll: function(){ + if (isBody(this)) return this.getWindow().getScroll(); + return {x: this.scrollLeft, y: this.scrollTop}; + }, + + getScrolls: function(){ + var element = this, position = {x: 0, y: 0}; + while (element && !isBody(element)){ + position.x += element.scrollLeft; + position.y += element.scrollTop; + element = element.parentNode; + } + return position; + }, + + getOffsetParent: function(){ + var element = this; + if (isBody(element)) return null; + if (!Browser.Engine.trident) return element.offsetParent; + while ((element = element.parentNode) && !isBody(element)){ + if (styleString(element, 'position') != 'static') return element; + } + return null; + }, + + getOffsets: function(){ + var element = this, position = {x: 0, y: 0}; + if (isBody(this)) return position; + + while (element && !isBody(element)){ + position.x += element.offsetLeft; + position.y += element.offsetTop; + + if (Browser.Engine.gecko){ + if (!borderBox(element)){ + position.x += leftBorder(element); + position.y += topBorder(element); + } + var parent = element.parentNode; + if (parent && styleString(parent, 'overflow') != 'visible'){ + position.x += leftBorder(parent); + position.y += topBorder(parent); + } + } else if (element != this && (Browser.Engine.trident || Browser.Engine.webkit)){ + position.x += leftBorder(element); + position.y += topBorder(element); + } + + element = element.offsetParent; + if (Browser.Engine.trident){ + while (element && !element.currentStyle.hasLayout) element = element.offsetParent; + } + } + if (Browser.Engine.gecko && !borderBox(this)){ + position.x -= leftBorder(this); + position.y -= topBorder(this); + } + return position; + }, + + getPosition: function(relative){ + if (isBody(this)) return {x: 0, y: 0}; + var offset = this.getOffsets(), scroll = this.getScrolls(); + var position = {x: offset.x - scroll.x, y: offset.y - scroll.y}; + var relativePosition = (relative && (relative = $(relative))) ? relative.getPosition() : {x: 0, y: 0}; + return {x: position.x - relativePosition.x, y: position.y - relativePosition.y}; + }, + + getCoordinates: function(element){ + if (isBody(this)) return this.getWindow().getCoordinates(); + var position = this.getPosition(element), size = this.getSize(); + var obj = {left: position.x, top: position.y, width: size.x, height: size.y}; + obj.right = obj.left + obj.width; + obj.bottom = obj.top + obj.height; + return obj; + }, + + computePosition: function(obj){ + return {left: obj.x - styleNumber(this, 'margin-left'), top: obj.y - styleNumber(this, 'margin-top')}; + }, + + position: function(obj){ + return this.setStyles(this.computePosition(obj)); + } + +}); + +Native.implement([Document, Window], { + + getSize: function(){ + var win = this.getWindow(); + if (Browser.Engine.presto || Browser.Engine.webkit) return {x: win.innerWidth, y: win.innerHeight}; + var doc = getCompatElement(this); + return {x: doc.clientWidth, y: doc.clientHeight}; + }, + + getScroll: function(){ + var win = this.getWindow(); + var doc = getCompatElement(this); + return {x: win.pageXOffset || doc.scrollLeft, y: win.pageYOffset || doc.scrollTop}; + }, + + getScrollSize: function(){ + var doc = getCompatElement(this); + var min = this.getSize(); + return {x: Math.max(doc.scrollWidth, min.x), y: Math.max(doc.scrollHeight, min.y)}; + }, + + getPosition: function(){ + return {x: 0, y: 0}; + }, + + getCoordinates: function(){ + var size = this.getSize(); + return {top: 0, left: 0, bottom: size.y, right: size.x, height: size.y, width: size.x}; + } + +}); + +// private methods + +var styleString = Element.getComputedStyle; + +function styleNumber(element, style){ + return styleString(element, style).toInt() || 0; +}; + +function borderBox(element){ + return styleString(element, '-moz-box-sizing') == 'border-box'; +}; + +function topBorder(element){ + return styleNumber(element, 'border-top-width'); +}; + +function leftBorder(element){ + return styleNumber(element, 'border-left-width'); +}; + +function isBody(element){ + return (/^(?:body|html)$/i).test(element.tagName); +}; + +function getCompatElement(element){ + var doc = element.getDocument(); + return (!doc.compatMode || doc.compatMode == 'CSS1Compat') ? doc.html : doc.body; +}; + +})(); + +//aliases + +Native.implement([Window, Document, Element], { + + getHeight: function(){ + return this.getSize().y; + }, + + getWidth: function(){ + return this.getSize().x; + }, + + getScrollTop: function(){ + return this.getScroll().y; + }, + + getScrollLeft: function(){ + return this.getScroll().x; + }, + + getScrollHeight: function(){ + return this.getScrollSize().y; + }, + + getScrollWidth: function(){ + return this.getScrollSize().x; + }, + + getTop: function(){ + return this.getPosition().y; + }, + + getLeft: function(){ + return this.getPosition().x; + } + +}); + +/* +Script: Selectors.js + Adds advanced CSS Querying capabilities for targeting elements. Also includes pseudoselectors support. + +License: + MIT-style license. +*/ + +Native.implement([Document, Element], { + + getElements: function(expression, nocash){ + expression = expression.split(','); + var items, local = {}; + for (var i = 0, l = expression.length; i < l; i++){ + var selector = expression[i], elements = Selectors.Utils.search(this, selector, local); + if (i != 0 && elements.item) elements = $A(elements); + items = (i == 0) ? elements : (items.item) ? $A(items).concat(elements) : items.concat(elements); + } + return new Elements(items, {ddup: (expression.length > 1), cash: !nocash}); + } + +}); + +Element.implement({ + + match: function(selector){ + if (!selector) return true; + var tagid = Selectors.Utils.parseTagAndID(selector); + var tag = tagid[0], id = tagid[1]; + if (!Selectors.Filters.byID(this, id) || !Selectors.Filters.byTag(this, tag)) return false; + var parsed = Selectors.Utils.parseSelector(selector); + return (parsed) ? Selectors.Utils.filter(this, parsed, {}) : true; + } + +}); + +var Selectors = {Cache: {nth: {}, parsed: {}}}; + +Selectors.RegExps = { + id: (/#([\w-]+)/), + tag: (/^(\w+|\*)/), + quick: (/^(\w+|\*)$/), + splitter: (/\s*([+>~\s])\s*([a-zA-Z#.*:\[])/g), + combined: (/\.([\w-]+)|\[(\w+)(?:([!*^$~|]?=)["']?(.*?)["']?)?\]|:([\w-]+)(?:\(["']?(.*?)?["']?\)|$)/g) +}; + +Selectors.Utils = { + + chk: function(item, uniques){ + if (!uniques) return true; + var uid = $uid(item); + if (!uniques[uid]) return uniques[uid] = true; + return false; + }, + + parseNthArgument: function(argument){ + if (Selectors.Cache.nth[argument]) return Selectors.Cache.nth[argument]; + var parsed = argument.match(/^([+-]?\d*)?([a-z]+)?([+-]?\d*)?$/); + if (!parsed) return false; + var inta = parseInt(parsed[1]); + var a = (inta || inta === 0) ? inta : 1; + var special = parsed[2] || false; + var b = parseInt(parsed[3]) || 0; + if (a != 0){ + b--; + while (b < 1) b += a; + while (b >= a) b -= a; + } else { + a = b; + special = 'index'; + } + switch (special){ + case 'n': parsed = {a: a, b: b, special: 'n'}; break; + case 'odd': parsed = {a: 2, b: 0, special: 'n'}; break; + case 'even': parsed = {a: 2, b: 1, special: 'n'}; break; + case 'first': parsed = {a: 0, special: 'index'}; break; + case 'last': parsed = {special: 'last-child'}; break; + case 'only': parsed = {special: 'only-child'}; break; + default: parsed = {a: (a - 1), special: 'index'}; + } + + return Selectors.Cache.nth[argument] = parsed; + }, + + parseSelector: function(selector){ + if (Selectors.Cache.parsed[selector]) return Selectors.Cache.parsed[selector]; + var m, parsed = {classes: [], pseudos: [], attributes: []}; + while ((m = Selectors.RegExps.combined.exec(selector))){ + var cn = m[1], an = m[2], ao = m[3], av = m[4], pn = m[5], pa = m[6]; + if (cn){ + parsed.classes.push(cn); + } else if (pn){ + var parser = Selectors.Pseudo.get(pn); + if (parser) parsed.pseudos.push({parser: parser, argument: pa}); + else parsed.attributes.push({name: pn, operator: '=', value: pa}); + } else if (an){ + parsed.attributes.push({name: an, operator: ao, value: av}); + } + } + if (!parsed.classes.length) delete parsed.classes; + if (!parsed.attributes.length) delete parsed.attributes; + if (!parsed.pseudos.length) delete parsed.pseudos; + if (!parsed.classes && !parsed.attributes && !parsed.pseudos) parsed = null; + return Selectors.Cache.parsed[selector] = parsed; + }, + + parseTagAndID: function(selector){ + var tag = selector.match(Selectors.RegExps.tag); + var id = selector.match(Selectors.RegExps.id); + return [(tag) ? tag[1] : '*', (id) ? id[1] : false]; + }, + + filter: function(item, parsed, local){ + var i; + if (parsed.classes){ + for (i = parsed.classes.length; i--; i){ + var cn = parsed.classes[i]; + if (!Selectors.Filters.byClass(item, cn)) return false; + } + } + if (parsed.attributes){ + for (i = parsed.attributes.length; i--; i){ + var att = parsed.attributes[i]; + if (!Selectors.Filters.byAttribute(item, att.name, att.operator, att.value)) return false; + } + } + if (parsed.pseudos){ + for (i = parsed.pseudos.length; i--; i){ + var psd = parsed.pseudos[i]; + if (!Selectors.Filters.byPseudo(item, psd.parser, psd.argument, local)) return false; + } + } + return true; + }, + + getByTagAndID: function(ctx, tag, id){ + if (id){ + var item = (ctx.getElementById) ? ctx.getElementById(id, true) : Element.getElementById(ctx, id, true); + return (item && Selectors.Filters.byTag(item, tag)) ? [item] : []; + } else { + return ctx.getElementsByTagName(tag); + } + }, + + search: function(self, expression, local){ + var splitters = []; + + var selectors = expression.trim().replace(Selectors.RegExps.splitter, function(m0, m1, m2){ + splitters.push(m1); + return ':)' + m2; + }).split(':)'); + + var items, match, filtered, item; + + for (var i = 0, l = selectors.length; i < l; i++){ + + var selector = selectors[i]; + + if (i == 0 && Selectors.RegExps.quick.test(selector)){ + items = self.getElementsByTagName(selector); + continue; + } + + var splitter = splitters[i - 1]; + + var tagid = Selectors.Utils.parseTagAndID(selector); + var tag = tagid[0], id = tagid[1]; + + if (i == 0){ + items = Selectors.Utils.getByTagAndID(self, tag, id); + } else { + var uniques = {}, found = []; + for (var j = 0, k = items.length; j < k; j++) found = Selectors.Getters[splitter](found, items[j], tag, id, uniques); + items = found; + } + + var parsed = Selectors.Utils.parseSelector(selector); + + if (parsed){ + filtered = []; + for (var m = 0, n = items.length; m < n; m++){ + item = items[m]; + if (Selectors.Utils.filter(item, parsed, local)) filtered.push(item); + } + items = filtered; + } + + } + + return items; + + } + +}; + +Selectors.Getters = { + + ' ': function(found, self, tag, id, uniques){ + var items = Selectors.Utils.getByTagAndID(self, tag, id); + for (var i = 0, l = items.length; i < l; i++){ + var item = items[i]; + if (Selectors.Utils.chk(item, uniques)) found.push(item); + } + return found; + }, + + '>': function(found, self, tag, id, uniques){ + var children = Selectors.Utils.getByTagAndID(self, tag, id); + for (var i = 0, l = children.length; i < l; i++){ + var child = children[i]; + if (child.parentNode == self && Selectors.Utils.chk(child, uniques)) found.push(child); + } + return found; + }, + + '+': function(found, self, tag, id, uniques){ + while ((self = self.nextSibling)){ + if (self.nodeType == 1){ + if (Selectors.Utils.chk(self, uniques) && Selectors.Filters.byTag(self, tag) && Selectors.Filters.byID(self, id)) found.push(self); + break; + } + } + return found; + }, + + '~': function(found, self, tag, id, uniques){ + + while ((self = self.nextSibling)){ + if (self.nodeType == 1){ + if (!Selectors.Utils.chk(self, uniques)) break; + if (Selectors.Filters.byTag(self, tag) && Selectors.Filters.byID(self, id)) found.push(self); + } + } + return found; + } + +}; + +Selectors.Filters = { + + byTag: function(self, tag){ + return (tag == '*' || (self.tagName && self.tagName.toLowerCase() == tag)); + }, + + byID: function(self, id){ + return (!id || (self.id && self.id == id)); + }, + + byClass: function(self, klass){ + return (self.className && self.className.contains(klass, ' ')); + }, + + byPseudo: function(self, parser, argument, local){ + return parser.call(self, argument, local); + }, + + byAttribute: function(self, name, operator, value){ + var result = Element.prototype.getProperty.call(self, name); + if (!result) return false; + if (!operator || value == undefined) return true; + switch (operator){ + case '=': return (result == value); + case '*=': return (result.contains(value)); + case '^=': return (result.substr(0, value.length) == value); + case '$=': return (result.substr(result.length - value.length) == value); + case '!=': return (result != value); + case '~=': return result.contains(value, ' '); + case '|=': return result.contains(value, '-'); + } + return false; + } + +}; + +Selectors.Pseudo = new Hash({ + + // w3c pseudo selectors + + empty: function(){ + return !(this.innerText || this.textContent || '').length; + }, + + not: function(selector){ + return !Element.match(this, selector); + }, + + contains: function(text){ + return (this.innerText || this.textContent || '').contains(text); + }, + + 'first-child': function(){ + return Selectors.Pseudo.index.call(this, 0); + }, + + 'last-child': function(){ + var element = this; + while ((element = element.nextSibling)){ + if (element.nodeType == 1) return false; + } + return true; + }, + + 'only-child': function(){ + var prev = this; + while ((prev = prev.previousSibling)){ + if (prev.nodeType == 1) return false; + } + var next = this; + while ((next = next.nextSibling)){ + if (next.nodeType == 1) return false; + } + return true; + }, + + 'nth-child': function(argument, local){ + argument = (argument == undefined) ? 'n' : argument; + var parsed = Selectors.Utils.parseNthArgument(argument); + if (parsed.special != 'n') return Selectors.Pseudo[parsed.special].call(this, parsed.a, local); + var count = 0; + local.positions = local.positions || {}; + var uid = $uid(this); + if (!local.positions[uid]){ + var self = this; + while ((self = self.previousSibling)){ + if (self.nodeType != 1) continue; + count ++; + var position = local.positions[$uid(self)]; + if (position != undefined){ + count = position + count; + break; + } + } + local.positions[uid] = count; + } + return (local.positions[uid] % parsed.a == parsed.b); + }, + + // custom pseudo selectors + + index: function(index){ + var element = this, count = 0; + while ((element = element.previousSibling)){ + if (element.nodeType == 1 && ++count > index) return false; + } + return (count == index); + }, + + even: function(argument, local){ + return Selectors.Pseudo['nth-child'].call(this, '2n+1', local); + }, + + odd: function(argument, local){ + return Selectors.Pseudo['nth-child'].call(this, '2n', local); + } + +}); + +/* +Script: Domready.js + Contains the domready custom event. + +License: + MIT-style license. +*/ + +Element.Events.domready = { + + onAdd: function(fn){ + if (Browser.loaded) fn.call(this); + } + +}; + +(function(){ + + var domready = function(){ + if (Browser.loaded) return; + Browser.loaded = true; + window.fireEvent('domready'); + document.fireEvent('domready'); + }; + + switch (Browser.Engine.name){ + + case 'webkit': (function(){ + (['loaded', 'complete'].contains(document.readyState)) ? domready() : arguments.callee.delay(50); + })(); break; + + case 'trident': + var temp = document.createElement('div'); + (function(){ + ($try(function(){ + temp.doScroll('left'); + return $(temp).inject(document.body).set('html', 'temp').dispose(); + })) ? domready() : arguments.callee.delay(50); + })(); + break; + + default: + window.addEvent('load', domready); + document.addEvent('DOMContentLoaded', domready); + + } + +})(); + +/* +Script: JSON.js + JSON encoder and decoder. + +License: + MIT-style license. + +See Also: + +*/ + +var JSON = new Hash({ + + encode: function(obj){ + switch ($type(obj)){ + case 'string': + return '"' + obj.replace(/[\x00-\x1f\\"]/g, JSON.$replaceChars) + '"'; + case 'array': + return '[' + String(obj.map(JSON.encode).filter($defined)) + ']'; + case 'object': case 'hash': + var string = []; + Hash.each(obj, function(value, key){ + var json = JSON.encode(value); + if (json) string.push(JSON.encode(key) + ':' + json); + }); + return '{' + string + '}'; + case 'number': case 'boolean': return String(obj); + case false: return 'null'; + } + return null; + }, + + $specialChars: {'\b': '\\b', '\t': '\\t', '\n': '\\n', '\f': '\\f', '\r': '\\r', '"' : '\\"', '\\': '\\\\'}, + + $replaceChars: function(chr){ + return JSON.$specialChars[chr] || '\\u00' + Math.floor(chr.charCodeAt() / 16).toString(16) + (chr.charCodeAt() % 16).toString(16); + }, + + decode: function(string, secure){ + if ($type(string) != 'string' || !string.length) return null; + if (secure && !(/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(string.replace(/\\./g, '@').replace(/"[^"\\\n\r]*"/g, ''))) return null; + return eval('(' + string + ')'); + } + +}); + +Native.implement([Hash, Array, String, Number], { + + toJSON: function(){ + return JSON.encode(this); + } + +}); + + +/* +Script: Cookie.js + Class for creating, loading, and saving browser Cookies. + +License: + MIT-style license. + +Credits: + Based on the functions by Peter-Paul Koch (http://quirksmode.org). +*/ + +var Cookie = new Class({ + + Implements: Options, + + options: { + path: false, + domain: false, + duration: false, + secure: false, + document: document + }, + + initialize: function(key, options){ + this.key = key; + this.setOptions(options); + }, + + write: function(value){ + value = encodeURIComponent(value); + if (this.options.domain) value += '; domain=' + this.options.domain; + if (this.options.path) value += '; path=' + this.options.path; + if (this.options.duration){ + var date = new Date(); + date.setTime(date.getTime() + this.options.duration * 24 * 60 * 60 * 1000); + value += '; expires=' + date.toGMTString(); + } + if (this.options.secure) value += '; secure'; + this.options.document.cookie = this.key + '=' + value; + return this; + }, + + read: function(){ + var value = this.options.document.cookie.match('(?:^|;)\\s*' + this.key.escapeRegExp() + '=([^;]*)'); + return (value) ? decodeURIComponent(value[1]) : null; + }, + + dispose: function(){ + new Cookie(this.key, $merge(this.options, {duration: -1})).write(''); + return this; + } + +}); + +Cookie.write = function(key, value, options){ + return new Cookie(key, options).write(value); +}; + +Cookie.read = function(key){ + return new Cookie(key).read(); +}; + +Cookie.dispose = function(key, options){ + return new Cookie(key, options).dispose(); +}; + +/* +Script: Swiff.js + Wrapper for embedding SWF movies. Supports (and fixes) External Interface Communication. + +License: + MIT-style license. + +Credits: + Flash detection & Internet Explorer + Flash Player 9 fix inspired by SWFObject. +*/ + +var Swiff = new Class({ + + Implements: [Options], + + options: { + id: null, + height: 1, + width: 1, + container: null, + properties: {}, + params: { + quality: 'high', + allowScriptAccess: 'always', + wMode: 'transparent', + swLiveConnect: true + }, + callBacks: {}, + vars: {} + }, + + toElement: function(){ + return this.object; + }, + + initialize: function(path, options){ + this.instance = 'Swiff_' + $time(); + + this.setOptions(options); + options = this.options; + var id = this.id = options.id || this.instance; + var container = $(options.container); + + Swiff.CallBacks[this.instance] = {}; + + var params = options.params, vars = options.vars, callBacks = options.callBacks; + var properties = $extend({height: options.height, width: options.width}, options.properties); + + var self = this; + + for (var callBack in callBacks){ + Swiff.CallBacks[this.instance][callBack] = (function(option){ + return function(){ + return option.apply(self.object, arguments); + }; + })(callBacks[callBack]); + vars[callBack] = 'Swiff.CallBacks.' + this.instance + '.' + callBack; + } + + params.flashVars = Hash.toQueryString(vars); + if (Browser.Engine.trident){ + properties.classid = 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'; + params.movie = path; + } else { + properties.type = 'application/x-shockwave-flash'; + properties.data = path; + } + var build = ''; + } + build += ''; + this.object = ((container) ? container.empty() : new Element('div')).set('html', build).firstChild; + }, + + replaces: function(element){ + element = $(element, true); + element.parentNode.replaceChild(this.toElement(), element); + return this; + }, + + inject: function(element){ + $(element, true).appendChild(this.toElement()); + return this; + }, + + remote: function(){ + return Swiff.remote.apply(Swiff, [this.toElement()].extend(arguments)); + } + +}); + +Swiff.CallBacks = {}; + +Swiff.remote = function(obj, fn){ + var rs = obj.CallFunction('' + __flash__argumentsToXML(arguments, 2) + ''); + return eval(rs); +}; + +/* +Script: Fx.js + Contains the basic animation logic to be extended by all other Fx Classes. + +License: + MIT-style license. +*/ + +var Fx = new Class({ + + Implements: [Chain, Events, Options], + + options: { + /* + onStart: $empty, + onCancel: $empty, + onComplete: $empty, + */ + fps: 50, + unit: false, + duration: 500, + link: 'ignore', + transition: function(p){ + return -(Math.cos(Math.PI * p) - 1) / 2; + } + }, + + initialize: function(options){ + this.subject = this.subject || this; + this.setOptions(options); + this.options.duration = Fx.Durations[this.options.duration] || this.options.duration.toInt(); + var wait = this.options.wait; + if (wait === false) this.options.link = 'cancel'; + }, + + step: function(){ + var time = $time(); + if (time < this.time + this.options.duration){ + var delta = this.options.transition((time - this.time) / this.options.duration); + this.set(this.compute(this.from, this.to, delta)); + } else { + this.set(this.compute(this.from, this.to, 1)); + this.complete(); + } + }, + + set: function(now){ + return now; + }, + + compute: function(from, to, delta){ + return Fx.compute(from, to, delta); + }, + + check: function(caller){ + if (!this.timer) return true; + switch (this.options.link){ + case 'cancel': this.cancel(); return true; + case 'chain': this.chain(caller.bind(this, Array.slice(arguments, 1))); return false; + } + return false; + }, + + start: function(from, to){ + if (!this.check(arguments.callee, from, to)) return this; + this.from = from; + this.to = to; + this.time = 0; + this.startTimer(); + this.onStart(); + return this; + }, + + complete: function(){ + if (this.stopTimer()) this.onComplete(); + return this; + }, + + cancel: function(){ + if (this.stopTimer()) this.onCancel(); + return this; + }, + + onStart: function(){ + this.fireEvent('start', this.subject); + }, + + onComplete: function(){ + this.fireEvent('complete', this.subject); + if (!this.callChain()) this.fireEvent('chainComplete', this.subject); + }, + + onCancel: function(){ + this.fireEvent('cancel', this.subject).clearChain(); + }, + + pause: function(){ + this.stopTimer(); + return this; + }, + + resume: function(){ + this.startTimer(); + return this; + }, + + stopTimer: function(){ + if (!this.timer) return false; + this.time = $time() - this.time; + this.timer = $clear(this.timer); + return true; + }, + + startTimer: function(){ + if (this.timer) return false; + this.time = $time() - this.time; + this.timer = this.step.periodical(Math.round(1000 / this.options.fps), this); + return true; + } + +}); + +Fx.compute = function(from, to, delta){ + return (to - from) * delta + from; +}; + +Fx.Durations = {'short': 250, 'normal': 500, 'long': 1000}; + + +/* +Script: Fx.CSS.js + Contains the CSS animation logic. Used by Fx.Tween, Fx.Morph, Fx.Elements. + +License: + MIT-style license. +*/ + +Fx.CSS = new Class({ + + Extends: Fx, + + //prepares the base from/to object + + prepare: function(element, property, values){ + values = $splat(values); + var values1 = values[1]; + if (!$chk(values1)){ + values[1] = values[0]; + values[0] = element.getStyle(property); + } + var parsed = values.map(this.parse); + return {from: parsed[0], to: parsed[1]}; + }, + + //parses a value into an array + + parse: function(value){ + value = $lambda(value)(); + value = (typeof value == 'string') ? value.split(' ') : $splat(value); + return value.map(function(val){ + val = String(val); + var found = false; + Fx.CSS.Parsers.each(function(parser, key){ + if (found) return; + var parsed = parser.parse(val); + if ($chk(parsed)) found = {value: parsed, parser: parser}; + }); + found = found || {value: val, parser: Fx.CSS.Parsers.String}; + return found; + }); + }, + + //computes by a from and to prepared objects, using their parsers. + + compute: function(from, to, delta){ + var computed = []; + (Math.min(from.length, to.length)).times(function(i){ + computed.push({value: from[i].parser.compute(from[i].value, to[i].value, delta), parser: from[i].parser}); + }); + computed.$family = {name: 'fx:css:value'}; + return computed; + }, + + //serves the value as settable + + serve: function(value, unit){ + if ($type(value) != 'fx:css:value') value = this.parse(value); + var returned = []; + value.each(function(bit){ + returned = returned.concat(bit.parser.serve(bit.value, unit)); + }); + return returned; + }, + + //renders the change to an element + + render: function(element, property, value, unit){ + element.setStyle(property, this.serve(value, unit)); + }, + + //searches inside the page css to find the values for a selector + + search: function(selector){ + if (Fx.CSS.Cache[selector]) return Fx.CSS.Cache[selector]; + var to = {}; + Array.each(document.styleSheets, function(sheet, j){ + var href = sheet.href; + if (href && href.contains('://') && !href.contains(document.domain)) return; + var rules = sheet.rules || sheet.cssRules; + Array.each(rules, function(rule, i){ + if (!rule.style) return; + var selectorText = (rule.selectorText) ? rule.selectorText.replace(/^\w+/, function(m){ + return m.toLowerCase(); + }) : null; + if (!selectorText || !selectorText.test('^' + selector + '$')) return; + Element.Styles.each(function(value, style){ + if (!rule.style[style] || Element.ShortStyles[style]) return; + value = String(rule.style[style]); + to[style] = (value.test(/^rgb/)) ? value.rgbToHex() : value; + }); + }); + }); + return Fx.CSS.Cache[selector] = to; + } + +}); + +Fx.CSS.Cache = {}; + +Fx.CSS.Parsers = new Hash({ + + Color: { + parse: function(value){ + if (value.match(/^#[0-9a-f]{3,6}$/i)) return value.hexToRgb(true); + return ((value = value.match(/(\d+),\s*(\d+),\s*(\d+)/))) ? [value[1], value[2], value[3]] : false; + }, + compute: function(from, to, delta){ + return from.map(function(value, i){ + return Math.round(Fx.compute(from[i], to[i], delta)); + }); + }, + serve: function(value){ + return value.map(Number); + } + }, + + Number: { + parse: parseFloat, + compute: Fx.compute, + serve: function(value, unit){ + return (unit) ? value + unit : value; + } + }, + + String: { + parse: $lambda(false), + compute: $arguments(1), + serve: $arguments(0) + } + +}); + + +/* +Script: Fx.Tween.js + Formerly Fx.Style, effect to transition any CSS property for an element. + +License: + MIT-style license. +*/ + +Fx.Tween = new Class({ + + Extends: Fx.CSS, + + initialize: function(element, options){ + this.element = this.subject = $(element); + this.parent(options); + }, + + set: function(property, now){ + if (arguments.length == 1){ + now = property; + property = this.property || this.options.property; + } + this.render(this.element, property, now, this.options.unit); + return this; + }, + + start: function(property, from, to){ + if (!this.check(arguments.callee, property, from, to)) return this; + var args = Array.flatten(arguments); + this.property = this.options.property || args.shift(); + var parsed = this.prepare(this.element, this.property, args); + return this.parent(parsed.from, parsed.to); + } + +}); + +Element.Properties.tween = { + + set: function(options){ + var tween = this.retrieve('tween'); + if (tween) tween.cancel(); + return this.eliminate('tween').store('tween:options', $extend({link: 'cancel'}, options)); + }, + + get: function(options){ + if (options || !this.retrieve('tween')){ + if (options || !this.retrieve('tween:options')) this.set('tween', options); + this.store('tween', new Fx.Tween(this, this.retrieve('tween:options'))); + } + return this.retrieve('tween'); + } + +}; + +Element.implement({ + + tween: function(property, from, to){ + this.get('tween').start(arguments); + return this; + }, + + fade: function(how){ + var fade = this.get('tween'), o = 'opacity', toggle; + how = $pick(how, 'toggle'); + switch (how){ + case 'in': fade.start(o, 1); break; + case 'out': fade.start(o, 0); break; + case 'show': fade.set(o, 1); break; + case 'hide': fade.set(o, 0); break; + case 'toggle': + var flag = this.retrieve('fade:flag', this.get('opacity') == 1); + fade.start(o, (flag) ? 0 : 1); + this.store('fade:flag', !flag); + toggle = true; + break; + default: fade.start(o, arguments); + } + if (!toggle) this.eliminate('fade:flag'); + return this; + }, + + highlight: function(start, end){ + if (!end){ + end = this.retrieve('highlight:original', this.getStyle('background-color')); + end = (end == 'transparent') ? '#fff' : end; + } + var tween = this.get('tween'); + tween.start('background-color', start || '#ffff88', end).chain(function(){ + this.setStyle('background-color', this.retrieve('highlight:original')); + tween.callChain(); + }.bind(this)); + return this; + } + +}); + + +/* +Script: Fx.Morph.js + Formerly Fx.Styles, effect to transition any number of CSS properties for an element using an object of rules, or CSS based selector rules. + +License: + MIT-style license. +*/ + +Fx.Morph = new Class({ + + Extends: Fx.CSS, + + initialize: function(element, options){ + this.element = this.subject = $(element); + this.parent(options); + }, + + set: function(now){ + if (typeof now == 'string') now = this.search(now); + for (var p in now) this.render(this.element, p, now[p], this.options.unit); + return this; + }, + + compute: function(from, to, delta){ + var now = {}; + for (var p in from) now[p] = this.parent(from[p], to[p], delta); + return now; + }, + + start: function(properties){ + if (!this.check(arguments.callee, properties)) return this; + if (typeof properties == 'string') properties = this.search(properties); + var from = {}, to = {}; + for (var p in properties){ + var parsed = this.prepare(this.element, p, properties[p]); + from[p] = parsed.from; + to[p] = parsed.to; + } + return this.parent(from, to); + } + +}); + +Element.Properties.morph = { + + set: function(options){ + var morph = this.retrieve('morph'); + if (morph) morph.cancel(); + return this.eliminate('morph').store('morph:options', $extend({link: 'cancel'}, options)); + }, + + get: function(options){ + if (options || !this.retrieve('morph')){ + if (options || !this.retrieve('morph:options')) this.set('morph', options); + this.store('morph', new Fx.Morph(this, this.retrieve('morph:options'))); + } + return this.retrieve('morph'); + } + +}; + +Element.implement({ + + morph: function(props){ + this.get('morph').start(props); + return this; + } + +}); + +/* +Script: Fx.Transitions.js + Contains a set of advanced transitions to be used with any of the Fx Classes. + +License: + MIT-style license. + +Credits: + Easing Equations by Robert Penner, , modified and optimized to be used with MooTools. +*/ + +(function(){ + + var old = Fx.prototype.initialize; + + Fx.prototype.initialize = function(options){ + old.call(this, options); + var trans = this.options.transition; + if (typeof trans == 'string' && (trans = trans.split(':'))){ + var base = Fx.Transitions; + base = base[trans[0]] || base[trans[0].capitalize()]; + if (trans[1]) base = base['ease' + trans[1].capitalize() + (trans[2] ? trans[2].capitalize() : '')]; + this.options.transition = base; + } + }; + +})(); + +Fx.Transition = function(transition, params){ + params = $splat(params); + return $extend(transition, { + easeIn: function(pos){ + return transition(pos, params); + }, + easeOut: function(pos){ + return 1 - transition(1 - pos, params); + }, + easeInOut: function(pos){ + return (pos <= 0.5) ? transition(2 * pos, params) / 2 : (2 - transition(2 * (1 - pos), params)) / 2; + } + }); +}; + +Fx.Transitions = new Hash({ + + linear: $arguments(0) + +}); + +Fx.Transitions.extend = function(transitions){ + for (var transition in transitions) Fx.Transitions[transition] = new Fx.Transition(transitions[transition]); +}; + +Fx.Transitions.extend({ + + Pow: function(p, x){ + return Math.pow(p, x[0] || 6); + }, + + Expo: function(p){ + return Math.pow(2, 8 * (p - 1)); + }, + + Circ: function(p){ + return 1 - Math.sin(Math.acos(p)); + }, + + Sine: function(p){ + return 1 - Math.sin((1 - p) * Math.PI / 2); + }, + + Back: function(p, x){ + x = x[0] || 1.618; + return Math.pow(p, 2) * ((x + 1) * p - x); + }, + + Bounce: function(p){ + var value; + for (var a = 0, b = 1; 1; a += b, b /= 2){ + if (p >= (7 - 4 * a) / 11){ + value = - Math.pow((11 - 6 * a - 11 * p) / 4, 2) + b * b; + break; + } + } + return value; + }, + + Elastic: function(p, x){ + return Math.pow(2, 10 * --p) * Math.cos(20 * p * Math.PI * (x[0] || 1) / 3); + } + +}); + +['Quad', 'Cubic', 'Quart', 'Quint'].each(function(transition, i){ + Fx.Transitions[transition] = new Fx.Transition(function(p){ + return Math.pow(p, [i + 2]); + }); +}); + + +/* +Script: Request.js + Powerful all purpose Request Class. Uses XMLHTTPRequest. + +License: + MIT-style license. +*/ + +var Request = new Class({ + + Implements: [Chain, Events, Options], + + options: { + /*onRequest: $empty, + onSuccess: $empty, + onFailure: $empty, + onException: $empty,*/ + url: '', + data: '', + headers: { + 'X-Requested-With': 'XMLHttpRequest', + 'Accept': 'text/javascript, text/html, application/xml, text/xml, */*' + }, + async: true, + format: false, + method: 'post', + link: 'ignore', + isSuccess: null, + emulation: true, + urlEncoded: true, + encoding: 'utf-8', + evalScripts: false, + evalResponse: false + }, + + initialize: function(options){ + this.xhr = new Browser.Request(); + this.setOptions(options); + this.options.isSuccess = this.options.isSuccess || this.isSuccess; + this.headers = new Hash(this.options.headers); + }, + + onStateChange: function(){ + if (this.xhr.readyState != 4 || !this.running) return; + this.running = false; + this.status = 0; + $try(function(){ + this.status = this.xhr.status; + }.bind(this)); + if (this.options.isSuccess.call(this, this.status)){ + this.response = {text: this.xhr.responseText, xml: this.xhr.responseXML}; + this.success(this.response.text, this.response.xml); + } else { + this.response = {text: null, xml: null}; + this.failure(); + } + this.xhr.onreadystatechange = $empty; + }, + + isSuccess: function(){ + return ((this.status >= 200) && (this.status < 300)); + }, + + processScripts: function(text){ + if (this.options.evalResponse || (/(ecma|java)script/).test(this.getHeader('Content-type'))) return $exec(text); + return text.stripScripts(this.options.evalScripts); + }, + + success: function(text, xml){ + this.onSuccess(this.processScripts(text), xml); + }, + + onSuccess: function(){ + this.fireEvent('complete', arguments).fireEvent('success', arguments).callChain(); + }, + + failure: function(){ + this.onFailure(); + }, + + onFailure: function(){ + this.fireEvent('complete').fireEvent('failure', this.xhr); + }, + + setHeader: function(name, value){ + this.headers.set(name, value); + return this; + }, + + getHeader: function(name){ + return $try(function(){ + return this.xhr.getResponseHeader(name); + }.bind(this)); + }, + + check: function(caller){ + if (!this.running) return true; + switch (this.options.link){ + case 'cancel': this.cancel(); return true; + case 'chain': this.chain(caller.bind(this, Array.slice(arguments, 1))); return false; + } + return false; + }, + + send: function(options){ + if (!this.check(arguments.callee, options)) return this; + this.running = true; + + var type = $type(options); + if (type == 'string' || type == 'element') options = {data: options}; + + var old = this.options; + options = $extend({data: old.data, url: old.url, method: old.method}, options); + var data = options.data, url = options.url, method = options.method; + + switch ($type(data)){ + case 'element': data = $(data).toQueryString(); break; + case 'object': case 'hash': data = Hash.toQueryString(data); + } + + if (this.options.format){ + var format = 'format=' + this.options.format; + data = (data) ? format + '&' + data : format; + } + + if (this.options.emulation && ['put', 'delete'].contains(method)){ + var _method = '_method=' + method; + data = (data) ? _method + '&' + data : _method; + method = 'post'; + } + + if (this.options.urlEncoded && method == 'post'){ + var encoding = (this.options.encoding) ? '; charset=' + this.options.encoding : ''; + this.headers.set('Content-type', 'application/x-www-form-urlencoded' + encoding); + } + + if (data && method == 'get'){ + url = url + (url.contains('?') ? '&' : '?') + data; + data = null; + } + + this.xhr.open(method.toUpperCase(), url, this.options.async); + + this.xhr.onreadystatechange = this.onStateChange.bind(this); + + this.headers.each(function(value, key){ + if (!$try(function(){ + this.xhr.setRequestHeader(key, value); + return true; + }.bind(this))) this.fireEvent('exception', [key, value]); + }, this); + + this.fireEvent('request'); + this.xhr.send(data); + if (!this.options.async) this.onStateChange(); + return this; + }, + + cancel: function(){ + if (!this.running) return this; + this.running = false; + this.xhr.abort(); + this.xhr.onreadystatechange = $empty; + this.xhr = new Browser.Request(); + this.fireEvent('cancel'); + return this; + } + +}); + +(function(){ + +var methods = {}; +['get', 'post', 'put', 'delete', 'GET', 'POST', 'PUT', 'DELETE'].each(function(method){ + methods[method] = function(){ + var params = Array.link(arguments, {url: String.type, data: $defined}); + return this.send($extend(params, {method: method.toLowerCase()})); + }; +}); + +Request.implement(methods); + +})(); + +Element.Properties.send = { + + set: function(options){ + var send = this.retrieve('send'); + if (send) send.cancel(); + return this.eliminate('send').store('send:options', $extend({ + data: this, link: 'cancel', method: this.get('method') || 'post', url: this.get('action') + }, options)); + }, + + get: function(options){ + if (options || !this.retrieve('send')){ + if (options || !this.retrieve('send:options')) this.set('send', options); + this.store('send', new Request(this.retrieve('send:options'))); + } + return this.retrieve('send'); + } + +}; + +Element.implement({ + + send: function(url){ + var sender = this.get('send'); + sender.send({data: this, url: url || sender.options.url}); + return this; + } + +}); + + +/* +Script: Request.HTML.js + Extends the basic Request Class with additional methods for interacting with HTML responses. + +License: + MIT-style license. +*/ + +Request.HTML = new Class({ + + Extends: Request, + + options: { + update: false, + evalScripts: true, + filter: false + }, + + processHTML: function(text){ + var match = text.match(/]*>([\s\S]*?)<\/body>/i); + text = (match) ? match[1] : text; + + var container = new Element('div'); + + return $try(function(){ + var root = '' + text + '', doc; + if (Browser.Engine.trident){ + doc = new ActiveXObject('Microsoft.XMLDOM'); + doc.async = false; + doc.loadXML(root); + } else { + doc = new DOMParser().parseFromString(root, 'text/xml'); + } + root = doc.getElementsByTagName('root')[0]; + for (var i = 0, k = root.childNodes.length; i < k; i++){ + var child = Element.clone(root.childNodes[i], true, true); + if (child) container.grab(child); + } + return container; + }) || container.set('html', text); + }, + + success: function(text){ + var options = this.options, response = this.response; + + response.html = text.stripScripts(function(script){ + response.javascript = script; + }); + + var temp = this.processHTML(response.html); + + response.tree = temp.childNodes; + response.elements = temp.getElements('*'); + + if (options.filter) response.tree = response.elements.filter(options.filter); + if (options.update) $(options.update).empty().adopt(response.tree); + if (options.evalScripts) $exec(response.javascript); + + this.onSuccess(response.tree, response.elements, response.html, response.javascript); + } + +}); + +Element.Properties.load = { + + set: function(options){ + var load = this.retrieve('load'); + if (load) send.cancel(); + return this.eliminate('load').store('load:options', $extend({data: this, link: 'cancel', update: this, method: 'get'}, options)); + }, + + get: function(options){ + if (options || ! this.retrieve('load')){ + if (options || !this.retrieve('load:options')) this.set('load', options); + this.store('load', new Request.HTML(this.retrieve('load:options'))); + } + return this.retrieve('load'); + } + +}; + +Element.implement({ + + load: function(){ + this.get('load').send(Array.link(arguments, {data: Object.type, url: String.type})); + return this; + } + +}); + + +/* +Script: Request.JSON.js + Extends the basic Request Class with additional methods for sending and receiving JSON data. + +License: + MIT-style license. +*/ + +Request.JSON = new Class({ + + Extends: Request, + + options: { + secure: true + }, + + initialize: function(options){ + this.parent(options); + this.headers.extend({'Accept': 'application/json', 'X-Request': 'JSON'}); + }, + + success: function(text){ + this.response.json = JSON.decode(text, this.options.secure); + this.onSuccess(this.response.json, text); + } + +}); + +//MooTools More, . Copyright (c) 2006-2008 Valerio Proietti, , MIT Style License. + +/* +Script: Fx.Slide.js + Effect to slide an element in and out of view. + +License: + MIT-style license. +*/ + +Fx.Slide = new Class({ + + Extends: Fx, + + options: { + mode: 'vertical' + }, + + initialize: function(element, options){ + this.addEvent('complete', function(){ + this.open = (this.wrapper['offset' + this.layout.capitalize()] != 0); + if (this.open && Browser.Engine.webkit419) this.element.dispose().inject(this.wrapper); + }, true); + this.element = this.subject = $(element); + this.parent(options); + var wrapper = this.element.retrieve('wrapper'); + this.wrapper = wrapper || new Element('div', { + styles: $extend(this.element.getStyles('margin', 'position'), {'overflow': 'hidden'}) + }).wraps(this.element); + this.element.store('wrapper', this.wrapper).setStyle('margin', 0); + this.now = []; + this.open = true; + }, + + vertical: function(){ + this.margin = 'margin-top'; + this.layout = 'height'; + this.offset = this.element.offsetHeight; + }, + + horizontal: function(){ + this.margin = 'margin-left'; + this.layout = 'width'; + this.offset = this.element.offsetWidth; + }, + + set: function(now){ + this.element.setStyle(this.margin, now[0]); + this.wrapper.setStyle(this.layout, now[1]); + return this; + }, + + compute: function(from, to, delta){ + var now = []; + var x = 2; + x.times(function(i){ + now[i] = Fx.compute(from[i], to[i], delta); + }); + return now; + }, + + start: function(how, mode){ + if (!this.check(arguments.callee, how, mode)) return this; + this[mode || this.options.mode](); + var margin = this.element.getStyle(this.margin).toInt(); + var layout = this.wrapper.getStyle(this.layout).toInt(); + var caseIn = [[margin, layout], [0, this.offset]]; + var caseOut = [[margin, layout], [-this.offset, 0]]; + var start; + switch (how){ + case 'in': start = caseIn; break; + case 'out': start = caseOut; break; + case 'toggle': start = (this.wrapper['offset' + this.layout.capitalize()] == 0) ? caseIn : caseOut; + } + return this.parent(start[0], start[1]); + }, + + slideIn: function(mode){ + return this.start('in', mode); + }, + + slideOut: function(mode){ + return this.start('out', mode); + }, + + hide: function(mode){ + this[mode || this.options.mode](); + this.open = false; + return this.set([-this.offset, 0]); + }, + + show: function(mode){ + this[mode || this.options.mode](); + this.open = true; + return this.set([0, this.offset]); + }, + + toggle: function(mode){ + return this.start('toggle', mode); + } + +}); + +Element.Properties.slide = { + + set: function(options){ + var slide = this.retrieve('slide'); + if (slide) slide.cancel(); + return this.eliminate('slide').store('slide:options', $extend({link: 'cancel'}, options)); + }, + + get: function(options){ + if (options || !this.retrieve('slide')){ + if (options || !this.retrieve('slide:options')) this.set('slide', options); + this.store('slide', new Fx.Slide(this, this.retrieve('slide:options'))); + } + return this.retrieve('slide'); + } + +}; + +Element.implement({ + + slide: function(how, mode){ + how = how || 'toggle'; + var slide = this.get('slide'), toggle; + switch (how){ + case 'hide': slide.hide(mode); break; + case 'show': slide.show(mode); break; + case 'toggle': + var flag = this.retrieve('slide:flag', slide.open); + slide[(flag) ? 'slideOut' : 'slideIn'](mode); + this.store('slide:flag', !flag); + toggle = true; + break; + default: slide.start(how, mode); + } + if (!toggle) this.eliminate('slide:flag'); + return this; + } + +}); + + +/* +Script: Fx.Scroll.js + Effect to smoothly scroll any element, including the window. + +License: + MIT-style license. +*/ + +Fx.Scroll = new Class({ + + Extends: Fx, + + options: { + offset: {'x': 0, 'y': 0}, + wheelStops: true + }, + + initialize: function(element, options){ + this.element = this.subject = $(element); + this.parent(options); + var cancel = this.cancel.bind(this, false); + + if ($type(this.element) != 'element') this.element = $(this.element.getDocument().body); + + var stopper = this.element; + + if (this.options.wheelStops){ + this.addEvent('start', function(){ + stopper.addEvent('mousewheel', cancel); + }, true); + this.addEvent('complete', function(){ + stopper.removeEvent('mousewheel', cancel); + }, true); + } + }, + + set: function(){ + var now = Array.flatten(arguments); + this.element.scrollTo(now[0], now[1]); + }, + + compute: function(from, to, delta){ + var now = []; + var x = 2; + x.times(function(i){ + now.push(Fx.compute(from[i], to[i], delta)); + }); + return now; + }, + + start: function(x, y){ + if (!this.check(arguments.callee, x, y)) return this; + var offsetSize = this.element.getSize(), scrollSize = this.element.getScrollSize(); + var scroll = this.element.getScroll(), values = {x: x, y: y}; + for (var z in values){ + var max = scrollSize[z] - offsetSize[z]; + if ($chk(values[z])) values[z] = ($type(values[z]) == 'number') ? values[z].limit(0, max) : max; + else values[z] = scroll[z]; + values[z] += this.options.offset[z]; + } + return this.parent([scroll.x, scroll.y], [values.x, values.y]); + }, + + toTop: function(){ + return this.start(false, 0); + }, + + toLeft: function(){ + return this.start(0, false); + }, + + toRight: function(){ + return this.start('right', false); + }, + + toBottom: function(){ + return this.start(false, 'bottom'); + }, + + toElement: function(el){ + var position = $(el).getPosition(this.element); + return this.start(position.x, position.y); + } + +}); + + +/* +Script: Fx.Elements.js + Effect to change any number of CSS properties of any number of Elements. + +License: + MIT-style license. +*/ + +Fx.Elements = new Class({ + + Extends: Fx.CSS, + + initialize: function(elements, options){ + this.elements = this.subject = $$(elements); + this.parent(options); + }, + + compute: function(from, to, delta){ + var now = {}; + for (var i in from){ + var iFrom = from[i], iTo = to[i], iNow = now[i] = {}; + for (var p in iFrom) iNow[p] = this.parent(iFrom[p], iTo[p], delta); + } + return now; + }, + + set: function(now){ + for (var i in now){ + var iNow = now[i]; + for (var p in iNow) this.render(this.elements[i], p, iNow[p], this.options.unit); + } + return this; + }, + + start: function(obj){ + if (!this.check(arguments.callee, obj)) return this; + var from = {}, to = {}; + for (var i in obj){ + var iProps = obj[i], iFrom = from[i] = {}, iTo = to[i] = {}; + for (var p in iProps){ + var parsed = this.prepare(this.elements[i], p, iProps[p]); + iFrom[p] = parsed.from; + iTo[p] = parsed.to; + } + } + return this.parent(from, to); + } + +}); + +/* +Script: Drag.js + The base Drag Class. Can be used to drag and resize Elements using mouse events. + +License: + MIT-style license. +*/ + +var Drag = new Class({ + + Implements: [Events, Options], + + options: {/* + onBeforeStart: $empty, + onStart: $empty, + onDrag: $empty, + onCancel: $empty, + onComplete: $empty,*/ + snap: 6, + unit: 'px', + grid: false, + style: true, + limit: false, + handle: false, + invert: false, + preventDefault: false, + modifiers: {x: 'left', y: 'top'} + }, + + initialize: function(){ + var params = Array.link(arguments, {'options': Object.type, 'element': $defined}); + this.element = $(params.element); + this.document = this.element.getDocument(); + this.setOptions(params.options || {}); + var htype = $type(this.options.handle); + this.handles = (htype == 'array' || htype == 'collection') ? $$(this.options.handle) : $(this.options.handle) || this.element; + this.mouse = {'now': {}, 'pos': {}}; + this.value = {'start': {}, 'now': {}}; + + this.selection = (Browser.Engine.trident) ? 'selectstart' : 'mousedown'; + + this.bound = { + start: this.start.bind(this), + check: this.check.bind(this), + drag: this.drag.bind(this), + stop: this.stop.bind(this), + cancel: this.cancel.bind(this), + eventStop: $lambda(false) + }; + this.attach(); + }, + + attach: function(){ + this.handles.addEvent('mousedown', this.bound.start); + return this; + }, + + detach: function(){ + this.handles.removeEvent('mousedown', this.bound.start); + return this; + }, + + start: function(event){ + if (this.options.preventDefault) event.preventDefault(); + this.fireEvent('beforeStart', this.element); + this.mouse.start = event.page; + var limit = this.options.limit; + this.limit = {'x': [], 'y': []}; + for (var z in this.options.modifiers){ + if (!this.options.modifiers[z]) continue; + if (this.options.style) this.value.now[z] = this.element.getStyle(this.options.modifiers[z]).toInt(); + else this.value.now[z] = this.element[this.options.modifiers[z]]; + if (this.options.invert) this.value.now[z] *= -1; + this.mouse.pos[z] = event.page[z] - this.value.now[z]; + if (limit && limit[z]){ + for (var i = 2; i--; i){ + if ($chk(limit[z][i])) this.limit[z][i] = $lambda(limit[z][i])(); + } + } + } + if ($type(this.options.grid) == 'number') this.options.grid = {'x': this.options.grid, 'y': this.options.grid}; + this.document.addEvents({mousemove: this.bound.check, mouseup: this.bound.cancel}); + this.document.addEvent(this.selection, this.bound.eventStop); + }, + + check: function(event){ + if (this.options.preventDefault) event.preventDefault(); + var distance = Math.round(Math.sqrt(Math.pow(event.page.x - this.mouse.start.x, 2) + Math.pow(event.page.y - this.mouse.start.y, 2))); + if (distance > this.options.snap){ + this.cancel(); + this.document.addEvents({ + mousemove: this.bound.drag, + mouseup: this.bound.stop + }); + this.fireEvent('start', this.element).fireEvent('snap', this.element); + } + }, + + drag: function(event){ + if (this.options.preventDefault) event.preventDefault(); + this.mouse.now = event.page; + for (var z in this.options.modifiers){ + if (!this.options.modifiers[z]) continue; + this.value.now[z] = this.mouse.now[z] - this.mouse.pos[z]; + if (this.options.invert) this.value.now[z] *= -1; + if (this.options.limit && this.limit[z]){ + if ($chk(this.limit[z][1]) && (this.value.now[z] > this.limit[z][1])){ + this.value.now[z] = this.limit[z][1]; + } else if ($chk(this.limit[z][0]) && (this.value.now[z] < this.limit[z][0])){ + this.value.now[z] = this.limit[z][0]; + } + } + if (this.options.grid[z]) this.value.now[z] -= (this.value.now[z] % this.options.grid[z]); + if (this.options.style) this.element.setStyle(this.options.modifiers[z], this.value.now[z] + this.options.unit); + else this.element[this.options.modifiers[z]] = this.value.now[z]; + } + this.fireEvent('drag', this.element); + }, + + cancel: function(event){ + this.document.removeEvent('mousemove', this.bound.check); + this.document.removeEvent('mouseup', this.bound.cancel); + if (event){ + this.document.removeEvent(this.selection, this.bound.eventStop); + this.fireEvent('cancel', this.element); + } + }, + + stop: function(event){ + this.document.removeEvent(this.selection, this.bound.eventStop); + this.document.removeEvent('mousemove', this.bound.drag); + this.document.removeEvent('mouseup', this.bound.stop); + if (event) this.fireEvent('complete', this.element); + } + +}); + +Element.implement({ + + makeResizable: function(options){ + return new Drag(this, $merge({modifiers: {'x': 'width', 'y': 'height'}}, options)); + } + +}); + +/* +Script: Drag.Move.js + A Drag extension that provides support for the constraining of draggables to containers and droppables. + +License: + MIT-style license. +*/ + +Drag.Move = new Class({ + + Extends: Drag, + + options: { + droppables: [], + container: false + }, + + initialize: function(element, options){ + this.parent(element, options); + this.droppables = $$(this.options.droppables); + this.container = $(this.options.container); + if (this.container && $type(this.container) != 'element') this.container = $(this.container.getDocument().body); + element = this.element; + + var current = element.getStyle('position'); + var position = (current != 'static') ? current : 'absolute'; + if (element.getStyle('left') == 'auto' || element.getStyle('top') == 'auto') element.position(element.getPosition(element.offsetParent)); + + element.setStyle('position', position); + + this.addEvent('start', function(){ + this.checkDroppables(); + }, true); + }, + + start: function(event){ + if (this.container){ + var el = this.element, cont = this.container, ccoo = cont.getCoordinates(el.offsetParent), cps = {}, ems = {}; + + ['top', 'right', 'bottom', 'left'].each(function(pad){ + cps[pad] = cont.getStyle('padding-' + pad).toInt(); + ems[pad] = el.getStyle('margin-' + pad).toInt(); + }, this); + + var width = el.offsetWidth + ems.left + ems.right, height = el.offsetHeight + ems.top + ems.bottom; + var x = [ccoo.left + cps.left, ccoo.right - cps.right - width]; + var y = [ccoo.top + cps.top, ccoo.bottom - cps.bottom - height]; + + this.options.limit = {x: x, y: y}; + } + this.parent(event); + }, + + checkAgainst: function(el){ + el = el.getCoordinates(); + var now = this.mouse.now; + return (now.x > el.left && now.x < el.right && now.y < el.bottom && now.y > el.top); + }, + + checkDroppables: function(){ + var overed = this.droppables.filter(this.checkAgainst, this).getLast(); + if (this.overed != overed){ + if (this.overed) this.fireEvent('leave', [this.element, this.overed]); + if (overed){ + this.overed = overed; + this.fireEvent('enter', [this.element, overed]); + } else { + this.overed = null; + } + } + }, + + drag: function(event){ + this.parent(event); + if (this.droppables.length) this.checkDroppables(); + }, + + stop: function(event){ + this.checkDroppables(); + this.fireEvent('drop', [this.element, this.overed]); + this.overed = null; + return this.parent(event); + } + +}); + +Element.implement({ + + makeDraggable: function(options){ + return new Drag.Move(this, options); + } + +}); + + +/* +Script: Hash.Cookie.js + Class for creating, reading, and deleting Cookies in JSON format. + +License: + MIT-style license. +*/ + +Hash.Cookie = new Class({ + + Extends: Cookie, + + options: { + autoSave: true + }, + + initialize: function(name, options){ + this.parent(name, options); + this.load(); + }, + + save: function(){ + var value = JSON.encode(this.hash); + if (!value || value.length > 4096) return false; //cookie would be truncated! + if (value == '{}') this.dispose(); + else this.write(value); + return true; + }, + + load: function(){ + this.hash = new Hash(JSON.decode(this.read(), true)); + return this; + } + +}); + +Hash.Cookie.implement((function(){ + + var methods = {}; + + Hash.each(Hash.prototype, function(method, name){ + methods[name] = function(){ + var value = method.apply(this.hash, arguments); + if (this.options.autoSave) this.save(); + return value; + }; + }); + + return methods; + +})()); + +/* +Script: Color.js + Class for creating and manipulating colors in JavaScript. Supports HSB -> RGB Conversions and vice versa. + +License: + MIT-style license. +*/ + +var Color = new Native({ + + initialize: function(color, type){ + if (arguments.length >= 3){ + type = "rgb"; color = Array.slice(arguments, 0, 3); + } else if (typeof color == 'string'){ + if (color.match(/rgb/)) color = color.rgbToHex().hexToRgb(true); + else if (color.match(/hsb/)) color = color.hsbToRgb(); + else color = color.hexToRgb(true); + } + type = type || 'rgb'; + switch (type){ + case 'hsb': + var old = color; + color = color.hsbToRgb(); + color.hsb = old; + break; + case 'hex': color = color.hexToRgb(true); break; + } + color.rgb = color.slice(0, 3); + color.hsb = color.hsb || color.rgbToHsb(); + color.hex = color.rgbToHex(); + return $extend(color, this); + } + +}); + +Color.implement({ + + mix: function(){ + var colors = Array.slice(arguments); + var alpha = ($type(colors.getLast()) == 'number') ? colors.pop() : 50; + var rgb = this.slice(); + colors.each(function(color){ + color = new Color(color); + for (var i = 0; i < 3; i++) rgb[i] = Math.round((rgb[i] / 100 * (100 - alpha)) + (color[i] / 100 * alpha)); + }); + return new Color(rgb, 'rgb'); + }, + + invert: function(){ + return new Color(this.map(function(value){ + return 255 - value; + })); + }, + + setHue: function(value){ + return new Color([value, this.hsb[1], this.hsb[2]], 'hsb'); + }, + + setSaturation: function(percent){ + return new Color([this.hsb[0], percent, this.hsb[2]], 'hsb'); + }, + + setBrightness: function(percent){ + return new Color([this.hsb[0], this.hsb[1], percent], 'hsb'); + } + +}); + +function $RGB(r, g, b){ + return new Color([r, g, b], 'rgb'); +}; + +function $HSB(h, s, b){ + return new Color([h, s, b], 'hsb'); +}; + +function $HEX(hex){ + return new Color(hex, 'hex'); +}; + +Array.implement({ + + rgbToHsb: function(){ + var red = this[0], green = this[1], blue = this[2]; + var hue, saturation, brightness; + var max = Math.max(red, green, blue), min = Math.min(red, green, blue); + var delta = max - min; + brightness = max / 255; + saturation = (max != 0) ? delta / max : 0; + if (saturation == 0){ + hue = 0; + } else { + var rr = (max - red) / delta; + var gr = (max - green) / delta; + var br = (max - blue) / delta; + if (red == max) hue = br - gr; + else if (green == max) hue = 2 + rr - br; + else hue = 4 + gr - rr; + hue /= 6; + if (hue < 0) hue++; + } + return [Math.round(hue * 360), Math.round(saturation * 100), Math.round(brightness * 100)]; + }, + + hsbToRgb: function(){ + var br = Math.round(this[2] / 100 * 255); + if (this[1] == 0){ + return [br, br, br]; + } else { + var hue = this[0] % 360; + var f = hue % 60; + var p = Math.round((this[2] * (100 - this[1])) / 10000 * 255); + var q = Math.round((this[2] * (6000 - this[1] * f)) / 600000 * 255); + var t = Math.round((this[2] * (6000 - this[1] * (60 - f))) / 600000 * 255); + switch (Math.floor(hue / 60)){ + case 0: return [br, t, p]; + case 1: return [q, br, p]; + case 2: return [p, br, t]; + case 3: return [p, q, br]; + case 4: return [t, p, br]; + case 5: return [br, p, q]; + } + } + return false; + } + +}); + +String.implement({ + + rgbToHsb: function(){ + var rgb = this.match(/\d{1,3}/g); + return (rgb) ? hsb.rgbToHsb() : null; + }, + + hsbToRgb: function(){ + var hsb = this.match(/\d{1,3}/g); + return (hsb) ? hsb.hsbToRgb() : null; + } + +}); + + +/* +Script: Group.js + Class for monitoring collections of events + +License: + MIT-style license. +*/ + +var Group = new Class({ + + initialize: function(){ + this.instances = Array.flatten(arguments); + this.events = {}; + this.checker = {}; + }, + + addEvent: function(type, fn){ + this.checker[type] = this.checker[type] || {}; + this.events[type] = this.events[type] || []; + if (this.events[type].contains(fn)) return false; + else this.events[type].push(fn); + this.instances.each(function(instance, i){ + instance.addEvent(type, this.check.bind(this, [type, instance, i])); + }, this); + return this; + }, + + check: function(type, instance, i){ + this.checker[type][i] = true; + var every = this.instances.every(function(current, j){ + return this.checker[type][j] || false; + }, this); + if (!every) return; + this.checker[type] = {}; + this.events[type].each(function(event){ + event.call(this, this.instances, instance); + }, this); + } + +}); + + +/* +Script: Assets.js + Provides methods to dynamically load JavaScript, CSS, and Image files into the document. + +License: + MIT-style license. +*/ + +var Asset = new Hash({ + + javascript: function(source, properties){ + properties = $extend({ + onload: $empty, + document: document, + check: $lambda(true) + }, properties); + + var script = new Element('script', {'src': source, 'type': 'text/javascript'}); + + var load = properties.onload.bind(script), check = properties.check, doc = properties.document; + delete properties.onload; delete properties.check; delete properties.document; + + script.addEvents({ + load: load, + readystatechange: function(){ + if (['loaded', 'complete'].contains(this.readyState)) load(); + } + }).setProperties(properties); + + + if (Browser.Engine.webkit419) var checker = (function(){ + if (!$try(check)) return; + $clear(checker); + load(); + }).periodical(50); + + return script.inject(doc.head); + }, + + css: function(source, properties){ + return new Element('link', $merge({ + 'rel': 'stylesheet', 'media': 'screen', 'type': 'text/css', 'href': source + }, properties)).inject(document.head); + }, + + image: function(source, properties){ + properties = $merge({ + 'onload': $empty, + 'onabort': $empty, + 'onerror': $empty + }, properties); + var image = new Image(); + var element = $(image) || new Element('img'); + ['load', 'abort', 'error'].each(function(name){ + var type = 'on' + name; + var event = properties[type]; + delete properties[type]; + image[type] = function(){ + if (!image) return; + if (!element.parentNode){ + element.width = image.width; + element.height = image.height; + } + image = image.onload = image.onabort = image.onerror = null; + event.delay(1, element, element); + element.fireEvent(name, element, 1); + }; + }); + image.src = element.src = source; + if (image && image.complete) image.onload.delay(1); + return element.setProperties(properties); + }, + + images: function(sources, options){ + options = $merge({ + onComplete: $empty, + onProgress: $empty + }, options); + if (!sources.push) sources = [sources]; + var images = []; + var counter = 0; + sources.each(function(source){ + var img = new Asset.image(source, { + 'onload': function(){ + options.onProgress.call(this, counter, sources.indexOf(source)); + counter++; + if (counter == sources.length) options.onComplete(); + } + }); + images.push(img); + }); + return new Elements(images); + } + +}); + +/* +Script: Sortables.js + Class for creating a drag and drop sorting interface for lists of items. + +License: + MIT-style license. +*/ + +var Sortables = new Class({ + + Implements: [Events, Options], + + options: {/* + onSort: $empty, + onStart: $empty, + onComplete: $empty,*/ + snap: 4, + opacity: 1, + clone: false, + revert: false, + handle: false, + constrain: false + }, + + initialize: function(lists, options){ + this.setOptions(options); + this.elements = []; + this.lists = []; + this.idle = true; + + this.addLists($$($(lists) || lists)); + if (!this.options.clone) this.options.revert = false; + if (this.options.revert) this.effect = new Fx.Morph(null, $merge({duration: 250, link: 'cancel'}, this.options.revert)); + }, + + attach: function(){ + this.addLists(this.lists); + return this; + }, + + detach: function(){ + this.lists = this.removeLists(this.lists); + return this; + }, + + addItems: function(){ + Array.flatten(arguments).each(function(element){ + this.elements.push(element); + var start = element.retrieve('sortables:start', this.start.bindWithEvent(this, element)); + (this.options.handle ? element.getElement(this.options.handle) || element : element).addEvent('mousedown', start); + }, this); + return this; + }, + + addLists: function(){ + Array.flatten(arguments).each(function(list){ + this.lists.push(list); + this.addItems(list.getChildren()); + }, this); + return this; + }, + + removeItems: function(){ + var elements = []; + Array.flatten(arguments).each(function(element){ + elements.push(element); + this.elements.erase(element); + var start = element.retrieve('sortables:start'); + (this.options.handle ? element.getElement(this.options.handle) || element : element).removeEvent('mousedown', start); + }, this); + return $$(elements); + }, + + removeLists: function(){ + var lists = []; + Array.flatten(arguments).each(function(list){ + lists.push(list); + this.lists.erase(list); + this.removeItems(list.getChildren()); + }, this); + return $$(lists); + }, + + getClone: function(event, element){ + if (!this.options.clone) return new Element('div').inject(document.body); + if ($type(this.options.clone) == 'function') return this.options.clone.call(this, event, element, this.list); + return element.clone(true).setStyles({ + 'margin': '0px', + 'position': 'absolute', + 'visibility': 'hidden', + 'width': element.getStyle('width') + }).inject(this.list).position(element.getPosition(element.getOffsetParent())); + }, + + getDroppables: function(){ + var droppables = this.list.getChildren(); + if (!this.options.constrain) droppables = this.lists.concat(droppables).erase(this.list); + return droppables.erase(this.clone).erase(this.element); + }, + + insert: function(dragging, element){ + var where = 'inside'; + if (this.lists.contains(element)){ + this.list = element; + this.drag.droppables = this.getDroppables(); + } else { + where = this.element.getAllPrevious().contains(element) ? 'before' : 'after'; + } + this.element.inject(element, where); + this.fireEvent('sort', [this.element, this.clone]); + }, + + start: function(event, element){ + if (!this.idle) return; + this.idle = false; + this.element = element; + this.opacity = element.get('opacity'); + this.list = element.getParent(); + this.clone = this.getClone(event, element); + + this.drag = new Drag.Move(this.clone, { + snap: this.options.snap, + container: this.options.constrain && this.element.getParent(), + droppables: this.getDroppables(), + onSnap: function(){ + event.stop(); + this.clone.setStyle('visibility', 'visible'); + this.element.set('opacity', this.options.opacity || 0); + this.fireEvent('start', [this.element, this.clone]); + }.bind(this), + onEnter: this.insert.bind(this), + onCancel: this.reset.bind(this), + onComplete: this.end.bind(this) + }); + + this.clone.inject(this.element, 'before'); + this.drag.start(event); + }, + + end: function(){ + this.drag.detach(); + this.element.set('opacity', this.opacity); + if (this.effect){ + var dim = this.element.getStyles('width', 'height'); + var pos = this.clone.computePosition(this.element.getPosition(this.clone.offsetParent)); + this.effect.element = this.clone; + this.effect.start({ + top: pos.top, + left: pos.left, + width: dim.width, + height: dim.height, + opacity: 0.25 + }).chain(this.reset.bind(this)); + } else { + this.reset(); + } + }, + + reset: function(){ + this.idle = true; + this.clone.destroy(); + this.fireEvent('complete', this.element); + }, + + serialize: function(){ + var params = Array.link(arguments, {modifier: Function.type, index: $defined}); + var serial = this.lists.map(function(list){ + return list.getChildren().map(params.modifier || function(element){ + return element.get('id'); + }, this); + }, this); + + var index = params.index; + if (this.lists.length == 1) index = 0; + return $chk(index) && index >= 0 && index < this.lists.length ? serial[index] : serial; + } + +}); + +/* +Script: Tips.js + Class for creating nice tips that follow the mouse cursor when hovering an element. + +License: + MIT-style license. +*/ + +var Tips = new Class({ + + Implements: [Events, Options], + + options: { + onShow: function(tip){ + tip.setStyle('visibility', 'visible'); + }, + onHide: function(tip){ + tip.setStyle('visibility', 'hidden'); + }, + showDelay: 100, + hideDelay: 100, + className: null, + offsets: {x: 16, y: 16}, + fixed: false + }, + + initialize: function(){ + var params = Array.link(arguments, {options: Object.type, elements: $defined}); + this.setOptions(params.options || null); + + this.tip = new Element('div').inject(document.body); + + if (this.options.className) this.tip.addClass(this.options.className); + + var top = new Element('div', {'class': 'tip-top'}).inject(this.tip); + this.container = new Element('div', {'class': 'tip'}).inject(this.tip); + var bottom = new Element('div', {'class': 'tip-bottom'}).inject(this.tip); + + this.tip.setStyles({position: 'absolute', top: 0, left: 0, visibility: 'hidden'}); + + if (params.elements) this.attach(params.elements); + }, + + attach: function(elements){ + $$(elements).each(function(element){ + var title = element.retrieve('tip:title', element.get('title')); + var text = element.retrieve('tip:text', element.get('rel') || element.get('href')); + var enter = element.retrieve('tip:enter', this.elementEnter.bindWithEvent(this, element)); + var leave = element.retrieve('tip:leave', this.elementLeave.bindWithEvent(this, element)); + element.addEvents({mouseenter: enter, mouseleave: leave}); + if (!this.options.fixed){ + var move = element.retrieve('tip:move', this.elementMove.bindWithEvent(this, element)); + element.addEvent('mousemove', move); + } + element.store('tip:native', element.get('title')); + element.erase('title'); + }, this); + return this; + }, + + detach: function(elements){ + $$(elements).each(function(element){ + element.removeEvent('mouseenter', element.retrieve('tip:enter') || $empty); + element.removeEvent('mouseleave', element.retrieve('tip:leave') || $empty); + element.removeEvent('mousemove', element.retrieve('tip:move') || $empty); + element.eliminate('tip:enter').eliminate('tip:leave').eliminate('tip:move'); + var original = element.retrieve('tip:native'); + if (original) element.set('title', original); + }); + return this; + }, + + elementEnter: function(event, element){ + + $A(this.container.childNodes).each(Element.dispose); + + var title = element.retrieve('tip:title'); + + if (title){ + this.titleElement = new Element('div', {'class': 'tip-title'}).inject(this.container); + this.fill(this.titleElement, title); + } + + var text = element.retrieve('tip:text'); + if (text){ + this.textElement = new Element('div', {'class': 'tip-text'}).inject(this.container); + this.fill(this.textElement, text); + } + + this.timer = $clear(this.timer); + this.timer = this.show.delay(this.options.showDelay, this); + + this.position((!this.options.fixed) ? event : {page: element.getPosition()}); + }, + + elementLeave: function(event){ + $clear(this.timer); + this.timer = this.hide.delay(this.options.hideDelay, this); + }, + + elementMove: function(event){ + this.position(event); + }, + + position: function(event){ + var size = window.getSize(), scroll = window.getScroll(); + var tip = {x: this.tip.offsetWidth, y: this.tip.offsetHeight}; + var props = {x: 'left', y: 'top'}; + for (var z in props){ + var pos = event.page[z] + this.options.offsets[z]; + if ((pos + tip[z] - scroll[z]) > size[z]) pos = event.page[z] - this.options.offsets[z] - tip[z]; + this.tip.setStyle(props[z], pos); + } + }, + + fill: function(element, contents){ + (typeof contents == 'string') ? element.set('html', contents) : element.adopt(contents); + }, + + show: function(){ + this.fireEvent('show', this.tip); + }, + + hide: function(){ + this.fireEvent('hide', this.tip); + } + +}); + +/* +Script: SmoothScroll.js + Class for creating a smooth scrolling effect to all internal links on the page. + +License: + MIT-style license. +*/ + +var SmoothScroll = new Class({ + + Extends: Fx.Scroll, + + initialize: function(options, context){ + context = context || document; + var doc = context.getDocument(), win = context.getWindow(); + this.parent(doc, options); + this.links = (this.options.links) ? $$(this.options.links) : $$(doc.links); + var location = win.location.href.match(/^[^#]*/)[0] + '#'; + this.links.each(function(link){ + if (link.href.indexOf(location) != 0) return; + var anchor = link.href.substr(location.length); + if (anchor && $(anchor)) this.useLink(link, anchor); + }, this); + if (!Browser.Engine.webkit419) this.addEvent('complete', function(){ + win.location.hash = this.anchor; + }, true); + }, + + useLink: function(link, anchor){ + link.addEvent('click', function(event){ + this.anchor = anchor; + this.toElement(anchor); + event.stop(); + }.bind(this)); + } + +}); + +/* +Script: Slider.js + Class for creating horizontal and vertical slider controls. + +License: + MIT-style license. +*/ + +var Slider = new Class({ + + Implements: [Events, Options], + + options: {/* + onChange: $empty, + onComplete: $empty,*/ + onTick: function(position){ + if(this.options.snap) position = this.toPosition(this.step); + this.knob.setStyle(this.property, position); + }, + snap: false, + offset: 0, + range: false, + wheel: false, + steps: 100, + mode: 'horizontal' + }, + + initialize: function(element, knob, options){ + this.setOptions(options); + this.element = $(element); + this.knob = $(knob); + this.previousChange = this.previousEnd = this.step = -1; + this.element.addEvent('mousedown', this.clickedElement.bind(this)); + if (this.options.wheel) this.element.addEvent('mousewheel', this.scrolledElement.bindWithEvent(this)); + var offset, limit = {}, modifiers = {'x': false, 'y': false}; + switch (this.options.mode){ + case 'vertical': + this.axis = 'y'; + this.property = 'top'; + offset = 'offsetHeight'; + break; + case 'horizontal': + this.axis = 'x'; + this.property = 'left'; + offset = 'offsetWidth'; + } + this.half = this.knob[offset] / 2; + this.full = this.element[offset] - this.knob[offset] + (this.options.offset * 2); + this.min = $chk(this.options.range[0]) ? this.options.range[0] : 0; + this.max = $chk(this.options.range[1]) ? this.options.range[1] : this.options.steps; + this.range = this.max - this.min; + this.steps = this.options.steps || this.full; + this.stepSize = Math.abs(this.range) / this.steps; + this.stepWidth = this.stepSize * this.full / Math.abs(this.range) ; + + this.knob.setStyle('position', 'relative').setStyle(this.property, - this.options.offset); + modifiers[this.axis] = this.property; + limit[this.axis] = [- this.options.offset, this.full - this.options.offset]; + this.drag = new Drag(this.knob, { + snap: 0, + limit: limit, + modifiers: modifiers, + onDrag: this.draggedKnob.bind(this), + onStart: this.draggedKnob.bind(this), + onComplete: function(){ + this.draggedKnob(); + this.end(); + }.bind(this) + }); + if (this.options.snap) { + this.drag.options.grid = Math.ceil(this.stepWidth); + this.drag.options.limit[this.axis][1] = this.full; + } + }, + + set: function(step){ + if (!((this.range > 0) ^ (step < this.min))) step = this.min; + if (!((this.range > 0) ^ (step > this.max))) step = this.max; + + this.step = Math.round(step); + this.checkStep(); + this.end(); + this.fireEvent('tick', this.toPosition(this.step)); + return this; + }, + + clickedElement: function(event){ + var dir = this.range < 0 ? -1 : 1; + var position = event.page[this.axis] - this.element.getPosition()[this.axis] - this.half; + position = position.limit(-this.options.offset, this.full -this.options.offset); + + this.step = Math.round(this.min + dir * this.toStep(position)); + this.checkStep(); + this.end(); + this.fireEvent('tick', position); + }, + + scrolledElement: function(event){ + var mode = (this.options.mode == 'horizontal') ? (event.wheel < 0) : (event.wheel > 0); + this.set(mode ? this.step - this.stepSize : this.step + this.stepSize); + event.stop(); + }, + + draggedKnob: function(){ + var dir = this.range < 0 ? -1 : 1; + var position = this.drag.value.now[this.axis]; + position = position.limit(-this.options.offset, this.full -this.options.offset); + this.step = Math.round(this.min + dir * this.toStep(position)); + this.checkStep(); + }, + + checkStep: function(){ + if (this.previousChange != this.step){ + this.previousChange = this.step; + this.fireEvent('change', this.step); + } + }, + + end: function(){ + if (this.previousEnd !== this.step){ + this.previousEnd = this.step; + this.fireEvent('complete', this.step + ''); + } + }, + + toStep: function(position){ + var step = (position + this.options.offset) * this.stepSize / this.full * this.steps; + return this.options.steps ? Math.round(step -= step % this.stepSize) : step; + }, + + toPosition: function(step){ + return (this.full * Math.abs(this.min - step)) / (this.steps * this.stepSize) - this.options.offset; + } + +}); + +/* +Script: Scroller.js + Class which scrolls the contents of any Element (including the window) when the mouse reaches the Element's boundaries. + +License: + MIT-style license. +*/ + +var Scroller = new Class({ + + Implements: [Events, Options], + + options: { + area: 20, + velocity: 1, + onChange: function(x, y){ + this.element.scrollTo(x, y); + } + }, + + initialize: function(element, options){ + this.setOptions(options); + this.element = $(element); + this.listener = ($type(this.element) != 'element') ? $(this.element.getDocument().body) : this.element; + this.timer = null; + this.coord = this.getCoords.bind(this); + }, + + start: function(){ + this.listener.addEvent('mousemove', this.coord); + }, + + stop: function(){ + this.listener.removeEvent('mousemove', this.coord); + this.timer = $clear(this.timer); + }, + + getCoords: function(event){ + this.page = (this.listener.get('tag') == 'body') ? event.client : event.page; + if (!this.timer) this.timer = this.scroll.periodical(50, this); + }, + + scroll: function(){ + var size = this.element.getSize(), scroll = this.element.getScroll(), pos = this.element.getPosition(), change = {'x': 0, 'y': 0}; + for (var z in this.page){ + if (this.page[z] < (this.options.area + pos[z]) && scroll[z] != 0) + change[z] = (this.page[z] - this.options.area - pos[z]) * this.options.velocity; + else if (this.page[z] + this.options.area > (size[z] + pos[z]) && size[z] + size[z] != scroll[z]) + change[z] = (this.page[z] - size[z] + this.options.area - pos[z]) * this.options.velocity; + } + if (change.y || change.x) this.fireEvent('change', [scroll.x + change.x, scroll.y + change.y]); + } + +}); + +/* +Script: Accordion.js + An Fx.Elements extension which allows you to easily create accordion type controls. + +License: + MIT-style license. +*/ + +var Accordion = new Class({ + + Extends: Fx.Elements, + + options: {/* + onActive: $empty, + onBackground: $empty,*/ + display: 0, + show: false, + height: true, + width: false, + opacity: true, + fixedHeight: false, + fixedWidth: false, + wait: false, + alwaysHide: false + }, + + initialize: function(){ + var params = Array.link(arguments, {'container': Element.type, 'options': Object.type, 'togglers': $defined, 'elements': $defined}); + this.parent(params.elements, params.options); + this.togglers = $$(params.togglers); + this.container = $(params.container); + this.previous = -1; + if (this.options.alwaysHide) this.options.wait = true; + if ($chk(this.options.show)){ + this.options.display = false; + this.previous = this.options.show; + } + if (this.options.start){ + this.options.display = false; + this.options.show = false; + } + this.effects = {}; + if (this.options.opacity) this.effects.opacity = 'fullOpacity'; + if (this.options.width) this.effects.width = this.options.fixedWidth ? 'fullWidth' : 'offsetWidth'; + if (this.options.height) this.effects.height = this.options.fixedHeight ? 'fullHeight' : 'scrollHeight'; + for (var i = 0, l = this.togglers.length; i < l; i++) this.addSection(this.togglers[i], this.elements[i]); + this.elements.each(function(el, i){ + if (this.options.show === i){ + this.fireEvent('active', [this.togglers[i], el]); + } else { + for (var fx in this.effects) el.setStyle(fx, 0); + } + }, this); + if ($chk(this.options.display)) this.display(this.options.display); + }, + + addSection: function(toggler, element, pos){ + toggler = $(toggler); + element = $(element); + var test = this.togglers.contains(toggler); + var len = this.togglers.length; + this.togglers.include(toggler); + this.elements.include(element); + if (len && (!test || pos)){ + pos = $pick(pos, len - 1); + toggler.inject(this.togglers[pos], 'before'); + element.inject(toggler, 'after'); + } else if (this.container && !test){ + toggler.inject(this.container); + element.inject(this.container); + } + var idx = this.togglers.indexOf(toggler); + toggler.addEvent('click', this.display.bind(this, idx)); + if (this.options.height) element.setStyles({'padding-top': 0, 'border-top': 'none', 'padding-bottom': 0, 'border-bottom': 'none'}); + if (this.options.width) element.setStyles({'padding-left': 0, 'border-left': 'none', 'padding-right': 0, 'border-right': 'none'}); + element.fullOpacity = 1; + if (this.options.fixedWidth) element.fullWidth = this.options.fixedWidth; + if (this.options.fixedHeight) element.fullHeight = this.options.fixedHeight; + element.setStyle('overflow', 'hidden'); + if (!test){ + for (var fx in this.effects) element.setStyle(fx, 0); + } + return this; + }, + + display: function(index){ + index = ($type(index) == 'element') ? this.elements.indexOf(index) : index; + if ((this.timer && this.options.wait) || (index === this.previous && !this.options.alwaysHide)) return this; + this.previous = index; + var obj = {}; + this.elements.each(function(el, i){ + obj[i] = {}; + var hide = (i != index) || (this.options.alwaysHide && (el.offsetHeight > 0)); + this.fireEvent(hide ? 'background' : 'active', [this.togglers[i], el]); + for (var fx in this.effects) obj[i][fx] = hide ? 0 : el[this.effects[fx]]; + }, this); + return this.start(obj); + } + +}); diff --git a/include/ECM/EcmDeleteDocument/EcmDeleteDocument.js b/include/ECM/EcmDeleteDocument/EcmDeleteDocument.js new file mode 100755 index 00000000..6112bd48 --- /dev/null +++ b/include/ECM/EcmDeleteDocument/EcmDeleteDocument.js @@ -0,0 +1,70 @@ +var deleteDocumentAjax = function(container) { + + var params = new Array; + var r = confirm('Czy na pewno chcesz usunąć ten dokument?'); + if (r == true) { + params[0] = $("#form :input[name='module']").val(); + params[1] = $("input[name='record']").val(); + jQuery.ajax({ + type : 'POST', + url : 'index.php?entryPoint=HandleEcmAjax', + data : { + ecmclass : 'EcmDeleteDocument', + job : 'deleteDocument', + params : utf8_to_b64(JSON.stringifyNoSecurity(params)), + }, + dataType : 'json', + async : false, + success : function(response) { + if(response==1){ + $('#sendreturn').html('Usunięte!'); + $('#sendreturn').show(); + window.location = 'index.php?module='+params[0]+'&action=ListView'; + } else { + $('#sendreturn').html('Błąd'); + $('#sendreturn').show(); + } + return; + }, + error : function(xhr, ajaxOptions, thrownError) { + console.log(thrownError); + } + }); + } + // $('#div_send').hide(); +} +var cancelDocumentAjax = function(container) { + + var params = new Array; + var r = confirm('Czy na pewno chcesz anulować ten dokument?'); + if (r == true) { + params[0] = $("#form :input[name='module']").val(); + params[1] = $("input[name='record']").val(); + jQuery.ajax({ + type : 'POST', + url : 'index.php?entryPoint=HandleEcmAjax', + data : { + ecmclass : 'EcmDeleteDocument', + job : 'cancelDocument', + params : utf8_to_b64(JSON.stringifyNoSecurity(params)), + }, + dataType : 'json', + async : false, + success : function(response) { + if(response==1){ + $('#sendreturn').html('Anulowane!'); + $('#sendreturn').show(); + window.location = 'index.php?module='+params[0]+'&action=ListView'; + } else { + $('#sendreturn').html('Błąd'); + $('#sendreturn').show(); + } + return; + }, + error : function(xhr, ajaxOptions, thrownError) { + console.log(thrownError); + } + }); + } + // $('#div_send').hide(); +} \ No newline at end of file diff --git a/include/ECM/EcmDocumentNumberGenerator/EcmDocumentNumberGenerator.js b/include/ECM/EcmDocumentNumberGenerator/EcmDocumentNumberGenerator.js new file mode 100755 index 00000000..154f26a3 --- /dev/null +++ b/include/ECM/EcmDocumentNumberGenerator/EcmDocumentNumberGenerator.js @@ -0,0 +1,124 @@ +var EcmDocumentNumberGenerator_getNumberTemplate = function(field_name, module) { + var params = new Array; + params[0] = module; + console.log('t'); + // AJAX call + jQuery.ajax({ + type : 'POST', + url : 'index.php?entryPoint=HandleEcmAjax', + data : { + ecmclass : 'EcmDocumentNumberGenerator', + job : 'getNumberTemplate', + params : utf8_to_b64(JSON.stringifyNoSecurity(params)), + }, + dataType : 'json', + async : false, + success : function(response) { + $('#'+field_name).val(response); + if (response == "") { + $('#'+field_name).attr('readonly', false); + } else { + $('#'+field_name).attr('readonly', 'readonly'); + $('#'+field_name).css('background-color', '#888888'); + } + return; + }, + error : function(xhr, ajaxOptions, thrownError) { + console.log(thrownError); + } + }); +} + +var EcmDocumentNumberGenerator_getNormalNumber = function(field_name, module, stock_id) { + + var params = new Array; + params[0] = module; + params[1] = stock_id; + + // AJAX call + jQuery.ajax({ + type : 'POST', + url : 'index.php?entryPoint=HandleEcmAjax', + data : { + ecmclass : 'EcmDocumentNumberGenerator', + job : 'getNormalNumber', + params : utf8_to_b64(JSON.stringifyNoSecurity(params)), + }, + dataType : 'json', + async : false, + success : function(response) { + $('#'+field_name).val(response); + return; + }, + error : function(xhr, ajaxOptions, thrownError) { + console.log(thrownError); + } + }); +} + +var EcmDocumentNumberGenerator_getCorrectNumber = function(field_name, module, stock_id) { + + var params = new Array; + params[0] = module; + params[1] = stock_id; + + // AJAX call + jQuery.ajax({ + type : 'POST', + url : 'index.php?entryPoint=HandleEcmAjax', + data : { + ecmclass : 'EcmDocumentNumberGenerator', + job : 'getCorrectNumber', + params : utf8_to_b64(JSON.stringifyNoSecurity(params)), + }, + dataType : 'json', + async : false, + success : function(response) { + $('#'+field_name).val(response); + return; + }, + error : function(xhr, ajaxOptions, thrownError) { + console.log(thrownError); + } + }); +} + +var EcmDocumentNumberGenerator_getNumber = function(field_name, module, stock_id) { + + var params = new Array; + params[0] = module; + params[1] = stock_id; + + // AJAX call + jQuery.ajax({ + type : 'POST', + url : 'index.php?entryPoint=HandleEcmAjax', + data : { + ecmclass : 'EcmDocumentNumberGenerator', + job : 'getNumber', + params : utf8_to_b64(JSON.stringifyNoSecurity(params)), + }, + dataType : 'json', + async : false, + success : function(response) { + $('#'+field_name).val(response); + return; + }, + error : function(xhr, ajaxOptions, thrownError) { + console.log(thrownError); + } + }); +} + +function utf8_to_b64( str ) { + return window.btoa(unescape(encodeURIComponent( str ))); +} + +function b64_to_utf8( str ) { + return decodeURIComponent(escape(window.atob( str ))); +} + + +var cl = function(m) { + console.log(m); +} \ No newline at end of file diff --git a/include/ECM/EcmDropdownEditor/EcmDropdownEditor.js b/include/ECM/EcmDropdownEditor/EcmDropdownEditor.js new file mode 100755 index 00000000..d6a7f516 --- /dev/null +++ b/include/ECM/EcmDropdownEditor/EcmDropdownEditor.js @@ -0,0 +1,205 @@ +var EcmDropdownEditor_show = function(container) { + + var div = $('[name='+container+']'); + var module = $('form[name=EditView]').find('input[name=module]').val(); + + var params = new Array; + params[0] = module; + params[1] = container; + + // AJAX call + jQuery.ajax({ + type : 'POST', + url : 'index.php?entryPoint=HandleEcmAjax', + data : { + ecmclass : 'EcmDropdownEditor', + job : 'getEditView', + params : utf8_to_b64(JSON.stringifyNoSecurity(params)), + }, + dataType : 'json', + async : false, + success : function(response) { + div.html(response[0]); + div.show(); + return; + }, + error : function(xhr, ajaxOptions, thrownError) { + console.log(thrownError); + } + }); + + div.show(); +} + +var EcmDropdownEditor_addOption = function(key) { + // AJAX call + jQuery.ajax({ + type : 'POST', + url : 'index.php?entryPoint=HandleEcmAjax', + data : { + ecmclass : 'EcmDropdownEditor', + job : 'getOptionTemplate', + }, + dataType : 'json', + async : false, + success : function(response) { + var optDiv = jQuery.parseHTML(response[0]); + jQuery(response[0]).insertBefore( + jQuery('[name=' + key + ']').find('span')); + return; + }, + error : function(xhr, ajaxOptions, thrownError) { + console.log(thrownError); + } + }); +} + +var EcmDropdownEditor_save = function(dom, container) { + if (!EcmDropdownEditor_validate(dom)) { + return false; + } + var doms = EcmDropdownEditor_parseArrays(dom); + var params = new Array; + params[0] = dom; //name of list + params[1] = doms;//list of values + // AJAX call + jQuery.ajax({ + type : 'POST', + url : 'index.php?entryPoint=HandleEcmAjax', + data : { + ecmclass : 'EcmDropdownEditor', + job : 'saveDom', + params : utf8_to_b64(JSON.stringifyNoSecurity(params)), + }, + dataType : 'json', + async : false, + success : function(response) { + var div = $('[name='+container+']'); + div.hide(); + EcmDropdownEditor_refreshField(container); + return; + }, + error : function(xhr, ajaxOptions, thrownError) { + console.log(thrownError); + } + }); +} + +var EcmDropdownEditor_refreshField = function(container) { + + var module = $('form[name=EditView]').find('input[name=module]').val(); + + var params = new Array; + params[0] = module;//list of values + params[1] = container;//list of values + // AJAX call + jQuery.ajax({ + type : 'POST', + url : 'index.php?entryPoint=HandleEcmAjax', + data : { + ecmclass : 'EcmDropdownEditor', + job : 'refreshField', + params : utf8_to_b64(JSON.stringifyNoSecurity(params)), + }, + dataType : 'json', + async : false, + success : function(response) { + var tmp = container.split("___"); + $('form[name=EditView]').find('select[name='+tmp[0]+']').html(response[0]); + return; + }, + error : function(xhr, ajaxOptions, thrownError) { + console.log(thrownError); + } + }); +} + +var EcmDropdownEditor_cancel = function(container) { + var div = $('[name='+container+']'); + div.html(''); + div.hide(); +} + +var EcmDropdownEditor_parseArrays = function(dom) { + var normal = {}; + var options = jQuery('[name=' + dom + ']').children('div'); + jQuery.each(options, function(key, val) { + //check normal inputs + var optionKey = jQuery(val).attr('name'); + console.log(val); + var values = jQuery(val).children('input:not([name$=ext])'); + jQuery.each(values, function(key2, val2) { + name = jQuery(val2).attr('name'); + if (!normal[name]) + normal[name] = {}; + normal[name][optionKey] = jQuery(val2).val(); + }); + }); + return normal; +} + +var EcmDropdownEditor_validate = function(dom) { + var error = false; + // get all options in DIV name = dom + var options = jQuery('[name=' + dom + ']').children('div'); + // loop throw options looking for errors + jQuery.each(options, function(key, val) { + // check empty options + var empty = true; + var values = jQuery(val).children('input'); + jQuery.each(values, function(key2, val2) { + valInput = jQuery(val2).val(); + valInput = valInput.trim(); + if (valInput.length != 0) + empty = false; + }); + if (empty) + jQuery(val).remove(); // delete empty option + values = null; + //check normal inputs + values = jQuery(val).children('input:not([name$=ext])'); + jQuery.each(values, function(key2, val2) { + valInput = jQuery(val2).val(); + valInput = valInput.trim(); + if (valInput.length == 0) { + jQuery(val2).addClass('dropdowneditor_error'); + error = true; + } else + jQuery(val2).removeClass('dropdowneditor_error'); + }); + }); + if (error) { + return false; + } + return true; +} + +var EcmDropdownEditor_moveElementUp = function(el) { + var parent = jQuery(el).parent(); + var prev = parent.prev(); + if (prev.length == 0) + return; + parent.insertBefore(prev); +} + +var EcmDropdownEditor_moveElementDown = function(el) { + var parent = jQuery(el).parent(); + var next = parent.next(); + if (next.length == 0) + return; + parent.insertAfter(next); +} + +//helper +function utf8_to_b64( str ) { + return window.btoa(unescape(encodeURIComponent( str ))); +} + +function b64_to_utf8( str ) { + return decodeURIComponent(escape(window.atob( str ))); +} + + +var cl = function(m) { + console.log(m); +} \ No newline at end of file diff --git a/include/ECM/EcmMultiPdf/EcmMultiPdf.js b/include/ECM/EcmMultiPdf/EcmMultiPdf.js new file mode 100755 index 00000000..f7079840 --- /dev/null +++ b/include/ECM/EcmMultiPdf/EcmMultiPdf.js @@ -0,0 +1,32 @@ +var EcmMultiPdf_create = function(documents, outputName) { + // fill params + var params = new Array(); + params[0] = documents; + + if (!(typeof outputName === 'undefined')) { + if ((outputName.toUpperCase().substring((outputName.length) - 4, + outputName.length)) != '.PDF') + outputName += '.pdf'; + params[2] = outputName; + } + + + // AJAX call + jQuery.ajax({ + type : 'POST', + url : 'index.php?entryPoint=HandleEcmAjax', + data : { + ecmclass : 'EcmMultiPdf', + job : 'create', + params : btoa(JSON.stringify(params)), + }, + dataType : 'json', + success : function(response) { + $.unblockUI(); + if (Number.isInteger(response[0])) + alert('ERROR '+response[0]); + else + window.open(response[0]); + }, + }); +} \ No newline at end of file diff --git a/include/ECM/EcmNotifications/EcmNotifications.js b/include/ECM/EcmNotifications/EcmNotifications.js new file mode 100755 index 00000000..0e9f0565 --- /dev/null +++ b/include/ECM/EcmNotifications/EcmNotifications.js @@ -0,0 +1,295 @@ +// where our WebSockets logic will go later +var socket, host; +var notification_count = 0; +var notification_array=new Array(); +var ajaxnotifications_url = "index.php?module=Schedulers&action=EcmNotificationAjax&to_pdf=1"; +var audiotypes = { + "mp3" : "audio/mpeg", + "mp4" : "audio/mp4", + "ogg" : "audio/ogg", + "wav" : "audio/wav" +} + +function ss_soundbits(sound) { + var audio_element = document.createElement('audio') + if (audio_element.canPlayType) { + for (var i = 0; i < arguments.length; i++) { + var source_element = document.createElement('source') + source_element.setAttribute('src', arguments[i]) + if (arguments[i].match(/\.(\w+)$/i)) + source_element.setAttribute('type', audiotypes[RegExp.$1]) + audio_element.appendChild(source_element) + } + audio_element.load() + audio_element.playclip = function() { + audio_element.pause() + audio_element.currentTime = 0 + audio_element.play() + } + return audio_element + } +} +var clicksound = ss_soundbits( + 'include/ECM/EcmNotifications/sounds/bell_ring.ogg', + "include/ECM/EcmNotifications/sounds/bell_ring.mp3") +host = "wss://system.saas-systems.pl:444"; +function connect() { + try { + socket = new WebSocket(host); + + addMessage("Socket State: " + socket.readyState); + + socket.onopen = function() { + addMessage("Socket Status: " + socket.readyState + " (open)"); + } + + socket.onclose = function() { + socket.close(); + } + + socket.onmessage = function(msg) { + + DrawMessage(msg.data); + } + } catch (exception) { + addMessage("Error: " + exception); + } +} + +function addMessage(msg) { + $("#chat-log").append("

" + msg + "

"); +} + + + +function DrawNotificationDiv(){ + var html=''; + + var toggle="if($('#notification_list').css('display')=='none'){$('#notification_list').show();}else{$('#notification_list').hide();}"; + if(notification_array.length>1){ + html='Masz '+notification_array.length+' nowe przypomnienia!'; + } + if(notification_array.length==0){ + html='

Brak nowych przypomnień.

'; + } + if(notification_array.length==1) { + html='Masz 1 nowe przypomnienie!'; + } + var div_header=''; + $("#notification-Div").html(html+div_header); + + +} + +function makeid() +{ + var text = ""; + var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; + + for( var i=0; i < 5; i++ ) + text += possible.charAt(Math.floor(Math.random() * possible.length)); + + return text; +} + +function leaveSelect(id){ + var html=''; + return html; +} + +function dialogContent(obj,id){ + if(obj.date_start === null){ + obj.date_start='brak'; + } + var toggle="if($('#leave_"+obj.id+"').css('display')=='none'){$('#leave_"+obj.id+"').show();}else{$('#leave_"+obj.id+"').hide();}"; + var html=''; + html+=''; + html+='
Temat:'+obj.name+'
Data rozpoczęcia:'+obj.date_start.substr(0,16)+'
Opis:'+obj.description+'
'; + html+='
'; + html+=''; + return html; +} + +function saveNotification(id,index){ + var params = { + job : 'changeNotificationDate', + id : id, + flag : $('#leaveSel_'+id+' :selected').val(), + }; + $.ajax({ + type : "POST", + url : ajaxnotifications_url, + dataType : "json", + success : function(data) { + if (data != '-1') + + $( "#dialog_"+id ).dialog( "close" ); + + notification_array.splice(index, 1); + send(id); + DrawNotificationDiv(); + }, + data : params + }); +} +function showLeavedNotifications(data){ + for( var i=0; i < data.length; i++ ){ + createDialog(data[i]); + } +} + +function getLeaveadNotifications(){ + + var params = { + job : 'getLeaveadNotifications', + user_id : $('#current_user_id').val(), + }; + $.ajax({ + type : "POST", + url : ajaxnotifications_url, + dataType : "json", + success : function(data) { + if (data != '-1'){ + notification_array=data; + DrawNotificationDiv(); + } + }, + data : params + }); +} + +function createDialog(obj){ + var id=obj; + var obj=notification_array[obj]; + var div_id=makeid(); + + $( "#notification-Dialog" ).html('
'); + $( "#dialog_"+obj.id).html(dialogContent(obj,id)); + $( "#dialog_"+obj.id).dialog({ + title: "Nowe przypomnienie o: "+obj.name.substr(0,15)+'...', + open: function() { // open event handler + $(this) // the element being dialogged + .parent() // get the dialog widget element + .find(".ui-dialog-titlebar-close") // find the close button for this dialog + .hide(); // hide it + }, + modal: true, + buttons: { + 'Przyjąłem': function() { + $( this ).dialog( "close" ); + }, + }, + beforeClose: function( event, ui ) { + var params = { + job : 'updateNotificationStatus', + id : obj.id, + flag : '2', + }; + $.ajax({ + type : "POST", + url : ajaxnotifications_url, + dataType : "json", + success : function(data) { + if (data != '-1') + console.log(data); + notification_array.splice(id, 1); + send(obj.id); + DrawNotificationDiv(); + }, + data : params + }); + } + }); + +} +function srt(desc) { + return function(a,b){ + return desc ? ~~(a < b) : ~~(a > b); + }; + } + +function checkExist(id){ + for(i=0;i= 0) { + var tab = X.split('.'); + if (tab[1].length >= (precyzja + 1)) { + if (parseInt(tab[1][precyzja]) < 5) { + tab[1] = tab[1].slice(0, precyzja); + } else { + tab[1] = tab[1].slice(0, precyzja); + var tmp = parseInt(tab[1]); + tmp = tmp + 1; + tab[1] = String(tmp); + if (tab[1].length > precyzja) { + tmp = ''; + while (tmp.length < precyzja) { + tmp += '0'; + } + tab[1] = tmp; + tmp = parseInt(tab[0]); + tmp = tmp + 1; + tab[0] = String(tmp); + } + + if (tab[1].length < precyzja) { + tmp = ''; + while (tmp.length < precyzja - 1) { + tmp += '0'; + } + tab[1] = String(tmp) + String(tab[1]); + } + } + } + wynik = parseFloat(tab[0] + '.' + tab[1]).toFixed(precyzja); + } else { + wynik = parseFloat(X).toFixed(precyzja); + } + + return wynik; + } + + +/* + this is not number function !!@#$%^ +*/ +function checkIsTheSameContractor(){ + var error=false; + var val=''; + $("input:checkbox[name='mass[]']:checked").each(function() { + + if(val==''){ + + val=$("#mass_"+$(this).val()).val(); + if($("#mass_inv_"+$(this).val()).val()!=''){ + error=true; + } + } else { + if( $("#mass_"+$(this).val()).val()!=val){ + error=true; + } + val=$("#mass_"+$(this).val()).val(); + if($("#mass_inv_"+$(this).val()).val()!=''){ + error=true; + } + } + + }); + return error; + +} + +function gotoInvoice(){ + var error=false; + var val=''; + var ids=new Array(); + $("input:checkbox[name='mass[]']:checked").each(function() { + $(this).val(); + ids.push( $(this).val()); + + }); + + window.open("index.php?module=EcmInvoiceOuts&action=EditView&isWZ=true&record="+ids.join('@')); +} \ No newline at end of file diff --git a/include/ECM/EcmPreviewPDF/EcmPreviewPDF.js b/include/ECM/EcmPreviewPDF/EcmPreviewPDF.js new file mode 100755 index 00000000..70240447 --- /dev/null +++ b/include/ECM/EcmPreviewPDF/EcmPreviewPDF.js @@ -0,0 +1,82 @@ +// JavaScript Document + +var pDivName = 'PreviewPDF_div'; +function EcmPreviewPDF(link,options) { + if(typeof(options)!="object") options = new Object(); + if(!options.zoom) options.zoom = 100; + if(!options.toolbar) options.toolbar = 0; + + var div = document.getElementById(pDivName); + if(!div) { + div = document.createElement('div'); + div_tmp = ''; + div.innerHTML = div_tmp; + div = div.firstChild; + document.body.appendChild(div); + } + if(div) { + DisplayOther(false); + div.style.display = ''; + var div_pdf = document.getElementById('PreviewPDF_div_pdf'); + var h_pdf = (div.offsetHeight-div.firstChild.offsetHeight); + if(div_pdf) { + div_pdf.innerHTML = ""; + } + } +} + +function HidePDF() { + var div = document.getElementById(pDivName); + if(div) { + DisplayOther(true); + div.style.display = 'none'; + } +} + +function HidePDFIframe() { + var div = parent.document.getElementById(pDivName); + if(div) { + DisplayOtherIframe(true); + div.style.display = 'none'; + } +} + + +function DisplayOther(disp) { + if(disp) display = ''; else display = 'none'; + for(var i = 0; i < document.body.childNodes.length; i++) { + var node = document.body.childNodes[i]; + if(node && node.style) { + if(disp) { + if(node.setOldDisplay_pdf) { + node.style.display = node.oldDisplay_pdf; + node.setOldDisplay_pdf = false; + } + } else { + node.oldDisplay_pdf = node.style.display; + node.setOldDisplay_pdf = true; + node.style.display = display; + } + } + } +} +function DisplayOtherIframe(disp) { + if(disp) display = ''; else display = 'none'; + for(var i = 0; i < parent.document.body.childNodes.length; i++) { + var node = parent.document.body.childNodes[i]; + if(node && node.style) { + if(disp) { + if(node.setOldDisplay_pdf) { + node.style.display = node.oldDisplay_pdf; + node.setOldDisplay_pdf = false; + } + } else { + node.oldDisplay_pdf = node.style.display; + node.setOldDisplay_pdf = true; + node.style.display = display; + } + } + } +} +function HideMenu(){ +} diff --git a/include/ECM/EcmSendPdfButton/EcmSendPdfButton.js b/include/ECM/EcmSendPdfButton/EcmSendPdfButton.js new file mode 100755 index 00000000..9be5a811 --- /dev/null +++ b/include/ECM/EcmSendPdfButton/EcmSendPdfButton.js @@ -0,0 +1,82 @@ +$(document).ready(function() { + $('#addr_email').scombobox({ + fullMatch : false, + invalidAsValue: true + // when fullMatch is true + // then highligh is also true by default + }); + $('#addr_email').css('width','250px'); + $('.scombobox-display').css('width','250px'); + +}); + +var sendMailAjax = function(pdf_opt) { + + var params = new Array; + params[0] = $("#form :input[name='module']").val(); + params[1] = $("input[name='record']").val(); + params[2] = $(".scombobox-display").val(); + params[3] = $("#textarea").val(); + params[4] = pdf_opt; + $(".loading_panel").css("display", "block"); + + jQuery.ajax({ + type : 'POST', + url : 'index.php?entryPoint=HandleEcmAjax', + data : { + ecmclass : 'EcmSendPdfButton', + job : 'sendEmailAjaxWithDocument', + params : utf8_to_b64(JSON.stringifyNoSecurity(params)), + }, + dataType : 'json', + async : false, + success : function(response) { + console.log(response); + if(response==1){ + $('#sendreturn').html('Wiadomość email została wysłana!'); + $('#sendreturn').show(); + } else { + $('#sendreturn').html('

Wiadomość email NIE została wysłana!

'); + $('#sendreturn').show(); + } + return; + }, + error : function(xhr, ajaxOptions, thrownError) { + console.log(thrownError); + } + }); + $(".loading_panel").css("display", "none"); + $('#div_send').hide(); +} +/* +function sendMailAjax() { + var ajax_url = "index.php?module=EcmSales&action=javahelper&to_pdf=1"; + $(".loading_panel").css("display", "block"); + var params = { + job : 'SendMail', + id : id, + modulee : modulee, + parent_id : parent_id, + }; + $ + .ajax({ + type : "POST", + url : ajax_url, + dataType : "json", + async : false, + success : function(data) { + if (data != '-1') { + + $("#sendreturn").text( + 'Email z dokumentem został wysłany!'); + $("#sendreturn").show(); + } else { + $("#sendreturn").text( + 'Email z dokumentem nie został wysłany!'); + $("#sendreturn").show(); + } + }, + data : params + }); + $(".loading_panel").css("display", "none"); +}*/ \ No newline at end of file diff --git a/include/ECM/SearchProductTable.js b/include/ECM/SearchProductTable.js new file mode 100644 index 00000000..45f74489 --- /dev/null +++ b/include/ECM/SearchProductTable.js @@ -0,0 +1,1118 @@ +var ajaxsearch_url = 'index.php?module=EcmProducts&action=javahelper&to_pdf=1'; +var dialog; +var form; +var currentPart=0; +var group_ks_search = ''; +function htmlEscape(str) { + return String(str) + .replace(/&/g, '&') + .replace(/"/g, '"') + .replace(/'/g, ''') + .replace(//g, '>'); +} +function showdialog() { + + $('#searchResultDiv').html(''); + $(".loading_panel").css("display", "block"); + var url = 'index.php?module=EcmProducts&action=QuickCreate2'; + $('#searchResultDiv'). + append(''); + + var iframe = $('#frameid'); + iframe.attr('src', url); + + iframe.load(function () { + $(".loading_panel").css("display", "none"); + callback(this, iframe); + + }); +} + + +function callback(frame, frame2) { + + $('#frameid').contents().bind({ + submit: function () { + $(".loading_panel").css("display", "block"); + frame2.load(function () { + AddProduct(searchEmpty(), $('#frameid').contents().find("#return_product_id").val()); + $('#searchResultDiv').html(''); + $(".loading_panel").css("display", "none"); + }); + } + + }); + +} + +function replaceAll(str, find, replace) { + return str.replace(new RegExp(find, 'g'), replace); + } +function replaceCharters(text){ + var res = replaceAll(text,'"', """); + var res = replaceAll(res,"'", "'"); + + return res; +} + +function FillTable(data, allReadOnly) { + html = ''; + // loop throw data rows + var pozycja = 1; + var color; + $.each( + data, + function (row_index, row) { + html += ''; + if (row.product_corrected == "false") { + color = '#D4D9DB'; + } else { + color = '#ffffff'; + } + // and insert columns + $.each( + columns, + function (col_index, column) { + // row must have code and name + if (!row.product_code + || row.product_code == '' + || !row.name + || row.name == '') + return; // return in each = + // continue in php for + // loop + // special types + if (column.name == 'number') { + html += '
'; + } else if (column.name == 'options') { + if (allReadOnly) + html += ''; + else { + html += ''; + // move up + html += ''; + html += ' '; + // move down + html += ''; + html += '
'; + // delete row + html += ''; + html += ''; + } + } + // other types + else { + if (column.hide == 'yes') + hide = ' style="display: none;background-color:' + + color + ';"'; + else + hide = 'style="background-color:' + + color + ';"'; + html += ''; + $ + .each( + column.content, + function ( + cell_index, + cell) { + var cellname = column.name + + cell.name; + + if (cellname == 'product_link') { + html += '' + + row.product_code + + '
'; + } else if (cellname == 'price_purchase') { + html += ''; + if(row.product_category_id=='bf900339-6c7b-f278-2737-542023796730' || row.product_ks_group=='3'){ + html += ' '; + html += ' '; + } + + }else if (cellname == 'price_start_div' + && !allReadOnly) { + html += '
'; + html += ''; + }else if (cellname == 'unit_div' + && !allReadOnly) { + html += '
'; + html += ''; + }else if (cellname == 'ecmvat_div' + && !allReadOnly) { + html += '
'; + html += ''; + } else if (cellname == 'quantity') { + + if (cell.label + && cell.label != '') + html += '

' + + cell.label + + '

'; + html += '

'; + } + }else if (cellname == 'stock_state') { + + if (cell.label + && cell.label != '') + html += '

' + + cell.label + + '

'; + html += '

'; + } + } else { + + if (cell.label + && cell.label != '') + html += '

' + + cell.label + + '

'; + html += ' tbody').html(html); + + if (!allReadOnly || allReadOnly == 'y') { + + if (module_function == 'EcmSales' + || module_function == 'EcmInvoiceOuts' + || module_function == 'EcmReceipts' + || module_function == 'EcmPurchaseOrders' + || module_function == 'EcmQuotes' || module_function == 'EcmStockDocIns' || module_function == 'EcmStockDocOuts') { + // calculate totals + var count = $('#' + itemsTable + '_T tr').length - 1; // -1 - + // thead + // row + for (var index = 0; index != count; index++) + calculateRow(index); + } + if (module_function == 'EcmStockDocOuts' + || module_function == 'EcmStockDocInsideOuts') { + + checkProducts(); + } + $('#itemsTable_T').enableCellNavigation(); + } else + DrawDetailSummary(); +} + +function changeName(index) { + console.log(index); + items[index].name = $('#name_' + index).val(); +} + +function SearchSingleProduct(index) { + /* + * var searchKey = $('#name_'+index).val(); if (searchKey.length < 6 && + * searchKey != '%') { $('#search_auto_id_'+index).hide(); } else { + * + * + * setTimeout(function() { if (searchKey == $('#name_'+index).val()) { var + * params = { job : 'searchProductsAutocomplite', searchKey : searchKey, + * searchStock : $("#productSearchStock :selected").val(), searchStockId : + * $("#stock_id").val(), index: index, }; + * + * $.ajax({ type : "POST", url : ajaxsearch_url, dataType : "json", async : + * false, success : function(data) { if (data != '-1'){ + * $('#search_auto_id_'+index).html(''); var content=''; $.each(data, + * function( index, value ) { + * + * content+='
  • '+value.name+'
  • '; }); + * $('#search_auto_id_'+index).append(content); + * $('#search_auto_id_'+index).show(); } }, data : params }); } }, 1000); } + */ + // prevent html escape + $["ui"]["autocomplete"].prototype["_renderItem"] = function (ul, item) { + return $("
  • ").data("item.autocomplete", item).append( + $("").html(item.label)).appendTo(ul); + }; + // prevent html escape end + if ($("#product_id_" + index).val() == '') { + $("#name_" + index) + .autocomplete( + { + source: function (request, response) { + $ + .ajax({ + type: "POST", + url: "index.php?module=EcmProducts&action=javahelper&to_pdf=1", + dataType: "json", + async: false, + data: { + job: "searchProductsAutocomplite", + term: request.term, + searchStock: $( + "#productSearchStock :selected") + .val(), + searchStockId: $("#stock_id") + .val(), + index: index + }, + success: function (data) { + response(data); + } + }); + }, + minLength: 6, + select: function (event, ui) { + var url = ui.item.id; + if (url != '') { + AddProduct(index, ui.item.id); + } + }, + html: false, + open: function (event, ui) { + $(".ui-autocomplete").css("z-index", 1000); + } + }); + } +} + +function set_item(item, index) { + // change input value + $('#name_' + index).text(item); + // hide proposition list + $('#search_auto_id_' + index).hide(); +} + +function AddSearchRecord() { + var p = new Object(); + p.product_id = ''; + p.name = 'Wpisz tu nazwę lub indeks produktu aby wyszukać'; + p.product_code = ' '; + p.product_id = ''; + p.ecmvat_id = ''; + p.ecmvat_value = ''; + p.ecmvat_name = ''; + p.product_ean = ''; + p.discount = ''; + p.product_ean2 = ''; + p.unit_name = ''; + p.unit_id = ''; + p.price_start = ''; + p.recipient_code = ''; + items.push(p); + FillTable(items, false); +} + +function deleteRow(index) { + items.splice(index, 1); + FillTable(items); +} + +function moveUpRow(index) { + if (index == 0) + return; // Can't go upper.. :( + var new_index = index - 1; + var old_index = index; + if (new_index >= items.length) { + var k = new_index - items.length; + while ((k--) + 1) { + items.push(undefined); + } + } + items.splice(new_index, 0, items.splice(old_index, 1)[0]); + FillTable(items); +} + +function moveDownRow(index) { + if (index == items.length - 1) + return; // Can't go lower.. :( + var new_index = index + 1; + var old_index = index; + if (new_index >= items.length) { + var k = new_index - items.length; + while ((k--) + 1) { + items.push(undefined); + } + } + items.splice(new_index, 0, items.splice(old_index, 1)[0]); + FillTable(items); +} + +function searchProducts() { + var searchKey = $('#searchProductsInput').val(); + if (searchKey.length < 2 && searchKey != '%') { + return; + } + var stockid = module_function == 'EcmStockDocMoves' ? $("#stock_out_id") + .val() : $("#stock_id").val(); + $("#searchResultDiv").html( + ''); + setTimeout(function () { + if (searchKey == $('#searchProductsInput').val()) { + var params = { + job: 'searchProducts', + searchKey: searchKey, + searchCategory: $("#productSearchCategory :selected").val(), + searchStock: $("#productSearchStock :selected").val(), + searchStockId: stockid, + searchSort: $("#searchSort").val(), + searchStart: $("#searchStart").val(), + searchCount: $("#searchCount").val(), + groupKs: group_ks_search, + }; + + $.ajax({ + type: "POST", + url: ajaxsearch_url, + dataType: "json", + success: function (data) { + if (data != '-1') + if (data.length == 0) + $('#searchResultDiv').html( + 'MOD.LBL_SEARCH_NO_RESULT'); + else + createSearchResult(data); + }, + data: params + }); + } + }, 1000); +} +function searchAllProducts() { + var searchKey = '%'; + var stockid = module_function == 'EcmStockDocMoves' ? $("#stock_out_id") + .val() : $("#stock_id").val(); + $("#searchResultDiv").html( + ''); + setTimeout(function () { + + var params = { + job: 'searchProducts', + searchKey: searchKey, + searchCategory: $("#productSearchCategory :selected").val(), + searchStock: $("#productSearchStock :selected").val(), + searchStockId: stockid, + searchSort: $("#searchSort").val(), + }; + + $.ajax({ + type: "POST", + url: ajaxsearch_url, + dataType: "json", + success: function (data) { + if (data != '-1') + if (data.length == 0) + $('#searchResultDiv').html('MOD.LBL_SEARCH_NO_RESULT'); + else + createSearchResult(data); + }, + data: params + }); + + }, 1000); +} + + + +function createPaginationTable(data) { + + // akcja + if (parseInt($("#searchStart").val()) - 50 >= 0) { + var img = 'start.gif'; + var disabled = ''; + var onclick = "$('#searchStart').val(0);searchProducts();"; + } else { + var img = 'start_off.gif'; + var disabled = 'disabled="disabled"'; + var onclick = ''; + } + // guzik + var firstbutton = ''; + + if (parseInt($("#searchStart").val()) - 50 >= 0) { + var img = 'previous.gif'; + var disabled = ''; + var onclick = "$('#searchStart').val(parseInt($('#searchStart').val())-50);searchProducts();"; + } else { + var img = 'previous_off.gif'; + var disabled = 'disabled="disabled"'; + var onclick = ''; + } + + var prev = ''; + + if (parseInt($("#searchStart").val()) + 50 < data.count) { + var img = 'next.gif'; + var disabled = ''; + var onclick = "$('#searchStart').val(parseInt($('#searchStart').val())+50);searchProducts();"; + } else { + var img = 'next_off.gif'; + var disabled = 'disabled="disabled"'; + var onclick = ''; + } + var next = ''; + + if (parseInt($("#searchStart").val()) + 50 < data.count) { + var img = 'end.gif'; + var disabled = ''; + var last = Math.floor(parseInt(data.count) / 50) * 50; + if (last == data.count) + last = last - 50; + var onclick = "$('#searchStart').val(" + last + ");searchProducts();"; + } else { + var img = 'end_off.gif'; + var disabled = 'disabled="disabled"'; + var onclick = ''; + } + + var lastbutton = ''; + + var action = "$('#searchStart').val($('#gotoPage option:selected').val());searchProducts();"; + var select = ''; + + var close = ''; + + var html = ''; + var page = 'Strona ' + current_page + ' z ' + total_pages; + html += '
    Znaleziono ' + + data.count + ' produktów' + + firstbutton + ' ' + prev + ' ' + select + ' ' + next + ' ' + + lastbutton + ' ' + page + ' ' + close + '
    '; + + return html; + +} + +function SelectDeselectChb() { + + if ($(".tf").is(':checked')) { + $(".tf").attr('checked', false); + } else { + $(".tf").prop('checked', 'checked'); + + } +} +function toggleSort(code1, code2) { + if ($("#searchSort").val() == code1) { + $("#searchSort").val(code2); + } else { + $("#searchSort").val(code1); + } + +} +function getSortImages() { + var img = new Object(); + if ($("#searchSort").val() == 1) { + img.indeximg = 'themes/Sugar5/images/arrow_up.gif'; + img.nameimg = 'themes/Sugar5/images/arrow.gif'; + } + if ($("#searchSort").val() == 2) { + img.indeximg = 'themes/Sugar5/images/arrow_down.gif'; + img.nameimg = 'themes/Sugar5/images/arrow.gif'; + } + if ($("#searchSort").val() == 3) { + img.nameimg = 'themes/Sugar5/images/arrow_up.gif'; + img.indeximg = 'themes/Sugar5/images/arrow.gif'; + } + if ($("#searchSort").val() == 4) { + img.nameimg = 'themes/Sugar5/images/arrow_down.gif'; + img.indeximg = 'themes/Sugar5/images/arrow.gif'; + } + return img; +} +function createSearchResult(data, single, index) { + // stronicowanie :)) + var single = single ? single : true; + var index = index ? index : false; + if (data.count > 0) { + var pagination = createPaginationTable(data); + var img = getSortImages(); // strzałki do sortowania + var html = pagination + + ''; + html += ''; + if (number_show == true) + html += ''; + // jeśli wyszukujesz z tabelki blokuje zaznaczanie wielu + if (single != false) { + disabled = ''; + } else { + disabled = 'disabled="disabled"'; + } + html += ''; + + html += ''; + html += ''; + if ($("#productSearchStock :selected").val() != '1') + html += ''; + if (unit_show == true) + html += ''; + if (extraproductinfo_show == true) + html += ''; + html += ''; + // numeracja wyszukiwanych rekordow + var number = parseInt($('#searchStart').val()) + 1; + // czy to podmiana rekodu czy kolejny + if (index == false) { + action = ' return addProducts();'; + } else { + action = ' return replaceProduct(' + index + ');'; + } + var counter; + delete data.count; + $.each( + data, + function (index, value) { + if (counter % 2 == 0) { + html += ''; + } else { + html += ''; + } + if (number_show == true) + html += ''; + html += ''; + html += ''; + html += ''; + if ($("#productSearchStock :selected").val() != '1') + html += ''; + if (unit_show == true) + html += ''; + if (extraproductinfo_show == true) { + html += ''; + } + html += ''; + searchedProducts.push(value.id); + counter++; + number++; + }); + // add button + html += '
    L.p.Indeks Nazwa StanJ.M. 
    ' + + number + '' + + value.code + '' + value.name + '' + + value.stock_state + '' + + value.unit_name + ''; + html += ''; + html += ''; + html += '

    '; + if (module_function != 'EcmStockDocOuts') { + html += 'Cena:  '; + } + html += 'Ilość: '; + if (index == false && single != false) { + html += '

    '; + } else if (index == false && single == false) { + html += '

    '; + } else { + html += '

    '; + } + $('#searchResultDiv').html(html); + if (single == false) + CheckBoxSingleSelectGuard(); + } else { + html = 'Nie znaleziono produktów o szukanej nazwie!
    '; + // add product + // html += ''; + $('#searchResultDiv').html(html); + } + +} + +function CheckBoxSingleSelectGuard() { + $('input[type="checkbox"]').on('change', function () { + $('input[type="checkbox"]').not(this).prop('checked', false); + }); +} + +function unsetAllCheckboxes() { + $("#searchResultDiv input[type=checkbox]").each(function () { + $(this).prop("checked", false); + }); +} +// search Empty record +function searchEmpty() { + for (var index in items) { + if ($('#product_id_' + index).val() == '') { + return index; + } + } + +} +// usuwa rekord do wyszukiwania +function clearEmpty() { + for (var index in items) { + if ($('#product_id_' + index).val() == '') { + items.splice(index, 1); + } + } + FillTable(items); +} +function getSearchInfo(product_id, product_code) { + $("#search_info_div_" + product_id).show('slow'); + var html = '' + product_code + '

    '; + html += ''; + var show_purchase_prices = false; + + if (show_purchase_prices) { + html += ''; + } + + html += '
    '; + // get prices info + var params = { + job: 'getPricesInfo', + product_id: product_id, + pricebook_id: $("#pricebook_id :selected").val(), + account_id: $("#parent_id").val(), + }; + $ + .ajax({ + type: "POST", + url: ajaxsearch_url, + dataType: "json", + async: false, + success: function (data) { + html += 'Ceny'; + $.each(data, function (key, value) { + if (value.name == 'pricebook') + html += ''; + if (value.name == $("#ecmprice_name").val()) + html += ''; + else + html += ''; + }); + html += '
    NazwaCena
    ' + + $("#pricebook_id :selected").html() + + '' + + FormatNumber(value.price) + '
    ' + + value.name + + '' + + FormatNumber(value.price) + '
    ' + + value.name + + '' + + FormatNumber(value.price) + '
    '; + }, + data: params + }); + html += '
    '; + var params = { + job: 'getStockArray', + product_id: product_id, + }; + $ + .ajax({ + type: "POST", + url: ajaxsearch_url, + dataType: "json", + async: false, + success: function (data) { + html += 'Stany'; + $.each(data, function (key, value) { + html += ''; + }); + html += '
    MagazynIlość
    ' + key + + '' + + FormatNumber(value) + '
    '; + }, + data: params + }); + // struktura zapasu start + html += '
    '; + var params = { + job: 'getStockProductDetails', + record: product_id, + stock_id: $("#stock_id").val(), + }; + $ + .ajax({ + type: "POST", + url: ajaxsearch_url, + dataType: "json", + async: false, + success: function (data) { + html += 'Struktura zapasu'; + $ + .each( + data, + function (key, value) { + html += ''; + }); + html += '
    DokumentIlośćCena
    ' + + value.parent_name + + '' + + FormatNumber(value.quantity) + + '' + + FormatNumber(value.price) + + '
    '; + }, + data: params + }); + // struktura zapasu end + html += '
    '; + var params = { + job: 'getPurchaseArray', + product_id: product_id, + }; + $.ajax({ + type: "POST", + url: ajaxsearch_url, + dataType: "json", + async: false, + success: function (data) { + console.log(data); + }, + data: params + }); + html += '
    '; + + $("#search_info_div_" + product_id).html(html); +} + +function getFirstpartNumber(){ + + var params = { + job: 'savePartNumber', + }; + + $.ajax({ + type: "POST", + url: ajaxsearch_url, + dataType: "json", + async: false, + success: function (data) { + if (data != '-1'){ + partCounter= data.value1; + } + }, + data: params + }); + console.log(partCounter); +} + +function getPartNumber(index){ + + + var params = { + job: 'savePartNumber', + }; + + $.ajax({ + type: "POST", + url: ajaxsearch_url, + dataType: "json", + async: false, + success: function (data) { + if (data != '-1'){ + + currentPart=data; + } + }, + data: params + }); + $('#consignments_div_'+index).find('#consignment_part_no').val(currentPart); + $('#product_consignment_part_' + index).val(currentPart); + items[index].product_consignment_part = currentPart; + +} diff --git a/include/ECM/comboselectbox.js b/include/ECM/comboselectbox.js new file mode 100755 index 00000000..c5686f07 --- /dev/null +++ b/include/ECM/comboselectbox.js @@ -0,0 +1,1361 @@ +/** +* jquery.simple-combobox v1.1.16 (2015-02-25): jQuery combobox plugin | (c) 2014-2015 Ilya Kremer +* MIT license http://www.opensource.org/licenses/mit-license.php +*/ +// Fill free to use this jQuery plugin in any projects you want +// while keeping the comment above on top of the script. +// Don't forget not to remove it from a minimised version also. +// Thank you! +// TODO consider to use markup when filling combobox from original select options +// TODO consider to add fadeout background for items (checkboxes mode) +// TODO implement items removal (for infinite number of items) +/** +* Original plugin structure taken and extended from http://stackoverflow.com/a/6871820/837165 +* See and change default options at the end of the code or use +* $.scombobox.extendDefaults(options) method if you don't feel like +* touching the original plugin source code. +* This plugin uses following JS native methods: +* +* String.prototype.trim() +* Array.prototype.indexOf() +* Object.keys() +* console object +* +* so don't forget to add them to your project for better browser compatibility. +* You can use missed.js file for that purpose from original GitHub project: +* https://github.com/ivkremer/jquery-simple-combobox +* +* This plugin adds click listener on document, so don't forget to check if events +* can rich it or use scombobox.close method. +* @param {Object} $ jQuery reference +* @param {Object} document (HTMLDocument) +* @returns {undefined} +*/ +(function($, document) { +'use strict'; +var pname = 'scombobox'; // plugin name, don't forget to change css prefixes if necessary +var cp = '.' + pname; +var cdisplay = '-display', cvalue = '-value', cinvalid = '-invalid', +cdiv = cdisplay + '-div', cditem = cdiv + '-item', cdiremove = cditem + '-remove', cdholder = cdiv + '-holder', +clist = '-list', cmainspan = '-mainspan', chovered = '-hovered', +csep = '-separator', cpheader = '-header', +cddback = '-dropdown-background', cddarr = '-dropdown-arrow', +cdisabled = '-disabled'; +function durations(d) { +return ({ +fast: 200, +normal: 400, +slow: 600 +})[d] || d; +} +var pInt = parseInt; +var methods = { +/** +* Initializes the combobox. +* @returns {Object} jQuery object +*/ +init: function() { +var $div = this.find(cp + clist), +$select = this.find('select'), +$dropdownBack = this.find(cp + cddback), +$dropdownArr = this.find(cp + cddarr); +var opts = this.data(pname); +this.addClass(pname); +if ($select.length == 0) { +this.append($(''); +$inputDisplay.attr('title', $select.attr('title')); +this.append($inputDisplay); +this.height( ++$inputDisplay.css('font-size') + ++$inputDisplay.css('padding-top') + ++$inputDisplay.css('padding-bottom') +); +} +} +if (opts.tabindex != null) { +this.find(cp + cdisplay).attr('tabindex', opts.tabindex); +} +if (this.find(cp + cvalue).length == 0) { +this.append(''); +} +if (this.find(cp + cdisplay).is(':disabled') || opts.disabled) { +this.find(cp + cddback + ', ' + cp + cddarr).hide(); +} +if (opts.disabled) { +this.find(cp + cdisplay).prop('disabled', true); +this.addClass(pname + cdisabled); +} +if ($div.length == 0) { +this.append($div = $('
    ')); +} +if (opts.mode == 'checkboxes') { +this.addClass(pname + '-checkboxes'); +this.find(cp + cdisplay).remove(); +var $displayDiv = this.find(cp + cdisplay + '-div'); +if ($displayDiv.length == 0) { +$displayDiv = this.append('
    '); +} +$displayDiv.attr('title', $select.attr('title')); +$div.insertAfter(this.find(cp + cdisplay + '-div')); +var $dholder = this.find(cp + cdholder); +var $testItem = $('
    x
    '); +$dholder.append($testItem.css('margin-left', '-9999px').show()); +var height = $testItem.height() ++ pInt($testItem.css('padding-top')) + pInt($testItem.css('padding-top')) ++ pInt($testItem.css('margin-top')) + pInt($testItem.css('margin-top')) ++ pInt($testItem.css('border-top-width')) + pInt($testItem.css('border-top-width')) ++ pInt($dholder.css('padding-top')) + pInt($dholder.css('padding-top')); +this.find(cp + cdisplay + '-div').css('min-height', height + 'px'); +$testItem.remove(); +} else { +this.find(cp + '-display-div').remove(); +$div.insertAfter(this.find(cp + cdisplay)); +} +$div.css({'max-width': opts.listMaxWidth, 'max-height': opts.maxHeight}); +if (opts.wrap == true) { +$div.css('white-space', 'normal'); +} +if (opts.autoLoad != $.noop) { +opts.loopScrolling = false; // there is no way to support this feature when auto loading more items +} +addListeners.call(this); +this.data(pname + '-init', true); // true says that it is right after initialization, it is necessary for callback +return methods.fill.call(this, opts.data); // (will be set to false after filling) +}, +/** +* Fills the combobox with specified data or using options list in select if no data given. +* @see comments in defaults +* @param {Array} data array of data objects. See comments in defaults +* @param {Number} appendMode flag defining if to append (1) or prepend (2) data to existing items +* @returns {Object} jQuery object +*/ +fill: function(data, appendMode) { +var $options = this.find('select').children('option, optgroup'); +// don't ever rely on div content, always use select options instead +var $div = this.find('.' + pname + clist), $select = this.find('select'); +data = normalizeData(data); +var opts = this.data(pname); +var mode = opts.mode; +if (!data) { // no data were given; get data from select options +if (opts.removeDuplicates) { +removeDupsjQ($options); +purifyOptions($options); +$options = this.find('select').children('option, optgroup'); // update after removal +} +if ($options.length == 0) { +// TODO restore, using $p.data(pname).key if provided instead +} else { // here are options: +$options.each(function () { +var $t = $(this); +var $p = $('

    '); +$p.attr('title', $t.attr('title')); +if ($t.hasClass(pname + csep)) { // separator, not an option +if ($t.hasClass(pname + cpheader)) { // if header text also given then add only header +$div.append($p.addClass(pname + cpheader).text($t.text())); +} else { // else add separator itself +$p.addClass(pname + csep); +} +} else if (this.tagName.toLowerCase() == 'optgroup') { +var label = $t.attr('label'); +var $innerOptions = $('option', this); +$t.before('

    ').attr('title', this.title).append($('').text($(this).text())).data('value', this.value)); +}); +return; +} else { +$p.append($('').text($t.text())).data('value', this.value); +if (mode == 'checkboxes') { +$p.prepend(''); +} +} +$div.append($p); +}); +} +} else { // fill directly from given data +if (opts.removeDuplicates) { +removeDups(data); +} +purifyData(data); +if (opts.sort) { +data.sort(sortF); +if (!opts.sortAsc) { +data.reverse(); +} +} +if (!appendMode) { +$select.empty(); +$div.empty(); +this.children(cp + cvalue + ', ' + cp + cdisplay).val(''); +} // TODO consider if appendMode == 2 is not a stupid piece of code +renderItems.call(this, data, appendMode == 2); // if appendMode == 2, then it is prepend +} +if (this.data(pname + '-init')) { +opts.callback.func.apply(this, opts.callback.args); +this.data(pname + '-init', false); +} +$options = this.find('select').children('option'); // update +if (!opts.empty) { +if (mode != 'checkboxes') { +this[pname]('val', $options.filter('option:selected:last').val()); +} else { +var selectedValues = $options.filter(':selected').map(function() { +return $(this).val(); +}).get(); +this[pname]('val', selectedValues); +} +} +return this; +}, +/** +* Removes all items from combobox (html-based removal) +* @returns {Object} jQuery object +*/ +clear: function() { // TODO check why to or not to remove data itself +this.children('select').empty(); +this.children(cp + clist).empty().width(''); +this.children(cp + cdisplay).removeClass(pname + cinvalid); +this.children(cp + cddback).removeClass(pname + cddback + cinvalid); +return this; +}, +/** +* Updates data without touching html items or gets the data. +* For updating combobox contents use fill method. +* @param {string} data +* @returns {Object} jQuery object +*/ +data: function(data) { // this method is required because after setting new options +// via options method the data will be merged which probably will be wrong +if (arguments.length == 0) { +return this.data(pname).data; +} else { +this.data(pname).data = data; +} +return this; +}, +/** +* Enables and disables combobox. +* @param {Boolean} b flag +* @returns {Object|Boolean} jQuery object or boolean desabled status. +*/ +disabled: function(b) { +var mode = this.data(pname).mode; +if (arguments.length == 0) { +if (mode == 'checkboxes') { +return this.hasClass(pname + cdisabled); +} else { // default mode +return this.children(cp + cdisplay).prop('disabled'); +} +} +b = !!b; +this.children(cp + cdisplay).prop('disabled', b); +if (b) { +this.addClass(pname + cdisabled); +this.children(cp + cddback + ', ' + cp + cddarr).hide(); +} else { +this.removeClass(pname + cdisabled); +this.children(cp + cddback + ', ' + cp + cddarr).show(); +} +return this; +}, +/** +* Sets the tabindex attribute for search input. +* @param index +* @returns {Number|Object} +*/ +tabindex: function(index) { +var $display = this.find(cp + cdisplay); +if (arguments.length == 0) { +return $display.attr('tabindex'); +} else { +$display.attr('tabindex', index); +return this; +} +}, +/** +* Resets options or see the options. Do not use this for changing data because merging is deep, so +* data may be merged instead of being replaced. +* For updating data use data method. +* @param {Object} options +* @returns {Object} jQuery object or options object +*/ +options: function(options) { +if (arguments.length == 0) { +return this.data(pname); +} +$.extend(true, this.data(pname), toCamelCase(options)); +return this; +}, +/** +* Combobox value setter and getter. +* @param {String|Array} v value +* @returns {Object|String|Array} jQuery object or string/array combobox current value. +* Value returns as string in the default mode and as an array of values where items were +* checked in checkboxes mode. +* If combobox is disabled then empty string is returned. +*/ // TODO add the second parameter: flag if trigger changing the value (now it is triggering by default) +val: function(v) { +var opts = this.data(pname), mode = opts.mode; +if (arguments.length == 0) { // get the value +if (mode == 'default') { +var value = this.find(cp + cvalue).val(); +} +return mode == 'default' ? +(this.find(cp + cdisplay).is(':disabled') ? '' : value) : +(mode == 'checkboxes' ? getValues.call(this) : null); +} else { // set the value +if (mode == 'default') { +setValue.call(this, v); +} else if (mode == 'checkboxes') { +setValues.call(this, v); +} +} +return this; +}, +open: function() { +slide.call(this.children(cp + clist), 'down'); +return this; +}, +close: function() { +slide.call(this.children(cp + clist), 'up'); +return this; +}, +/* +* Listeners. +* Call $('#combo').combobox('keyup', null, 'namespace'); +* to trigger an event of specific namespace. +*/ +change: function(callback, namespace) { +return bindOrTrig.call(this, 'change', this.children(cp + cvalue), callback, namespace); +}, +focus: function(callback, namespace) { +return bindOrTrig.call(this, 'focus', this.children(cp + cdisplay), callback, namespace); +}, +blur: function(callback, namespace) { +return bindOrTrig.call(this, 'blur', this.children(cp + cdisplay), callback, namespace); +}, +keyup: function(callback, namespace) { +return bindOrTrig.call(this, 'keyup', this.children(cp + cdisplay), callback, namespace); +}, +keydown: function(callback, namespace) { +return bindOrTrig.call(this, 'keydown', this.children(cp + cdisplay), callback, namespace); +}, +keypress: function(callback, namespace) { +return bindOrTrig.call(this, 'keypress', this.children(cp + cdisplay), callback, namespace); +}, +click: function(callback, namespace) { +return bindOrTrig.call(this, 'click', this.children(cp + cdisplay), callback, namespace); +}, +mousedown: function(callback, namespace) { +return bindOrTrig.call(this, 'mousedown', this.children(cp + cdisplay), callback, namespace); +}, +clickDropdown: function(callback, namespace) { +return bindOrTrig.call(this, 'click', this.children(cp + cddarr), callback, namespace); +}, +toSelect: function() { +var $select = this.children('select').insertAfter(this); +if (this.data(pname).reassignId) { +$select.attr('id', this.attr('id')); +} +this.remove(); +return $select; +}, +displayDropdown: function(b) { +if (arguments.length) { +if (!!b) { +this.children(cp + cddarr + ', ' + cp + cddback).show(); +} else { +this.children(cp + cddarr + ', ' + cp + cddback).hide(); +} +} else { +if (this.data(pname).showDropdown) { +this.children(cp + cddarr + ', ' + cp + cddback).show(); +} else { +this.children(cp + cddarr + ', ' + cp + cddback).hide(); +} +} +return this; +} +}; +function bindOrTrig(type, $element, callback, namespace) { +if (typeof callback != 'function') { // trigger +var action = type + (typeof callback == 'string' ? '.' + callback : (typeof namespace == 'string' ? '.' + namespace : '')); +$element.trigger(action); +} else { // bind +addAdditionalListener.call($element, type, callback, namespace); +} +return this; +} +function addAdditionalListener(type, callback, namespace) { +var action = type + (typeof namespace == 'string' ? '.' + namespace : ''); +this.bind(action, callback); +} +function getValues() { // for checkbox mode +return JSON.parse(this.find(cp + cvalue).val() || '[]'); +} +/** +* Executes after checking a checkbox. +* this refers to combobox. +*/// TODO remove duplicate code if possible +function updateValueInput() { // used for checkboxes mode only +var $paragraphs = $(this).find(cp + clist + ' p'), $vInput = $(this).children(cp + cvalue), arrV = []; +$paragraphs.each(function() { +var $p = $(this); +var $check = $p.find(':checkbox'); +if ($check.prop('checked')) { +arrV.push($p.data('value')); +} +}); +$(this).children('select').val(arrV); +$vInput.val(JSON.stringify(arrV)); +} +function setValues(values) { // for checkboxes mode; this refers to combobox +var $paragraphs = $(this).find(cp + clist + ' p'), $vInput = $(this).children(cp + cvalue), arrV = []; +var $lastChecked; +for (var i = 0; i < $paragraphs.length; i++) { +var $p = $paragraphs.eq(i), ind = values.indexOf($p.data('value')); +if (values.indexOf($p.data('value')) >= 0) { +$lastChecked = $p.find(':checkbox').prop('checked', true); +arrV.push(values[ind]); +} else { +$p.find(':checkbox').prop('checked', false); +} +} +$(this).children('select').val(values); +$lastChecked.trigger(pname + '-chupdate', [true]); +$vInput.val(JSON.stringify(arrV)); +} +function setValue(value) { // for default mode +var $t = $(this); +var O = this.data(pname); +var $select = $t.children('select'), $valueInput = $t.children(cp + cvalue), $display = $t.children(cp + cdisplay); +var $selected = $select.children('[value="' + value + '"]'); +$display.removeClass(pname + cinvalid).siblings(cp + cddback).removeClass(pname + cddback + cinvalid) +if (!$selected.length) { // no such value +$t.find(cp + clist + ' p').removeClass(pname + chovered); +$select.children().prop('selected', false); +if (!O.invalidAsValue) { +value = ''; // TODO make combobox return null instead of empty string (standard select behavior) +} else { +if (O.highlightInvalid || (O.invalidAsValue ? (O.highlightInvalid) : O.highlightInvalid === null)) { +$display.addClass(pname + cinvalid).siblings(cp + cddback) +.addClass(pname + cddback + cinvalid); +} +} +$valueInput.val(value); +$display.val(value); +return; +} +$t.find(cp + clist + ' p').eq($selected[0].index).addClass(pname + chovered).siblings().removeClass(pname + chovered); +$valueInput.val(value).data('changed', true); +$select.val(value).change(); +} +/** +* Add all the combobox logic. +* @returns {undefined} +*/ +var blurTimer; +function addListeners() { +if (this.data('listenersAdded')) { // prevent duplicating listeners +return; +} +var $T = this, O = $T.data(pname); +this.on('keyup', cp + cdisplay + ', ' + cp + cdiv, function(e) { // filter +// Ignore keys that can't alter input field value on their own +if ([38, //Up arrow +40, //Down arrow +13, //Enter +27, //Escape +9, //Tab +37, //Left arrow +39, //Right arrow +17, //Ctrl +18, //Alt +16, //Shift +20, //Caps lock +33, //Page up +34, //Page down +35, //End +36 //Home +].indexOf(e.which) >= 0) { +return; +} +// Some extra cases +if (!e.ctrlKey && !e.shiftKey && e.which==45) return; //Insert without modifier +if (e.ctrlKey && e.which==65) return; //Ctrl+A; imperfect because sometimes we release the A *after* the Ctrl +var fullMatch = O.fullMatch, highlight = O.highlight; +if (fullMatch) { +highlight = highlight !== false; +} else { +highlight = !!highlight; +} +var $t = $(this), search = this.value.trim(); +if (O.filterIgnoreCase) { +search = search.toLowerCase(); +} +var $div = $t.closest(cp).children(cp + clist); +slide.call($div, 'down', true); +var $options = $t.closest(cp).find('select option'); +$(cp + ' ' + cp + clist).each(function() { +if ($div[0] != this) { +slide.call($(this), 'up'); +} +}); +if (!search) { +$div.children('p').show().each(function() { +$(cp + '-marker', this).contents().unwrap(); // remove selection +}); +return; +} +var hideSelector = O.hideSeparatorsOnSearch ? 'p' : 'p:not(' + cp + csep + ', ' + cp + cpheader + ')'; +$div.children(hideSelector).hide(); +$options.each(function() { +var text = $(this).text().trim(); +if (O.filterIgnoreCase) { +text = text.toLowerCase(); +} +if (fullMatch ? text.indexOf(search) >= 0 : text.indexOf(search) == 0) { +// check index and show corresponding paragraph +var regexFlags = O.filterIgnoreCase ? 'i' : ''; +var re = new RegExp("(" + search.replace(/([.?*+^$[\]\\(){}|-])/g, "\\$1") + ")", fullMatch ? regexFlags + 'g' : regexFlags); +var $ps = $div.children('p:eq(' + $options.index(this) + '):not(' + cp + csep + ', ' + cp + cpheader + ')').show(); +if (highlight) { +$ps.each(function() { +$(cp + '-marker', this).contents().unwrap(); // remove previous selection +var mainSpan = $(cp + cmainspan, this)[0]; +mainSpan.innerHTML = mainSpan.innerHTML.replace(re, '$1'); +}); +} +} +}); +}); +this.on('keydown', cp + cdisplay, function(e) { +if ([38, 40, 13, 27, 9].indexOf(e.which) >= 0) { +if (e.which != 9) { +e.preventDefault(); +} +var $combobox = $(this).closest(cp); +var $div = $combobox.children(cp + clist); +var $hovered = $(cp + chovered, $div[0]), $curr, offset; +var $first = $('p:first', $div[0]); +var cycle = O.loopScrolling; +var notHeaderSelector = ':not(' + cp + csep + ', ' + cp + cpheader + ')'; +} else { +return; +} +var fillOnArrow = O.mode == 'default' ? O.fillOnArrowPress : false; // always false for checkboxes mode +if ($div.is(':animated')) { +return; // keydown event is only for arrows, enter and escape +} +var v = this.value.trim(); +v = (O.filterIgnoreCase) ? v.toLowerCase() : v; +var scrollTop = $div.scrollTop(); +if (e.which == 40) { // arrdown +if ($div.is(':hidden')) { +slide.call($div, 'down'); +return; +} +if ($hovered.length == 0) { +if ($first.is(':visible' + notHeaderSelector)) { +$curr = $first.addClass(pname + chovered); +} else { +$curr = $first.nextAll(':visible' + notHeaderSelector).first().addClass(pname + chovered); +} +} else { +if (!cycle) { +if (!$hovered.nextAll(':visible' + notHeaderSelector).first().length) { +return; +} +} +$curr = $hovered.removeClass(pname + chovered).nextAll(':visible' + notHeaderSelector).first().addClass(pname + chovered); +if ($curr.length == 0) { +if ($first.is(':visible')) { +$curr = $first.addClass(pname + chovered); +} else { +$curr = $first.nextAll(':visible' + notHeaderSelector).first().addClass(pname + chovered); +} +} +if ($curr.length == 0) { +$curr = $first; +} +offset = $curr.position().top - $div.position().top; +var currHeight = $curr.outerHeight(); +if (offset + currHeight * 6 > $div.height()) { // keep 4 elements ahead +if ((offset + currHeight * 6) - $div.height() > currHeight * 1.5) { // $curr is under the visible bottom border +$div.scrollTop(scrollTop + offset); +} else { // no fix required +$div.scrollTop(scrollTop + currHeight); // incremental scrolltop +} +} else if (offset < 0) { +$div.scrollTop(scrollTop - -offset); +} +} +if (fillOnArrow) { +this.value = $curr.find(cp + cmainspan).text(); +$combobox.children(cp + cdisplay).data('fillonarrow', true); +} +} else if (e.which == 38) { // arrup +if ($div.is(':visible')) { +if (!cycle) { +if (!$hovered.prevAll(':visible' + notHeaderSelector).first().length) { +return; +} +} +$curr = $hovered.removeClass(pname + chovered).prevAll(':visible' + notHeaderSelector).first().addClass(pname + chovered); +if ($curr.length == 0) { +$curr = $('p:visible' + notHeaderSelector + ':last', $div[0]).addClass(pname + chovered); +} +offset = $curr.position().top - $div.position().top; +currHeight = $curr.outerHeight(); +if (offset < currHeight * 3) { +$div.scrollTop(scrollTop - -offset - currHeight * 3); +} else if (offset > $div.height() - currHeight * 3) { +$div.scrollTop(scrollTop + offset - currHeight * 3); // to the last (was $div[0].scrollHeight) +} +if (fillOnArrow) { +this.value = $curr.find(cp + cmainspan).text(); +$combobox.children(cp + cdisplay).data('fillonarrow', true); +} +} +} else if (e.which == 13) { // enter +if (O.fillOnBlur) { +getFirstP($div).click(); +return; +} +$div.children(cp + chovered).click(); +if (O.mode == 'default') { +slide.call($div, 'up'); +} +} else if (e.which == 27) { // escape +var $t = O.blurOnEscape ? $(this).blur() : $(this); +// If list is down, escape slides it up and doesn't propagate outward +if ($div.is(':visible')) { +slide.call($div, 'up'); +e.stopPropagation(); +} +} else if (e.which == 9) { // tab +if (O.fillOnTab) { +if (v) { +// Used to pick the first visible item in the dropdown +// Now pick the selected item (if any) +var $p = $div.children(cp + chovered); +if ($p.length) { +e.preventDefault(); +$p.click(); +} +} +} +} +}); +this.on('change', 'select', function(e, checkboxesMode) { // someone triggered combobox select change +var $combo = $(this).closest(cp); +var dtext = $('option:selected', this).text(); +$combo.children(cp + cdisplay).val(dtext).data('value', dtext); +var $valueInput = $combo.children(cp + cvalue); +if ($valueInput.data('changed')) { +$valueInput.data('changed', false); +return; +} +if (checkboxesMode) { // no slideup for checkboxes mode +updateValueInput.call($combo); +$valueInput.change(); +return; +} +$valueInput.change(); +slide.call($combo.children(cp + clist), 'up'); // can be triggered at the page load +}); +this.on(pname + '-chupdate', cp + clist + ' p :checkbox', function(e, forRefresh) { +if (forRefresh) { +e.stopPropagation(); +checkboxesModePClick.call($(this).parent(), e, true); +} +}); +this.on('click', cp + clist + ' p', function(e) { // value selected by clicking +clearTimeout(blurTimer); +e.stopPropagation(); +if ($(this).is(cp + csep + ', ' + cp + cpheader)) { +return; +} +$T.children(cp + cinvalid).removeClass(pname + cinvalid); // 100% it is not invalid now +$T.children(cp + cddback).removeClass(pname + cddback + cinvalid); +var $t = $(this), $div = $t.parent(), $ps = $div.children(); +var index = $ps.index(this); +if ($T.data(pname).mode == 'checkboxes') { +checkboxesModePClick.call(this, e); // process checking +return; +} +var $select = $div.closest(cp).children('select'); +$select.children('option').eq(index).prop('selected', true); +$select.siblings(cp + cvalue).val($select.val()); +$select.change(); +slide.call($t.parent(), 'up'); +$t.addClass(pname + chovered).siblings().removeClass(pname + chovered); +}); +this.on('blur', cp + cdisplay, function(e) { +// Need to do some stuff only when user moves off the scombobox. +// Do nothing in this handler if losing focus to another part of this +// combobox (e.g. the down/up button, or the list itself). +// IE needs this technique in addition to the timer one (see below) because +// clicking on the dropped-down div's scroller (if present) gives a blur +// but no suitable subsequent event with which to cancel the timer. +var rt = $(e.relatedTarget).closest(cp); +if (rt.length > 0 && rt[0] === $t.closest(cp)[0]) { +return; +} +// The relatedTarget technique doesn't work on Chrome or on Firefox. +// So we start a 200ms timer when display element loses focus. In click +// handlers of control's other elements clearTimeout cancels the timer. +// If the timer isn't cancelled it will fire and do the necessary stuff. +// Note that the timer's function's bind() method is used to supply it with the correct 'this' +blurTimer = setTimeout( function() { +var $t = $(this), O = $T.data(pname); +if (this===document.activeElement) { +// Suppress autoexpand on next focus if this blur was actually the entire window losing focus +// rather than this element losing focus to another element on the same window +$t.data('silentfocus', true); +} +$t.data('fillonarrow', false); // Prevent the slide-up from resetting value +slide.call($t.closest(cp).children(cp + clist), 'up'); // Make sure the list closes when we leave the control +if (O.fillOnBlur && !O.invalidAsValue) { +getFirstP($t.parent().children(cp + clist)).click(); +return; +} +var vOriginal = $t.val().trim(); +var $valueInput = $t.siblings(cp + cvalue); +var previousV = $valueInput.val(); +if (!vOriginal) { // if combo was emptied then set its value to '': +$valueInput.val(''); +} else { +var value; +$t.siblings('select').find('option').each(function () { +if (O.filterIgnoreCase) { +if (vOriginal.toLowerCase() == $(this).text().trim().toLowerCase()) { +value = this.value; +} +} else { +if (vOriginal == $(this).text().trim()) { +value = this.value; +} +} +}); +if (!value) { // value not found (invalid) +$valueInput.val(O.invalidAsValue ? vOriginal : ''); +} else { +$valueInput.val(value); +} +} +if (previousV !== $valueInput.val()) { +$valueInput.change().data('changed', true); +} +}.bind(this), +200) +}); +this.on('focus', cp + cdisplay, function() { +// Check for indicator that focus shouldn't cause expansion +if ($(this).data('silentfocus')) { +$(this).data('silentfocus', false); +return; +} +if (!this.value.trim()) { // focusing in empty field +// should trigger full dropdown: +if (($T.data(pname).expandOnFocus)||($(this).data('expandfocus'))) { +$(this).keyup(); +} +} else { // input.display is not empty +if (($T.data(pname).expandOnFocusWithValue)||($(this).data('expandfocus'))) { +if ($T[pname]('val')) { // if value is valid +var $listDiv = $T.children(cp + clist); +$listDiv.children().show(); +slide.call($listDiv, 'down'); +} else { +$(this).keyup(); // else start filtering +} +} +} +$(this).data('expandfocus', false); +}); +this.on('click', cp + cdisplay + '-div', function() { +if ($T.data(pname).disabled) { +return; +} +slide.call($(this).siblings(cp + clist), 'down'); +}); +this.on('click', cp + cdisplay, function(e) { +var t = $(this).closest(cp)[0]; +$(cp).each(function() { // close all other comboboxes +if (this != t) { +$(this)[pname]('close'); +} +}); +e.stopPropagation(); +}); +this.on('click', cp + cddarr, function(e) { +clearTimeout(blurTimer); +e.stopPropagation(); +var $t = $(this), $combo = $t.closest(cp); +var $div = $combo.children(cp + clist); +if ($div.is(':visible')) { +slide.call($div, 'up'); +$combo.children(cp + cdisplay).data('silentfocus', true).focus(); +} else { +$combo.children(cp + cdisplay).data('expandfocus', true).focus(); +} +}); +this.on('click', cp + cdiremove, function(e) { +clearTimeout(blurTimer); +e.stopPropagation(); +var $t = $(this); +var $item = $t.parent(), $div = $T.children(cp + clist); +$div.children('p').eq($t.data('index')).find(':checkbox').prop('checked', false); +$item.fadeOut(O.animation.duration); +$t.closest(cp).children('select').trigger('change', [true]); +}); +// scroll listener is for ajax loading +if (O.autoLoad != $.noop) { +$(cp + clist, this).scroll(function() { +var $t = $(this), $select = $T.children('select'); +var currentScrollTop = $t.scrollTop(); +var overhead = 50; +if (currentScrollTop > $t.data('scrollTop')) { // scrolling down +if (this.scrollHeight - currentScrollTop - overhead < $t.height()) { +if (!$T.data('pending')) { +$T.data('pending', true); +O.autoLoad.call($T, $select.find('option[value]:last').val(), 'bottom'); +} +} +} else { // scrolling up +if (currentScrollTop < $t.height() / 2) { +if (!$T.data('pending')) { +$T.data('pending', true); +O.autoLoad.call($T, $select.find('option[value]:first').val(), 'top'); +} +} +} +$t.data('scrollTop', currentScrollTop); +}).data('scrollTop', 0); +} +$(document).bind('click.' + pname, {thisIs: this}, function(e) { +slide.call($(e.data.thisIs).children(cp + clist), 'up'); +}); +this.data('listenersAdded', true); +} +/** +* Converts given data to final form in the most convenient way. +* @param {Array} data data given as options.data param +* @returns {Array|Boolean} array of data objects or false if no data were given +*/ +function normalizeData(data) { +if (typeof data == 'string') { // json given +data = $.parseJSON(data); +if (data == null) { // null == empty array +return []; +} +} +if (!data) { // all falsy except empty string +return false; +} +if (!(data instanceof Array)) { // object (probably) was given, convert it to array +if (typeof data != 'object') { +return false; +} +if (typeof data.length == 'undefined') { +data.length = Object.keys(data).length; +} +data = [].slice.call(data); +} +return data; // array was given +} +function purifyData(data) { +for (var i = 0; i < data.length; i++) { +if ((!data[i].value || !data[i].text) && !(data[i].hasOwnProperty('separator'))) { +data.splice(i, 1); +} +} +} +function purifyOptions($options) { +for (var i = 0; i < $options.length; i++) { +if (!$options[i].value && !$($options[i]).hasClass(pname + csep) && $options[i].tagName.toLowerCase() != 'optgroup') { // if no value, +// but if it is a separator, then it is no matter if there is a not empty value +// if this is an optgroup tag, then it will be used as a separator +$($options[i]).remove(); +} +} +} +function sortF(a, b) { +var aT = a.text.trim().toLowerCase(), bT = b.text.trim().toLowerCase(); +return aT > bT ? 1 : aT == bT ? 0 : -1; +} +function removeDups(a) { +for (var i = 0; i < a.length; i++) { +for (var j = i + 1; j < a.length; j++) { +if (!a[i] || !a[j]) +continue; +if (a[i].value == a[j].value) +a.splice(i, 1); +} +} +} +function removeDupsjQ(a) { +for (var i = 0; i < a.length; i++) { +for (var j = i + 1; j < a.length; j++) { +if (!a[i] || !a[j]) +continue; +if (a[i].value == a[j].value && a[i].tagName.toLowerCase() != 'optgroup') { +$(a[i]).remove(); +} +} +} +} +/** +* `this` refers to combobox +*/ +function checkForInvalid() { +var $display = this.children(cp + cdisplay), $select = this.children('select'), O = this.data(pname); +var value, v = $display.val().trim(); +v = (O.filterIgnoreCase) ? v.toLowerCase() : v; +// check if such value exists in options +$select.find('option').each(function () { +var candidate = $(this).text().trim(); +candidate = (O.filterIgnoreCase) ? candidate.toLowerCase() : candidate; +if (candidate == v) { +value = this.value; +} +}); +var invalid = (!value && v); +if (invalid) { +if (O.forbidInvalid) { +$display.closest(cp).find(cp + cdisplay).val('').data('value', ''); +} else { +// if highlightInvalid is enabled directly (default is null) +// or invalidAsValue is on and highlightInvalid is not its default: +// TODO refactor to make a more readable code: +if (O.highlightInvalid || (O.invalidAsValue ? (O.highlightInvalid) : O.highlightInvalid === null)) { +$display.addClass(pname + cinvalid).siblings(cp + cddback) +.addClass(pname + cddback + cinvalid); +} +} +if (!O.invalidAsValue) { // TODO check if this code affects anything +$display.siblings('select, ' + cp + cvalue).val(''); +} +} else { +$display.removeClass(pname + cinvalid).siblings(cp + cddback).removeClass(pname + cddback + cinvalid); +} +} +/** +* Slides the div with a list. `this` refers to the list +* @param dir 'up' = collapse, 'down' = expand. +* @param backspace to fix backspace bug +*/ // TODO rename and comment backspace argument +function slide(dir, backspace) { +if (this.is(':animated') || !this.length) { +return; +} +if (dir == 'up' && this.is(':hidden') && this.length == 1) { +return; // todo put a comment: why? (one reason is probably optimization, but what is this.length == 1 for?) +} +var options = this.parent().data(pname).animation; +if (!$.easing[options.easing]) { +console.warn('no such easing: ' + options.easing); +options.easing = 'swing'; +} +var $combobox = this.parent(), O = $combobox.data(pname); +if (dir == 'up') { +O.beforeClose.call($combobox); +options.complete = function() { +if (O.mode != 'checkboxes') { +checkForInvalid.call($combobox); +} +O.afterClose.call($combobox); +}; +this.slideUp(options).data('p-clicked-index', -1); +$combobox.children(cp + cddarr).removeClass(pname + cddarr + '-up'); +} else { +O.beforeOpen.call($combobox); +options.complete = function() {O.afterOpen.call($combobox)}; +this.slideDown(options); +$combobox.children(cp + cddarr).addClass(pname + cddarr + '-up'); +// Every edit keystroke will call a slide down; use this opportunity to reset the list's display characteristics fully. +$combobox.find(cp + chovered).removeClass(pname + chovered); // remove previous selection +$(cp + '-marker', $combobox).contents().unwrap(); // remove previous highlight +// Reveal everything whenever we slide down, so that user gets to see all the options. +// If the slide down was triggered by entry of a character, filtering will immediately reduce the list +// to matching items. If the slide down was by clicking the down-button, or entry of cursor-down, +// all entries will remain displayed. +$combobox.children(cp + clist).children('p').show(); +} +var $display = $combobox.children(cp + cdisplay); // code for fillOnArrowPress feature +$display.each(function() { +var $t = $(this); +if ($t.data('fillonarrow') && !backspace) { // fix backspace bug +$t.data('fillonarrow', false).val($t.data('value')); +} +// Highlight first full match when dropping down +if (dir == 'down') { +var search = this.value.trim(); +if (O.filterIgnoreCase) { +search = search.toLowerCase(); +} +var $selopts = $combobox.find('select option'); +$selopts.each(function() { +var text = $(this).text().trim(); +if (O.filterIgnoreCase) { +text = text.toLowerCase(); +} +if (text == search) { +$combobox.children(cp + clist).children('p:eq(' + $selopts.index(this) + '):not(' + cp + csep + ', ' + cp + cpheader + ')').first().addClass(pname + chovered); +return false; +} +}); +} +}); +} +function checkboxesModePClick(e, forRefresh) { // this refers to paragraph dom element +var $t = $(this), $combo = $t.closest(cp), $div = $t.parent(), $ps = $div.children('p'), +index = $ps.index(this), duration = durations($div.parent().data(pname).animation.duration); +if (!forRefresh) { +var $chbox = $t.find(':checkbox'); +// don't toggle prop('checked') if checkbox itself was clicked. +if (!$(e.target).is(':checkbox')) { +$chbox.prop('checked', !$chbox.prop('checked')); // avoid clicking, change prop instead +} +var choice = $chbox.prop('checked'); +if (e.shiftKey) { // mark between last click and current +if ($div.data('p-clicked-index') >= 0) { // not for the first time +var f = $div.data('p-clicked-index'); +var from = f < index ? f : index, to = f < index ? index : f; +for (var i = from; i <= to; i++) { +$($ps[i]).find(':checkbox').prop('checked', choice); +} +} +} +} +var $dispDivHolder = $combo.find(cp + cdholder).prepend(''); +$combo.find(cp + cdholder).fadeOut(duration / 5, function() { +$dispDivHolder.empty().show(); +// get all selected properties +$ps.each(function(i) { +var $t = $(this); +if ($t.find(':checkbox').prop('checked')) { +$dispDivHolder.append( +$('

    ').addClass(pname + cditem) +.append($('
    ').addClass(pname + cditem + '-text').text($t.find(cp + cmainspan).text())) +.append($('
    ').addClass(pname + cdiremove).text('×').data('index', i)).fadeIn(duration * 1.5) +.attr('title', $t.attr('title')) +); +} +}); +$dispDivHolder.append('
    '); +}); +$div.data('p-clicked-index', index); +$t.closest(cp).children('select').trigger('change', [true]); // true for do not slideup the items div +} +/** +* @param items +* @param prepend flag if prepend instead of appending +*/ +function renderItems(items, prepend) { +var settings = this.data(pname); +var $select = this.find('select'), $div = this.find(cp + clist); +for (var i = 0; i < items.length; i++) { +if (items[i].hasOwnProperty('separator')) { // if separator given then +if (items[i].hasOwnProperty('header')) { // if header text also given then add only header +$p = $('

    ').text(items[i].header); +} else { // else add separator itself +var $p = $('

    '); +} +var $option = $('

    '); +if (options.reassignId) { +$t.parent().attr('id', $t.attr('id')); +} +$t = $t.parent(); +} +$t.data(pname, $.extend(true, {}, options)); // cloning object is required for cases like: +// $('multiple targets selector').combobox(settings) +// $('one of a bunch').combobox('options', propertiesToChange) +// If the options object is not cloned above, +// then changing properties will affect every target in the original set. +methods.init.apply($t); +}); +}; +$.fn[pname].defaults = { +/** +* If no data given combobox is filled relying on $('select option') list. +* By default (see pMarkup and pFillFunc) the data is an array of objects: +* {value: '', text: '', additional: '', selected: true/false, anyCustomOption: customValue} +* You can also provide json or object with enumerated properties: +* {0: {...}, 1: {...}, ...} +*/ +data: null, +/** +* Whether combobox is empty by default (true) or has an original select value (usually it the first value, +* but can be changed by added a `selected` prop). +*/ +empty: false, +/** +* Whether set combobox disabled. +*/ +disabled: false, +/** +* Whether to sort options alphabetically or not +*/ +sort: true, +/** +* false to sort descending +*/ +sortAsc: true, +/** +* Whether to remove duplicates (regarding to values only). +* Not removing duplicated may cause an error, so be careful +*/ +removeDuplicates: true, +/** +* Whether to match in any part of the option text or only start from the beginning of the text +*/ +fullMatch: false, +/** +* By default highlighting is turned on when fullMatch is turned on. +* Set it strictly to false to disable it anyway or to any truthy value to set it always enabled +*/ +highlight: null, +/** +* Searching ignore case. +*/ +filterIgnoreCase: true, +/** +* Hide separators when typing something in a combo. +*/ +hideSeparatorsOnSearch: false, +/** +* When false options list does not drop down on focus (applies on an empty combobox). +* In this case you have to click on arrow to expand the list or start typing. +*/ +expandOnFocus: true, +/** +* When false options list does not drop down on focus (applies on a filled combobox). +*/ +expandOnFocusWithValue: true, +/** +* Set tabindex +*/ +tabindex: null, +/** +* When true, invalid values are forbidden what means combobox search input empties on blur in case the value +* was not chosen and search field contained wrong text. +* When false, incorrect filled combobox search field will has invalid css class. +*/ +forbidInvalid: false, +/** +* When true, then value from visible input will be a value returned by `$(combo).scombobox('val');` +*/ +invalidAsValue: false, +/** +* Whether to mark a combobox with invalid value with red or not. By default it is turned on. +* When `invalidAsValue` option is set to true, `highlightInvalid` is considered false by default. +* If you want to enabled or disable it regardless to `invalidAsValue`, set it to a any truthy value or not null +* falsy value correspondingly. +*/ +highlightInvalid: null, +/** +* If true id from select will be reassigned to the created combobox div when query target was select, like $('select').combobox() +*/ +reassignId: true, +/** +* Combobox mode 'default' means it is looking like select box with input for searching. +* mode 'checkboxes' means every option has a checkbox. In checkboxes mode the value of +* combobox is an array of values which were checked. +*/ +mode: 'default', +/** +* Don't forget to change pFillFunc if necessary when you change the markup. +* is required to use marker highlighting while typing. Highlighting is only working for the text +* in this span. That means filter does not apply to additional text. See data parameter. +*/ +pMarkup: '${text} ${additional}', +/** +* Change replacements lines in this function if necessary after changing pMarkup. +* this refers to combobox +* @param item {Object} item from data array +* @param options {Object} plugin instance properties +*/ +pFillFunc: function(item, options) { +return $('

    ').html(options.pMarkup +.replace('${text}', item.text) +.replace('${additional}', item.additional ? item.additional : '') +); +}, +/** +* Animation settings. +*/ +animation: { +duration: 'fast', // animation speed +easing: 'swing' // easing effect +}, +/** +* Dropdown div max width +*/ +listMaxWidth: window.screen.width / 2, +/** +* Use this to handle long text options lists. +* If true then long text options will take multiple lines. If false, then horizontal slider appears in list. +*/ +wrap: true, +/** +* Items list div maximum height (css property) +*/ +maxHeight: '', +/** +* Put main text in input while walking though the options with arrow keys +*/ +fillOnArrowPress: true, +/** +* Select hovered or first matching option on blur +*/ +fillOnBlur: false, +/** +* Blurs the search field on escape keypress +*/ +blurOnEscape: false, +/** +* Whether to set the first visible item as a value on tab key press (works only if search input is not empty). +* If set to false then the default action is working (going to the next input on page). +*/ +fillOnTab: true, +/** +* If set to true dropdown arrow appears in the right corner of combobox +*/ +showDropDown: true, +/** +* Callback executes after finishing initialization. +*/ +callback: { +func: $.noop, // this refers to combobox's div holder +args: [] // arguments +}, +beforeOpen: $.noop, +beforeClose: $.noop, +afterOpen: $.noop, +afterClose: $.noop, +/** +* This option is for ajax loading (appending/prepending items). This function usage is: +* function(value, direction) { +* // value here is the edge value in the list (last for appending or first for prepending). +* // direction here is the scrolling direction, which can be either 'top' or 'bottom' +* // so you can do something like this: +* var $t = $(this); +* $.post('your url here' + (direction == 'top' ? '?prepend' : ''), {id: value}, function(res) { +* $t.scombobox('fill', res, direction == 'top' ? 2 : 1); // 1 for prepending, 2 for appending +* $t.data('pending', false); // this line is compulsory +* }); +* } +*/ +autoLoad: $.noop, +/** +* Enables infinite scrolling for up and down arrows keys. +* When autoLoad function provided then loopScrolling is set to false. +*/ +loopScrolling: true +}; +/** +* This function lets you override the default params without touching original plugin code. +* Usage: $.scombobox.extendDefaults(yourDefaults); +* @param options {Object} your custom defaults. +*/ +$.fn[pname].extendDefaults = function(options) { +$.extend(true, $.fn[pname].defaults, options); +}; +})(jQuery, document); \ No newline at end of file diff --git a/include/ECM/loadEcmJsFiles.js b/include/ECM/loadEcmJsFiles.js new file mode 100755 index 00000000..ae49d16f --- /dev/null +++ b/include/ECM/loadEcmJsFiles.js @@ -0,0 +1,8 @@ +var scripts = new Array(); +var jsPath = 'include/ECM/'; +scripts.push('EcmMultiPdf/EcmMultiPdf.js'); +scripts.push('EcmDropdownEditor/EcmDropdownEditor.js'); + +$.each(scripts, function(k,v) { + $.getScript(jsPath+v, function(){}); +} ); \ No newline at end of file diff --git a/include/ECM/open_flash_chart/js/swfobject.js b/include/ECM/open_flash_chart/js/swfobject.js new file mode 100755 index 00000000..caa256a2 --- /dev/null +++ b/include/ECM/open_flash_chart/js/swfobject.js @@ -0,0 +1,233 @@ +/** + * SWFObject v1.5: Flash Player detection and embed - http://blog.deconcept.com/swfobject/ + * + * SWFObject is (c) 2007 Geoff Stearns and is released under the MIT License: + * http://www.opensource.org/licenses/mit-license.php + * + */ +if(typeof deconcept == "undefined") var deconcept = new Object(); +if(typeof deconcept.util == "undefined") deconcept.util = new Object(); +if(typeof deconcept.SWFObjectUtil == "undefined") deconcept.SWFObjectUtil = new Object(); +deconcept.SWFObject = function(swf, id, w, h, ver, c, quality, xiRedirectUrl, redirectUrl, detectKey) { + if (!document.getElementById) { return; } + this.DETECT_KEY = detectKey ? detectKey : 'detectflash'; + this.skipDetect = deconcept.util.getRequestParameter(this.DETECT_KEY); + this.params = new Object(); + this.variables = new Object(); + this.attributes = new Array(); + if(swf) { this.setAttribute('swf', swf); } + if(id) { this.setAttribute('id', id); } + if(w) { this.setAttribute('width', w); } + if(h) { this.setAttribute('height', h); } + if(ver) { this.setAttribute('version', new deconcept.PlayerVersion(ver.toString().split("."))); } + this.installedVer = deconcept.SWFObjectUtil.getPlayerVersion(); + if (!window.opera && document.all && this.installedVer.major > 7) { + // only add the onunload cleanup if the Flash Player version supports External Interface and we are in IE + deconcept.SWFObject.doPrepUnload = true; + } + if(c) { this.addParam('bgcolor', c); } + var q = quality ? quality : 'high'; + this.addParam('quality', q); + this.setAttribute('useExpressInstall', false); + this.setAttribute('doExpressInstall', false); + var xir = (xiRedirectUrl) ? xiRedirectUrl : window.location; + this.setAttribute('xiRedirectUrl', xir); + this.setAttribute('redirectUrl', ''); + if(redirectUrl) { this.setAttribute('redirectUrl', redirectUrl); } +} +deconcept.SWFObject.prototype = { + useExpressInstall: function(path) { + this.xiSWFPath = !path ? "expressinstall.swf" : path; + this.setAttribute('useExpressInstall', true); + }, + setAttribute: function(name, value){ + this.attributes[name] = value; + }, + getAttribute: function(name){ + return this.attributes[name]; + }, + addParam: function(name, value){ + this.params[name] = value; + }, + getParams: function(){ + return this.params; + }, + addVariable: function(name, value){ + this.variables[name] = value; + }, + getVariable: function(name){ + return this.variables[name]; + }, + getVariables: function(){ + return this.variables; + }, + getVariablePairs: function(){ + var variablePairs = new Array(); + var key; + var variables = this.getVariables(); + for(key in variables){ + variablePairs[variablePairs.length] = key +"="+ variables[key]; + } + return variablePairs; + }, + getSWFHTML: function() { + var swfNode = ""; + if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) { // netscape plugin architecture + if (this.getAttribute("doExpressInstall")) { + this.addVariable("MMplayerType", "PlugIn"); + this.setAttribute('swf', this.xiSWFPath); + } + swfNode = ' 0){ swfNode += 'flashvars="'+ pairs +'"'; } + swfNode += '/>'; + } else { // PC IE + if (this.getAttribute("doExpressInstall")) { + this.addVariable("MMplayerType", "ActiveX"); + this.setAttribute('swf', this.xiSWFPath); + } + swfNode = ''; + swfNode += ''; + var params = this.getParams(); + for(var key in params) { + swfNode += ''; + } + var pairs = this.getVariablePairs().join("&"); + if(pairs.length > 0) {swfNode += '';} + swfNode += ""; + } + return swfNode; + }, + write: function(elementId){ + if(this.getAttribute('useExpressInstall')) { + // check to see if we need to do an express install + var expressInstallReqVer = new deconcept.PlayerVersion([6,0,65]); + if (this.installedVer.versionIsValid(expressInstallReqVer) && !this.installedVer.versionIsValid(this.getAttribute('version'))) { + this.setAttribute('doExpressInstall', true); + this.addVariable("MMredirectURL", escape(this.getAttribute('xiRedirectUrl'))); + document.title = document.title.slice(0, 47) + " - Flash Player Installation"; + this.addVariable("MMdoctitle", document.title); + } + } + if(this.skipDetect || this.getAttribute('doExpressInstall') || this.installedVer.versionIsValid(this.getAttribute('version'))){ + var n = (typeof elementId == 'string') ? document.getElementById(elementId) : elementId; + n.innerHTML = this.getSWFHTML(); + return true; + }else{ + if(this.getAttribute('redirectUrl') != "") { + document.location.replace(this.getAttribute('redirectUrl')); + } + } + return false; + } +} + +/* ---- detection functions ---- */ +deconcept.SWFObjectUtil.getPlayerVersion = function(){ + var PlayerVersion = new deconcept.PlayerVersion([0,0,0]); + if(navigator.plugins && navigator.mimeTypes.length){ + var x = navigator.plugins["Shockwave Flash"]; + if(x && x.description) { + PlayerVersion = new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split(".")); + } + }else if (navigator.userAgent && navigator.userAgent.indexOf("Windows CE") >= 0){ // if Windows CE + var axo = 1; + var counter = 3; + while(axo) { + try { + counter++; + axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+ counter); +// document.write("player v: "+ counter); + PlayerVersion = new deconcept.PlayerVersion([counter,0,0]); + } catch (e) { + axo = null; + } + } + } else { // Win IE (non mobile) + // do minor version lookup in IE, but avoid fp6 crashing issues + // see http://blog.deconcept.com/2006/01/11/getvariable-setvariable-crash-internet-explorer-flash-6/ + try{ + var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7"); + }catch(e){ + try { + var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6"); + PlayerVersion = new deconcept.PlayerVersion([6,0,21]); + axo.AllowScriptAccess = "always"; // error if player version < 6.0.47 (thanks to Michael Williams @ Adobe for this code) + } catch(e) { + if (PlayerVersion.major == 6) { + return PlayerVersion; + } + } + try { + axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash"); + } catch(e) {} + } + if (axo != null) { + PlayerVersion = new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(",")); + } + } + return PlayerVersion; +} +deconcept.PlayerVersion = function(arrVersion){ + this.major = arrVersion[0] != null ? parseInt(arrVersion[0]) : 0; + this.minor = arrVersion[1] != null ? parseInt(arrVersion[1]) : 0; + this.rev = arrVersion[2] != null ? parseInt(arrVersion[2]) : 0; +} +deconcept.PlayerVersion.prototype.versionIsValid = function(fv){ + if(this.major < fv.major) return false; + if(this.major > fv.major) return true; + if(this.minor < fv.minor) return false; + if(this.minor > fv.minor) return true; + if(this.rev < fv.rev) return false; + return true; +} +/* ---- get value of query string param ---- */ +deconcept.util = { + getRequestParameter: function(param) { + var q = document.location.search || document.location.hash; + if (param == null) { return q; } + if(q) { + var pairs = q.substring(1).split("&"); + for (var i=0; i < pairs.length; i++) { + if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) { + return pairs[i].substring((pairs[i].indexOf("=")+1)); + } + } + } + return ""; + } +} +/* fix for video streaming bug */ +deconcept.SWFObjectUtil.cleanupSWFs = function() { + var objects = document.getElementsByTagName("OBJECT"); + for (var i = objects.length - 1; i >= 0; i--) { + objects[i].style.display = 'none'; + for (var x in objects[i]) { + if (typeof objects[i][x] == 'function') { + objects[i][x] = function(){}; + } + } + } +} +// fixes bug in some fp9 versions see http://blog.deconcept.com/2006/07/28/swfobject-143-released/ +if (deconcept.SWFObject.doPrepUnload) { + if (!deconcept.unloadSet) { + deconcept.SWFObjectUtil.prepUnload = function() { + __flash_unloadHandler = function(){}; + __flash_savedUnloadHandler = function(){}; + window.attachEvent("onunload", deconcept.SWFObjectUtil.cleanupSWFs); + } + window.attachEvent("onbeforeunload", deconcept.SWFObjectUtil.prepUnload); + deconcept.unloadSet = true; + } +} +/* add document.getElementById if needed (mobile IE < 5) */ +if (!document.getElementById && document.all) { document.getElementById = function(id) { return document.all[id]; }} + +/* add some aliases for ease of use/backwards compatibility */ +var getQueryParamValue = deconcept.util.getRequestParameter; +var FlashObject = deconcept.SWFObject; // for legacy support +var SWFObject = deconcept.SWFObject; diff --git a/include/ECM/open_flash_chart2/dot-net-library/written-by-xiao-yifang/OpenFlashChart/swfobject.js b/include/ECM/open_flash_chart2/dot-net-library/written-by-xiao-yifang/OpenFlashChart/swfobject.js new file mode 100755 index 00000000..08fb2700 --- /dev/null +++ b/include/ECM/open_flash_chart2/dot-net-library/written-by-xiao-yifang/OpenFlashChart/swfobject.js @@ -0,0 +1,5 @@ +/* SWFObject v2.1 + Copyright (c) 2007-2008 Geoff Stearns, Michael Williams, and Bobby van der Sluis + This software is released under the MIT License +*/ +var swfobject=function(){var b="undefined",Q="object",n="Shockwave Flash",p="ShockwaveFlash.ShockwaveFlash",P="application/x-shockwave-flash",m="SWFObjectExprInst",j=window,K=document,T=navigator,o=[],N=[],i=[],d=[],J,Z=null,M=null,l=null,e=false,A=false;var h=function(){var v=typeof K.getElementById!=b&&typeof K.getElementsByTagName!=b&&typeof K.createElement!=b,AC=[0,0,0],x=null;if(typeof T.plugins!=b&&typeof T.plugins[n]==Q){x=T.plugins[n].description;if(x&&!(typeof T.mimeTypes!=b&&T.mimeTypes[P]&&!T.mimeTypes[P].enabledPlugin)){x=x.replace(/^.*\s+(\S+\s+\S+$)/,"$1");AC[0]=parseInt(x.replace(/^(.*)\..*$/,"$1"),10);AC[1]=parseInt(x.replace(/^.*\.(.*)\s.*$/,"$1"),10);AC[2]=/r/.test(x)?parseInt(x.replace(/^.*r(.*)$/,"$1"),10):0}}else{if(typeof j.ActiveXObject!=b){var y=null,AB=false;try{y=new ActiveXObject(p+".7")}catch(t){try{y=new ActiveXObject(p+".6");AC=[6,0,21];y.AllowScriptAccess="always"}catch(t){if(AC[0]==6){AB=true}}if(!AB){try{y=new ActiveXObject(p)}catch(t){}}}if(!AB&&y){try{x=y.GetVariable("$version");if(x){x=x.split(" ")[1].split(",");AC=[parseInt(x[0],10),parseInt(x[1],10),parseInt(x[2],10)]}}catch(t){}}}}var AD=T.userAgent.toLowerCase(),r=T.platform.toLowerCase(),AA=/webkit/.test(AD)?parseFloat(AD.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,q=false,z=r?/win/.test(r):/win/.test(AD),w=r?/mac/.test(r):/mac/.test(AD);/*@cc_on q=true;@if(@_win32)z=true;@elif(@_mac)w=true;@end@*/return{w3cdom:v,pv:AC,webkit:AA,ie:q,win:z,mac:w}}();var L=function(){if(!h.w3cdom){return }f(H);if(h.ie&&h.win){try{K.write("'+data.responseText;subpanelContents[theDiv]['newDiv'].id=theDiv+'_newDiv';subpanelContents[theDiv]['newDiv'].className='quickcreate';theDivObj.style.display='none';theDivObj.parentNode.insertBefore(subpanelContents[theDiv]['newDiv'],theDivObj);if(!dataToDOMAvail){SUGAR.util.evalScript(data.responseText);} +subpanelLocked[theDiv]=false;setTimeout("enableQS(false)",500);ajaxStatus.hideStatus();} +if(typeof subpanelLocked[theDiv]!='undefined'&&subpanelLocked[theDiv])return false;subpanelLocked[theDiv]=true;if(typeof loadingStr=='undefined')loadingStr=SUGAR.language.get('app_strings','LBL_LOADING');ajaxStatus.showStatus(loadingStr);YAHOO.util.Connect.setForm(theForm);var cObj=YAHOO.util.Connect.asyncRequest('POST','index.php',{success:success,failure:success});return false;},cancelCreate:function(buttonName){var element=document.getElementById(buttonName);do{element=element.parentNode;}while(element.className!='quickcreate'&&element.parentNode);var theDiv=element.id.substr(0,element.id.length-7);if(typeof(subpanelContents[theDiv])=='undefined') +return false;subpanelContents[theDiv]['newDiv'].parentNode.removeChild(subpanelContents[theDiv]['newDiv']);subpanelContents[theDiv]['list'].style.display='';return false;},loadSubpanelGroupFromMore:function(group){SUGAR.subpanelUtils.updateSubpanelMoreTab(group);SUGAR.subpanelUtils.loadSubpanelGroup(group);},updateSubpanelMoreTab:function(group){var moreTab=document.getElementById(SUGAR.subpanelUtils.subpanelMoreTab+'_sp_tab');moreTab.id=group+'_sp_tab';moreTab.getElementsByTagName('a')[0].innerHTML=group;moreTab.getElementsByTagName('a')[0].href="javascript:SUGAR.subpanelUtils.loadSubpanelGroup('"+group+"');";var menuLink=document.getElementById(group+'_sp_mm');menuLink.id=SUGAR.subpanelUtils.subpanelMoreTab+'_sp_mm';menuLink.href="javascript:SUGAR.subpanelUtils.loadSubpanelGroupFromMore('"+SUGAR.subpanelUtils.subpanelMoreTab+"');";menuLink.innerHTML=SUGAR.subpanelUtils.subpanelMoreTab;SUGAR.subpanelUtils.subpanelMoreTab=group;},loadSubpanelGroup:function(group){if(group==SUGAR.subpanelUtils.currentSubpanelGroup)return;if(SUGAR.subpanelUtils.loadedGroups[group]){SUGAR.subpanelUtils.updateSubpanel(group);}else{SUGAR.subpanelUtils.loadedGroups.push(group);var needed=Array();for(group_sp in SUGAR.subpanelUtils.subpanelGroups[group]){if(typeof(SUGAR.subpanelUtils.subpanelGroups[group][group_sp])=='string'&&!document.getElementById('whole_subpanel_'+SUGAR.subpanelUtils.subpanelGroups[group][group_sp])){needed.push(SUGAR.subpanelUtils.subpanelGroups[group][group_sp]);}} +var success=function(){SUGAR.subpanelUtils.updateSubpanelEventHandlers(needed);SUGAR.subpanelUtils.updateSubpanels(group);};if(needed.length){ajaxStatus.showStatus(SUGAR.language.get('app_strings','LBL_LOADING'));SUGAR.util.retrieveAndFill(SUGAR.subpanelUtils.requestUrl+needed.join(','),'subpanel_list',null,success,null,true);}else{SUGAR.subpanelUtils.updateSubpanels(group);}} +SUGAR.subpanelUtils.setGroupCookie(group);},updateSubpanels:function(group){var sp_list=document.getElementById('subpanel_list');for(sp in sp_list.childNodes){if(sp_list.childNodes[sp].id){sp_list.childNodes[sp].style.display='none';}} +for(group_sp in SUGAR.subpanelUtils.subpanelGroups[group]){if(typeof(SUGAR.subpanelUtils.subpanelGroups[group][group_sp])!='string')continue;var cur=document.getElementById('whole_subpanel_'+SUGAR.subpanelUtils.subpanelGroups[group][group_sp]);cur.style.display='block';try{YAHOO.util.DDM.swapNode(cur,sp_list.getElementsByTagName('LI')[group_sp]);}catch(e){}} +SUGAR.subpanelUtils.updateSubpanelTabs(group);},updateSubpanelTabs:function(group){if(SUGAR.subpanelUtils.showLinks){SUGAR.subpanelUtils.updateSubpanelSubtabs(group);document.getElementById('subpanelSubTabs').innerHTML=SUGAR.subpanelUtils.subpanelSubTabs[group];} +oldTab=document.getElementById(SUGAR.subpanelUtils.currentSubpanelGroup+'_sp_tab');if(oldTab){oldTab.className='';oldTab.getElementsByTagName('a')[0].className='';} +mainTab=document.getElementById(group+'_sp_tab');mainTab.className='active';mainTab.getElementsByTagName('a')[0].className='current';SUGAR.subpanelUtils.currentSubpanelGroup=group;ajaxStatus.hideStatus();},updateSubpanelEventHandlers:function(){if(SubpanelInitTabNames){SubpanelInitTabNames(SUGAR.subpanelUtils.getLayout(false));}},reorderSubpanelSubtabs:function(group,order){SUGAR.subpanelUtils.subpanelGroups[group]=order;if(SUGAR.subpanelUtils.showLinks==1){SUGAR.subpanelUtils.updateSubpanelSubtabs(group);if(SUGAR.subpanelUtils.currentSubpanelGroup==group){document.getElementById('subpanelSubTabs').innerHTML=SUGAR.subpanelUtils.subpanelSubTabs[group];}}},updateSubpanelSubtabs:function(group){var notFirst=0;var preMore=SUGAR.subpanelUtils.subpanelGroups[group].slice(0,SUGAR.subpanelUtils.subpanelMaxSubtabs);SUGAR.subpanelUtils.subpanelSubTabs[group]='';for(var sp_key=0;sp_key | ';}else{notFirst=1;} +SUGAR.subpanelUtils.subpanelSubTabs[group]+='';} +if(document.getElementById('MoreSub'+group+'PanelMenu')){SUGAR.subpanelUtils.subpanelSubTabs[group]+='';} +SUGAR.subpanelUtils.subpanelSubTabs[group]+='
    '+SUGAR.subpanelUtils.subpanelTitles[preMore[sp_key]]+' |  >> 
    ';var postMore=SUGAR.subpanelUtils.subpanelGroups[group].slice(SUGAR.subpanelUtils.subpanelMaxSubtabs);var subpanelMenu=document.getElementById('MoreSub'+group+'PanelMenu');if(postMore&&subpanelMenu){subpanelMenu.innerHTML='';for(var sp_key=0;sp_key'+SUGAR.subpanelUtils.subpanelTitles[postMore[sp_key]]+'';} +subpanelMenu+='

    ';}},setGroupCookie:function(group){Set_Cookie(SUGAR.subpanelUtils.tabCookieName,group,3000,false,false,false);}};}();SUGAR.subpanelUtils.menu=function(){return{tbspButtonMouseOver:function(id,top,left,leftOffset){closeMenusDelay=eraseTimeout(closeMenusDelay);if(openMenusDelay==null){openMenusDelay=window.setTimeout("SUGAR.subpanelUtils.menu.spShowMenu('"+id+"','"+top+"','"+left+"','"+leftOffset+"')",delayTime);}},spShowMenu:function(id,top,left,leftOffset){openMenusDelay=eraseTimeout(openMenusDelay);var menuName=id.replace(/Handle/i,'Menu');var menu=getLayer(menuName);if(currentMenu){closeAllMenus();} +SUGAR.subpanelUtils.menu.spPopupMenu(id,menu,top,left,leftOffset);},spPopupMenu:function(handleID,menu,top,left,leftOffset){var bw=checkBrowserWidth();var menuName=handleID.replace(/Handle/i,'Menu');var menuWidth=120;var imgWidth=document.getElementById(handleID).width;if(menu){var menuHandle=getLayer(handleID);var p=menuHandle;if(left==""){var left=0;while(p&&p.tagName.toUpperCase()!='BODY'){left+=p.offsetLeft;p=p.offsetParent;} +left+=parseInt(leftOffset);} +if(top==""){var top=0;p=menuHandle;top+=p.offsetHeight;while(p&&p.tagName.toUpperCase()!='BODY'){top+=p.offsetTop;p=p.offsetParent;}} +if(left+menuWidth>bw){left=left-menuWidth+imgWidth;} +setMenuVisible(menu,left,top,false);}}};}(); \ No newline at end of file diff --git a/include/SugarDependentDropdown/javascript/SugarDependentDropdown.js b/include/SugarDependentDropdown/javascript/SugarDependentDropdown.js new file mode 100755 index 00000000..bdf3e154 --- /dev/null +++ b/include/SugarDependentDropdown/javascript/SugarDependentDropdown.js @@ -0,0 +1,52 @@ +/********************************************************************************* + * SugarCRM is a customer relationship management program developed by + * SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc. + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU Affero General Public License version 3 as published by the + * Free Software Foundation with the addition of the following permission added + * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK + * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY + * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS. + * + * 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 Affero General Public License for more + * details. + * + * You should have received a copy of the GNU Affero General Public License along with + * this program; if not, see http://www.gnu.org/licenses or write to the Free + * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301 USA. + * + * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road, + * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com. + * + * The interactive user interfaces in modified source and object code versions + * of this program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU Affero General Public License version 3. + * + * In accordance with Section 7(b) of the GNU Affero General Public License version 3, + * these Appropriate Legal Notices must retain the display of the "Powered by + * SugarCRM" logo. If the display of the logo is not reasonably feasible for + * technical reasons, the Appropriate Legal Notices must display the words + * "Powered by SugarCRM". + ********************************************************************************/ +SUGAR.dependentDropdown={currentAction:null,debugMode:false} +SUGAR.dependentDropdown.handleDependentDropdown=function(el){} +SUGAR.dependentDropdown.generateElement=function(focusElement,elementRow,index,elementIndex){if(SUGAR.dependentDropdown.debugMode)SUGAR.dependentDropdown.utils.debugStack('generateElement');var tmp=null;if(focusElement){var sandbox=SUGAR.dependentDropdown.utils.generateElementContainer(focusElement,elementRow,index,elementIndex);if(focusElement.label){focusLabel={tag:'span',cls:'routingLabel',html:" "+focusElement.label+" "} +switch(focusElement.label_pos){case"top":focusLabel.html=focusElement.label+"
    ";break;case"bottom":focusLabel.html="
    "+focusElement.label;break;} +if(focusElement.label_pos=='left'||focusElement.label_pos=='top'){YAHOO.ext.DomHelper.append(sandbox,focusLabel);}} +switch(focusElement.type){case'input':if(typeof(focusElement.values)=='string'){focusElement.values=eval(focusElement.values);} +var preselect=SUGAR.dependentDropdown.utils.getPreselectKey(focusElement.name);if(preselect.match(/::/)) +preselect='';tmp=YAHOO.ext.DomHelper.append(sandbox,{tag:'input',id:focusElement.grouping+"::"+index+":::"+elementIndex+":-:"+focusElement.id,name:focusElement.grouping+"::"+index+"::"+focusElement.name,cls:'input',onchange:focusElement.onchange,value:preselect},true);var newElement=tmp.dom;break;case'select':tmp=YAHOO.ext.DomHelper.append(sandbox,{tag:'select',id:focusElement.grouping+"::"+index+":::"+elementIndex+":-:"+focusElement.id,name:focusElement.grouping+"::"+index+"::"+focusElement.name,cls:'input',onchange:focusElement.onchange},true);var newElement=tmp.dom;if(typeof(focusElement.values)=='string'){focusElement.values=eval(focusElement.values);} +var preselect=SUGAR.dependentDropdown.utils.getPreselectKey(focusElement.name);var i=0;for(var key in focusElement.values){var selected=(preselect==key)?true:false;newElement.options[i]=new Option(focusElement.values[key],key,selected);if(selected){newElement.options[i].selected=true;} +i++;} +break;case'none':break;case'checkbox':alert('implement checkbox pls');break;case'multiple':alert('implement multiple pls');break;default:if(SUGAR.dependentDropdown.dropdowns.debugMode){alert("Improper type defined: [ "+focusElement.type+"]");} +return;break;} +if(focusElement.label){if(focusElement.label_pos=='right'||focusElement.label_pos=='bottom'){YAHOO.ext.DomHelper.append(sandbox,focusLabel);}} +try{newElement.onchange();}catch(e){if(SUGAR.dependentDropdown.dropdowns.debugMode){debugger;}}}else{}} +SUGAR.dependentDropdown.utils={generateElementContainer:function(focusElement,elementRow,index,elementIndex){var oldElement=document.getElementById('elementContainer'+focusElement.grouping+"::"+index+":::"+elementIndex);if(oldElement){SUGAR.dependentDropdown.utils.removeChildren(oldElement);} +var tmp=YAHOO.ext.DomHelper.append(elementRow,{tag:'span',id:'elementContainer'+focusElement.grouping+"::"+index+":::"+elementIndex},true);return tmp.dom;},getPreselectKey:function(elementName){try{if(SUGAR.dependentDropdown.currentAction.action[elementName]){return SUGAR.dependentDropdown.currentAction.action[elementName];}else{return'';}}catch(e){if(SUGAR.dependentDropdown.dropdowns.debugMode){} +return'';}},debugStack:function(func){if(!SUGAR.dependentDropdown._stack){SUGAR.dependentDropdown._stack=new Array();} +SUGAR.dependentDropdown._stack.push(func);},removeChildren:function(el){for(i=el.childNodes.length-1;i>=0;i--){if(el.childNodes[i]){el.removeChild(el.childNodes[i]);}}}} \ No newline at end of file diff --git a/include/SugarEmailAddress/SugarEmailAddress.js b/include/SugarEmailAddress/SugarEmailAddress.js new file mode 100755 index 00000000..29f4ee32 --- /dev/null +++ b/include/SugarEmailAddress/SugarEmailAddress.js @@ -0,0 +1,69 @@ +/********************************************************************************* + * SugarCRM is a customer relationship management program developed by + * SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc. + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU Affero General Public License version 3 as published by the + * Free Software Foundation with the addition of the following permission added + * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK + * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY + * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS. + * + * 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 Affero General Public License for more + * details. + * + * You should have received a copy of the GNU Affero General Public License along with + * this program; if not, see http://www.gnu.org/licenses or write to the Free + * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301 USA. + * + * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road, + * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com. + * + * The interactive user interfaces in modified source and object code versions + * of this program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU Affero General Public License version 3. + * + * In accordance with Section 7(b) of the GNU Affero General Public License version 3, + * these Appropriate Legal Notices must retain the display of the "Powered by + * SugarCRM" logo. If the display of the logo is not reasonably feasible for + * technical reasons, the Appropriate Legal Notices must display the words + * "Powered by SugarCRM". + ********************************************************************************/ +(function(){if(SUGAR.EmailAddressWidget)return;var Dom=YAHOO.util.Dom;SUGAR.EmailAddressWidget=function(module){if(!SUGAR.EmailAddressWidget.count[module])SUGAR.EmailAddressWidget.count[module]=0;this.count=SUGAR.EmailAddressWidget.count[module];SUGAR.EmailAddressWidget.count[module]++;this.module=module;this.id=this.module+this.count;if(document.getElementById(module+'_email_widget_id')) +document.getElementById(module+'_email_widget_id').value=this.id;SUGAR.EmailAddressWidget.instances[this.id]=this;} +SUGAR.EmailAddressWidget.instances={};SUGAR.EmailAddressWidget.count={};SUGAR.EmailAddressWidget.prototype={emailTemplate:''+''+' '+''+''+''+''+'',numberEmailAddresses:0,replyToFlagObject:new Object(),verifying:false,enterPressed:false,tabPressed:false,emailView:"",emailIsRequired:false,prefillEmailAddresses:function(tableId,o){for(i=0;i1){verifyElementFlag.parentNode.removeChild(verifyElementFlag.parentNode.lastChild);} +var verifiedTextNode=document.createElement('span');verifiedTextNode.innerHTML='';verifyElementFlag.parentNode.appendChild(verifiedTextNode);verifyElementFlag.value="true";this.verifyElementValue=Dom.get(this.id+'emailAddressVerifiedValue'+index);this.verifyElementValue.value=Dom.get(this.id+'emailAddress'+index).value;this.verifying=false;var savePressed=false;if(event){var elm=document.activeElement||event.explicitOriginalTarget;if(typeof elm.type!='undefined'&&/submit|button/.test(elm.type.toLowerCase())){savePressed=true;}} +if(savePressed||this.enterPressed){setTimeout("SUGAR.EmailAddressWidget.instances."+this.id+".forceSubmit()",2100);}else if(this.tabPressed){Dom.get(this.id+'emailAddressPrimaryFlag'+index).focus();}} +var event=this.getEvent(event);var targetEl=this.getEventElement(event);var index=/[a-z]*\d?emailAddress(\d+)/i.exec(targetEl.id)[1];var verifyElementFlag=Dom.get(this.id+'emailAddressVerifiedFlag'+index);this.verifyElementValue=Dom.get(this.id+'emailAddressVerifiedValue'+index);verifyElementFlag.value=(trim(targetEl.value)==''||targetEl.value==this.verifyElementValue.value)?"true":"false" +if(verifyElementFlag.parentNode.childNodes.length>1){verifyElementFlag.parentNode.removeChild(verifyElementFlag.parentNode.lastChild);} +if(/emailAddress\d+$/.test(targetEl.id)&&isValidEmail(targetEl.value)&&!this.verifying&&verifyElementFlag.value=="false"){verifiedTextNode=document.createElement('span');verifyElementFlag.parentNode.appendChild(verifiedTextNode);verifiedTextNode.innerHTML=SUGAR.language.get('app_strings','LBL_VERIFY_EMAIL_ADDRESS');this.verifying=true;var cObj=YAHOO.util.Connect.asyncRequest('GET','index.php?&module=Contacts&action=RetrieveEmail&target='+targetEl.id+'&email='+targetEl.value,{success:callbackFunction,failure:callbackFunction,scope:this});}},handleKeyDown:function(event){var e=this.getEvent(event);var eL=this.getEventElement(e);if((kc=e["keyCode"])){this.enterPressed=(kc==13)?true:false;this.tabPressed=(kc==9)?true:false;if(this.enterPressed||this.tabPressed){this.retrieveEmailAddress(e);if(this.enterPressed);this.freezeEvent(e);}}},getEvent:function(event){return(event?event:window.event);},getEventElement:function(e){return(e.srcElement?e.srcElement:(e.target?e.target:e.currentTarget));},freezeEvent:function(e){if(e.preventDefault)e.preventDefault();e.returnValue=false;e.cancelBubble=true;if(e.stopPropagation)e.stopPropagation();return false;},addEmailAddress:function(tableId,address,primaryFlag,replyToFlag,optOutFlag,invalidFlag){if(this.addInProgress) +return;this.addInProgress=true;if(!address) +address="";var insertInto=Dom.get(tableId);var parentObj=insertInto.parentNode;var newContent=document.createElement("input");var nav=new String(navigator.appVersion);var newContentPrimaryFlag;if(SUGAR.isIE){newContentPrimaryFlag=document.createElement("");}else{newContentPrimaryFlag=document.createElement("input");} +var newContentReplyToFlag=document.createElement("input");var newContentOptOutFlag=document.createElement("input");var newContentInvalidFlag=document.createElement("input");var newContentVerifiedFlag=document.createElement("input");var newContentVerifiedValue=document.createElement("input");var removeButton=document.createElement("img");var tbody=document.createElement("tbody");var tr=document.createElement("tr");var td1=document.createElement("td");var td2=document.createElement("td");var td3=document.createElement("td");var td4=document.createElement("td");var td5=document.createElement("td");var td6=document.createElement("td");var td7=document.createElement("td");var td8=document.createElement("td");newContent.setAttribute("type","text");newContent.setAttribute("style","width: 250px;");newContent.setAttribute("name",this.id+"emailAddress"+this.numberEmailAddresses);newContent.setAttribute("id",this.id+"emailAddress"+this.numberEmailAddresses);newContent.setAttribute("size","30");if(address!=''){newContent.setAttribute("value",address);} +removeButton.setAttribute("id",this.id+"removeButton"+this.numberEmailAddresses);removeButton.setAttribute("class","id-ff-remove");removeButton.setAttribute("name",this.numberEmailAddresses);removeButton.eaw=this;removeButton.setAttribute("src","index.php?entryPoint=getImage&themeName="+SUGAR.themes.theme_name+"&imageName=id-ff-remove.png");removeButton.onclick=function(){this.eaw.removeEmailAddress(this.name);};newContentPrimaryFlag.setAttribute("type","radio");newContentPrimaryFlag.setAttribute("name",this.id+"emailAddressPrimaryFlag");newContentPrimaryFlag.setAttribute("id",this.id+"emailAddressPrimaryFlag"+this.numberEmailAddresses);newContentPrimaryFlag.setAttribute("value",this.id+"emailAddress"+this.numberEmailAddresses);newContentPrimaryFlag.setAttribute("enabled","true");newContentReplyToFlag.setAttribute("type","radio");newContentReplyToFlag.setAttribute("name",this.id+"emailAddressReplyToFlag");newContentReplyToFlag.setAttribute("id",this.id+"emailAddressReplyToFlag"+this.numberEmailAddresses);newContentReplyToFlag.setAttribute("value",this.id+"emailAddress"+this.numberEmailAddresses);newContentReplyToFlag.setAttribute("enabled","true");newContentReplyToFlag.eaw=this;newContentReplyToFlag['onclick']=function(){var form=document.forms[this.eaw.emailView];if(!form){form=document.forms['editContactForm'];} +var nav=new String(navigator.appVersion);if(nav.match(/MSIE/gim)){for(i=0;i0&&this.mins<15){this.mins=15;}else if(this.mins>15&&this.mins<30){this.mins=30;}else if(this.mins>30&&this.mins<45){this.mins=45;}else if(this.mins>45){this.hrs+=1;this.mins=0;} +this.timeformat=timeformat;this.tabindex=tabindex==null||isNaN(tabindex)?1:tabindex;this.timeseparator=this.timeformat.substring(2,3);this.has12Hours=/^11/.test(this.timeformat);this.hasMeridiem=/am|pm/i.test(this.timeformat);if(this.hasMeridiem){this.pm=/pm/.test(this.timeformat);} +this.meridiem=this.hasMeridiem?trim(this.datetime.substring(16)):'';this.datetime=this.datetime.substr(0,10);this.showCheckbox=showCheckbox;this.checked=checked;document.getElementById(this.fieldname+'_date').value=this.datetime;} +Datetimecombo.prototype.jsscript=function(callback){text='\nfunction update_'+this.fieldname+'(calendar) {';text+='\nif(calendar != null) {';text+='\ncalendar.onUpdateTime();';text+='\ncalendar.onSetTime();';text+='\ncalendar.hide();';text+='\n}' +text+='\nd = document.getElementById("'+this.fieldname+'_date").value;';text+='\nh = document.getElementById("'+this.fieldname+'_hours").value;';text+='\nm = document.getElementById("'+this.fieldname+'_minutes").value;';text+='\nnewdate = d + " " + h + "'+this.timeseparator+'" + m;';if(this.hasMeridiem){text+='\nif(typeof document.getElementById("'+this.fieldname+'_meridiem") != "undefined") {';text+='\n newdate += document.getElementById("'+this.fieldname+'_meridiem").value;';text+='\n}';} +text+='\nif(trim(newdate) =="'+this.timeseparator+'") newdate="";';text+='\ndocument.getElementById("'+this.fieldname+'").value = newdate;';text+='\n'+callback;text+='\n}';return text;} +Datetimecombo.prototype.html=function(callback){var text=' ';text+=this.timeseparator;text+='\n ';if(this.hasMeridiem){text+='\n ';text+='\n';} +if(this.showCheckbox){text+='\n';} +return text;};Datetimecombo.prototype.update=function(){id=this.fieldname+'_date';d=window.document.getElementById(id).value;id=this.fieldname+'_hours';h=window.document.getElementById(id).value;id=this.fieldname+'_minutes';m=window.document.getElementById(id).value;newdate=d+' '+h+this.timeseparator+m;if(this.hasMeridiem){ampm=document.getElementById(this.fieldname+"_meridiem").value;newdate+=ampm;} +if(trim(newdate)==""+this.timeseparator+""){newdate='';} +document.getElementById(this.fieldname).value=newdate;if(this.showCheckbox){flag=this.fieldname+'_flag';date=this.fieldname+'_date';hours=this.fieldname+'_hours';mins=this.fieldname+'_minutes';if(document.getElementById(flag).checked){document.getElementById(flag).value=1;document.getElementById(this.fieldname).value='';document.getElementById(date).disabled=true;document.getElementById(hours).disabled=true;document.getElementById(mins).disabled=true;}else{document.getElementById(flag).value=0;document.getElementById(date).disabled=false;document.getElementById(hours).disabled=false;document.getElementById(mins).disabled=false;}}}; \ No newline at end of file diff --git a/include/SugarFields/Fields/File/jquery.form.js b/include/SugarFields/Fields/File/jquery.form.js new file mode 100755 index 00000000..9a5eb848 --- /dev/null +++ b/include/SugarFields/Fields/File/jquery.form.js @@ -0,0 +1,1279 @@ +/*! + * jQuery Form Plugin + * version: 3.51.0-2014.06.20 + * Requires jQuery v1.5 or later + * Copyright (c) 2014 M. Alsup + * Examples and documentation at: http://malsup.com/jquery/form/ + * Project repository: https://github.com/malsup/form + * Dual licensed under the MIT and GPL licenses. + * https://github.com/malsup/form#copyright-and-license + */ +/*global ActiveXObject */ + +// AMD support +(function (factory) { + "use strict"; + if (typeof define === 'function' && define.amd) { + // using AMD; register as anon module + define(['jquery'], factory); + } else { + // no AMD; invoke directly + factory( (typeof(jQuery) != 'undefined') ? jQuery : window.Zepto ); + } +} + +(function($) { +"use strict"; + +/* + Usage Note: + ----------- + Do not use both ajaxSubmit and ajaxForm on the same form. These + functions are mutually exclusive. Use ajaxSubmit if you want + to bind your own submit handler to the form. For example, + + $(document).ready(function() { + $('#myForm').on('submit', function(e) { + e.preventDefault(); // <-- important + $(this).ajaxSubmit({ + target: '#output' + }); + }); + }); + + Use ajaxForm when you want the plugin to manage all the event binding + for you. For example, + + $(document).ready(function() { + $('#myForm').ajaxForm({ + target: '#output' + }); + }); + + You can also use ajaxForm with delegation (requires jQuery v1.7+), so the + form does not have to exist when you invoke ajaxForm: + + $('#myForm').ajaxForm({ + delegation: true, + target: '#output' + }); + + When using ajaxForm, the ajaxSubmit function will be invoked for you + at the appropriate time. +*/ + +/** + * Feature detection + */ +var feature = {}; +feature.fileapi = $("").get(0).files !== undefined; +feature.formdata = window.FormData !== undefined; + +var hasProp = !!$.fn.prop; + +// attr2 uses prop when it can but checks the return type for +// an expected string. this accounts for the case where a form +// contains inputs with names like "action" or "method"; in those +// cases "prop" returns the element +$.fn.attr2 = function() { + if ( ! hasProp ) { + return this.attr.apply(this, arguments); + } + var val = this.prop.apply(this, arguments); + if ( ( val && val.jquery ) || typeof val === 'string' ) { + return val; + } + return this.attr.apply(this, arguments); +}; + +/** + * ajaxSubmit() provides a mechanism for immediately submitting + * an HTML form using AJAX. + */ +$.fn.ajaxSubmit = function(options) { + + /*jshint scripturl:true */ + + // fast fail if nothing selected (http://dev.jquery.com/ticket/2752) + if (!this.length) { + log('ajaxSubmit: skipping submit process - no element selected'); + return this; + } + + var method, action, url, $form = this; + + if (typeof options == 'function') { + options = { success: options }; + } + else if ( options === undefined ) { + options = {}; + } + + method = options.type || this.attr2('method'); + action = options.url || this.attr2('action'); + + url = (typeof action === 'string') ? $.trim(action) : ''; + url = url || window.location.href || ''; + if (url) { + // clean url (don't include hash vaue) + url = (url.match(/^([^#]+)/)||[])[1]; + } + + options = $.extend(true, { + url: url, + success: $.ajaxSettings.success, + type: method || $.ajaxSettings.type, + iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank' + }, options); + + // hook for manipulating the form data before it is extracted; + // convenient for use with rich editors like tinyMCE or FCKEditor + var veto = {}; + this.trigger('form-pre-serialize', [this, options, veto]); + if (veto.veto) { + log('ajaxSubmit: submit vetoed via form-pre-serialize trigger'); + return this; + } + + // provide opportunity to alter form data before it is serialized + if (options.beforeSerialize && options.beforeSerialize(this, options) === false) { + log('ajaxSubmit: submit aborted via beforeSerialize callback'); + return this; + } + + var traditional = options.traditional; + if ( traditional === undefined ) { + traditional = $.ajaxSettings.traditional; + } + + var elements = []; + var qx, a = this.formToArray(options.semantic, elements); + if (options.data) { + options.extraData = options.data; + qx = $.param(options.data, traditional); + } + + // give pre-submit callback an opportunity to abort the submit + if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) { + log('ajaxSubmit: submit aborted via beforeSubmit callback'); + return this; + } + + // fire vetoable 'validate' event + this.trigger('form-submit-validate', [a, this, options, veto]); + if (veto.veto) { + log('ajaxSubmit: submit vetoed via form-submit-validate trigger'); + return this; + } + + var q = $.param(a, traditional); + if (qx) { + q = ( q ? (q + '&' + qx) : qx ); + } + if (options.type.toUpperCase() == 'GET') { + options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q; + options.data = null; // data is null for 'get' + } + else { + options.data = q; // data is the query string for 'post' + } + + var callbacks = []; + if (options.resetForm) { + callbacks.push(function() { $form.resetForm(); }); + } + if (options.clearForm) { + callbacks.push(function() { $form.clearForm(options.includeHidden); }); + } + + // perform a load on the target only if dataType is not provided + if (!options.dataType && options.target) { + var oldSuccess = options.success || function(){}; + callbacks.push(function(data) { + var fn = options.replaceTarget ? 'replaceWith' : 'html'; + $(options.target)[fn](data).each(oldSuccess, arguments); + }); + } + else if (options.success) { + callbacks.push(options.success); + } + + options.success = function(data, status, xhr) { // jQuery 1.4+ passes xhr as 3rd arg + var context = options.context || this ; // jQuery 1.4+ supports scope context + for (var i=0, max=callbacks.length; i < max; i++) { + callbacks[i].apply(context, [data, status, xhr || $form, $form]); + } + }; + + if (options.error) { + var oldError = options.error; + options.error = function(xhr, status, error) { + var context = options.context || this; + oldError.apply(context, [xhr, status, error, $form]); + }; + } + + if (options.complete) { + var oldComplete = options.complete; + options.complete = function(xhr, status) { + var context = options.context || this; + oldComplete.apply(context, [xhr, status, $form]); + }; + } + + // are there files to upload? + + // [value] (issue #113), also see comment: + // https://github.com/malsup/form/commit/588306aedba1de01388032d5f42a60159eea9228#commitcomment-2180219 + var fileInputs = $('input[type=file]:enabled', this).filter(function() { return $(this).val() !== ''; }); + + var hasFileInputs = fileInputs.length > 0; + var mp = 'multipart/form-data'; + var multipart = ($form.attr('enctype') == mp || $form.attr('encoding') == mp); + + var fileAPI = feature.fileapi && feature.formdata; + log("fileAPI :" + fileAPI); + var shouldUseFrame = (hasFileInputs || multipart) && !fileAPI; + + var jqxhr; + + // options.iframe allows user to force iframe mode + // 06-NOV-09: now defaulting to iframe mode if file input is detected + if (options.iframe !== false && (options.iframe || shouldUseFrame)) { + // hack to fix Safari hang (thanks to Tim Molendijk for this) + // see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d + if (options.closeKeepAlive) { + $.get(options.closeKeepAlive, function() { + jqxhr = fileUploadIframe(a); + }); + } + else { + jqxhr = fileUploadIframe(a); + } + } + else if ((hasFileInputs || multipart) && fileAPI) { + jqxhr = fileUploadXhr(a); + } + else { + jqxhr = $.ajax(options); + } + + $form.removeData('jqxhr').data('jqxhr', jqxhr); + + // clear element array + for (var k=0; k < elements.length; k++) { + elements[k] = null; + } + + // fire 'notify' event + this.trigger('form-submit-notify', [this, options]); + return this; + + // utility fn for deep serialization + function deepSerialize(extraData){ + var serialized = $.param(extraData, options.traditional).split('&'); + var len = serialized.length; + var result = []; + var i, part; + for (i=0; i < len; i++) { + // #252; undo param space replacement + serialized[i] = serialized[i].replace(/\+/g,' '); + part = serialized[i].split('='); + // #278; use array instead of object storage, favoring array serializations + result.push([decodeURIComponent(part[0]), decodeURIComponent(part[1])]); + } + return result; + } + + // XMLHttpRequest Level 2 file uploads (big hat tip to francois2metz) + function fileUploadXhr(a) { + var formdata = new FormData(); + + for (var i=0; i < a.length; i++) { + formdata.append(a[i].name, a[i].value); + } + + if (options.extraData) { + var serializedData = deepSerialize(options.extraData); + for (i=0; i < serializedData.length; i++) { + if (serializedData[i]) { + formdata.append(serializedData[i][0], serializedData[i][1]); + } + } + } + + options.data = null; + + var s = $.extend(true, {}, $.ajaxSettings, options, { + contentType: false, + processData: false, + cache: false, + type: method || 'POST' + }); + + if (options.uploadProgress) { + // workaround because jqXHR does not expose upload property + s.xhr = function() { + var xhr = $.ajaxSettings.xhr(); + if (xhr.upload) { + xhr.upload.addEventListener('progress', function(event) { + var percent = 0; + var position = event.loaded || event.position; /*event.position is deprecated*/ + var total = event.total; + if (event.lengthComputable) { + percent = Math.ceil(position / total * 100); + } + options.uploadProgress(event, position, total, percent); + }, false); + } + return xhr; + }; + } + + s.data = null; + var beforeSend = s.beforeSend; + s.beforeSend = function(xhr, o) { + //Send FormData() provided by user + if (options.formData) { + o.data = options.formData; + } + else { + o.data = formdata; + } + if(beforeSend) { + beforeSend.call(this, xhr, o); + } + }; + return $.ajax(s); + } + + // private function for handling file uploads (hat tip to YAHOO!) + function fileUploadIframe(a) { + var form = $form[0], el, i, s, g, id, $io, io, xhr, sub, n, timedOut, timeoutHandle; + var deferred = $.Deferred(); + + // #341 + deferred.abort = function(status) { + xhr.abort(status); + }; + + if (a) { + // ensure that every serialized input is still enabled + for (i=0; i < elements.length; i++) { + el = $(elements[i]); + if ( hasProp ) { + el.prop('disabled', false); + } + else { + el.removeAttr('disabled'); + } + } + } + + s = $.extend(true, {}, $.ajaxSettings, options); + s.context = s.context || s; + id = 'jqFormIO' + (new Date().getTime()); + if (s.iframeTarget) { + $io = $(s.iframeTarget); + n = $io.attr2('name'); + if (!n) { + $io.attr2('name', id); + } + else { + id = n; + } + } + else { + $io = $('');return b.join("")})}},fileButton:function(b,a,d){var f=this;if(!(3>arguments.length)){h.call(this,a);a.validate&&(this.validate=a.validate);var c=CKEDITOR.tools.extend({},a),e=c.onClick;c.className=(c.className?c.className+" ":"")+"cke_dialog_ui_button";c.onClick=function(c){var d= +a["for"];if(!e||e.call(this,c)!==false){b.getContentElement(d[0],d[1]).submit();this.disable()}};b.on("load",function(){b.getContentElement(a["for"][0],a["for"][1])._.buttons.push(f)});CKEDITOR.ui.dialog.button.call(this,b,c,d)}},html:function(){var b=/^\s*<[\w:]+\s+([^>]*)?>/,a=/^(\s*<[\w:]+(?:\s+[^>]*)?)((?:.|\r|\n)+)$/,d=/\/$/;return function(f,c,e){if(!(3>arguments.length)){var k=[],g=c.html;"<"!=g.charAt(0)&&(g=""+g+"");var i=c.focus;if(i){var j=this.focus;this.focus=function(){("function"== +typeof i?i:j).call(this);this.fire("focus")};c.isFocusable&&(this.isFocusable=this.isFocusable);this.keyboardFocusable=!0}CKEDITOR.ui.dialog.uiElement.call(this,f,c,k,"span",null,null,"");k=k.join("").match(b);g=g.match(a)||["","",""];d.test(g[1])&&(g[1]=g[1].slice(0,-1),g[2]="/"+g[2]);e.push([g[1]," ",k[1]||"",g[2]].join(""))}}}(),fieldset:function(b,a,d,f,c){var e=c.label;this._={children:a};CKEDITOR.ui.dialog.uiElement.call(this,b,c,f,"fieldset",null,null,function(){var a=[];e&&a.push(""+e+"");for(var b=0;ba.getChildCount()?(new CKEDITOR.dom.text(b,CKEDITOR.document)).appendTo(a):a.getChild(0).$.nodeValue=b;return this},getLabel:function(){var b= +CKEDITOR.document.getById(this._.labelId);return!b||1>b.getChildCount()?"":b.getChild(0).getText()},eventProcessors:o},!0);CKEDITOR.ui.dialog.button.prototype=CKEDITOR.tools.extend(new CKEDITOR.ui.dialog.uiElement,{click:function(){return!this._.disabled?this.fire("click",{dialog:this._.dialog}):!1},enable:function(){this._.disabled=!1;var b=this.getElement();b&&b.removeClass("cke_disabled")},disable:function(){this._.disabled=!0;this.getElement().addClass("cke_disabled")},isVisible:function(){return this.getElement().getFirst().isVisible()}, +isEnabled:function(){return!this._.disabled},eventProcessors:CKEDITOR.tools.extend({},CKEDITOR.ui.dialog.uiElement.prototype.eventProcessors,{onClick:function(b,a){this.on("click",function(){a.apply(this,arguments)})}},!0),accessKeyUp:function(){this.click()},accessKeyDown:function(){this.focus()},keyboardFocusable:!0},!0);CKEDITOR.ui.dialog.textInput.prototype=CKEDITOR.tools.extend(new CKEDITOR.ui.dialog.labeledElement,{getInputElement:function(){return CKEDITOR.document.getById(this._.inputId)}, +focus:function(){var b=this.selectParentTab();setTimeout(function(){var a=b.getInputElement();a&&a.$.focus()},0)},select:function(){var b=this.selectParentTab();setTimeout(function(){var a=b.getInputElement();a&&(a.$.focus(),a.$.select())},0)},accessKeyUp:function(){this.select()},setValue:function(b){!b&&(b="");return CKEDITOR.ui.dialog.uiElement.prototype.setValue.apply(this,arguments)},keyboardFocusable:!0},n,!0);CKEDITOR.ui.dialog.textarea.prototype=new CKEDITOR.ui.dialog.textInput;CKEDITOR.ui.dialog.select.prototype= +CKEDITOR.tools.extend(new CKEDITOR.ui.dialog.labeledElement,{getInputElement:function(){return this._.select.getElement()},add:function(b,a,d){var f=new CKEDITOR.dom.element("option",this.getDialog().getParentEditor().document),c=this.getInputElement().$;f.$.text=b;f.$.value=void 0===a||null===a?b:a;void 0===d||null===d?CKEDITOR.env.ie?c.add(f.$):c.add(f.$,null):c.add(f.$,d);return this},remove:function(b){this.getInputElement().$.remove(b);return this},clear:function(){for(var b=this.getInputElement().$;0< +b.length;)b.remove(0);return this},keyboardFocusable:!0},n,!0);CKEDITOR.ui.dialog.checkbox.prototype=CKEDITOR.tools.extend(new CKEDITOR.ui.dialog.uiElement,{getInputElement:function(){return this._.checkbox.getElement()},setValue:function(b,a){this.getInputElement().$.checked=b;!a&&this.fire("change",{value:b})},getValue:function(){return this.getInputElement().$.checked},accessKeyUp:function(){this.setValue(!this.getValue())},eventProcessors:{onChange:function(b,a){if(!CKEDITOR.env.ie||8','
    " ); + +}() ); diff --git a/include/jQuery/jquery-ui/tests/jquery.simulate.js b/include/jQuery/jquery-ui/tests/jquery.simulate.js new file mode 100755 index 00000000..6e2f3ba8 --- /dev/null +++ b/include/jQuery/jquery-ui/tests/jquery.simulate.js @@ -0,0 +1,324 @@ + /*! + * jQuery Simulate v0.0.1 - simulate browser mouse and keyboard events + * https://github.com/jquery/jquery-simulate + * + * Copyright 2012 jQuery Foundation and other contributors + * Released under the MIT license. + * http://jquery.org/license + * + * Date: Sun Dec 9 12:15:33 2012 -0500 + */ + +;(function( $, undefined ) { + +var rkeyEvent = /^key/, + rmouseEvent = /^(?:mouse|contextmenu)|click/; + +$.fn.simulate = function( type, options ) { + return this.each(function() { + new $.simulate( this, type, options ); + }); +}; + +$.simulate = function( elem, type, options ) { + var method = $.camelCase( "simulate-" + type ); + + this.target = elem; + this.options = options; + + if ( this[ method ] ) { + this[ method ](); + } else { + this.simulateEvent( elem, type, options ); + } +}; + +$.extend( $.simulate, { + + keyCode: { + BACKSPACE: 8, + COMMA: 188, + DELETE: 46, + DOWN: 40, + END: 35, + ENTER: 13, + ESCAPE: 27, + HOME: 36, + LEFT: 37, + NUMPAD_ADD: 107, + NUMPAD_DECIMAL: 110, + NUMPAD_DIVIDE: 111, + NUMPAD_ENTER: 108, + NUMPAD_MULTIPLY: 106, + NUMPAD_SUBTRACT: 109, + PAGE_DOWN: 34, + PAGE_UP: 33, + PERIOD: 190, + RIGHT: 39, + SPACE: 32, + TAB: 9, + UP: 38 + }, + + buttonCode: { + LEFT: 0, + MIDDLE: 1, + RIGHT: 2 + } +}); + +$.extend( $.simulate.prototype, { + + simulateEvent: function( elem, type, options ) { + var event = this.createEvent( type, options ); + this.dispatchEvent( elem, type, event, options ); + }, + + createEvent: function( type, options ) { + if ( rkeyEvent.test( type ) ) { + return this.keyEvent( type, options ); + } + + if ( rmouseEvent.test( type ) ) { + return this.mouseEvent( type, options ); + } + }, + + mouseEvent: function( type, options ) { + var event, eventDoc, doc, body; + options = $.extend({ + bubbles: true, + cancelable: (type !== "mousemove"), + view: window, + detail: 0, + screenX: 0, + screenY: 0, + clientX: 1, + clientY: 1, + ctrlKey: false, + altKey: false, + shiftKey: false, + metaKey: false, + button: 0, + relatedTarget: undefined + }, options ); + + if ( document.createEvent ) { + event = document.createEvent( "MouseEvents" ); + event.initMouseEvent( type, options.bubbles, options.cancelable, + options.view, options.detail, + options.screenX, options.screenY, options.clientX, options.clientY, + options.ctrlKey, options.altKey, options.shiftKey, options.metaKey, + options.button, options.relatedTarget || document.body.parentNode ); + + // IE 9+ creates events with pageX and pageY set to 0. + // Trying to modify the properties throws an error, + // so we define getters to return the correct values. + if ( event.pageX === 0 && event.pageY === 0 && Object.defineProperty ) { + eventDoc = event.relatedTarget.ownerDocument || document; + doc = eventDoc.documentElement; + body = eventDoc.body; + + Object.defineProperty( event, "pageX", { + get: function() { + return options.clientX + + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - + ( doc && doc.clientLeft || body && body.clientLeft || 0 ); + } + }); + Object.defineProperty( event, "pageY", { + get: function() { + return options.clientY + + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - + ( doc && doc.clientTop || body && body.clientTop || 0 ); + } + }); + } + } else if ( document.createEventObject ) { + event = document.createEventObject(); + $.extend( event, options ); + // standards event.button uses constants defined here: http://msdn.microsoft.com/en-us/library/ie/ff974877(v=vs.85).aspx + // old IE event.button uses constants defined here: http://msdn.microsoft.com/en-us/library/ie/ms533544(v=vs.85).aspx + // so we actually need to map the standard back to oldIE + event.button = { + 0: 1, + 1: 4, + 2: 2 + }[ event.button ] || event.button; + } + + return event; + }, + + keyEvent: function( type, options ) { + var event; + options = $.extend({ + bubbles: true, + cancelable: true, + view: window, + ctrlKey: false, + altKey: false, + shiftKey: false, + metaKey: false, + keyCode: 0, + charCode: undefined + }, options ); + + if ( document.createEvent ) { + try { + event = document.createEvent( "KeyEvents" ); + event.initKeyEvent( type, options.bubbles, options.cancelable, options.view, + options.ctrlKey, options.altKey, options.shiftKey, options.metaKey, + options.keyCode, options.charCode ); + // initKeyEvent throws an exception in WebKit + // see: http://stackoverflow.com/questions/6406784/initkeyevent-keypress-only-works-in-firefox-need-a-cross-browser-solution + // and also https://bugs.webkit.org/show_bug.cgi?id=13368 + // fall back to a generic event until we decide to implement initKeyboardEvent + } catch( err ) { + event = document.createEvent( "Events" ); + event.initEvent( type, options.bubbles, options.cancelable ); + $.extend( event, { + view: options.view, + ctrlKey: options.ctrlKey, + altKey: options.altKey, + shiftKey: options.shiftKey, + metaKey: options.metaKey, + keyCode: options.keyCode, + charCode: options.charCode + }); + } + } else if ( document.createEventObject ) { + event = document.createEventObject(); + $.extend( event, options ); + } + + if ( !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() ) || (({}).toString.call( window.opera ) === "[object Opera]") ) { + event.keyCode = (options.charCode > 0) ? options.charCode : options.keyCode; + event.charCode = undefined; + } + + return event; + }, + + dispatchEvent: function( elem, type, event ) { + if ( elem.dispatchEvent ) { + elem.dispatchEvent( event ); + } else if ( elem.fireEvent ) { + elem.fireEvent( "on" + type, event ); + } + }, + + simulateFocus: function() { + var focusinEvent, + triggered = false, + element = $( this.target ); + + function trigger() { + triggered = true; + } + + element.bind( "focus", trigger ); + element[ 0 ].focus(); + + if ( !triggered ) { + focusinEvent = $.Event( "focusin" ); + focusinEvent.preventDefault(); + element.trigger( focusinEvent ); + element.triggerHandler( "focus" ); + } + element.unbind( "focus", trigger ); + }, + + simulateBlur: function() { + var focusoutEvent, + triggered = false, + element = $( this.target ); + + function trigger() { + triggered = true; + } + + element.bind( "blur", trigger ); + element[ 0 ].blur(); + + // blur events are async in IE + setTimeout(function() { + // IE won't let the blur occur if the window is inactive + if ( element[ 0 ].ownerDocument.activeElement === element[ 0 ] ) { + element[ 0 ].ownerDocument.body.focus(); + } + + // Firefox won't trigger events if the window is inactive + // IE doesn't trigger events if we had to manually focus the body + if ( !triggered ) { + focusoutEvent = $.Event( "focusout" ); + focusoutEvent.preventDefault(); + element.trigger( focusoutEvent ); + element.triggerHandler( "blur" ); + } + element.unbind( "blur", trigger ); + }, 1 ); + } +}); + + + +/** complex events **/ + +function findCenter( elem ) { + var offset, + document = $( elem.ownerDocument ); + elem = $( elem ); + offset = elem.offset(); + + return { + x: offset.left + elem.outerWidth() / 2 - document.scrollLeft(), + y: offset.top + elem.outerHeight() / 2 - document.scrollTop() + }; +} + +function findCorner( elem ) { + var offset, + document = $( elem.ownerDocument ); + elem = $( elem ); + offset = elem.offset(); + + return { + x: offset.left - document.scrollLeft(), + y: offset.top - document.scrollTop() + }; +} + +$.extend( $.simulate.prototype, { + simulateDrag: function() { + var i = 0, + target = this.target, + options = this.options, + center = options.handle === "corner" ? findCorner( target ) : findCenter( target ), + x = Math.floor( center.x ), + y = Math.floor( center.y ), + coord = { clientX: x, clientY: y }, + dx = options.dx || ( options.x !== undefined ? options.x - x : 0 ), + dy = options.dy || ( options.y !== undefined ? options.y - y : 0 ), + moves = options.moves || 3; + + this.simulateEvent( target, "mousedown", coord ); + + for ( ; i < moves ; i++ ) { + x += dx / moves; + y += dy / moves; + + coord = { + clientX: Math.round( x ), + clientY: Math.round( y ) + }; + + this.simulateEvent( document, "mousemove", coord ); + } + + this.simulateEvent( target, "mouseup", coord ); + this.simulateEvent( target, "click", coord ); + } +}); + +})( jQuery ); diff --git a/include/jQuery/jquery-ui/tests/unit/accordion/accordion_common.js b/include/jQuery/jquery-ui/tests/unit/accordion/accordion_common.js new file mode 100755 index 00000000..ef24cf25 --- /dev/null +++ b/include/jQuery/jquery-ui/tests/unit/accordion/accordion_common.js @@ -0,0 +1,20 @@ +TestHelpers.commonWidgetTests( "accordion", { + defaults: { + active: 0, + animate: {}, + collapsible: false, + disabled: false, + event: "click", + header: "> li > :first-child,> :not(li):even", + heightStyle: "auto", + icons: { + "activeHeader": "ui-icon-triangle-1-s", + "header": "ui-icon-triangle-1-e" + }, + + // callbacks + activate: null, + beforeActivate: null, + create: null + } +}); diff --git a/include/jQuery/jquery-ui/tests/unit/accordion/accordion_core.js b/include/jQuery/jquery-ui/tests/unit/accordion/accordion_core.js new file mode 100755 index 00000000..8e0175ae --- /dev/null +++ b/include/jQuery/jquery-ui/tests/unit/accordion/accordion_core.js @@ -0,0 +1,117 @@ +(function( $ ) { + +var setupTeardown = TestHelpers.accordion.setupTeardown, + state = TestHelpers.accordion.state; + +module( "accordion: core", setupTeardown() ); + +$.each( { div: "#list1", ul: "#navigation", dl: "#accordion-dl" }, function( type, selector ) { + test( "markup structure: " + type, function() { + expect( 4 ); + var element = $( selector ).accordion(); + ok( element.hasClass( "ui-accordion" ), "main element is .ui-accordion" ); + equal( element.find( ".ui-accordion-header" ).length, 3, + ".ui-accordion-header elements exist, correct number" ); + equal( element.find( ".ui-accordion-content" ).length, 3, + ".ui-accordion-content elements exist, correct number" ); + deepEqual( element.find( ".ui-accordion-header" ).next().get(), + element.find( ".ui-accordion-content" ).get(), + "content panels come immediately after headers" ); + }); +}); + +test( "handle click on header-descendant", function() { + expect( 1 ); + var element = $( "#navigation" ).accordion(); + $( "#navigation h2:eq(1) a" ).click(); + state( element, 0, 1, 0 ); +}); + +test( "accessibility", function () { + expect( 37 ); + var element = $( "#list1" ).accordion({ + active: 1 + }), + headers = element.find( ".ui-accordion-header" ); + + equal( element.attr( "role" ), "tablist", "element role" ); + headers.each(function( i ) { + var header = headers.eq( i ), + panel = header.next(); + equal( header.attr( "role" ), "tab", "header " + i + " role" ); + equal( header.attr( "aria-controls" ), panel.attr( "id" ), "header " + i + " aria-controls" ); + equal( panel.attr( "role" ), "tabpanel", "panel " + i + " role" ); + equal( panel.attr( "aria-labelledby" ), header.attr( "id" ), "panel " + i + " aria-labelledby" ); + }); + + equal( headers.eq( 1 ).attr( "tabindex" ), 0, "active header has tabindex=0" ); + equal( headers.eq( 1 ).attr( "aria-selected" ), "true", "active tab has aria-selected=true" ); + equal( headers.eq( 1 ).attr( "aria-expanded" ), "true", "active tab has aria-expanded=true" ); + equal( headers.eq( 1 ).next().attr( "aria-hidden" ), "false", "active tabpanel has aria-hidden=false" ); + equal( headers.eq( 0 ).attr( "tabindex" ), -1, "inactive header has tabindex=-1" ); + equal( headers.eq( 0 ).attr( "aria-selected" ), "false", "inactive tab has aria-selected=false" ); + equal( headers.eq( 0 ).attr( "aria-expanded" ), "false", "inactive tab has aria-expanded=false" ); + equal( headers.eq( 0 ).next().attr( "aria-hidden" ), "true", "inactive tabpanel has aria-hidden=true" ); + equal( headers.eq( 2 ).attr( "tabindex" ), -1, "inactive header has tabindex=-1" ); + equal( headers.eq( 2 ).attr( "aria-selected" ), "false", "inactive tab has aria-selected=false" ); + equal( headers.eq( 2 ).attr( "aria-expanded" ), "false", "inactive tab has aria-expanded=false" ); + equal( headers.eq( 2 ).next().attr( "aria-hidden" ), "true", "inactive tabpanel has aria-hidden=true" ); + + element.accordion( "option", "active", 0 ); + equal( headers.eq( 0 ).attr( "tabindex" ), 0, "active header has tabindex=0" ); + equal( headers.eq( 0 ).attr( "aria-selected" ), "true", "active tab has aria-selected=true" ); + equal( headers.eq( 0 ).attr( "aria-expanded" ), "true", "active tab has aria-expanded=true" ); + equal( headers.eq( 0 ).next().attr( "aria-hidden" ), "false", "active tabpanel has aria-hidden=false" ); + equal( headers.eq( 1 ).attr( "tabindex" ), -1, "inactive header has tabindex=-1" ); + equal( headers.eq( 1 ).attr( "aria-selected" ), "false", "inactive tab has aria-selected=false" ); + equal( headers.eq( 1 ).attr( "aria-expanded" ), "false", "inactive tab has aria-expanded=false" ); + equal( headers.eq( 1 ).next().attr( "aria-hidden" ), "true", "inactive tabpanel has aria-hidden=true" ); + equal( headers.eq( 2 ).attr( "tabindex" ), -1, "inactive header has tabindex=-1" ); + equal( headers.eq( 2 ).attr( "aria-selected" ), "false", "inactive tab has aria-selected=false" ); + equal( headers.eq( 2 ).attr( "aria-expanded" ), "false", "inactive tab has aria-expanded=false" ); + equal( headers.eq( 2 ).next().attr( "aria-hidden" ), "true", "inactive tabpanel has aria-hidden=true" ); +}); + +asyncTest( "keyboard support", function() { + expect( 13 ); + var element = $( "#list1" ).accordion(), + headers = element.find( ".ui-accordion-header" ), + anchor = headers.eq( 1 ).next().find( "a" ).eq( 0 ), + keyCode = $.ui.keyCode; + equal( headers.filter( ".ui-state-focus" ).length, 0, "no headers focused on init" ); + headers.eq( 0 ).simulate( "focus" ); + setTimeout(function() { + ok( headers.eq( 0 ).is( ".ui-state-focus" ), "first header has focus" ); + headers.eq( 0 ).simulate( "keydown", { keyCode: keyCode.DOWN } ); + ok( headers.eq( 1 ).is( ".ui-state-focus" ), "DOWN moves focus to next header" ); + headers.eq( 1 ).simulate( "keydown", { keyCode: keyCode.RIGHT } ); + ok( headers.eq( 2 ).is( ".ui-state-focus" ), "RIGHT moves focus to next header" ); + headers.eq( 2 ).simulate( "keydown", { keyCode: keyCode.DOWN } ); + ok( headers.eq( 0 ).is( ".ui-state-focus" ), "DOWN wraps focus to first header" ); + + headers.eq( 0 ).simulate( "keydown", { keyCode: keyCode.UP } ); + ok( headers.eq( 2 ).is( ".ui-state-focus" ), "UP wraps focus to last header" ); + headers.eq( 2 ).simulate( "keydown", { keyCode: keyCode.LEFT } ); + ok( headers.eq( 1 ).is( ".ui-state-focus" ), "LEFT moves focus to previous header" ); + + headers.eq( 1 ).simulate( "keydown", { keyCode: keyCode.HOME } ); + ok( headers.eq( 0 ).is( ".ui-state-focus" ), "HOME moves focus to first header" ); + headers.eq( 0 ).simulate( "keydown", { keyCode: keyCode.END } ); + ok( headers.eq( 2 ).is( ".ui-state-focus" ), "END moves focus to last header" ); + + headers.eq( 2 ).simulate( "keydown", { keyCode: keyCode.ENTER } ); + equal( element.accordion( "option", "active" ) , 2, "ENTER activates panel" ); + headers.eq( 1 ).simulate( "keydown", { keyCode: keyCode.SPACE } ); + equal( element.accordion( "option", "active" ), 1, "SPACE activates panel" ); + + anchor.simulate( "focus" ); + setTimeout(function() { + ok( !headers.eq( 1 ).is( ".ui-state-focus" ), "header loses focus when focusing inside the panel" ); + anchor.simulate( "keydown", { keyCode: keyCode.UP, ctrlKey: true } ); + ok( headers.eq( 1 ).is( ".ui-state-focus" ), "CTRL+UP moves focus to header" ); + start(); + }, 1 ); + }, 1 ); +}); + +}( jQuery ) ); diff --git a/include/jQuery/jquery-ui/tests/unit/accordion/accordion_events.js b/include/jQuery/jquery-ui/tests/unit/accordion/accordion_events.js new file mode 100755 index 00000000..79283d11 --- /dev/null +++ b/include/jQuery/jquery-ui/tests/unit/accordion/accordion_events.js @@ -0,0 +1,169 @@ +(function( $ ) { + +var setupTeardown = TestHelpers.accordion.setupTeardown, + state = TestHelpers.accordion.state; + +module( "accordion: events", setupTeardown() ); + +test( "create", function() { + expect( 15 ); + + var element = $( "#list1" ), + headers = element.children( "h3" ), + contents = headers.next(); + + element.accordion({ + create: function( event, ui ) { + equal( ui.header.length, 1, "header length" ); + strictEqual( ui.header[ 0 ], headers[ 0 ], "header" ); + equal( ui.panel.length, 1, "panel length" ); + strictEqual( ui.panel[ 0 ], contents[ 0 ], "panel" ); + equal( ui.content.length, 1, "content length" ); + strictEqual( ui.content[ 0 ], contents[ 0 ], "content" ); + } + }); + element.accordion( "destroy" ); + + element.accordion({ + active: 2, + create: function( event, ui ) { + equal( ui.header.length, 1, "header length" ); + strictEqual( ui.header[ 0 ], headers[ 2 ], "header" ); + equal( ui.panel.length, 1, "panel length" ); + strictEqual( ui.panel[ 0 ], contents[ 2 ], "panel" ); + equal( ui.content.length, 1, "content length" ); + strictEqual( ui.content[ 0 ], contents[ 2 ], "content" ); + } + }); + element.accordion( "destroy" ); + + element.accordion({ + active: false, + collapsible: true, + create: function( event, ui ) { + equal( ui.header.length, 0, "header length" ); + equal( ui.panel.length, 0, "panel length" ); + equal( ui.content.length, 0, "content length" ); + } + }); + element.accordion( "destroy" ); +}); + +test( "beforeActivate", function() { + expect( 38 ); + var element = $( "#list1" ).accordion({ + active: false, + collapsible: true + }), + headers = element.find( ".ui-accordion-header" ), + content = element.find( ".ui-accordion-content" ); + + element.one( "accordionbeforeactivate", function( event, ui ) { + ok( !( "originalEvent" in event ) ); + equal( ui.oldHeader.length, 0 ); + equal( ui.oldPanel.length, 0 ); + equal( ui.newHeader.length, 1 ); + strictEqual( ui.newHeader[ 0 ], headers[ 0 ] ); + equal( ui.newPanel.length, 1 ); + strictEqual( ui.newPanel[ 0 ], content[ 0 ] ); + state( element, 0, 0, 0 ); + }); + element.accordion( "option", "active", 0 ); + state( element, 1, 0, 0 ); + + element.one( "accordionbeforeactivate", function( event, ui ) { + equal( event.originalEvent.type, "click" ); + equal( ui.oldHeader.length, 1 ); + strictEqual( ui.oldHeader[ 0 ], headers[ 0 ] ); + equal( ui.oldPanel.length, 1 ); + strictEqual( ui.oldPanel[ 0 ], content[ 0 ] ); + equal( ui.newHeader.length, 1 ); + strictEqual( ui.newHeader[ 0 ], headers[ 1 ] ); + equal( ui.newPanel.length, 1 ); + strictEqual( ui.newPanel[ 0 ], content[ 1 ] ); + state( element, 1, 0, 0 ); + }); + headers.eq( 1 ).click(); + state( element, 0, 1, 0 ); + + element.one( "accordionbeforeactivate", function( event, ui ) { + ok( !( "originalEvent" in event ) ); + equal( ui.oldHeader.length, 1 ); + strictEqual( ui.oldHeader[ 0 ], headers[ 1 ] ); + equal( ui.oldPanel.length, 1 ); + strictEqual( ui.oldPanel[ 0 ], content[ 1 ] ); + equal( ui.newHeader.length, 0 ); + equal( ui.newPanel.length, 0 ); + state( element, 0, 1, 0 ); + }); + element.accordion( "option", "active", false ); + state( element, 0, 0, 0 ); + + element.one( "accordionbeforeactivate", function( event, ui ) { + ok( !( "originalEvent" in event ) ); + equal( ui.oldHeader.length, 0 ); + equal( ui.oldPanel.length, 0 ); + equal( ui.newHeader.length, 1 ); + strictEqual( ui.newHeader[ 0 ], headers[ 2 ] ); + equal( ui.newPanel.length, 1 ); + strictEqual( ui.newPanel[ 0 ], content[ 2 ] ); + event.preventDefault(); + state( element, 0, 0, 0 ); + }); + element.accordion( "option", "active", 2 ); + state( element, 0, 0, 0 ); +}); + +test( "activate", function() { + expect( 21 ); + var element = $( "#list1" ).accordion({ + active: false, + collapsible: true + }), + headers = element.find( ".ui-accordion-header" ), + content = element.find( ".ui-accordion-content" ); + + element.one( "accordionactivate", function( event, ui ) { + equal( ui.oldHeader.length, 0 ); + equal( ui.oldPanel.length, 0 ); + equal( ui.newHeader.length, 1 ); + strictEqual( ui.newHeader[ 0 ], headers[ 0 ] ); + equal( ui.newPanel.length, 1 ); + strictEqual( ui.newPanel[ 0 ], content[ 0 ] ); + }); + element.accordion( "option", "active", 0 ); + + element.one( "accordionactivate", function( event, ui ) { + equal( ui.oldHeader.length, 1 ); + strictEqual( ui.oldHeader[ 0 ], headers[ 0 ] ); + equal( ui.oldPanel.length, 1 ); + strictEqual( ui.oldPanel[ 0 ], content[ 0 ] ); + equal( ui.newHeader.length, 1 ); + strictEqual( ui.newHeader[ 0 ], headers[ 1 ] ); + equal( ui.newPanel.length, 1 ); + strictEqual( ui.newPanel[ 0 ], content[ 1 ] ); + }); + headers.eq( 1 ).click(); + + element.one( "accordionactivate", function( event, ui ) { + equal( ui.oldHeader.length, 1 ); + strictEqual( ui.oldHeader[ 0 ], headers[ 1 ] ); + equal( ui.oldPanel.length, 1 ); + strictEqual( ui.oldPanel[ 0 ], content[ 1 ] ); + equal( ui.newHeader.length, 0 ); + equal( ui.newPanel.length, 0 ); + }); + element.accordion( "option", "active", false ); + + // prevent activation + element.one( "accordionbeforeactivate", function( event ) { + ok( true ); + event.preventDefault(); + }); + element.one( "accordionactivate", function() { + ok( false ); + }); + element.accordion( "option", "active", 1 ); +}); + +}( jQuery ) ); diff --git a/include/jQuery/jquery-ui/tests/unit/accordion/accordion_methods.js b/include/jQuery/jquery-ui/tests/unit/accordion/accordion_methods.js new file mode 100755 index 00000000..f81bd6de --- /dev/null +++ b/include/jQuery/jquery-ui/tests/unit/accordion/accordion_methods.js @@ -0,0 +1,126 @@ +(function( $ ) { + +var equalHeight = TestHelpers.accordion.equalHeight, + setupTeardown = TestHelpers.accordion.setupTeardown, + state = TestHelpers.accordion.state; + +module( "accordion: methods", setupTeardown() ); + +test( "destroy", function() { + expect( 1 ); + domEqual( "#list1", function() { + $( "#list1" ).accordion().accordion( "destroy" ); + }); +}); + +test( "enable/disable", function() { + expect( 4 ); + var element = $( "#list1" ).accordion(); + state( element, 1, 0, 0 ); + element.accordion( "disable" ); + // event does nothing + element.find( ".ui-accordion-header" ).eq( 1 ).trigger( "click" ); + state( element, 1, 0, 0 ); + // option still works + element.accordion( "option", "active", 1 ); + state( element, 0, 1, 0 ); + element.accordion( "enable" ); + element.accordion( "option", "active", 2 ); + state( element, 0, 0, 1 ); +}); + +test( "refresh", function() { + expect( 19 ); + var element = $( "#navigation" ) + .parent() + .height( 300 ) + .end() + .accordion({ + heightStyle: "fill" + }); + equalHeight( element, 255 ); + + element.parent().height( 500 ); + element.accordion( "refresh" ); + equalHeight( element, 455 ); + + element = $( "#list1" ); + element.accordion(); + state( element, 1, 0, 0 ); + + // disable panel via markup + element.find( "h3.bar" ).eq( 1 ).addClass( "ui-state-disabled" ); + element.accordion( "refresh" ); + state( element, 1, 0, 0 ); + + // don't add multiple icons + element.accordion( "refresh" ); + equal( element.find( ".ui-accordion-header-icon" ).length, 3 ); + + // add a panel + element + .append("

    new 1

    ") + .append("
    new 1
    "); + element.accordion( "refresh" ); + state( element, 1, 0, 0, 0 ); + + // remove all tabs + element.find( "h3.bar, div.foo" ).remove(); + element.accordion( "refresh" ); + state( element ); + equal( element.accordion( "option", "active" ), false, "no active accordion panel" ); + + // add panels + element + .append("

    new 2

    ") + .append("
    new 2
    ") + .append("

    new 3

    ") + .append("
    new 3
    ") + .append("

    new 4

    ") + .append("
    new 4
    ") + .append("

    new 5

    ") + .append("
    new 5
    "); + element.accordion( "refresh" ); + state( element, 1, 0, 0, 0 ); + + // activate third tab + element.accordion( "option", "active", 2 ); + state( element, 0, 0, 1, 0 ); + + // remove fourth panel, third panel should stay active + element.find( "h3.bar" ).eq( 3 ).remove(); + element.find( "div.foo" ).eq( 3 ).remove(); + element.accordion( "refresh" ); + state( element, 0, 0, 1 ); + + // remove third (active) panel, second panel should become active + element.find( "h3.bar" ).eq( 2 ).remove(); + element.find( "div.foo" ).eq( 2 ).remove(); + element.accordion( "refresh" ); + state( element, 0, 1 ); + + // remove first panel, previously active panel (now first) should stay active + element.find( "h3.bar" ).eq( 0 ).remove(); + element.find( "div.foo" ).eq( 0 ).remove(); + element.accordion( "refresh" ); + state( element, 1 ); + + // collapse all panels + element.accordion( "option", { + collapsible: true, + active: false + }); + state( element, 0 ); + element.accordion( "refresh" ); + state( element, 0 ); +}); + +test( "widget", function() { + expect( 2 ); + var element = $( "#list1" ).accordion(), + widgetElement = element.accordion( "widget" ); + equal( widgetElement.length, 1, "one element" ); + strictEqual( widgetElement[ 0 ], element[ 0 ], "same element" ); +}); + +}( jQuery ) ); diff --git a/include/jQuery/jquery-ui/tests/unit/accordion/accordion_options.js b/include/jQuery/jquery-ui/tests/unit/accordion/accordion_options.js new file mode 100755 index 00000000..214753e4 --- /dev/null +++ b/include/jQuery/jquery-ui/tests/unit/accordion/accordion_options.js @@ -0,0 +1,463 @@ +(function( $ ) { + +var equalHeight = TestHelpers.accordion.equalHeight, + setupTeardown = TestHelpers.accordion.setupTeardown, + state = TestHelpers.accordion.state; + +module( "accordion: options", setupTeardown() ); + +test( "{ active: default }", function() { + expect( 2 ); + var element = $( "#list1" ).accordion(); + equal( element.accordion( "option", "active" ), 0 ); + state( element, 1, 0, 0 ); +}); + +test( "{ active: null }", function() { + expect( 2 ); + var element = $( "#list1" ).accordion({ + active: null + }); + equal( element.accordion( "option", "active" ), 0 ); + state( element, 1, 0, 0 ); +}); + +test( "{ active: false }", function() { + expect( 7 ); + var element = $( "#list1" ).accordion({ + active: false, + collapsible: true + }); + state( element, 0, 0, 0 ); + equal( element.find( ".ui-accordion-header.ui-state-active" ).length, 0, "no headers selected" ); + equal( element.accordion( "option", "active" ), false ); + + element.accordion( "option", "collapsible", false ); + state( element, 1, 0, 0 ); + equal( element.accordion( "option", "active" ), 0 ); + + element.accordion( "destroy" ); + element.accordion({ + active: false + }); + state( element, 1, 0, 0 ); + strictEqual( element.accordion( "option", "active" ), 0 ); +}); + +test( "{ active: Number }", function() { + expect( 8 ); + var element = $( "#list1" ).accordion({ + active: 2 + }); + equal( element.accordion( "option", "active" ), 2 ); + state( element, 0, 0, 1 ); + + element.accordion( "option", "active", 0 ); + equal( element.accordion( "option", "active" ), 0 ); + state( element, 1, 0, 0 ); + + element.find( ".ui-accordion-header" ).eq( 1 ).click(); + equal( element.accordion( "option", "active" ), 1 ); + state( element, 0, 1, 0 ); + + element.accordion( "option", "active", 10 ); + equal( element.accordion( "option", "active" ), 1 ); + state( element, 0, 1, 0 ); +}); + +test( "{ active: -Number }", function() { + expect( 8 ); + var element = $( "#list1" ).accordion({ + active: -1 + }); + equal( element.accordion( "option", "active" ), 2 ); + state( element, 0, 0, 1 ); + + element.accordion( "option", "active", -2 ); + equal( element.accordion( "option", "active" ), 1 ); + state( element, 0, 1, 0 ); + + element.accordion( "option", "active", -10 ); + equal( element.accordion( "option", "active" ), 1 ); + state( element, 0, 1, 0 ); + + element.accordion( "option", "active", -3 ); + equal( element.accordion( "option", "active" ), 0 ); + state( element, 1, 0, 0 ); +}); + +test( "{ animate: false }", function() { + expect( 3 ); + var element = $( "#list1" ).accordion({ + animate: false + }), + panels = element.find( ".ui-accordion-content" ), + animate = $.fn.animate; + $.fn.animate = function() { + ok( false, ".animate() called" ); + }; + + ok( panels.eq( 0 ).is( ":visible" ), "first panel visible" ); + element.accordion( "option", "active", 1 ); + ok( panels.eq( 0 ).is( ":hidden" ), "first panel hidden" ); + ok( panels.eq( 1 ).is( ":visible" ), "second panel visible" ); + $.fn.animate = animate; +}); + +asyncTest( "{ animate: Number }", function() { + expect( 7 ); + var element = $( "#list1" ).accordion({ + animate: 100 + }), + panels = element.find( ".ui-accordion-content" ), + animate = $.fn.animate; + // called twice (both panels) + $.fn.animate = function( props, options ) { + equal( options.duration, 100, "correct duration" ); + equal( options.easing, undefined, "default easing" ); + animate.apply( this, arguments ); + }; + + ok( panels.eq( 0 ).is( ":visible" ), "first panel visible" ); + element.accordion( "option", "active", 1 ); + panels.promise().done(function() { + ok( panels.eq( 0 ).is( ":hidden" ), "first panel hidden" ); + ok( panels.eq( 1 ).is( ":visible" ), "second panel visible" ); + $.fn.animate = animate; + start(); + }); +}); + +asyncTest( "{ animate: String }", function() { + expect( 7 ); + var element = $( "#list1" ).accordion({ + animate: "linear" + }), + panels = element.find( ".ui-accordion-content" ), + animate = $.fn.animate; + // called twice (both panels) + $.fn.animate = function( props, options ) { + equal( options.duration, undefined, "default duration" ); + equal( options.easing, "linear", "correct easing" ); + animate.apply( this, arguments ); + }; + + ok( panels.eq( 0 ).is( ":visible" ), "first panel visible" ); + element.accordion( "option", "active", 1 ); + panels.promise().done(function() { + ok( panels.eq( 0 ).is( ":hidden" ), "first panel hidden" ); + ok( panels.eq( 1 ).is( ":visible" ), "second panel visible" ); + $.fn.animate = animate; + start(); + }); +}); + +asyncTest( "{ animate: {} }", function() { + expect( 7 ); + var element = $( "#list1" ).accordion({ + animate: {} + }), + panels = element.find( ".ui-accordion-content" ), + animate = $.fn.animate; + // called twice (both panels) + $.fn.animate = function( props, options ) { + equal( options.duration, undefined, "default duration" ); + equal( options.easing, undefined, "default easing" ); + animate.apply( this, arguments ); + }; + + ok( panels.eq( 0 ).is( ":visible" ), "first panel visible" ); + element.accordion( "option", "active", 1 ); + panels.promise().done(function() { + ok( panels.eq( 0 ).is( ":hidden" ), "first panel hidden" ); + ok( panels.eq( 1 ).is( ":visible" ), "second panel visible" ); + $.fn.animate = animate; + start(); + }); +}); + +asyncTest( "{ animate: { duration, easing } }", function() { + expect( 7 ); + var element = $( "#list1" ).accordion({ + animate: { duration: 100, easing: "linear" } + }), + panels = element.find( ".ui-accordion-content" ), + animate = $.fn.animate; + // called twice (both panels) + $.fn.animate = function( props, options ) { + equal( options.duration, 100, "correct duration" ); + equal( options.easing, "linear", "correct easing" ); + animate.apply( this, arguments ); + }; + + ok( panels.eq( 0 ).is( ":visible" ), "first panel visible" ); + element.accordion( "option", "active", 1 ); + panels.promise().done(function() { + ok( panels.eq( 0 ).is( ":hidden" ), "first panel hidden" ); + ok( panels.eq( 1 ).is( ":visible" ), "second panel visible" ); + $.fn.animate = animate; + start(); + }); +}); + +asyncTest( "{ animate: { duration, easing } }, animate down", function() { + expect( 7 ); + var element = $( "#list1" ).accordion({ + active: 1, + animate: { duration: 100, easing: "linear" } + }), + panels = element.find( ".ui-accordion-content" ), + animate = $.fn.animate; + // called twice (both panels) + $.fn.animate = function( props, options ) { + equal( options.duration, 100, "correct duration" ); + equal( options.easing, "linear", "correct easing" ); + animate.apply( this, arguments ); + }; + + ok( panels.eq( 1 ).is( ":visible" ), "first panel visible" ); + element.accordion( "option", "active", 0 ); + panels.promise().done(function() { + ok( panels.eq( 1 ).is( ":hidden" ), "first panel hidden" ); + ok( panels.eq( 0 ).is( ":visible" ), "second panel visible" ); + $.fn.animate = animate; + start(); + }); +}); + +asyncTest( "{ animate: { duration, easing, down } }, animate down", function() { + expect( 7 ); + var element = $( "#list1" ).accordion({ + active: 1, + animate: { + duration: 100, + easing: "linear", + down: { + easing: "swing" + } + } + }), + panels = element.find( ".ui-accordion-content" ), + animate = $.fn.animate; + // called twice (both panels) + $.fn.animate = function( props, options ) { + equal( options.duration, 100, "correct duration" ); + equal( options.easing, "swing", "correct easing" ); + animate.apply( this, arguments ); + }; + + ok( panels.eq( 1 ).is( ":visible" ), "first panel visible" ); + element.accordion( "option", "active", 0 ); + panels.promise().done(function() { + ok( panels.eq( 1 ).is( ":hidden" ), "first panel hidden" ); + ok( panels.eq( 0 ).is( ":visible" ), "second panel visible" ); + $.fn.animate = animate; + start(); + }); +}); + +test( "{ collapsible: false }", function() { + expect( 4 ); + var element = $( "#list1" ).accordion({ + active: 1 + }); + element.accordion( "option", "active", false ); + equal( element.accordion( "option", "active" ), 1 ); + state( element, 0, 1, 0 ); + + element.find( ".ui-accordion-header" ).eq( 1 ).click(); + equal( element.accordion( "option", "active" ), 1 ); + state( element, 0, 1, 0 ); +}); + +test( "{ collapsible: true }", function() { + expect( 6 ); + var element = $( "#list1" ).accordion({ + active: 1, + collapsible: true + }); + + element.accordion( "option", "active", false ); + equal( element.accordion( "option", "active" ), false ); + state( element, 0, 0, 0 ); + + element.accordion( "option", "active", 1 ); + equal( element.accordion( "option", "active" ), 1 ); + state( element, 0, 1, 0 ); + + element.find( ".ui-accordion-header" ).eq( 1 ).click(); + equal( element.accordion( "option", "active" ), false ); + state( element, 0, 0, 0 ); +}); + +test( "{ event: null }", function() { + expect( 5 ); + var element = $( "#list1" ).accordion({ + event: null + }); + state( element, 1, 0, 0 ); + + element.accordion( "option", "active", 1 ); + equal( element.accordion( "option", "active" ), 1 ); + state( element, 0, 1, 0 ); + + // ensure default click handler isn't bound + element.find( ".ui-accordion-header" ).eq( 2 ).click(); + equal( element.accordion( "option", "active" ), 1 ); + state( element, 0, 1, 0 ); +}); + +test( "{ event: custom }", function() { + expect( 11 ); + var element = $( "#list1" ).accordion({ + event: "custom1 custom2" + }); + state( element, 1, 0, 0 ); + + element.find( ".ui-accordion-header" ).eq( 1 ).trigger( "custom1" ); + equal( element.accordion( "option", "active" ), 1 ); + state( element, 0, 1, 0 ); + + // ensure default click handler isn't bound + element.find( ".ui-accordion-header" ).eq( 2 ).trigger( "click" ); + equal( element.accordion( "option", "active" ), 1 ); + state( element, 0, 1, 0 ); + + element.find( ".ui-accordion-header" ).eq( 2 ).trigger( "custom2" ); + equal( element.accordion( "option", "active" ), 2 ); + state( element, 0, 0, 1 ); + + element.accordion( "option", "event", "custom3" ); + + // ensure old event handlers are unbound + element.find( ".ui-accordion-header" ).eq( 1 ).trigger( "custom1" ); + element.find( ".ui-accordion-header" ).eq( 1 ).trigger( "custom2" ); + equal( element.accordion( "option", "active" ), 2 ); + state( element, 0, 0, 1 ); + + element.find( ".ui-accordion-header" ).eq( 1 ).trigger( "custom3" ); + equal( element.accordion( "option", "active" ), 1 ); + state( element, 0, 1, 0 ); +}); + +test( "{ header: default }", function() { + expect( 2 ); + // default: > li > :first-child,> :not(li):even + // > :not(li):even + state( $( "#list1" ).accordion(), 1, 0, 0); + // > li > :first-child + state( $( "#navigation" ).accordion(), 1, 0, 0); +}); + +test( "{ header: custom }", function() { + expect( 6 ); + var element = $( "#navigationWrapper" ).accordion({ + header: "h2" + }); + element.find( "h2" ).each(function() { + ok( $( this ).hasClass( "ui-accordion-header" ) ); + }); + equal( element.find( ".ui-accordion-header" ).length, 3 ); + state( element, 1, 0, 0 ); + element.accordion( "option", "active", 2 ); + state( element, 0, 0, 1 ); +}); + +test( "{ heightStyle: 'auto' }", function() { + expect( 3 ); + var element = $( "#navigation" ).accordion({ heightStyle: "auto" }); + equalHeight( element, 105 ); +}); + +test( "{ heightStyle: 'content' }", function() { + expect( 3 ); + var element = $( "#navigation" ).accordion({ heightStyle: "content" }), + sizes = element.find( ".ui-accordion-content" ).map(function() { + return $( this ).height(); + }).get(); + equal( sizes[ 0 ], 75 ); + equal( sizes[ 1 ], 105 ); + equal( sizes[ 2 ], 45 ); +}); + +test( "{ heightStyle: 'fill' }", function() { + expect( 3 ); + $( "#navigationWrapper" ).height( 500 ); + var element = $( "#navigation" ).accordion({ heightStyle: "fill" }); + equalHeight( element, 455 ); +}); + +test( "{ heightStyle: 'fill' } with sibling", function() { + expect( 3 ); + $( "#navigationWrapper" ).height( 500 ); + $( "

    Lorem Ipsum

    " ) + .css({ + height: 50, + marginTop: 20, + marginBottom: 30 + }) + .prependTo( "#navigationWrapper" ); + var element = $( "#navigation" ).accordion({ heightStyle: "fill" }); + equalHeight( element , 355 ); +}); + +test( "{ heightStyle: 'fill' } with multiple siblings", function() { + expect( 3 ); + $( "#navigationWrapper" ).height( 500 ); + $( "

    Lorem Ipsum

    " ) + .css({ + height: 50, + marginTop: 20, + marginBottom: 30 + }) + .prependTo( "#navigationWrapper" ); + $( "

    Lorem Ipsum

    " ) + .css({ + height: 50, + marginTop: 20, + marginBottom: 30, + position: "absolute" + }) + .prependTo( "#navigationWrapper" ); + $( "

    Lorem Ipsum

    " ) + .css({ + height: 25, + marginTop: 10, + marginBottom: 15 + }) + .prependTo( "#navigationWrapper" ); + var element = $( "#navigation" ).accordion({ heightStyle: "fill" }); + equalHeight( element, 305 ); +}); + +test( "{ icons: false }", function() { + expect( 8 ); + var element = $( "#list1" ); + function icons( on ) { + deepEqual( element.find( "span.ui-icon").length, on ? 3 : 0 ); + deepEqual( element.find( ".ui-accordion-header.ui-accordion-icons" ).length, on ? 3 : 0 ); + } + element.accordion(); + icons( true ); + element.accordion( "destroy" ).accordion({ + icons: false + }); + icons( false ); + element.accordion( "option", "icons", { header: "foo", activeHeader: "bar" } ); + icons( true ); + element.accordion( "option", "icons", false ); + icons( false ); +}); + +test( "{ icons: hash }", function() { + expect( 3 ); + var element = $( "#list1" ).accordion({ + icons: { activeHeader: "a1", header: "h1" } + }); + ok( element.find( ".ui-accordion-header.ui-state-active span.ui-icon" ).hasClass( "a1" ) ); + element.accordion( "option", "icons", { activeHeader: "a2", header: "h2" } ); + ok( !element.find( ".ui-accordion-header.ui-state-active span.ui-icon" ).hasClass( "a1" ) ); + ok( element.find( ".ui-accordion-header.ui-state-active span.ui-icon" ).hasClass( "a2" ) ); +}); + +}( jQuery ) ); diff --git a/include/jQuery/jquery-ui/tests/unit/accordion/accordion_test_helpers.js b/include/jQuery/jquery-ui/tests/unit/accordion/accordion_test_helpers.js new file mode 100755 index 00000000..643f8e28 --- /dev/null +++ b/include/jQuery/jquery-ui/tests/unit/accordion/accordion_test_helpers.js @@ -0,0 +1,27 @@ +TestHelpers.accordion = { + equalHeight: function( accordion, height ) { + accordion.find( ".ui-accordion-content" ).each(function() { + equal( $( this ).outerHeight(), height ); + }); + }, + + setupTeardown: function() { + var animate = $.ui.accordion.prototype.options.animate; + return { + setup: function() { + $.ui.accordion.prototype.options.animate = false; + }, + teardown: function() { + $.ui.accordion.prototype.options.animate = animate; + } + }; + }, + + state: function( accordion ) { + var expected = $.makeArray( arguments ).slice( 1 ), + actual = accordion.find( ".ui-accordion-content" ).map(function() { + return $( this ).css( "display" ) === "none" ? 0 : 1; + }).get(); + QUnit.push( QUnit.equiv(actual, expected), actual, expected ); + } +}; diff --git a/include/jQuery/jquery-ui/tests/unit/autocomplete/autocomplete_common.js b/include/jQuery/jquery-ui/tests/unit/autocomplete/autocomplete_common.js new file mode 100755 index 00000000..63b24d38 --- /dev/null +++ b/include/jQuery/jquery-ui/tests/unit/autocomplete/autocomplete_common.js @@ -0,0 +1,29 @@ +TestHelpers.commonWidgetTests( "autocomplete", { + defaults: { + appendTo: null, + autoFocus: false, + delay: 300, + disabled: false, + messages: { + noResults: "No search results.", + results: $.ui.autocomplete.prototype.options.messages.results + }, + minLength: 1, + position: { + my: "left top", + at: "left bottom", + collision: "none" + }, + source: null, + + // callbacks + change: null, + close: null, + create: null, + focus: null, + open: null, + response: null, + search: null, + select: null + } +}); diff --git a/include/jQuery/jquery-ui/tests/unit/autocomplete/autocomplete_core.js b/include/jQuery/jquery-ui/tests/unit/autocomplete/autocomplete_core.js new file mode 100755 index 00000000..679955d1 --- /dev/null +++ b/include/jQuery/jquery-ui/tests/unit/autocomplete/autocomplete_core.js @@ -0,0 +1,270 @@ +(function( $ ) { + +module( "autocomplete: core" ); + +test( "prevent form submit on enter when menu is active", function() { + expect( 2 ); + var event, + element = $( "#autocomplete" ) + .autocomplete({ + source: [ "java", "javascript" ] + }) + .val( "ja" ) + .autocomplete( "search" ), + menu = element.autocomplete( "widget" ); + + event = $.Event( "keydown" ); + event.keyCode = $.ui.keyCode.DOWN; + element.trigger( event ); + deepEqual( menu.find( ".ui-menu-item:has(.ui-state-focus)" ).length, 1, "menu item is active" ); + + event = $.Event( "keydown" ); + event.keyCode = $.ui.keyCode.ENTER; + element.trigger( event ); + ok( event.isDefaultPrevented(), "default action is prevented" ); +}); + +test( "allow form submit on enter when menu is not active", function() { + expect( 1 ); + var event, + element = $( "#autocomplete" ) + .autocomplete({ + autoFocus: false, + source: [ "java", "javascript" ] + }) + .val( "ja" ) + .autocomplete( "search" ); + + event = $.Event( "keydown" ); + event.keyCode = $.ui.keyCode.ENTER; + element.trigger( event ); + ok( !event.isDefaultPrevented(), "default action is prevented" ); +}); + +(function() { + test( "up arrow invokes search - input", function() { + arrowsInvokeSearch( "#autocomplete", true, true ); + }); + + test( "down arrow invokes search - input", function() { + arrowsInvokeSearch( "#autocomplete", false, true ); + }); + + test( "up arrow invokes search - textarea", function() { + arrowsInvokeSearch( "#autocomplete-textarea", true, false ); + }); + + test( "down arrow invokes search - textarea", function() { + arrowsInvokeSearch( "#autocomplete-textarea", false, false ); + }); + + test( "up arrow invokes search - contenteditable", function() { + arrowsInvokeSearch( "#autocomplete-contenteditable", true, false ); + }); + + test( "down arrow invokes search - contenteditable", function() { + arrowsInvokeSearch( "#autocomplete-contenteditable", false, false ); + }); + + test( "up arrow moves focus - input", function() { + arrowsMoveFocus( "#autocomplete", true ); + }); + + test( "down arrow moves focus - input", function() { + arrowsMoveFocus( "#autocomplete", false ); + }); + + test( "up arrow moves focus - textarea", function() { + arrowsMoveFocus( "#autocomplete-textarea", true ); + }); + + test( "down arrow moves focus - textarea", function() { + arrowsMoveFocus( "#autocomplete-textarea", false ); + }); + + test( "up arrow moves focus - contenteditable", function() { + arrowsMoveFocus( "#autocomplete-contenteditable", true ); + }); + + test( "down arrow moves focus - contenteditable", function() { + arrowsMoveFocus( "#autocomplete-contenteditable", false ); + }); + + test( "up arrow moves cursor - input", function() { + arrowsNavigateElement( "#autocomplete", true, false ); + }); + + test( "down arrow moves cursor - input", function() { + arrowsNavigateElement( "#autocomplete", false, false ); + }); + + test( "up arrow moves cursor - textarea", function() { + arrowsNavigateElement( "#autocomplete-textarea", true, true ); + }); + + test( "down arrow moves cursor - textarea", function() { + arrowsNavigateElement( "#autocomplete-textarea", false, true ); + }); + + test( "up arrow moves cursor - contenteditable", function() { + arrowsNavigateElement( "#autocomplete-contenteditable", true, true ); + }); + + test( "down arrow moves cursor - contenteditable", function() { + arrowsNavigateElement( "#autocomplete-contenteditable", false, true ); + }); + + function arrowsInvokeSearch( id, isKeyUp, shouldMove ) { + expect( 1 ); + + var didMove = false, + element = $( id ).autocomplete({ + source: [ "a" ], + delay: 0, + minLength: 0 + }); + element.data( "ui-autocomplete" )._move = function() { + didMove = true; + }; + element.simulate( "keydown", { keyCode: ( isKeyUp ? $.ui.keyCode.UP : $.ui.keyCode.DOWN ) } ); + equal( didMove, shouldMove, "respond to arrow" ); + } + + function arrowsMoveFocus( id, isKeyUp ) { + expect( 1 ); + + var element = $( id ).autocomplete({ + source: [ "a" ], + delay: 0, + minLength: 0 + }); + element.data( "ui-autocomplete" )._move = function() { + ok( true, "repsond to arrow" ); + }; + element.autocomplete( "search" ); + element.simulate( "keydown", { keyCode: ( isKeyUp ? $.ui.keyCode.UP : $.ui.keyCode.DOWN ) } ); + } + + function arrowsNavigateElement( id, isKeyUp, shouldMove ) { + expect( 1 ); + + var didMove = false, + element = $( id ).autocomplete({ + source: [ "a" ], + delay: 0, + minLength: 0 + }); + element.on( "keypress", function( e ) { + didMove = !e.isDefaultPrevented(); + }); + element.simulate( "keydown", { keyCode: ( isKeyUp ? $.ui.keyCode.UP : $.ui.keyCode.DOWN ) } ); + element.simulate( "keypress" ); + equal( didMove, shouldMove, "respond to arrow" ); + } +})(); + +asyncTest( "handle race condition", function() { + expect( 3 ); + var count = 0, + element = $( "#autocomplete" ).autocomplete({ + source: function( request, response ) { + count++; + if ( request.term.length === 1 ) { + equal( count, 1, "request with 1 character is first" ); + setTimeout(function() { + response([ "one" ]); + setTimeout( checkResults, 1 ); + }, 1 ); + return; + } + equal( count, 2, "request with 2 characters is second" ); + response([ "two" ]); + } + }); + + element.autocomplete( "search", "a" ); + element.autocomplete( "search", "ab" ); + + function checkResults() { + equal( element.autocomplete( "widget" ).find( ".ui-menu-item" ).text(), "two", + "correct results displayed" ); + start(); + } +}); + +asyncTest( "simultaneous searches (#9334)", function() { + expect( 2 ); + var element = $( "#autocomplete" ).autocomplete({ + source: function( request, response ) { + setTimeout(function() { + response([ request.term ]); + }); + }, + response: function() { + ok( true, "response from first instance" ); + } + }), + element2 = $( "#autocomplete-textarea" ).autocomplete({ + source: function( request, response ) { + setTimeout(function() { + response([ request.term ]); + }); + }, + response: function() { + ok( true, "response from second instance" ); + start(); + } + }); + + element.autocomplete( "search", "test" ); + element2.autocomplete( "search", "test" ); +}); + +test( "ARIA", function() { + expect( 7 ); + var element = $( "#autocomplete" ).autocomplete({ + source: [ "java", "javascript" ] + }), + liveRegion = element.data( "ui-autocomplete" ).liveRegion; + + equal( liveRegion.text(), "", "Empty live region on create" ); + + element.autocomplete( "search", "j" ); + equal( liveRegion.text(), "2 results are available, use up and down arrow keys to navigate.", + "Live region for multiple values" ); + + element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } ); + equal( liveRegion.text(), "2 results are available, use up and down arrow keys to navigate.", + "Live region not changed on focus" ); + + element.one( "autocompletefocus", function( event ) { + event.preventDefault(); + }); + element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } ); + equal( liveRegion.text(), "javascript", + "Live region updated when default focus is prevented" ); + + element.autocomplete( "search", "javas" ); + equal( liveRegion.text(), "1 result is available, use up and down arrow keys to navigate.", + "Live region for one value" ); + + element.autocomplete( "search", "z" ); + equal( liveRegion.text(), "No search results.", + "Live region for no values" ); + + element.autocomplete( "search", "j" ); + equal( liveRegion.text(), "2 results are available, use up and down arrow keys to navigate.", + "Live region for multiple values" ); +}); + +test( ".replaceWith() (#9172)", function() { + expect( 1 ); + + var element = $( "#autocomplete" ).autocomplete(), + replacement = "
    test
    ", + parent = element.parent(); + element.replaceWith( replacement ); + equal( parent.html().toLowerCase(), replacement ); +}); + +}( jQuery ) ); diff --git a/include/jQuery/jquery-ui/tests/unit/autocomplete/autocomplete_events.js b/include/jQuery/jquery-ui/tests/unit/autocomplete/autocomplete_events.js new file mode 100755 index 00000000..fb1cf73a --- /dev/null +++ b/include/jQuery/jquery-ui/tests/unit/autocomplete/autocomplete_events.js @@ -0,0 +1,182 @@ +(function( $ ) { + +module( "autocomplete: events" ); + +var data = [ "Clojure", "COBOL", "ColdFusion", "Java", "JavaScript", "Scala", "Scheme" ]; + +$.each([ + { + type: "input", + selector: "#autocomplete", + valueMethod: "val" + }, + { + type: "textarea", + selector: "#autocomplete-textarea", + valueMethod: "val" + }, + { + type: "contenteditable", + selector: "#autocomplete-contenteditable", + valueMethod: "text" + } +], function( i, settings ) { + asyncTest( "all events - " + settings.type, function() { + expect( 13 ); + var element = $( settings.selector ) + .autocomplete({ + autoFocus: false, + delay: 0, + source: data, + search: function( event ) { + equal( event.originalEvent.type, "keydown", "search originalEvent" ); + }, + response: function( event, ui ) { + deepEqual( ui.content, [ + { label: "Clojure", value: "Clojure" }, + { label: "Java", value: "Java" }, + { label: "JavaScript", value: "JavaScript" } + ], "response ui.content" ); + ui.content.splice( 0, 1 ); + }, + open: function() { + ok( menu.is( ":visible" ), "menu open on open" ); + }, + focus: function( event, ui ) { + equal( event.originalEvent.type, "menufocus", "focus originalEvent" ); + deepEqual( ui.item, { label: "Java", value: "Java" }, "focus ui.item" ); + }, + close: function( event ) { + equal( event.originalEvent.type, "menuselect", "close originalEvent" ); + ok( menu.is( ":hidden" ), "menu closed on close" ); + }, + select: function( event, ui ) { + equal( event.originalEvent.type, "menuselect", "select originalEvent" ); + deepEqual( ui.item, { label: "Java", value: "Java" }, "select ui.item" ); + }, + change: function( event, ui ) { + equal( event.originalEvent.type, "blur", "change originalEvent" ); + deepEqual( ui.item, { label: "Java", value: "Java" }, "change ui.item" ); + ok( menu.is( ":hidden" ), "menu closed on change" ); + start(); + } + }), + menu = element.autocomplete( "widget" ); + + element.simulate( "focus" )[ settings.valueMethod ]( "j" ).keydown(); + setTimeout(function() { + ok( menu.is( ":visible" ), "menu is visible after delay" ); + element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } ); + element.simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } ); + // blur must be async for IE to handle it properly + setTimeout(function() { + element.simulate( "blur" ); + }, 1 ); + }, 50 ); + }); +}); + +asyncTest( "change without selection", function() { + expect( 1 ); + var element = $( "#autocomplete" ).autocomplete({ + delay: 0, + source: data, + change: function( event, ui ) { + strictEqual( ui.item, null ); + start(); + } + }); + element.triggerHandler( "focus" ); + element.val( "ja" ).triggerHandler( "blur" ); +}); + +asyncTest( "cancel search", function() { + expect( 6 ); + var first = true, + element = $( "#autocomplete" ).autocomplete({ + delay: 0, + source: data, + search: function() { + if ( first ) { + equal( element.val(), "ja", "val on first search" ); + first = false; + return false; + } + equal( element.val(), "java", "val on second search" ); + }, + open: function() { + ok( true, "menu opened" ); + } + }), + menu = element.autocomplete( "widget" ); + element.val( "ja" ).keydown(); + setTimeout(function() { + ok( menu.is( ":hidden" ), "menu is hidden after first search" ); + element.val( "java" ).keydown(); + setTimeout(function() { + ok( menu.is( ":visible" ), "menu is visible after second search" ); + equal( menu.find( ".ui-menu-item" ).length, 2, "# of menu items" ); + start(); + }, 50 ); + }, 50 ); +}); + +asyncTest( "cancel focus", function() { + expect( 1 ); + var customVal = "custom value", + element = $( "#autocomplete" ).autocomplete({ + delay: 0, + source: data, + focus: function() { + $( this ).val( customVal ); + return false; + } + }); + element.val( "ja" ).keydown(); + setTimeout(function() { + element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } ); + equal( element.val(), customVal ); + start(); + }, 50 ); +}); + +asyncTest( "cancel select", function() { + expect( 1 ); + var customVal = "custom value", + element = $( "#autocomplete" ).autocomplete({ + delay: 0, + source: data, + select: function() { + $( this ).val( customVal ); + return false; + } + }); + element.val( "ja" ).keydown(); + setTimeout(function() { + element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } ); + element.simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } ); + equal( element.val(), customVal ); + start(); + }, 50 ); +}); + +asyncTest( "blur during remote search", function() { + expect( 1 ); + var ac = $( "#autocomplete" ).autocomplete({ + delay: 0, + source: function( request, response ) { + ok( true, "trigger request" ); + ac.simulate( "blur" ); + setTimeout(function() { + response([ "result" ]); + start(); + }, 100 ); + }, + open: function() { + ok( false, "opened after a blur" ); + } + }); + ac.val( "ro" ).keydown(); +}); + +}( jQuery ) ); diff --git a/include/jQuery/jquery-ui/tests/unit/autocomplete/autocomplete_methods.js b/include/jQuery/jquery-ui/tests/unit/autocomplete/autocomplete_methods.js new file mode 100755 index 00000000..1bfa1055 --- /dev/null +++ b/include/jQuery/jquery-ui/tests/unit/autocomplete/autocomplete_methods.js @@ -0,0 +1,45 @@ +(function( $ ) { + +module( "autocomplete: methods" ); + +test( "destroy", function() { + expect( 1 ); + domEqual( "#autocomplete", function() { + $( "#autocomplete" ).autocomplete().autocomplete( "destroy" ); + }); +}); + +test( "search, close", function() { + expect( 6 ); + var data = [ "c++", "java", "php", "coldfusion", "javascript", "asp", "ruby", "python", "c", "scala", "groovy", "haskell", "perl" ], + element = $( "#autocomplete" ).autocomplete({ + source: data, + minLength: 0 + }), + menu = element.autocomplete( "widget" ); + + ok( menu.is( ":hidden" ), "menu is hidden on init" ); + + element.autocomplete( "search" ); + ok( menu.is( ":visible" ), "menu is visible after search" ); + equal( menu.find( ".ui-menu-item" ).length, data.length, "all items for a blank search" ); + + element.val( "has" ).autocomplete( "search" ); + equal( menu.find( ".ui-menu-item" ).text(), "haskell", "only one item for set input value" ); + + element.autocomplete( "search", "ja" ); + equal( menu.find( ".ui-menu-item" ).length, 2, "only java and javascript for 'ja'" ); + + element.autocomplete( "close" ); + ok( menu.is( ":hidden" ), "menu is hidden after close" ); +}); + +test( "widget", function() { + expect( 2 ); + var element = $( "#autocomplete" ).autocomplete(), + widgetElement = element.autocomplete( "widget" ); + equal( widgetElement.length, 1, "one element" ); + ok( widgetElement.is( ".ui-menu" ), "menu element" ); +}); + +}( jQuery ) ); diff --git a/include/jQuery/jquery-ui/tests/unit/autocomplete/autocomplete_options.js b/include/jQuery/jquery-ui/tests/unit/autocomplete/autocomplete_options.js new file mode 100755 index 00000000..0a2e07bf --- /dev/null +++ b/include/jQuery/jquery-ui/tests/unit/autocomplete/autocomplete_options.js @@ -0,0 +1,278 @@ +(function( $ ) { + +module( "autocomplete: options" ); + +var data = [ "c++", "java", "php", "coldfusion", "javascript", "asp", "ruby", + "python", "c", "scala", "groovy", "haskell", "perl" ]; + +test( "appendTo", function() { + expect( 8 ); + var detached = $( "
    " ), + element = $( "#autocomplete" ).autocomplete(); + equal( element.autocomplete( "widget" ).parent()[ 0 ], document.body, + "defaults to body" ); + element.autocomplete( "destroy" ); + + element.autocomplete({ + appendTo: ".autocomplete-wrap" + }); + equal( element.autocomplete( "widget" ).parent()[ 0 ], + $( "#autocomplete-wrap1" )[ 0 ], "first found element" ); + equal( $( "#autocomplete-wrap2 .ui-autocomplete" ).length, 0, + "only appends to one element" ); + element.autocomplete( "destroy" ); + + $( "#autocomplete-wrap2" ).addClass( "ui-front" ); + element.autocomplete(); + equal( element.autocomplete( "widget" ).parent()[ 0 ], + $( "#autocomplete-wrap2" )[ 0 ], "null, inside .ui-front" ); + element.autocomplete( "destroy" ); + $( "#autocomlete-wrap2" ).removeClass( "ui-front" ); + + element.autocomplete().autocomplete( "option", "appendTo", "#autocomplete-wrap1" ); + equal( element.autocomplete( "widget" ).parent()[ 0 ], + $( "#autocomplete-wrap1" )[ 0 ], "modified after init" ); + element.autocomplete( "destroy" ); + + element.autocomplete({ + appendTo: detached + }); + equal( element.autocomplete( "widget" ).parent()[ 0 ], detached[ 0 ], + "detached jQuery object" ); + element.autocomplete( "destroy" ); + + element.autocomplete({ + appendTo: detached[ 0 ] + }); + equal( element.autocomplete( "widget" ).parent()[ 0 ], detached[ 0 ], + "detached DOM element" ); + element.autocomplete( "destroy" ); + + element.autocomplete().autocomplete( "option", "appendTo", detached ); + equal( element.autocomplete( "widget" ).parent()[ 0 ], detached[ 0 ], + "detached DOM element via option()" ); + element.autocomplete( "destroy" ); +}); + +function autoFocusTest( afValue, focusedLength ) { + var element = $( "#autocomplete" ).autocomplete({ + autoFocus: afValue, + delay: 0, + source: data, + open: function() { + equal( + element.autocomplete( "widget" ) + .children( ".ui-menu-item:first" ) + .find( ".ui-state-focus" ) + .length, + focusedLength, + "first item is " + (afValue ? "" : "not") + " auto focused" ); + start(); + } + }); + element.val( "ja" ).keydown(); + stop(); +} + +test( "autoFocus: false", function() { + expect( 1 ); + autoFocusTest( false, 0 ); +}); + +test( "autoFocus: true", function() { + expect( 1 ); + autoFocusTest( true, 1 ); +}); + +asyncTest( "delay", function() { + expect( 2 ); + var element = $( "#autocomplete" ).autocomplete({ + source: data, + delay: 50 + }), + menu = element.autocomplete( "widget" ); + element.val( "ja" ).keydown(); + + ok( menu.is( ":hidden" ), "menu is closed immediately after search" ); + + setTimeout(function() { + ok( menu.is( ":visible" ), "menu is open after delay" ); + start(); + }, 100 ); +}); + +asyncTest( "disabled", function() { + expect( 2 ); + var element = $( "#autocomplete" ).autocomplete({ + source: data, + delay: 0, + disabled: true + }), + menu = element.autocomplete( "widget" ); + element.val( "ja" ).keydown(); + + ok( menu.is( ":hidden" ) ); + + setTimeout(function() { + ok( menu.is( ":hidden" ) ); + start(); + }, 50 ); +}); + +test( "minLength", function() { + expect( 2 ); + var element = $( "#autocomplete" ).autocomplete({ + source: data + }), + menu = element.autocomplete( "widget" ); + element.autocomplete( "search", "" ); + ok( menu.is( ":hidden" ), "blank not enough for minLength: 1" ); + + element.autocomplete( "option", "minLength", 0 ); + element.autocomplete( "search", "" ); + ok( menu.is( ":visible" ), "blank enough for minLength: 0" ); +}); + +asyncTest( "minLength, exceed then drop below", function() { + expect( 4 ); + var element = $( "#autocomplete" ).autocomplete({ + minLength: 2, + source: function( req, res ) { + equal( req.term, "12", "correct search term" ); + setTimeout(function() { + res([ "item" ]); + }, 1 ); + } + }), + menu = element.autocomplete( "widget" ); + + ok( menu.is( ":hidden" ), "menu is hidden before first search" ); + element.autocomplete( "search", "12" ); + + ok( menu.is( ":hidden" ), "menu is hidden before second search" ); + element.autocomplete( "search", "1" ); + + setTimeout(function() { + ok( menu.is( ":hidden" ), "menu is hidden after searches" ); + start(); + }, 50 ); +}); + +test( "minLength, exceed then drop below then exceed", function() { + expect( 3 ); + var _res = [], + element = $( "#autocomplete" ).autocomplete({ + minLength: 2, + source: function( req, res ) { + _res.push( res ); + } + }), + menu = element.autocomplete( "widget" ); + + // trigger a valid search + ok( menu.is( ":hidden" ), "menu is hidden before first search" ); + element.autocomplete( "search", "12" ); + + // trigger a search below the minLength, to turn on cancelSearch flag + ok( menu.is( ":hidden" ), "menu is hidden before second search" ); + element.autocomplete( "search", "1" ); + + // trigger a valid search + element.autocomplete( "search", "13" ); + // react as if the first search was cancelled (default ajax behavior) + _res[ 0 ]([]); + // react to second search + _res[ 1 ]([ "13" ]); + + ok( menu.is( ":visible" ), "menu is visible after searches" ); +}); + +test( "source, local string array", function() { + expect( 1 ); + var element = $( "#autocomplete" ).autocomplete({ + source: data + }), + menu = element.autocomplete( "widget" ); + element.val( "ja" ).autocomplete( "search" ); + equal( menu.find( ".ui-menu-item" ).text(), "javajavascript" ); +}); + +function sourceTest( source, async ) { + var element = $( "#autocomplete" ).autocomplete({ + source: source + }), + menu = element.autocomplete( "widget" ); + function result() { + equal( menu.find( ".ui-menu-item" ).text(), "javajavascript" ); + element.autocomplete( "destroy" ); + if ( async ) { + start(); + } + } + if ( async ) { + stop(); + $( document ).one( "ajaxStop", result ); + } + element.val( "ja" ).autocomplete( "search" ); + if ( !async ) { + result(); + } +} + +test( "source, local object array, only label property", function() { + expect( 1 ); + sourceTest([ + { label: "java" }, + { label: "php" }, + { label: "coldfusion" }, + { label: "javascript" } + ]); +}); + +test( "source, local object array, only value property", function() { + expect( 1 ); + sourceTest([ + { value: "java" }, + { value: "php" }, + { value: "coldfusion" }, + { value: "javascript" } + ]); +}); + +test( "source, url string with remote json string array", function() { + expect( 1 ); + sourceTest( "remote_string_array.txt", true ); +}); + +test( "source, url string with remote json object array, only value properties", function() { + expect( 1 ); + sourceTest( "remote_object_array_values.txt", true ); +}); + +test( "source, url string with remote json object array, only label properties", function() { + expect( 1 ); + sourceTest( "remote_object_array_labels.txt", true ); +}); + +test( "source, custom", function() { + expect( 2 ); + sourceTest(function( request, response ) { + equal( request.term, "ja" ); + response( ["java", "javascript"] ); + }); +}); + +test( "source, update after init", function() { + expect( 2 ); + var element = $( "#autocomplete" ).autocomplete({ + source: [ "java", "javascript", "haskell" ] + }), + menu = element.autocomplete( "widget" ); + element.val( "ja" ).autocomplete( "search" ); + equal( menu.find( ".ui-menu-item" ).text(), "javajavascript" ); + element.autocomplete( "option", "source", [ "php", "asp" ] ); + element.val( "ph" ).autocomplete( "search" ); + equal( menu.find( ".ui-menu-item" ).text(), "php" ); +}); + +}( jQuery ) ); diff --git a/include/jQuery/jquery-ui/tests/unit/button/button_common.js b/include/jQuery/jquery-ui/tests/unit/button/button_common.js new file mode 100755 index 00000000..ef22d301 --- /dev/null +++ b/include/jQuery/jquery-ui/tests/unit/button/button_common.js @@ -0,0 +1,14 @@ +TestHelpers.commonWidgetTests( "button", { + defaults: { + disabled: null, + icons: { + primary: null, + secondary: null + }, + label: null, + text: true, + + // callbacks + create: null + } +}); diff --git a/include/jQuery/jquery-ui/tests/unit/button/button_core.js b/include/jQuery/jquery-ui/tests/unit/button/button_core.js new file mode 100755 index 00000000..41623e08 --- /dev/null +++ b/include/jQuery/jquery-ui/tests/unit/button/button_core.js @@ -0,0 +1,212 @@ +/* + * button_core.js + */ + + +(function($) { + +module("button: core"); + +test("checkbox", function() { + expect( 4 ); + var input = $("#check"), + label = $("label[for=check]"); + ok( input.is(":visible") ); + ok( label.is(":not(.ui-button)") ); + input.button(); + ok( input.is(".ui-helper-hidden-accessible") ); + ok( label.is(".ui-button") ); +}); + +test("radios", function() { + expect( 4 ); + var inputs = $("#radio0 input"), + labels = $("#radio0 label"); + ok( inputs.is(":visible") ); + ok( labels.is(":not(.ui-button)") ); + inputs.button(); + ok( inputs.is(".ui-helper-hidden-accessible") ); + ok( labels.is(".ui-button") ); +}); + +function assert(noForm, form1, form2) { + ok( $("#radio0 .ui-button" + noForm).is(".ui-state-active") ); + ok( $("#radio1 .ui-button" + form1).is(".ui-state-active") ); + ok( $("#radio2 .ui-button" + form2).is(".ui-state-active") ); +} + +test("radio groups", function() { + expect( 12 ); + $("input[type=radio]").button(); + assert(":eq(0)", ":eq(1)", ":eq(2)"); + + // click outside of forms + $("#radio0 .ui-button:eq(1)").click(); + assert(":eq(1)", ":eq(1)", ":eq(2)"); + + // click in first form + $("#radio1 .ui-button:eq(0)").click(); + assert(":eq(1)", ":eq(0)", ":eq(2)"); + + // click in second form + $("#radio2 .ui-button:eq(0)").click(); + assert(":eq(1)", ":eq(0)", ":eq(0)"); +}); + +test("input type submit, don't create child elements", function() { + expect( 2 ); + var input = $("#submit"); + deepEqual( input.children().length, 0 ); + input.button(); + deepEqual( input.children().length, 0 ); +}); + +test("buttonset", function() { + expect( 6 ); + var set = $("#radio1").buttonset(); + ok( set.is(".ui-buttonset") ); + deepEqual( set.children(".ui-button").length, 3 ); + deepEqual( set.children("input[type=radio].ui-helper-hidden-accessible").length, 3 ); + ok( set.children("label:eq(0)").is(".ui-button.ui-corner-left:not(.ui-corner-all)") ); + ok( set.children("label:eq(1)").is(".ui-button:not(.ui-corner-all)") ); + ok( set.children("label:eq(2)").is(".ui-button.ui-corner-right:not(.ui-corner-all)") ); +}); + +test("buttonset (rtl)", function() { + expect( 6 ); + var set, + parent = $("#radio1").parent(); + // Set to rtl + parent.attr("dir", "rtl"); + + set = $("#radio1").buttonset(); + ok( set.is(".ui-buttonset") ); + deepEqual( set.children(".ui-button").length, 3 ); + deepEqual( set.children("input[type=radio].ui-helper-hidden-accessible").length, 3 ); + ok( set.children("label:eq(0)").is(".ui-button.ui-corner-right:not(.ui-corner-all)") ); + ok( set.children("label:eq(1)").is(".ui-button:not(.ui-corner-all)") ); + ok( set.children("label:eq(2)").is(".ui-button.ui-corner-left:not(.ui-corner-all)") ); +}); + +// TODO: simulated click events don't behave like real click events in IE +// remove this when simulate properly simulates this +// see http://yuilibrary.com/projects/yui2/ticket/2528826 fore more info +if ( !$.ui.ie || ( document.documentMode && document.documentMode > 8 ) ) { + asyncTest( "ensure checked and aria after single click on checkbox label button, see #5518", function() { + expect( 3 ); + + $("#check2").button().change( function() { + var lbl = $( this ).button("widget"); + ok( this.checked, "checked ok" ); + ok( lbl.attr("aria-pressed") === "true", "aria ok" ); + ok( lbl.hasClass("ui-state-active"), "ui-state-active ok" ); + }); + + // support: Opera + // Opera doesn't trigger a change event when this is done synchronously. + // This seems to be a side effect of another test, but until that can be + // tracked down, this delay will have to do. + setTimeout(function() { + $("#check2").button("widget").simulate("click"); + start(); + }, 1 ); + }); +} + +test( "#7092 - button creation that requires a matching label does not find label in all cases", function() { + expect( 5 ); + var group = $( "" ); + group.find( "input[type=checkbox]" ).button(); + ok( group.find( "label" ).is( ".ui-button" ) ); + + group = $( "" ); + group.filter( "input[type=checkbox]" ).button(); + ok( group.filter( "label" ).is( ".ui-button" ) ); + + group = $( "" ); + group.find( "input[type=checkbox]" ).button(); + ok( group.filter( "label" ).is( ".ui-button" ) ); + + group = $( "" ); + group.find( "input[type=checkbox]" ).button(); + ok( group.find( "label" ).is( ".ui-button" ) ); + + group = $( "" ); + group.filter( "input[type=checkbox]" ).button(); + ok( group.find( "label" ).is( ".ui-button" ) ); +}); + +test( "#5946 - buttonset should ignore buttons that are not :visible", function() { + expect( 2 ); + $( "#radio01" ).next().addBack().hide(); + var set = $( "#radio0" ).buttonset({ items: "input[type=radio]:visible" }); + ok( set.find( "label:eq(0)" ).is( ":not(.ui-button):not(.ui-corner-left)" ) ); + ok( set.find( "label:eq(1)" ).is( ".ui-button.ui-corner-left" ) ); +}); + +test( "#6262 - buttonset not applying ui-corner to invisible elements", function() { + expect( 3 ); + $( "#radio0" ).hide(); + var set = $( "#radio0" ).buttonset(); + ok( set.find( "label:eq(0)" ).is( ".ui-button.ui-corner-left" ) ); + ok( set.find( "label:eq(1)" ).is( ".ui-button" ) ); + ok( set.find( "label:eq(2)" ).is( ".ui-button.ui-corner-right" ) ); +}); + +asyncTest( "Resetting a button's form should refresh the visual state of the button widget to match.", function() { + expect( 2 ); + var form = $( "
    " + + "" + + "" + + "
    " ), + button = form.find( "button" ).button(), + checkbox = form.find( "input[type=checkbox]" ).button(); + + checkbox.prop( "checked", false ).button( "refresh" ); + ok( !checkbox.button( "widget" ).hasClass( "ui-state-active" ) ); + + form.get( 0 ).reset(); + + // #9213: If a button has been removed, refresh should not be called on it when + // its corresponding form is reset. + button.remove(); + + setTimeout(function() { + ok( checkbox.button( "widget" ).hasClass( "ui-state-active" )); + start(); + }, 1 ); +}); + +asyncTest( "#6711 Checkbox/Radiobutton do not Show Focused State when using Keyboard Navigation", function() { + expect( 2 ); + var check = $( "#check" ).button(), + label = $( "label[for='check']" ); + ok( !label.is( ".ui-state-focus" ) ); + check.focus(); + setTimeout(function() { + ok( label.is( ".ui-state-focus" ) ); + start(); + }); +}); + +test( "#7534 - Button label selector works for ids with \":\"", function() { + expect( 1 ); + var group = $( "" ); + group.find( "input" ).button(); + ok( group.find( "label" ).is( ".ui-button" ), "Found an id with a :" ); +}); + +asyncTest( "#9169 - Disabled button maintains ui-state-focus", function() { + expect( 2 ); + var element = $( "#button1" ).button(); + element[ 0 ].focus(); + setTimeout(function() { + ok( element.hasClass( "ui-state-focus" ), "button has ui-state-focus" ); + element.button( "disable" ); + ok( !element.hasClass( "ui-state-focus" ), + "button does not have ui-state-focus when disabled" ); + start(); + }); +}); + +})(jQuery); diff --git a/include/jQuery/jquery-ui/tests/unit/button/button_events.js b/include/jQuery/jquery-ui/tests/unit/button/button_events.js new file mode 100755 index 00000000..2fd03832 --- /dev/null +++ b/include/jQuery/jquery-ui/tests/unit/button/button_events.js @@ -0,0 +1,36 @@ +/* + * button_events.js + */ +(function($) { + +module("button: events"); + +test("buttonset works with single-quote named elements (#7505)", function() { + expect( 1 ); + $("#radio3").buttonset(); + $("#radio33").click( function(){ + ok( true, "button clicks work with single-quote named elements" ); + }).click(); +}); + +asyncTest( "when button loses focus, ensure active state is removed (#8559)", function() { + expect( 1 ); + + var element = $( "#button" ).button(); + + element.one( "keypress", function() { + element.one( "blur", function() { + ok( !element.is(".ui-state-active"), "button loses active state appropriately" ); + start(); + }).blur(); + }); + + element.focus(); + setTimeout(function() { + element + .simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } ) + .simulate( "keypress", { keyCode: $.ui.keyCode.ENTER } ); + }); +}); + +})(jQuery); diff --git a/include/jQuery/jquery-ui/tests/unit/button/button_methods.js b/include/jQuery/jquery-ui/tests/unit/button/button_methods.js new file mode 100755 index 00000000..467938f0 --- /dev/null +++ b/include/jQuery/jquery-ui/tests/unit/button/button_methods.js @@ -0,0 +1,52 @@ +/* + * button_methods.js + */ +(function($) { + + +module("button: methods"); + +test("destroy", function() { + expect( 1 ); + domEqual( "#button", function() { + $( "#button" ).button().button( "destroy" ); + }); +}); + +test( "refresh: Ensure disabled state is preserved correctly.", function() { + expect( 8 ); + + var element = $( "" ); + element.button({ disabled: true }).button( "refresh" ); + ok( element.button( "option", "disabled" ), "Anchor button should remain disabled after refresh" ); //See #8237 + + element = $( "
    " ); + element.button({ disabled: true }).button( "refresh" ); + ok( element.button( "option", "disabled" ), "
    buttons should remain disabled after refresh" ); + + element = $( "" ); + element.button( { disabled: true} ).button( "refresh" ); + ok( element.button( "option", "disabled" ), "" ); + element.button( { disabled: true} ).prop( "disabled", false ).button( "refresh" ); + ok( !element.button( "option", "disabled" ), "Changing a ").addClass(this._triggerClass). + html(!buttonImage ? buttonText : $("").attr( + { src:buttonImage, alt:buttonText, title:buttonText }))); + input[isRTL ? "before" : "after"](inst.trigger); + inst.trigger.click(function() { + if ($.datepicker._datepickerShowing && $.datepicker._lastInput === input[0]) { + $.datepicker._hideDatepicker(); + } else if ($.datepicker._datepickerShowing && $.datepicker._lastInput !== input[0]) { + $.datepicker._hideDatepicker(); + $.datepicker._showDatepicker(input[0]); + } else { + $.datepicker._showDatepicker(input[0]); + } + return false; + }); + } + }, + + /* Apply the maximum length for the date format. */ + _autoSize: function(inst) { + if (this._get(inst, "autoSize") && !inst.inline) { + var findMax, max, maxI, i, + date = new Date(2009, 12 - 1, 20), // Ensure double digits + dateFormat = this._get(inst, "dateFormat"); + + if (dateFormat.match(/[DM]/)) { + findMax = function(names) { + max = 0; + maxI = 0; + for (i = 0; i < names.length; i++) { + if (names[i].length > max) { + max = names[i].length; + maxI = i; + } + } + return maxI; + }; + date.setMonth(findMax(this._get(inst, (dateFormat.match(/MM/) ? + "monthNames" : "monthNamesShort")))); + date.setDate(findMax(this._get(inst, (dateFormat.match(/DD/) ? + "dayNames" : "dayNamesShort"))) + 20 - date.getDay()); + } + inst.input.attr("size", this._formatDate(inst, date).length); + } + }, + + /* Attach an inline date picker to a div. */ + _inlineDatepicker: function(target, inst) { + var divSpan = $(target); + if (divSpan.hasClass(this.markerClassName)) { + return; + } + divSpan.addClass(this.markerClassName).append(inst.dpDiv); + $.data(target, PROP_NAME, inst); + this._setDate(inst, this._getDefaultDate(inst), true); + this._updateDatepicker(inst); + this._updateAlternate(inst); + //If disabled option is true, disable the datepicker before showing it (see ticket #5665) + if( inst.settings.disabled ) { + this._disableDatepicker( target ); + } + // Set display:block in place of inst.dpDiv.show() which won't work on disconnected elements + // http://bugs.jqueryui.com/ticket/7552 - A Datepicker created on a detached div has zero height + inst.dpDiv.css( "display", "block" ); + }, + + /* Pop-up the date picker in a "dialog" box. + * @param input element - ignored + * @param date string or Date - the initial date to display + * @param onSelect function - the function to call when a date is selected + * @param settings object - update the dialog date picker instance's settings (anonymous object) + * @param pos int[2] - coordinates for the dialog's position within the screen or + * event - with x/y coordinates or + * leave empty for default (screen centre) + * @return the manager object + */ + _dialogDatepicker: function(input, date, onSelect, settings, pos) { + var id, browserWidth, browserHeight, scrollX, scrollY, + inst = this._dialogInst; // internal instance + + if (!inst) { + this.uuid += 1; + id = "dp" + this.uuid; + this._dialogInput = $(""); + this._dialogInput.keydown(this._doKeyDown); + $("body").append(this._dialogInput); + inst = this._dialogInst = this._newInst(this._dialogInput, false); + inst.settings = {}; + $.data(this._dialogInput[0], PROP_NAME, inst); + } + extendRemove(inst.settings, settings || {}); + date = (date && date.constructor === Date ? this._formatDate(inst, date) : date); + this._dialogInput.val(date); + + this._pos = (pos ? (pos.length ? pos : [pos.pageX, pos.pageY]) : null); + if (!this._pos) { + browserWidth = document.documentElement.clientWidth; + browserHeight = document.documentElement.clientHeight; + scrollX = document.documentElement.scrollLeft || document.body.scrollLeft; + scrollY = document.documentElement.scrollTop || document.body.scrollTop; + this._pos = // should use actual width/height below + [(browserWidth / 2) - 100 + scrollX, (browserHeight / 2) - 150 + scrollY]; + } + + // move input on screen for focus, but hidden behind dialog + this._dialogInput.css("left", (this._pos[0] + 20) + "px").css("top", this._pos[1] + "px"); + inst.settings.onSelect = onSelect; + this._inDialog = true; + this.dpDiv.addClass(this._dialogClass); + this._showDatepicker(this._dialogInput[0]); + if ($.blockUI) { + $.blockUI(this.dpDiv); + } + $.data(this._dialogInput[0], PROP_NAME, inst); + return this; + }, + + /* Detach a datepicker from its control. + * @param target element - the target input field or division or span + */ + _destroyDatepicker: function(target) { + var nodeName, + $target = $(target), + inst = $.data(target, PROP_NAME); + + if (!$target.hasClass(this.markerClassName)) { + return; + } + + nodeName = target.nodeName.toLowerCase(); + $.removeData(target, PROP_NAME); + if (nodeName === "input") { + inst.append.remove(); + inst.trigger.remove(); + $target.removeClass(this.markerClassName). + unbind("focus", this._showDatepicker). + unbind("keydown", this._doKeyDown). + unbind("keypress", this._doKeyPress). + unbind("keyup", this._doKeyUp); + } else if (nodeName === "div" || nodeName === "span") { + $target.removeClass(this.markerClassName).empty(); + } + }, + + /* Enable the date picker to a jQuery selection. + * @param target element - the target input field or division or span + */ + _enableDatepicker: function(target) { + var nodeName, inline, + $target = $(target), + inst = $.data(target, PROP_NAME); + + if (!$target.hasClass(this.markerClassName)) { + return; + } + + nodeName = target.nodeName.toLowerCase(); + if (nodeName === "input") { + target.disabled = false; + inst.trigger.filter("button"). + each(function() { this.disabled = false; }).end(). + filter("img").css({opacity: "1.0", cursor: ""}); + } else if (nodeName === "div" || nodeName === "span") { + inline = $target.children("." + this._inlineClass); + inline.children().removeClass("ui-state-disabled"); + inline.find("select.ui-datepicker-month, select.ui-datepicker-year"). + prop("disabled", false); + } + this._disabledInputs = $.map(this._disabledInputs, + function(value) { return (value === target ? null : value); }); // delete entry + }, + + /* Disable the date picker to a jQuery selection. + * @param target element - the target input field or division or span + */ + _disableDatepicker: function(target) { + var nodeName, inline, + $target = $(target), + inst = $.data(target, PROP_NAME); + + if (!$target.hasClass(this.markerClassName)) { + return; + } + + nodeName = target.nodeName.toLowerCase(); + if (nodeName === "input") { + target.disabled = true; + inst.trigger.filter("button"). + each(function() { this.disabled = true; }).end(). + filter("img").css({opacity: "0.5", cursor: "default"}); + } else if (nodeName === "div" || nodeName === "span") { + inline = $target.children("." + this._inlineClass); + inline.children().addClass("ui-state-disabled"); + inline.find("select.ui-datepicker-month, select.ui-datepicker-year"). + prop("disabled", true); + } + this._disabledInputs = $.map(this._disabledInputs, + function(value) { return (value === target ? null : value); }); // delete entry + this._disabledInputs[this._disabledInputs.length] = target; + }, + + /* Is the first field in a jQuery collection disabled as a datepicker? + * @param target element - the target input field or division or span + * @return boolean - true if disabled, false if enabled + */ + _isDisabledDatepicker: function(target) { + if (!target) { + return false; + } + for (var i = 0; i < this._disabledInputs.length; i++) { + if (this._disabledInputs[i] === target) { + return true; + } + } + return false; + }, + + /* Retrieve the instance data for the target control. + * @param target element - the target input field or division or span + * @return object - the associated instance data + * @throws error if a jQuery problem getting data + */ + _getInst: function(target) { + try { + return $.data(target, PROP_NAME); + } + catch (err) { + throw "Missing instance data for this datepicker"; + } + }, + + /* Update or retrieve the settings for a date picker attached to an input field or division. + * @param target element - the target input field or division or span + * @param name object - the new settings to update or + * string - the name of the setting to change or retrieve, + * when retrieving also "all" for all instance settings or + * "defaults" for all global defaults + * @param value any - the new value for the setting + * (omit if above is an object or to retrieve a value) + */ + _optionDatepicker: function(target, name, value) { + var settings, date, minDate, maxDate, + inst = this._getInst(target); + + if (arguments.length === 2 && typeof name === "string") { + return (name === "defaults" ? $.extend({}, $.datepicker._defaults) : + (inst ? (name === "all" ? $.extend({}, inst.settings) : + this._get(inst, name)) : null)); + } + + settings = name || {}; + if (typeof name === "string") { + settings = {}; + settings[name] = value; + } + + if (inst) { + if (this._curInst === inst) { + this._hideDatepicker(); + } + + date = this._getDateDatepicker(target, true); + minDate = this._getMinMaxDate(inst, "min"); + maxDate = this._getMinMaxDate(inst, "max"); + extendRemove(inst.settings, settings); + // reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided + if (minDate !== null && settings.dateFormat !== undefined && settings.minDate === undefined) { + inst.settings.minDate = this._formatDate(inst, minDate); + } + if (maxDate !== null && settings.dateFormat !== undefined && settings.maxDate === undefined) { + inst.settings.maxDate = this._formatDate(inst, maxDate); + } + if ( "disabled" in settings ) { + if ( settings.disabled ) { + this._disableDatepicker(target); + } else { + this._enableDatepicker(target); + } + } + this._attachments($(target), inst); + this._autoSize(inst); + this._setDate(inst, date); + this._updateAlternate(inst); + this._updateDatepicker(inst); + } + }, + + // change method deprecated + _changeDatepicker: function(target, name, value) { + this._optionDatepicker(target, name, value); + }, + + /* Redraw the date picker attached to an input field or division. + * @param target element - the target input field or division or span + */ + _refreshDatepicker: function(target) { + var inst = this._getInst(target); + if (inst) { + this._updateDatepicker(inst); + } + }, + + /* Set the dates for a jQuery selection. + * @param target element - the target input field or division or span + * @param date Date - the new date + */ + _setDateDatepicker: function(target, date) { + var inst = this._getInst(target); + if (inst) { + this._setDate(inst, date); + this._updateDatepicker(inst); + this._updateAlternate(inst); + } + }, + + /* Get the date(s) for the first entry in a jQuery selection. + * @param target element - the target input field or division or span + * @param noDefault boolean - true if no default date is to be used + * @return Date - the current date + */ + _getDateDatepicker: function(target, noDefault) { + var inst = this._getInst(target); + if (inst && !inst.inline) { + this._setDateFromField(inst, noDefault); + } + return (inst ? this._getDate(inst) : null); + }, + + /* Handle keystrokes. */ + _doKeyDown: function(event) { + var onSelect, dateStr, sel, + inst = $.datepicker._getInst(event.target), + handled = true, + isRTL = inst.dpDiv.is(".ui-datepicker-rtl"); + + inst._keyEvent = true; + if ($.datepicker._datepickerShowing) { + switch (event.keyCode) { + case 9: $.datepicker._hideDatepicker(); + handled = false; + break; // hide on tab out + case 13: sel = $("td." + $.datepicker._dayOverClass + ":not(." + + $.datepicker._currentClass + ")", inst.dpDiv); + if (sel[0]) { + $.datepicker._selectDay(event.target, inst.selectedMonth, inst.selectedYear, sel[0]); + } + + onSelect = $.datepicker._get(inst, "onSelect"); + if (onSelect) { + dateStr = $.datepicker._formatDate(inst); + + // trigger custom callback + onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]); + } else { + $.datepicker._hideDatepicker(); + } + + return false; // don't submit the form + case 27: $.datepicker._hideDatepicker(); + break; // hide on escape + case 33: $.datepicker._adjustDate(event.target, (event.ctrlKey ? + -$.datepicker._get(inst, "stepBigMonths") : + -$.datepicker._get(inst, "stepMonths")), "M"); + break; // previous month/year on page up/+ ctrl + case 34: $.datepicker._adjustDate(event.target, (event.ctrlKey ? + +$.datepicker._get(inst, "stepBigMonths") : + +$.datepicker._get(inst, "stepMonths")), "M"); + break; // next month/year on page down/+ ctrl + case 35: if (event.ctrlKey || event.metaKey) { + $.datepicker._clearDate(event.target); + } + handled = event.ctrlKey || event.metaKey; + break; // clear on ctrl or command +end + case 36: if (event.ctrlKey || event.metaKey) { + $.datepicker._gotoToday(event.target); + } + handled = event.ctrlKey || event.metaKey; + break; // current on ctrl or command +home + case 37: if (event.ctrlKey || event.metaKey) { + $.datepicker._adjustDate(event.target, (isRTL ? +1 : -1), "D"); + } + handled = event.ctrlKey || event.metaKey; + // -1 day on ctrl or command +left + if (event.originalEvent.altKey) { + $.datepicker._adjustDate(event.target, (event.ctrlKey ? + -$.datepicker._get(inst, "stepBigMonths") : + -$.datepicker._get(inst, "stepMonths")), "M"); + } + // next month/year on alt +left on Mac + break; + case 38: if (event.ctrlKey || event.metaKey) { + $.datepicker._adjustDate(event.target, -7, "D"); + } + handled = event.ctrlKey || event.metaKey; + break; // -1 week on ctrl or command +up + case 39: if (event.ctrlKey || event.metaKey) { + $.datepicker._adjustDate(event.target, (isRTL ? -1 : +1), "D"); + } + handled = event.ctrlKey || event.metaKey; + // +1 day on ctrl or command +right + if (event.originalEvent.altKey) { + $.datepicker._adjustDate(event.target, (event.ctrlKey ? + +$.datepicker._get(inst, "stepBigMonths") : + +$.datepicker._get(inst, "stepMonths")), "M"); + } + // next month/year on alt +right + break; + case 40: if (event.ctrlKey || event.metaKey) { + $.datepicker._adjustDate(event.target, +7, "D"); + } + handled = event.ctrlKey || event.metaKey; + break; // +1 week on ctrl or command +down + default: handled = false; + } + } else if (event.keyCode === 36 && event.ctrlKey) { // display the date picker on ctrl+home + $.datepicker._showDatepicker(this); + } else { + handled = false; + } + + if (handled) { + event.preventDefault(); + event.stopPropagation(); + } + }, + + /* Filter entered characters - based on date format. */ + _doKeyPress: function(event) { + var chars, chr, + inst = $.datepicker._getInst(event.target); + + if ($.datepicker._get(inst, "constrainInput")) { + chars = $.datepicker._possibleChars($.datepicker._get(inst, "dateFormat")); + chr = String.fromCharCode(event.charCode == null ? event.keyCode : event.charCode); + return event.ctrlKey || event.metaKey || (chr < " " || !chars || chars.indexOf(chr) > -1); + } + }, + + /* Synchronise manual entry and field/alternate field. */ + _doKeyUp: function(event) { + var date, + inst = $.datepicker._getInst(event.target); + + if (inst.input.val() !== inst.lastVal) { + try { + date = $.datepicker.parseDate($.datepicker._get(inst, "dateFormat"), + (inst.input ? inst.input.val() : null), + $.datepicker._getFormatConfig(inst)); + + if (date) { // only if valid + $.datepicker._setDateFromField(inst); + $.datepicker._updateAlternate(inst); + $.datepicker._updateDatepicker(inst); + } + } + catch (err) { + } + } + return true; + }, + + /* Pop-up the date picker for a given input field. + * If false returned from beforeShow event handler do not show. + * @param input element - the input field attached to the date picker or + * event - if triggered by focus + */ + _showDatepicker: function(input) { + input = input.target || input; + if (input.nodeName.toLowerCase() !== "input") { // find from button/image trigger + input = $("input", input.parentNode)[0]; + } + + if ($.datepicker._isDisabledDatepicker(input) || $.datepicker._lastInput === input) { // already here + return; + } + + var inst, beforeShow, beforeShowSettings, isFixed, + offset, showAnim, duration; + + inst = $.datepicker._getInst(input); + if ($.datepicker._curInst && $.datepicker._curInst !== inst) { + $.datepicker._curInst.dpDiv.stop(true, true); + if ( inst && $.datepicker._datepickerShowing ) { + $.datepicker._hideDatepicker( $.datepicker._curInst.input[0] ); + } + } + + beforeShow = $.datepicker._get(inst, "beforeShow"); + beforeShowSettings = beforeShow ? beforeShow.apply(input, [input, inst]) : {}; + if(beforeShowSettings === false){ + return; + } + extendRemove(inst.settings, beforeShowSettings); + + inst.lastVal = null; + $.datepicker._lastInput = input; + $.datepicker._setDateFromField(inst); + + if ($.datepicker._inDialog) { // hide cursor + input.value = ""; + } + if (!$.datepicker._pos) { // position below input + $.datepicker._pos = $.datepicker._findPos(input); + $.datepicker._pos[1] += input.offsetHeight; // add the height + } + + isFixed = false; + $(input).parents().each(function() { + isFixed |= $(this).css("position") === "fixed"; + return !isFixed; + }); + + offset = {left: $.datepicker._pos[0], top: $.datepicker._pos[1]}; + $.datepicker._pos = null; + //to avoid flashes on Firefox + inst.dpDiv.empty(); + // determine sizing offscreen + inst.dpDiv.css({position: "absolute", display: "block", top: "-1000px"}); + $.datepicker._updateDatepicker(inst); + // fix width for dynamic number of date pickers + // and adjust position before showing + offset = $.datepicker._checkOffset(inst, offset, isFixed); + inst.dpDiv.css({position: ($.datepicker._inDialog && $.blockUI ? + "static" : (isFixed ? "fixed" : "absolute")), display: "none", + left: offset.left + "px", top: offset.top + "px"}); + + if (!inst.inline) { + showAnim = $.datepicker._get(inst, "showAnim"); + duration = $.datepicker._get(inst, "duration"); + inst.dpDiv.zIndex($(input).zIndex()+1); + $.datepicker._datepickerShowing = true; + + if ( $.effects && $.effects.effect[ showAnim ] ) { + inst.dpDiv.show(showAnim, $.datepicker._get(inst, "showOptions"), duration); + } else { + inst.dpDiv[showAnim || "show"](showAnim ? duration : null); + } + + if ( $.datepicker._shouldFocusInput( inst ) ) { + inst.input.focus(); + } + + $.datepicker._curInst = inst; + } + }, + + /* Generate the date picker content. */ + _updateDatepicker: function(inst) { + this.maxRows = 4; //Reset the max number of rows being displayed (see #7043) + instActive = inst; // for delegate hover events + inst.dpDiv.empty().append(this._generateHTML(inst)); + this._attachHandlers(inst); + inst.dpDiv.find("." + this._dayOverClass + " a").mouseover(); + + var origyearshtml, + numMonths = this._getNumberOfMonths(inst), + cols = numMonths[1], + width = 17; + + inst.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""); + if (cols > 1) { + inst.dpDiv.addClass("ui-datepicker-multi-" + cols).css("width", (width * cols) + "em"); + } + inst.dpDiv[(numMonths[0] !== 1 || numMonths[1] !== 1 ? "add" : "remove") + + "Class"]("ui-datepicker-multi"); + inst.dpDiv[(this._get(inst, "isRTL") ? "add" : "remove") + + "Class"]("ui-datepicker-rtl"); + + if (inst === $.datepicker._curInst && $.datepicker._datepickerShowing && $.datepicker._shouldFocusInput( inst ) ) { + inst.input.focus(); + } + + // deffered render of the years select (to avoid flashes on Firefox) + if( inst.yearshtml ){ + origyearshtml = inst.yearshtml; + setTimeout(function(){ + //assure that inst.yearshtml didn't change. + if( origyearshtml === inst.yearshtml && inst.yearshtml ){ + inst.dpDiv.find("select.ui-datepicker-year:first").replaceWith(inst.yearshtml); + } + origyearshtml = inst.yearshtml = null; + }, 0); + } + }, + + // #6694 - don't focus the input if it's already focused + // this breaks the change event in IE + // Support: IE and jQuery <1.9 + _shouldFocusInput: function( inst ) { + return inst.input && inst.input.is( ":visible" ) && !inst.input.is( ":disabled" ) && !inst.input.is( ":focus" ); + }, + + /* Check positioning to remain on screen. */ + _checkOffset: function(inst, offset, isFixed) { + var dpWidth = inst.dpDiv.outerWidth(), + dpHeight = inst.dpDiv.outerHeight(), + inputWidth = inst.input ? inst.input.outerWidth() : 0, + inputHeight = inst.input ? inst.input.outerHeight() : 0, + viewWidth = document.documentElement.clientWidth + (isFixed ? 0 : $(document).scrollLeft()), + viewHeight = document.documentElement.clientHeight + (isFixed ? 0 : $(document).scrollTop()); + + offset.left -= (this._get(inst, "isRTL") ? (dpWidth - inputWidth) : 0); + offset.left -= (isFixed && offset.left === inst.input.offset().left) ? $(document).scrollLeft() : 0; + offset.top -= (isFixed && offset.top === (inst.input.offset().top + inputHeight)) ? $(document).scrollTop() : 0; + + // now check if datepicker is showing outside window viewport - move to a better place if so. + offset.left -= Math.min(offset.left, (offset.left + dpWidth > viewWidth && viewWidth > dpWidth) ? + Math.abs(offset.left + dpWidth - viewWidth) : 0); + offset.top -= Math.min(offset.top, (offset.top + dpHeight > viewHeight && viewHeight > dpHeight) ? + Math.abs(dpHeight + inputHeight) : 0); + + return offset; + }, + + /* Find an object's position on the screen. */ + _findPos: function(obj) { + var position, + inst = this._getInst(obj), + isRTL = this._get(inst, "isRTL"); + + while (obj && (obj.type === "hidden" || obj.nodeType !== 1 || $.expr.filters.hidden(obj))) { + obj = obj[isRTL ? "previousSibling" : "nextSibling"]; + } + + position = $(obj).offset(); + return [position.left, position.top]; + }, + + /* Hide the date picker from view. + * @param input element - the input field attached to the date picker + */ + _hideDatepicker: function(input) { + var showAnim, duration, postProcess, onClose, + inst = this._curInst; + + if (!inst || (input && inst !== $.data(input, PROP_NAME))) { + return; + } + + if (this._datepickerShowing) { + showAnim = this._get(inst, "showAnim"); + duration = this._get(inst, "duration"); + postProcess = function() { + $.datepicker._tidyDialog(inst); + }; + + // DEPRECATED: after BC for 1.8.x $.effects[ showAnim ] is not needed + if ( $.effects && ( $.effects.effect[ showAnim ] || $.effects[ showAnim ] ) ) { + inst.dpDiv.hide(showAnim, $.datepicker._get(inst, "showOptions"), duration, postProcess); + } else { + inst.dpDiv[(showAnim === "slideDown" ? "slideUp" : + (showAnim === "fadeIn" ? "fadeOut" : "hide"))]((showAnim ? duration : null), postProcess); + } + + if (!showAnim) { + postProcess(); + } + this._datepickerShowing = false; + + onClose = this._get(inst, "onClose"); + if (onClose) { + onClose.apply((inst.input ? inst.input[0] : null), [(inst.input ? inst.input.val() : ""), inst]); + } + + this._lastInput = null; + if (this._inDialog) { + this._dialogInput.css({ position: "absolute", left: "0", top: "-100px" }); + if ($.blockUI) { + $.unblockUI(); + $("body").append(this.dpDiv); + } + } + this._inDialog = false; + } + }, + + /* Tidy up after a dialog display. */ + _tidyDialog: function(inst) { + inst.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar"); + }, + + /* Close date picker if clicked elsewhere. */ + _checkExternalClick: function(event) { + if (!$.datepicker._curInst) { + return; + } + + var $target = $(event.target), + inst = $.datepicker._getInst($target[0]); + + if ( ( ( $target[0].id !== $.datepicker._mainDivId && + $target.parents("#" + $.datepicker._mainDivId).length === 0 && + !$target.hasClass($.datepicker.markerClassName) && + !$target.closest("." + $.datepicker._triggerClass).length && + $.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI) ) ) || + ( $target.hasClass($.datepicker.markerClassName) && $.datepicker._curInst !== inst ) ) { + $.datepicker._hideDatepicker(); + } + }, + + /* Adjust one of the date sub-fields. */ + _adjustDate: function(id, offset, period) { + var target = $(id), + inst = this._getInst(target[0]); + + if (this._isDisabledDatepicker(target[0])) { + return; + } + this._adjustInstDate(inst, offset + + (period === "M" ? this._get(inst, "showCurrentAtPos") : 0), // undo positioning + period); + this._updateDatepicker(inst); + }, + + /* Action for current link. */ + _gotoToday: function(id) { + var date, + target = $(id), + inst = this._getInst(target[0]); + + if (this._get(inst, "gotoCurrent") && inst.currentDay) { + inst.selectedDay = inst.currentDay; + inst.drawMonth = inst.selectedMonth = inst.currentMonth; + inst.drawYear = inst.selectedYear = inst.currentYear; + } else { + date = new Date(); + inst.selectedDay = date.getDate(); + inst.drawMonth = inst.selectedMonth = date.getMonth(); + inst.drawYear = inst.selectedYear = date.getFullYear(); + } + this._notifyChange(inst); + this._adjustDate(target); + }, + + /* Action for selecting a new month/year. */ + _selectMonthYear: function(id, select, period) { + var target = $(id), + inst = this._getInst(target[0]); + + inst["selected" + (period === "M" ? "Month" : "Year")] = + inst["draw" + (period === "M" ? "Month" : "Year")] = + parseInt(select.options[select.selectedIndex].value,10); + + this._notifyChange(inst); + this._adjustDate(target); + }, + + /* Action for selecting a day. */ + _selectDay: function(id, month, year, td) { + var inst, + target = $(id); + + if ($(td).hasClass(this._unselectableClass) || this._isDisabledDatepicker(target[0])) { + return; + } + + inst = this._getInst(target[0]); + inst.selectedDay = inst.currentDay = $("a", td).html(); + inst.selectedMonth = inst.currentMonth = month; + inst.selectedYear = inst.currentYear = year; + this._selectDate(id, this._formatDate(inst, + inst.currentDay, inst.currentMonth, inst.currentYear)); + }, + + /* Erase the input field and hide the date picker. */ + _clearDate: function(id) { + var target = $(id); + this._selectDate(target, ""); + }, + + /* Update the input field with the selected date. */ + _selectDate: function(id, dateStr) { + var onSelect, + target = $(id), + inst = this._getInst(target[0]); + + dateStr = (dateStr != null ? dateStr : this._formatDate(inst)); + if (inst.input) { + inst.input.val(dateStr); + } + this._updateAlternate(inst); + + onSelect = this._get(inst, "onSelect"); + if (onSelect) { + onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]); // trigger custom callback + } else if (inst.input) { + inst.input.trigger("change"); // fire the change event + } + + if (inst.inline){ + this._updateDatepicker(inst); + } else { + this._hideDatepicker(); + this._lastInput = inst.input[0]; + if (typeof(inst.input[0]) !== "object") { + inst.input.focus(); // restore focus + } + this._lastInput = null; + } + }, + + /* Update any alternate field to synchronise with the main field. */ + _updateAlternate: function(inst) { + var altFormat, date, dateStr, + altField = this._get(inst, "altField"); + + if (altField) { // update alternate field too + altFormat = this._get(inst, "altFormat") || this._get(inst, "dateFormat"); + date = this._getDate(inst); + dateStr = this.formatDate(altFormat, date, this._getFormatConfig(inst)); + $(altField).each(function() { $(this).val(dateStr); }); + } + }, + + /* Set as beforeShowDay function to prevent selection of weekends. + * @param date Date - the date to customise + * @return [boolean, string] - is this date selectable?, what is its CSS class? + */ + noWeekends: function(date) { + var day = date.getDay(); + return [(day > 0 && day < 6), ""]; + }, + + /* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition. + * @param date Date - the date to get the week for + * @return number - the number of the week within the year that contains this date + */ + iso8601Week: function(date) { + var time, + checkDate = new Date(date.getTime()); + + // Find Thursday of this week starting on Monday + checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7)); + + time = checkDate.getTime(); + checkDate.setMonth(0); // Compare with Jan 1 + checkDate.setDate(1); + return Math.floor(Math.round((time - checkDate) / 86400000) / 7) + 1; + }, + + /* Parse a string value into a date object. + * See formatDate below for the possible formats. + * + * @param format string - the expected format of the date + * @param value string - the date in the above format + * @param settings Object - attributes include: + * shortYearCutoff number - the cutoff year for determining the century (optional) + * dayNamesShort string[7] - abbreviated names of the days from Sunday (optional) + * dayNames string[7] - names of the days from Sunday (optional) + * monthNamesShort string[12] - abbreviated names of the months (optional) + * monthNames string[12] - names of the months (optional) + * @return Date - the extracted date value or null if value is blank + */ + parseDate: function (format, value, settings) { + if (format == null || value == null) { + throw "Invalid arguments"; + } + + value = (typeof value === "object" ? value.toString() : value + ""); + if (value === "") { + return null; + } + + var iFormat, dim, extra, + iValue = 0, + shortYearCutoffTemp = (settings ? settings.shortYearCutoff : null) || this._defaults.shortYearCutoff, + shortYearCutoff = (typeof shortYearCutoffTemp !== "string" ? shortYearCutoffTemp : + new Date().getFullYear() % 100 + parseInt(shortYearCutoffTemp, 10)), + dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort, + dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames, + monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort, + monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames, + year = -1, + month = -1, + day = -1, + doy = -1, + literal = false, + date, + // Check whether a format character is doubled + lookAhead = function(match) { + var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match); + if (matches) { + iFormat++; + } + return matches; + }, + // Extract a number from the string value + getNumber = function(match) { + var isDoubled = lookAhead(match), + size = (match === "@" ? 14 : (match === "!" ? 20 : + (match === "y" && isDoubled ? 4 : (match === "o" ? 3 : 2)))), + digits = new RegExp("^\\d{1," + size + "}"), + num = value.substring(iValue).match(digits); + if (!num) { + throw "Missing number at position " + iValue; + } + iValue += num[0].length; + return parseInt(num[0], 10); + }, + // Extract a name from the string value and convert to an index + getName = function(match, shortNames, longNames) { + var index = -1, + names = $.map(lookAhead(match) ? longNames : shortNames, function (v, k) { + return [ [k, v] ]; + }).sort(function (a, b) { + return -(a[1].length - b[1].length); + }); + + $.each(names, function (i, pair) { + var name = pair[1]; + if (value.substr(iValue, name.length).toLowerCase() === name.toLowerCase()) { + index = pair[0]; + iValue += name.length; + return false; + } + }); + if (index !== -1) { + return index + 1; + } else { + throw "Unknown name at position " + iValue; + } + }, + // Confirm that a literal character matches the string value + checkLiteral = function() { + if (value.charAt(iValue) !== format.charAt(iFormat)) { + throw "Unexpected literal at position " + iValue; + } + iValue++; + }; + + for (iFormat = 0; iFormat < format.length; iFormat++) { + if (literal) { + if (format.charAt(iFormat) === "'" && !lookAhead("'")) { + literal = false; + } else { + checkLiteral(); + } + } else { + switch (format.charAt(iFormat)) { + case "d": + day = getNumber("d"); + break; + case "D": + getName("D", dayNamesShort, dayNames); + break; + case "o": + doy = getNumber("o"); + break; + case "m": + month = getNumber("m"); + break; + case "M": + month = getName("M", monthNamesShort, monthNames); + break; + case "y": + year = getNumber("y"); + break; + case "@": + date = new Date(getNumber("@")); + year = date.getFullYear(); + month = date.getMonth() + 1; + day = date.getDate(); + break; + case "!": + date = new Date((getNumber("!") - this._ticksTo1970) / 10000); + year = date.getFullYear(); + month = date.getMonth() + 1; + day = date.getDate(); + break; + case "'": + if (lookAhead("'")){ + checkLiteral(); + } else { + literal = true; + } + break; + default: + checkLiteral(); + } + } + } + + if (iValue < value.length){ + extra = value.substr(iValue); + if (!/^\s+/.test(extra)) { + throw "Extra/unparsed characters found in date: " + extra; + } + } + + if (year === -1) { + year = new Date().getFullYear(); + } else if (year < 100) { + year += new Date().getFullYear() - new Date().getFullYear() % 100 + + (year <= shortYearCutoff ? 0 : -100); + } + + if (doy > -1) { + month = 1; + day = doy; + do { + dim = this._getDaysInMonth(year, month - 1); + if (day <= dim) { + break; + } + month++; + day -= dim; + } while (true); + } + + date = this._daylightSavingAdjust(new Date(year, month - 1, day)); + if (date.getFullYear() !== year || date.getMonth() + 1 !== month || date.getDate() !== day) { + throw "Invalid date"; // E.g. 31/02/00 + } + return date; + }, + + /* Standard date formats. */ + ATOM: "yy-mm-dd", // RFC 3339 (ISO 8601) + COOKIE: "D, dd M yy", + ISO_8601: "yy-mm-dd", + RFC_822: "D, d M y", + RFC_850: "DD, dd-M-y", + RFC_1036: "D, d M y", + RFC_1123: "D, d M yy", + RFC_2822: "D, d M yy", + RSS: "D, d M y", // RFC 822 + TICKS: "!", + TIMESTAMP: "@", + W3C: "yy-mm-dd", // ISO 8601 + + _ticksTo1970: (((1970 - 1) * 365 + Math.floor(1970 / 4) - Math.floor(1970 / 100) + + Math.floor(1970 / 400)) * 24 * 60 * 60 * 10000000), + + /* Format a date object into a string value. + * The format can be combinations of the following: + * d - day of month (no leading zero) + * dd - day of month (two digit) + * o - day of year (no leading zeros) + * oo - day of year (three digit) + * D - day name short + * DD - day name long + * m - month of year (no leading zero) + * mm - month of year (two digit) + * M - month name short + * MM - month name long + * y - year (two digit) + * yy - year (four digit) + * @ - Unix timestamp (ms since 01/01/1970) + * ! - Windows ticks (100ns since 01/01/0001) + * "..." - literal text + * '' - single quote + * + * @param format string - the desired format of the date + * @param date Date - the date value to format + * @param settings Object - attributes include: + * dayNamesShort string[7] - abbreviated names of the days from Sunday (optional) + * dayNames string[7] - names of the days from Sunday (optional) + * monthNamesShort string[12] - abbreviated names of the months (optional) + * monthNames string[12] - names of the months (optional) + * @return string - the date in the above format + */ + formatDate: function (format, date, settings) { + if (!date) { + return ""; + } + + var iFormat, + dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort, + dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames, + monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort, + monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames, + // Check whether a format character is doubled + lookAhead = function(match) { + var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match); + if (matches) { + iFormat++; + } + return matches; + }, + // Format a number, with leading zero if necessary + formatNumber = function(match, value, len) { + var num = "" + value; + if (lookAhead(match)) { + while (num.length < len) { + num = "0" + num; + } + } + return num; + }, + // Format a name, short or long as requested + formatName = function(match, value, shortNames, longNames) { + return (lookAhead(match) ? longNames[value] : shortNames[value]); + }, + output = "", + literal = false; + + if (date) { + for (iFormat = 0; iFormat < format.length; iFormat++) { + if (literal) { + if (format.charAt(iFormat) === "'" && !lookAhead("'")) { + literal = false; + } else { + output += format.charAt(iFormat); + } + } else { + switch (format.charAt(iFormat)) { + case "d": + output += formatNumber("d", date.getDate(), 2); + break; + case "D": + output += formatName("D", date.getDay(), dayNamesShort, dayNames); + break; + case "o": + output += formatNumber("o", + Math.round((new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime() - new Date(date.getFullYear(), 0, 0).getTime()) / 86400000), 3); + break; + case "m": + output += formatNumber("m", date.getMonth() + 1, 2); + break; + case "M": + output += formatName("M", date.getMonth(), monthNamesShort, monthNames); + break; + case "y": + output += (lookAhead("y") ? date.getFullYear() : + (date.getYear() % 100 < 10 ? "0" : "") + date.getYear() % 100); + break; + case "@": + output += date.getTime(); + break; + case "!": + output += date.getTime() * 10000 + this._ticksTo1970; + break; + case "'": + if (lookAhead("'")) { + output += "'"; + } else { + literal = true; + } + break; + default: + output += format.charAt(iFormat); + } + } + } + } + return output; + }, + + /* Extract all possible characters from the date format. */ + _possibleChars: function (format) { + var iFormat, + chars = "", + literal = false, + // Check whether a format character is doubled + lookAhead = function(match) { + var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match); + if (matches) { + iFormat++; + } + return matches; + }; + + for (iFormat = 0; iFormat < format.length; iFormat++) { + if (literal) { + if (format.charAt(iFormat) === "'" && !lookAhead("'")) { + literal = false; + } else { + chars += format.charAt(iFormat); + } + } else { + switch (format.charAt(iFormat)) { + case "d": case "m": case "y": case "@": + chars += "0123456789"; + break; + case "D": case "M": + return null; // Accept anything + case "'": + if (lookAhead("'")) { + chars += "'"; + } else { + literal = true; + } + break; + default: + chars += format.charAt(iFormat); + } + } + } + return chars; + }, + + /* Get a setting value, defaulting if necessary. */ + _get: function(inst, name) { + return inst.settings[name] !== undefined ? + inst.settings[name] : this._defaults[name]; + }, + + /* Parse existing date and initialise date picker. */ + _setDateFromField: function(inst, noDefault) { + if (inst.input.val() === inst.lastVal) { + return; + } + + var dateFormat = this._get(inst, "dateFormat"), + dates = inst.lastVal = inst.input ? inst.input.val() : null, + defaultDate = this._getDefaultDate(inst), + date = defaultDate, + settings = this._getFormatConfig(inst); + + try { + date = this.parseDate(dateFormat, dates, settings) || defaultDate; + } catch (event) { + dates = (noDefault ? "" : dates); + } + inst.selectedDay = date.getDate(); + inst.drawMonth = inst.selectedMonth = date.getMonth(); + inst.drawYear = inst.selectedYear = date.getFullYear(); + inst.currentDay = (dates ? date.getDate() : 0); + inst.currentMonth = (dates ? date.getMonth() : 0); + inst.currentYear = (dates ? date.getFullYear() : 0); + this._adjustInstDate(inst); + }, + + /* Retrieve the default date shown on opening. */ + _getDefaultDate: function(inst) { + return this._restrictMinMax(inst, + this._determineDate(inst, this._get(inst, "defaultDate"), new Date())); + }, + + /* A date may be specified as an exact value or a relative one. */ + _determineDate: function(inst, date, defaultDate) { + var offsetNumeric = function(offset) { + var date = new Date(); + date.setDate(date.getDate() + offset); + return date; + }, + offsetString = function(offset) { + try { + return $.datepicker.parseDate($.datepicker._get(inst, "dateFormat"), + offset, $.datepicker._getFormatConfig(inst)); + } + catch (e) { + // Ignore + } + + var date = (offset.toLowerCase().match(/^c/) ? + $.datepicker._getDate(inst) : null) || new Date(), + year = date.getFullYear(), + month = date.getMonth(), + day = date.getDate(), + pattern = /([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g, + matches = pattern.exec(offset); + + while (matches) { + switch (matches[2] || "d") { + case "d" : case "D" : + day += parseInt(matches[1],10); break; + case "w" : case "W" : + day += parseInt(matches[1],10) * 7; break; + case "m" : case "M" : + month += parseInt(matches[1],10); + day = Math.min(day, $.datepicker._getDaysInMonth(year, month)); + break; + case "y": case "Y" : + year += parseInt(matches[1],10); + day = Math.min(day, $.datepicker._getDaysInMonth(year, month)); + break; + } + matches = pattern.exec(offset); + } + return new Date(year, month, day); + }, + newDate = (date == null || date === "" ? defaultDate : (typeof date === "string" ? offsetString(date) : + (typeof date === "number" ? (isNaN(date) ? defaultDate : offsetNumeric(date)) : new Date(date.getTime())))); + + newDate = (newDate && newDate.toString() === "Invalid Date" ? defaultDate : newDate); + if (newDate) { + newDate.setHours(0); + newDate.setMinutes(0); + newDate.setSeconds(0); + newDate.setMilliseconds(0); + } + return this._daylightSavingAdjust(newDate); + }, + + /* Handle switch to/from daylight saving. + * Hours may be non-zero on daylight saving cut-over: + * > 12 when midnight changeover, but then cannot generate + * midnight datetime, so jump to 1AM, otherwise reset. + * @param date (Date) the date to check + * @return (Date) the corrected date + */ + _daylightSavingAdjust: function(date) { + if (!date) { + return null; + } + date.setHours(date.getHours() > 12 ? date.getHours() + 2 : 0); + return date; + }, + + /* Set the date(s) directly. */ + _setDate: function(inst, date, noChange) { + var clear = !date, + origMonth = inst.selectedMonth, + origYear = inst.selectedYear, + newDate = this._restrictMinMax(inst, this._determineDate(inst, date, new Date())); + + inst.selectedDay = inst.currentDay = newDate.getDate(); + inst.drawMonth = inst.selectedMonth = inst.currentMonth = newDate.getMonth(); + inst.drawYear = inst.selectedYear = inst.currentYear = newDate.getFullYear(); + if ((origMonth !== inst.selectedMonth || origYear !== inst.selectedYear) && !noChange) { + this._notifyChange(inst); + } + this._adjustInstDate(inst); + if (inst.input) { + inst.input.val(clear ? "" : this._formatDate(inst)); + } + }, + + /* Retrieve the date(s) directly. */ + _getDate: function(inst) { + var startDate = (!inst.currentYear || (inst.input && inst.input.val() === "") ? null : + this._daylightSavingAdjust(new Date( + inst.currentYear, inst.currentMonth, inst.currentDay))); + return startDate; + }, + + /* Attach the onxxx handlers. These are declared statically so + * they work with static code transformers like Caja. + */ + _attachHandlers: function(inst) { + var stepMonths = this._get(inst, "stepMonths"), + id = "#" + inst.id.replace( /\\\\/g, "\\" ); + inst.dpDiv.find("[data-handler]").map(function () { + var handler = { + prev: function () { + $.datepicker._adjustDate(id, -stepMonths, "M"); + }, + next: function () { + $.datepicker._adjustDate(id, +stepMonths, "M"); + }, + hide: function () { + $.datepicker._hideDatepicker(); + }, + today: function () { + $.datepicker._gotoToday(id); + }, + selectDay: function () { + $.datepicker._selectDay(id, +this.getAttribute("data-month"), +this.getAttribute("data-year"), this); + return false; + }, + selectMonth: function () { + $.datepicker._selectMonthYear(id, this, "M"); + return false; + }, + selectYear: function () { + $.datepicker._selectMonthYear(id, this, "Y"); + return false; + } + }; + $(this).bind(this.getAttribute("data-event"), handler[this.getAttribute("data-handler")]); + }); + }, + + /* Generate the HTML for the current state of the date picker. */ + _generateHTML: function(inst) { + var maxDraw, prevText, prev, nextText, next, currentText, gotoDate, + controls, buttonPanel, firstDay, showWeek, dayNames, dayNamesMin, + monthNames, monthNamesShort, beforeShowDay, showOtherMonths, + selectOtherMonths, defaultDate, html, dow, row, group, col, selectedDate, + cornerClass, calender, thead, day, daysInMonth, leadDays, curRows, numRows, + printDate, dRow, tbody, daySettings, otherMonth, unselectable, + tempDate = new Date(), + today = this._daylightSavingAdjust( + new Date(tempDate.getFullYear(), tempDate.getMonth(), tempDate.getDate())), // clear time + isRTL = this._get(inst, "isRTL"), + showButtonPanel = this._get(inst, "showButtonPanel"), + hideIfNoPrevNext = this._get(inst, "hideIfNoPrevNext"), + navigationAsDateFormat = this._get(inst, "navigationAsDateFormat"), + numMonths = this._getNumberOfMonths(inst), + showCurrentAtPos = this._get(inst, "showCurrentAtPos"), + stepMonths = this._get(inst, "stepMonths"), + isMultiMonth = (numMonths[0] !== 1 || numMonths[1] !== 1), + currentDate = this._daylightSavingAdjust((!inst.currentDay ? new Date(9999, 9, 9) : + new Date(inst.currentYear, inst.currentMonth, inst.currentDay))), + minDate = this._getMinMaxDate(inst, "min"), + maxDate = this._getMinMaxDate(inst, "max"), + drawMonth = inst.drawMonth - showCurrentAtPos, + drawYear = inst.drawYear; + + if (drawMonth < 0) { + drawMonth += 12; + drawYear--; + } + if (maxDate) { + maxDraw = this._daylightSavingAdjust(new Date(maxDate.getFullYear(), + maxDate.getMonth() - (numMonths[0] * numMonths[1]) + 1, maxDate.getDate())); + maxDraw = (minDate && maxDraw < minDate ? minDate : maxDraw); + while (this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1)) > maxDraw) { + drawMonth--; + if (drawMonth < 0) { + drawMonth = 11; + drawYear--; + } + } + } + inst.drawMonth = drawMonth; + inst.drawYear = drawYear; + + prevText = this._get(inst, "prevText"); + prevText = (!navigationAsDateFormat ? prevText : this.formatDate(prevText, + this._daylightSavingAdjust(new Date(drawYear, drawMonth - stepMonths, 1)), + this._getFormatConfig(inst))); + + prev = (this._canAdjustMonth(inst, -1, drawYear, drawMonth) ? + "" + prevText + "" : + (hideIfNoPrevNext ? "" : "" + prevText + "")); + + nextText = this._get(inst, "nextText"); + nextText = (!navigationAsDateFormat ? nextText : this.formatDate(nextText, + this._daylightSavingAdjust(new Date(drawYear, drawMonth + stepMonths, 1)), + this._getFormatConfig(inst))); + + next = (this._canAdjustMonth(inst, +1, drawYear, drawMonth) ? + "" + nextText + "" : + (hideIfNoPrevNext ? "" : "" + nextText + "")); + + currentText = this._get(inst, "currentText"); + gotoDate = (this._get(inst, "gotoCurrent") && inst.currentDay ? currentDate : today); + currentText = (!navigationAsDateFormat ? currentText : + this.formatDate(currentText, gotoDate, this._getFormatConfig(inst))); + + controls = (!inst.inline ? "" : ""); + + buttonPanel = (showButtonPanel) ? "
    " + (isRTL ? controls : "") + + (this._isInRange(inst, gotoDate) ? "" : "") + (isRTL ? "" : controls) + "
    " : ""; + + firstDay = parseInt(this._get(inst, "firstDay"),10); + firstDay = (isNaN(firstDay) ? 0 : firstDay); + + showWeek = this._get(inst, "showWeek"); + dayNames = this._get(inst, "dayNames"); + dayNamesMin = this._get(inst, "dayNamesMin"); + monthNames = this._get(inst, "monthNames"); + monthNamesShort = this._get(inst, "monthNamesShort"); + beforeShowDay = this._get(inst, "beforeShowDay"); + showOtherMonths = this._get(inst, "showOtherMonths"); + selectOtherMonths = this._get(inst, "selectOtherMonths"); + defaultDate = this._getDefaultDate(inst); + html = ""; + dow; + for (row = 0; row < numMonths[0]; row++) { + group = ""; + this.maxRows = 4; + for (col = 0; col < numMonths[1]; col++) { + selectedDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, inst.selectedDay)); + cornerClass = " ui-corner-all"; + calender = ""; + if (isMultiMonth) { + calender += "
    "; + } + calender += "
    " + + (/all|left/.test(cornerClass) && row === 0 ? (isRTL ? next : prev) : "") + + (/all|right/.test(cornerClass) && row === 0 ? (isRTL ? prev : next) : "") + + this._generateMonthYearHeader(inst, drawMonth, drawYear, minDate, maxDate, + row > 0 || col > 0, monthNames, monthNamesShort) + // draw month headers + "
    " + + ""; + thead = (showWeek ? "" : ""); + for (dow = 0; dow < 7; dow++) { // days of the week + day = (dow + firstDay) % 7; + thead += "= 5 ? " class='ui-datepicker-week-end'" : "") + ">" + + "" + dayNamesMin[day] + ""; + } + calender += thead + ""; + daysInMonth = this._getDaysInMonth(drawYear, drawMonth); + if (drawYear === inst.selectedYear && drawMonth === inst.selectedMonth) { + inst.selectedDay = Math.min(inst.selectedDay, daysInMonth); + } + leadDays = (this._getFirstDayOfMonth(drawYear, drawMonth) - firstDay + 7) % 7; + curRows = Math.ceil((leadDays + daysInMonth) / 7); // calculate the number of rows to generate + numRows = (isMultiMonth ? this.maxRows > curRows ? this.maxRows : curRows : curRows); //If multiple months, use the higher number of rows (see #7043) + this.maxRows = numRows; + printDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays)); + for (dRow = 0; dRow < numRows; dRow++) { // create date picker rows + calender += ""; + tbody = (!showWeek ? "" : ""); + for (dow = 0; dow < 7; dow++) { // create date picker days + daySettings = (beforeShowDay ? + beforeShowDay.apply((inst.input ? inst.input[0] : null), [printDate]) : [true, ""]); + otherMonth = (printDate.getMonth() !== drawMonth); + unselectable = (otherMonth && !selectOtherMonths) || !daySettings[0] || + (minDate && printDate < minDate) || (maxDate && printDate > maxDate); + tbody += ""; // display selectable date + printDate.setDate(printDate.getDate() + 1); + printDate = this._daylightSavingAdjust(printDate); + } + calender += tbody + ""; + } + drawMonth++; + if (drawMonth > 11) { + drawMonth = 0; + drawYear++; + } + calender += "
    " + this._get(inst, "weekHeader") + "
    " + + this._get(inst, "calculateWeek")(printDate) + "" + // actions + (otherMonth && !showOtherMonths ? " " : // display for other months + (unselectable ? "" + printDate.getDate() + "" : "" + printDate.getDate() + "")) + "
    " + (isMultiMonth ? "
    " + + ((numMonths[0] > 0 && col === numMonths[1]-1) ? "
    " : "") : ""); + group += calender; + } + html += group; + } + html += buttonPanel; + inst._keyEvent = false; + return html; + }, + + /* Generate the month and year header. */ + _generateMonthYearHeader: function(inst, drawMonth, drawYear, minDate, maxDate, + secondary, monthNames, monthNamesShort) { + + var inMinYear, inMaxYear, month, years, thisYear, determineYear, year, endYear, + changeMonth = this._get(inst, "changeMonth"), + changeYear = this._get(inst, "changeYear"), + showMonthAfterYear = this._get(inst, "showMonthAfterYear"), + html = "
    ", + monthHtml = ""; + + // month selection + if (secondary || !changeMonth) { + monthHtml += "" + monthNames[drawMonth] + ""; + } else { + inMinYear = (minDate && minDate.getFullYear() === drawYear); + inMaxYear = (maxDate && maxDate.getFullYear() === drawYear); + monthHtml += ""; + } + + if (!showMonthAfterYear) { + html += monthHtml + (secondary || !(changeMonth && changeYear) ? " " : ""); + } + + // year selection + if ( !inst.yearshtml ) { + inst.yearshtml = ""; + if (secondary || !changeYear) { + html += "" + drawYear + ""; + } else { + // determine range of years to display + years = this._get(inst, "yearRange").split(":"); + thisYear = new Date().getFullYear(); + determineYear = function(value) { + var year = (value.match(/c[+\-].*/) ? drawYear + parseInt(value.substring(1), 10) : + (value.match(/[+\-].*/) ? thisYear + parseInt(value, 10) : + parseInt(value, 10))); + return (isNaN(year) ? thisYear : year); + }; + year = determineYear(years[0]); + endYear = Math.max(year, determineYear(years[1] || "")); + year = (minDate ? Math.max(year, minDate.getFullYear()) : year); + endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear); + inst.yearshtml += ""; + + html += inst.yearshtml; + inst.yearshtml = null; + } + } + + html += this._get(inst, "yearSuffix"); + if (showMonthAfterYear) { + html += (secondary || !(changeMonth && changeYear) ? " " : "") + monthHtml; + } + html += "
    "; // Close datepicker_header + return html; + }, + + /* Adjust one of the date sub-fields. */ + _adjustInstDate: function(inst, offset, period) { + var year = inst.drawYear + (period === "Y" ? offset : 0), + month = inst.drawMonth + (period === "M" ? offset : 0), + day = Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) + (period === "D" ? offset : 0), + date = this._restrictMinMax(inst, this._daylightSavingAdjust(new Date(year, month, day))); + + inst.selectedDay = date.getDate(); + inst.drawMonth = inst.selectedMonth = date.getMonth(); + inst.drawYear = inst.selectedYear = date.getFullYear(); + if (period === "M" || period === "Y") { + this._notifyChange(inst); + } + }, + + /* Ensure a date is within any min/max bounds. */ + _restrictMinMax: function(inst, date) { + var minDate = this._getMinMaxDate(inst, "min"), + maxDate = this._getMinMaxDate(inst, "max"), + newDate = (minDate && date < minDate ? minDate : date); + return (maxDate && newDate > maxDate ? maxDate : newDate); + }, + + /* Notify change of month/year. */ + _notifyChange: function(inst) { + var onChange = this._get(inst, "onChangeMonthYear"); + if (onChange) { + onChange.apply((inst.input ? inst.input[0] : null), + [inst.selectedYear, inst.selectedMonth + 1, inst]); + } + }, + + /* Determine the number of months to show. */ + _getNumberOfMonths: function(inst) { + var numMonths = this._get(inst, "numberOfMonths"); + return (numMonths == null ? [1, 1] : (typeof numMonths === "number" ? [1, numMonths] : numMonths)); + }, + + /* Determine the current maximum date - ensure no time components are set. */ + _getMinMaxDate: function(inst, minMax) { + return this._determineDate(inst, this._get(inst, minMax + "Date"), null); + }, + + /* Find the number of days in a given month. */ + _getDaysInMonth: function(year, month) { + return 32 - this._daylightSavingAdjust(new Date(year, month, 32)).getDate(); + }, + + /* Find the day of the week of the first of a month. */ + _getFirstDayOfMonth: function(year, month) { + return new Date(year, month, 1).getDay(); + }, + + /* Determines if we should allow a "next/prev" month display change. */ + _canAdjustMonth: function(inst, offset, curYear, curMonth) { + var numMonths = this._getNumberOfMonths(inst), + date = this._daylightSavingAdjust(new Date(curYear, + curMonth + (offset < 0 ? offset : numMonths[0] * numMonths[1]), 1)); + + if (offset < 0) { + date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth())); + } + return this._isInRange(inst, date); + }, + + /* Is the given date in the accepted range? */ + _isInRange: function(inst, date) { + var yearSplit, currentYear, + minDate = this._getMinMaxDate(inst, "min"), + maxDate = this._getMinMaxDate(inst, "max"), + minYear = null, + maxYear = null, + years = this._get(inst, "yearRange"); + if (years){ + yearSplit = years.split(":"); + currentYear = new Date().getFullYear(); + minYear = parseInt(yearSplit[0], 10); + maxYear = parseInt(yearSplit[1], 10); + if ( yearSplit[0].match(/[+\-].*/) ) { + minYear += currentYear; + } + if ( yearSplit[1].match(/[+\-].*/) ) { + maxYear += currentYear; + } + } + + return ((!minDate || date.getTime() >= minDate.getTime()) && + (!maxDate || date.getTime() <= maxDate.getTime()) && + (!minYear || date.getFullYear() >= minYear) && + (!maxYear || date.getFullYear() <= maxYear)); + }, + + /* Provide the configuration settings for formatting/parsing. */ + _getFormatConfig: function(inst) { + var shortYearCutoff = this._get(inst, "shortYearCutoff"); + shortYearCutoff = (typeof shortYearCutoff !== "string" ? shortYearCutoff : + new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10)); + return {shortYearCutoff: shortYearCutoff, + dayNamesShort: this._get(inst, "dayNamesShort"), dayNames: this._get(inst, "dayNames"), + monthNamesShort: this._get(inst, "monthNamesShort"), monthNames: this._get(inst, "monthNames")}; + }, + + /* Format the given date for display. */ + _formatDate: function(inst, day, month, year) { + if (!day) { + inst.currentDay = inst.selectedDay; + inst.currentMonth = inst.selectedMonth; + inst.currentYear = inst.selectedYear; + } + var date = (day ? (typeof day === "object" ? day : + this._daylightSavingAdjust(new Date(year, month, day))) : + this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay))); + return this.formatDate(this._get(inst, "dateFormat"), date, this._getFormatConfig(inst)); + } +}); + +/* + * Bind hover events for datepicker elements. + * Done via delegate so the binding only occurs once in the lifetime of the parent div. + * Global instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker. + */ +function bindHover(dpDiv) { + var selector = "button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a"; + return dpDiv.delegate(selector, "mouseout", function() { + $(this).removeClass("ui-state-hover"); + if (this.className.indexOf("ui-datepicker-prev") !== -1) { + $(this).removeClass("ui-datepicker-prev-hover"); + } + if (this.className.indexOf("ui-datepicker-next") !== -1) { + $(this).removeClass("ui-datepicker-next-hover"); + } + }) + .delegate(selector, "mouseover", function(){ + if (!$.datepicker._isDisabledDatepicker( instActive.inline ? dpDiv.parent()[0] : instActive.input[0])) { + $(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"); + $(this).addClass("ui-state-hover"); + if (this.className.indexOf("ui-datepicker-prev") !== -1) { + $(this).addClass("ui-datepicker-prev-hover"); + } + if (this.className.indexOf("ui-datepicker-next") !== -1) { + $(this).addClass("ui-datepicker-next-hover"); + } + } + }); +} + +/* jQuery extend now ignores nulls! */ +function extendRemove(target, props) { + $.extend(target, props); + for (var name in props) { + if (props[name] == null) { + target[name] = props[name]; + } + } + return target; +} + +/* Invoke the datepicker functionality. + @param options string - a command, optionally followed by additional parameters or + Object - settings for attaching new datepicker functionality + @return jQuery object */ +$.fn.datepicker = function(options){ + + /* Verify an empty collection wasn't passed - Fixes #6976 */ + if ( !this.length ) { + return this; + } + + /* Initialise the date picker. */ + if (!$.datepicker.initialized) { + $(document).mousedown($.datepicker._checkExternalClick); + $.datepicker.initialized = true; + } + + /* Append datepicker main container to body if not exist. */ + if ($("#"+$.datepicker._mainDivId).length === 0) { + $("body").append($.datepicker.dpDiv); + } + + var otherArgs = Array.prototype.slice.call(arguments, 1); + if (typeof options === "string" && (options === "isDisabled" || options === "getDate" || options === "widget")) { + return $.datepicker["_" + options + "Datepicker"]. + apply($.datepicker, [this[0]].concat(otherArgs)); + } + if (options === "option" && arguments.length === 2 && typeof arguments[1] === "string") { + return $.datepicker["_" + options + "Datepicker"]. + apply($.datepicker, [this[0]].concat(otherArgs)); + } + return this.each(function() { + typeof options === "string" ? + $.datepicker["_" + options + "Datepicker"]. + apply($.datepicker, [this].concat(otherArgs)) : + $.datepicker._attachDatepicker(this, options); + }); +}; + +$.datepicker = new Datepicker(); // singleton instance +$.datepicker.initialized = false; +$.datepicker.uuid = new Date().getTime(); +$.datepicker.version = "1.10.4"; + +})(jQuery); + +(function( $, undefined ) { + +var sizeRelatedOptions = { + buttons: true, + height: true, + maxHeight: true, + maxWidth: true, + minHeight: true, + minWidth: true, + width: true + }, + resizableRelatedOptions = { + maxHeight: true, + maxWidth: true, + minHeight: true, + minWidth: true + }; + +$.widget( "ui.dialog", { + version: "1.10.4", + options: { + appendTo: "body", + autoOpen: true, + buttons: [], + closeOnEscape: true, + closeText: "close", + dialogClass: "", + draggable: true, + hide: null, + height: "auto", + maxHeight: null, + maxWidth: null, + minHeight: 150, + minWidth: 150, + modal: false, + position: { + my: "center", + at: "center", + of: window, + collision: "fit", + // Ensure the titlebar is always visible + using: function( pos ) { + var topOffset = $( this ).css( pos ).offset().top; + if ( topOffset < 0 ) { + $( this ).css( "top", pos.top - topOffset ); + } + } + }, + resizable: true, + show: null, + title: null, + width: 300, + + // callbacks + beforeClose: null, + close: null, + drag: null, + dragStart: null, + dragStop: null, + focus: null, + open: null, + resize: null, + resizeStart: null, + resizeStop: null + }, + + _create: function() { + this.originalCss = { + display: this.element[0].style.display, + width: this.element[0].style.width, + minHeight: this.element[0].style.minHeight, + maxHeight: this.element[0].style.maxHeight, + height: this.element[0].style.height + }; + this.originalPosition = { + parent: this.element.parent(), + index: this.element.parent().children().index( this.element ) + }; + this.originalTitle = this.element.attr("title"); + this.options.title = this.options.title || this.originalTitle; + + this._createWrapper(); + + this.element + .show() + .removeAttr("title") + .addClass("ui-dialog-content ui-widget-content") + .appendTo( this.uiDialog ); + + this._createTitlebar(); + this._createButtonPane(); + + if ( this.options.draggable && $.fn.draggable ) { + this._makeDraggable(); + } + if ( this.options.resizable && $.fn.resizable ) { + this._makeResizable(); + } + + this._isOpen = false; + }, + + _init: function() { + if ( this.options.autoOpen ) { + this.open(); + } + }, + + _appendTo: function() { + var element = this.options.appendTo; + if ( element && (element.jquery || element.nodeType) ) { + return $( element ); + } + return this.document.find( element || "body" ).eq( 0 ); + }, + + _destroy: function() { + var next, + originalPosition = this.originalPosition; + + this._destroyOverlay(); + + this.element + .removeUniqueId() + .removeClass("ui-dialog-content ui-widget-content") + .css( this.originalCss ) + // Without detaching first, the following becomes really slow + .detach(); + + this.uiDialog.stop( true, true ).remove(); + + if ( this.originalTitle ) { + this.element.attr( "title", this.originalTitle ); + } + + next = originalPosition.parent.children().eq( originalPosition.index ); + // Don't try to place the dialog next to itself (#8613) + if ( next.length && next[0] !== this.element[0] ) { + next.before( this.element ); + } else { + originalPosition.parent.append( this.element ); + } + }, + + widget: function() { + return this.uiDialog; + }, + + disable: $.noop, + enable: $.noop, + + close: function( event ) { + var activeElement, + that = this; + + if ( !this._isOpen || this._trigger( "beforeClose", event ) === false ) { + return; + } + + this._isOpen = false; + this._destroyOverlay(); + + if ( !this.opener.filter(":focusable").focus().length ) { + + // support: IE9 + // IE9 throws an "Unspecified error" accessing document.activeElement from an '); + else + lyr1 = $(''); + + if (opts.theme) + lyr2 = $(''); + else + lyr2 = $(''); + + if (opts.theme && full) { + s = ''; + } + else if (opts.theme) { + s = ''; + } + else if (full) { + s = ''; + } + else { + s = ''; + } + lyr3 = $(s); + + // if we have a message, style it + if (msg) { + if (opts.theme) { + lyr3.css(themedCSS); + lyr3.addClass('ui-widget-content'); + } + else + lyr3.css(css); + } + + // style the overlay + if (!opts.theme /*&& (!opts.applyPlatformOpacityRules)*/) + lyr2.css(opts.overlayCSS); + lyr2.css('position', full ? 'fixed' : 'absolute'); + + // make iframe layer transparent in IE + if (msie || opts.forceIframe) + lyr1.css('opacity',0.0); + + //$([lyr1[0],lyr2[0],lyr3[0]]).appendTo(full ? 'body' : el); + var layers = [lyr1,lyr2,lyr3], $par = full ? $('body') : $(el); + $.each(layers, function() { + this.appendTo($par); + }); + + if (opts.theme && opts.draggable && $.fn.draggable) { + lyr3.draggable({ + handle: '.ui-dialog-titlebar', + cancel: 'li' + }); + } + + // ie7 must use absolute positioning in quirks mode and to account for activex issues (when scrolling) + var expr = setExpr && (!$.support.boxModel || $('object,embed', full ? null : el).length > 0); + if (ie6 || expr) { + // give body 100% height + if (full && opts.allowBodyStretch && $.support.boxModel) + $('html,body').css('height','100%'); + + // fix ie6 issue when blocked element has a border width + if ((ie6 || !$.support.boxModel) && !full) { + var t = sz(el,'borderTopWidth'), l = sz(el,'borderLeftWidth'); + var fixT = t ? '(0 - '+t+')' : 0; + var fixL = l ? '(0 - '+l+')' : 0; + } + + // simulate fixed position + $.each(layers, function(i,o) { + var s = o[0].style; + s.position = 'absolute'; + if (i < 2) { + if (full) + s.setExpression('height','Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.support.boxModel?0:'+opts.quirksmodeOffsetHack+') + "px"'); + else + s.setExpression('height','this.parentNode.offsetHeight + "px"'); + if (full) + s.setExpression('width','jQuery.support.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"'); + else + s.setExpression('width','this.parentNode.offsetWidth + "px"'); + if (fixL) s.setExpression('left', fixL); + if (fixT) s.setExpression('top', fixT); + } + else if (opts.centerY) { + if (full) s.setExpression('top','(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"'); + s.marginTop = 0; + } + else if (!opts.centerY && full) { + var top = (opts.css && opts.css.top) ? parseInt(opts.css.top, 10) : 0; + var expression = '((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + '+top+') + "px"'; + s.setExpression('top',expression); + } + }); + } + + // show the message + if (msg) { + if (opts.theme) + lyr3.find('.ui-widget-content').append(msg); + else + lyr3.append(msg); + if (msg.jquery || msg.nodeType) + $(msg).show(); + } + + if ((msie || opts.forceIframe) && opts.showOverlay) + lyr1.show(); // opacity is zero + if (opts.fadeIn) { + var cb = opts.onBlock ? opts.onBlock : noOp; + var cb1 = (opts.showOverlay && !msg) ? cb : noOp; + var cb2 = msg ? cb : noOp; + if (opts.showOverlay) + lyr2._fadeIn(opts.fadeIn, cb1); + if (msg) + lyr3._fadeIn(opts.fadeIn, cb2); + } + else { + if (opts.showOverlay) + lyr2.show(); + if (msg) + lyr3.show(); + if (opts.onBlock) + opts.onBlock(); + } + + // bind key and mouse events + bind(1, el, opts); + + if (full) { + pageBlock = lyr3[0]; + pageBlockEls = $(opts.focusableElements,pageBlock); + if (opts.focusInput) + setTimeout(focus, 20); + } + else + center(lyr3[0], opts.centerX, opts.centerY); + + if (opts.timeout) { + // auto-unblock + var to = setTimeout(function() { + if (full) + $.unblockUI(opts); + else + $(el).unblock(opts); + }, opts.timeout); + $(el).data('blockUI.timeout', to); + } + } + + // remove the block + function remove(el, opts) { + var count; + var full = (el == window); + var $el = $(el); + var data = $el.data('blockUI.history'); + var to = $el.data('blockUI.timeout'); + if (to) { + clearTimeout(to); + $el.removeData('blockUI.timeout'); + } + opts = $.extend({}, $.blockUI.defaults, opts || {}); + bind(0, el, opts); // unbind events + + if (opts.onUnblock === null) { + opts.onUnblock = $el.data('blockUI.onUnblock'); + $el.removeData('blockUI.onUnblock'); + } + + var els; + if (full) // crazy selector to handle odd field errors in ie6/7 + els = $('body').children().filter('.blockUI').add('body > .blockUI'); + else + els = $el.find('>.blockUI'); + + // fix cursor issue + if ( opts.cursorReset ) { + if ( els.length > 1 ) + els[1].style.cursor = opts.cursorReset; + if ( els.length > 2 ) + els[2].style.cursor = opts.cursorReset; + } + + if (full) + pageBlock = pageBlockEls = null; + + if (opts.fadeOut) { + count = els.length; + els.stop().fadeOut(opts.fadeOut, function() { + if ( --count === 0) + reset(els,data,opts,el); + }); + } + else + reset(els, data, opts, el); + } + + // move blocking element back into the DOM where it started + function reset(els,data,opts,el) { + var $el = $(el); + if ( $el.data('blockUI.isBlocked') ) + return; + + els.each(function(i,o) { + // remove via DOM calls so we don't lose event handlers + if (this.parentNode) + this.parentNode.removeChild(this); + }); + + if (data && data.el) { + data.el.style.display = data.display; + data.el.style.position = data.position; + if (data.parent) + data.parent.appendChild(data.el); + $el.removeData('blockUI.history'); + } + + if ($el.data('blockUI.static')) { + $el.css('position', 'static'); // #22 + } + + if (typeof opts.onUnblock == 'function') + opts.onUnblock(el,opts); + + // fix issue in Safari 6 where block artifacts remain until reflow + var body = $(document.body), w = body.width(), cssW = body[0].style.width; + body.width(w-1).width(w); + body[0].style.width = cssW; + } + + // bind/unbind the handler + function bind(b, el, opts) { + var full = el == window, $el = $(el); + + // don't bother unbinding if there is nothing to unbind + if (!b && (full && !pageBlock || !full && !$el.data('blockUI.isBlocked'))) + return; + + $el.data('blockUI.isBlocked', b); + + // don't bind events when overlay is not in use or if bindEvents is false + if (!full || !opts.bindEvents || (b && !opts.showOverlay)) + return; + + // bind anchors and inputs for mouse and key events + var events = 'mousedown mouseup keydown keypress keyup touchstart touchend touchmove'; + if (b) + $(document).bind(events, opts, handler); + else + $(document).unbind(events, handler); + + // former impl... + // var $e = $('a,:input'); + // b ? $e.bind(events, opts, handler) : $e.unbind(events, handler); + } + + // event handler to suppress keyboard/mouse events when blocking + function handler(e) { + // allow tab navigation (conditionally) + if (e.type === 'keydown' && e.keyCode && e.keyCode == 9) { + if (pageBlock && e.data.constrainTabKey) { + var els = pageBlockEls; + var fwd = !e.shiftKey && e.target === els[els.length-1]; + var back = e.shiftKey && e.target === els[0]; + if (fwd || back) { + setTimeout(function(){focus(back);},10); + return false; + } + } + } + var opts = e.data; + var target = $(e.target); + if (target.hasClass('blockOverlay') && opts.onOverlayClick) + opts.onOverlayClick(e); + + // allow events within the message content + if (target.parents('div.' + opts.blockMsgClass).length > 0) + return true; + + // allow events for content that is not being blocked + return target.parents().children().filter('div.blockUI').length === 0; + } + + function focus(back) { + if (!pageBlockEls) + return; + var e = pageBlockEls[back===true ? pageBlockEls.length-1 : 0]; + if (e) + e.focus(); + } + + function center(el, x, y) { + var p = el.parentNode, s = el.style; + var l = ((p.offsetWidth - el.offsetWidth)/2) - sz(p,'borderLeftWidth'); + var t = ((p.offsetHeight - el.offsetHeight)/2) - sz(p,'borderTopWidth'); + if (x) s.left = l > 0 ? (l+'px') : '0'; + if (y) s.top = t > 0 ? (t+'px') : '0'; + } + + function sz(el, p) { + return parseInt($.css(el,p),10)||0; + } + + } + + + /*global define:true */ + if (typeof define === 'function' && define.amd && define.amd.jQuery) { + define(['jquery'], setup); + } else { + setup(jQuery); + } + +})(); diff --git a/include/jQuery/jquery.tablesorter.js b/include/jQuery/jquery.tablesorter.js new file mode 100644 index 00000000..e8e23234 --- /dev/null +++ b/include/jQuery/jquery.tablesorter.js @@ -0,0 +1,1031 @@ +/* + * + * TableSorter 2.0 - Client-side table sorting with ease! + * Version 2.0.5b + * @requires jQuery v1.2.3 + * + * Copyright (c) 2007 Christian Bach + * Examples and docs at: http://tablesorter.com + * Dual licensed under the MIT and GPL licenses: + * http://www.opensource.org/licenses/mit-license.php + * http://www.gnu.org/licenses/gpl.html + * + */ +/** + * + * @description Create a sortable table with multi-column sorting capabilitys + * + * @example $('table').tablesorter(); + * @desc Create a simple tablesorter interface. + * + * @example $('table').tablesorter({ sortList:[[0,0],[1,0]] }); + * @desc Create a tablesorter interface and sort on the first and secound column column headers. + * + * @example $('table').tablesorter({ headers: { 0: { sorter: false}, 1: {sorter: false} } }); + * + * @desc Create a tablesorter interface and disableing the first and second column headers. + * + * + * @example $('table').tablesorter({ headers: { 0: {sorter:"integer"}, 1: {sorter:"currency"} } }); + * + * @desc Create a tablesorter interface and set a column parser for the first + * and second column. + * + * + * @param Object + * settings An object literal containing key/value pairs to provide + * optional settings. + * + * + * @option String cssHeader (optional) A string of the class name to be appended + * to sortable tr elements in the thead of the table. Default value: + * "header" + * + * @option String cssAsc (optional) A string of the class name to be appended to + * sortable tr elements in the thead on a ascending sort. Default value: + * "headerSortUp" + * + * @option String cssDesc (optional) A string of the class name to be appended + * to sortable tr elements in the thead on a descending sort. Default + * value: "headerSortDown" + * + * @option String sortInitialOrder (optional) A string of the inital sorting + * order can be asc or desc. Default value: "asc" + * + * @option String sortMultisortKey (optional) A string of the multi-column sort + * key. Default value: "shiftKey" + * + * @option String textExtraction (optional) A string of the text-extraction + * method to use. For complex html structures inside td cell set this + * option to "complex", on large tables the complex option can be slow. + * Default value: "simple" + * + * @option Object headers (optional) An array containing the forces sorting + * rules. This option let's you specify a default sorting rule. Default + * value: null + * + * @option Array sortList (optional) An array containing the forces sorting + * rules. This option let's you specify a default sorting rule. Default + * value: null + * + * @option Array sortForce (optional) An array containing forced sorting rules. + * This option let's you specify a default sorting rule, which is + * prepended to user-selected rules. Default value: null + * + * @option Boolean sortLocaleCompare (optional) Boolean flag indicating whatever + * to use String.localeCampare method or not. Default set to true. + * + * + * @option Array sortAppend (optional) An array containing forced sorting rules. + * This option let's you specify a default sorting rule, which is + * appended to user-selected rules. Default value: null + * + * @option Boolean widthFixed (optional) Boolean flag indicating if tablesorter + * should apply fixed widths to the table columns. This is usefull when + * using the pager companion plugin. This options requires the dimension + * jquery plugin. Default value: false + * + * @option Boolean cancelSelection (optional) Boolean flag indicating if + * tablesorter should cancel selection of the table headers text. + * Default value: true + * + * @option Boolean debug (optional) Boolean flag indicating if tablesorter + * should display debuging information usefull for development. + * + * @type jQuery + * + * @name tablesorter + * + * @cat Plugins/Tablesorter + * + * @author Christian Bach/christian.bach@polyester.se + */ + +(function ($) { + $.extend({ + tablesorter: new + function () { + + var parsers = [], + widgets = []; + + this.defaults = { + cssHeader: "header", + cssAsc: "headerSortUp", + cssDesc: "headerSortDown", + cssChildRow: "expand-child", + sortInitialOrder: "asc", + sortMultiSortKey: "shiftKey", + sortForce: null, + sortAppend: null, + sortLocaleCompare: true, + textExtraction: "simple", + parsers: {}, widgets: [], + widgetZebra: { + css: ["even", "odd"] + }, headers: {}, widthFixed: false, + cancelSelection: true, + sortList: [], + headerList: [], + dateFormat: "us", + decimal: '/\.|\,/g', + onRenderHeader: null, + selectorHeaders: 'thead th', + debug: false + }; + + /* debuging utils */ + + function benchmark(s, d) { + log(s + "," + (new Date().getTime() - d.getTime()) + "ms"); + } + + this.benchmark = benchmark; + + function log(s) { + if (typeof console != "undefined" && typeof console.debug != "undefined") { + console.log(s); + } else { + alert(s); + } + } + + /* parsers utils */ + + function buildParserCache(table, $headers) { + + if (table.config.debug) { + var parsersDebug = ""; + } + + if (table.tBodies.length == 0) return; // In the case of empty tables + var rows = table.tBodies[0].rows; + + if (rows[0]) { + + var list = [], + cells = rows[0].cells, + l = cells.length; + + for (var i = 0; i < l; i++) { + + var p = false; + + if ($.metadata && ($($headers[i]).metadata() && $($headers[i]).metadata().sorter)) { + + p = getParserById($($headers[i]).metadata().sorter); + + } else if ((table.config.headers[i] && table.config.headers[i].sorter)) { + + p = getParserById(table.config.headers[i].sorter); + } + if (!p) { + + p = detectParserForColumn(table, rows, -1, i); + } + + if (table.config.debug) { + parsersDebug += "column:" + i + " parser:" + p.id + "\n"; + } + + list.push(p); + } + } + + if (table.config.debug) { + log(parsersDebug); + } + + return list; + }; + + function detectParserForColumn(table, rows, rowIndex, cellIndex) { + var l = parsers.length, + node = false, + nodeValue = false, + keepLooking = true; + while (nodeValue == '' && keepLooking) { + rowIndex++; + if (rows[rowIndex]) { + node = getNodeFromRowAndCellIndex(rows, rowIndex, cellIndex); + nodeValue = trimAndGetNodeText(table.config, node); + if (table.config.debug) { + log('Checking if value was empty on row:' + rowIndex); + } + } else { + keepLooking = false; + } + } + for (var i = 1; i < l; i++) { + if (parsers[i].is(nodeValue, table, node)) { + return parsers[i]; + } + } + // 0 is always the generic parser (text) + return parsers[0]; + } + + function getNodeFromRowAndCellIndex(rows, rowIndex, cellIndex) { + return rows[rowIndex].cells[cellIndex]; + } + + function trimAndGetNodeText(config, node) { + return $.trim(getElementText(config, node)); + } + + function getParserById(name) { + var l = parsers.length; + for (var i = 0; i < l; i++) { + if (parsers[i].id.toLowerCase() == name.toLowerCase()) { + return parsers[i]; + } + } + return false; + } + + /* utils */ + + function buildCache(table) { + + if (table.config.debug) { + var cacheTime = new Date(); + } + + var totalRows = (table.tBodies[0] && table.tBodies[0].rows.length) || 0, + totalCells = (table.tBodies[0].rows[0] && table.tBodies[0].rows[0].cells.length) || 0, + parsers = table.config.parsers, + cache = { + row: [], + normalized: [] + }; + + for (var i = 0; i < totalRows; ++i) { + + /** Add the table data to main data array */ + var c = $(table.tBodies[0].rows[i]), + cols = []; + + // if this is a child row, add it to the last row's children and + // continue to the next row + if (c.hasClass(table.config.cssChildRow)) { + cache.row[cache.row.length - 1] = cache.row[cache.row.length - 1].add(c); + // go to the next for loop + continue; + } + + cache.row.push(c); + + for (var j = 0; j < totalCells; ++j) { + cols.push(parsers[j].format(getElementText(table.config, c[0].cells[j]), table, c[0].cells[j])); + } + + cols.push(cache.normalized.length); // add position for rowCache + cache.normalized.push(cols); + cols = null; + }; + + if (table.config.debug) { + benchmark("Building cache for " + totalRows + " rows:", cacheTime); + } + + return cache; + }; + + function getElementText(config, node) { + + var text = ""; + + if (!node) return ""; + + if (!config.supportsTextContent) config.supportsTextContent = node.textContent || false; + + if (config.textExtraction == "simple") { + if (config.supportsTextContent) { + text = node.textContent; + } else { + if (node.childNodes[0] && node.childNodes[0].hasChildNodes()) { + text = node.childNodes[0].innerHTML; + } else { + text = node.innerHTML; + } + } + } else { + if (typeof(config.textExtraction) == "function") { + text = config.textExtraction(node); + } else { + text = $(node).text(); + } + } + return text; + } + + function appendToTable(table, cache) { + + if (table.config.debug) { + var appendTime = new Date() + } + + var c = cache, + r = c.row, + n = c.normalized, + totalRows = n.length, + checkCell = (n[0].length - 1), + tableBody = $(table.tBodies[0]), + rows = []; + + + for (var i = 0; i < totalRows; i++) { + var pos = n[i][checkCell]; + + rows.push(r[pos]); + + if (!table.config.appender) { + + //var o = ; + var l = r[pos].length; + for (var j = 0; j < l; j++) { + tableBody[0].appendChild(r[pos][j]); + } + + // + } + } + + + + if (table.config.appender) { + + table.config.appender(table, rows); + } + + rows = null; + + if (table.config.debug) { + benchmark("Rebuilt table:", appendTime); + } + + // apply table widgets + applyWidget(table); + + // trigger sortend + setTimeout(function () { + $(table).trigger("sortEnd"); + }, 0); + + }; + + function buildHeaders(table) { + + if (table.config.debug) { + var time = new Date(); + } + + var meta = ($.metadata) ? true : false; + + var header_index = computeTableHeaderCellIndexes(table); + + $tableHeaders = $(table.config.selectorHeaders, table).each(function (index) { + + this.column = header_index[this.parentNode.rowIndex + "-" + this.cellIndex]; + // this.column = index; + this.order = formatSortingOrder(table.config.sortInitialOrder); + + + this.count = this.order; + + if (checkHeaderMetadata(this) || checkHeaderOptions(table, index)) this.sortDisabled = true; + if (checkHeaderOptionsSortingLocked(table, index)) this.order = this.lockedOrder = checkHeaderOptionsSortingLocked(table, index); + + if (!this.sortDisabled) { + var $th = $(this).addClass(table.config.cssHeader); + if (table.config.onRenderHeader) table.config.onRenderHeader.apply($th); + } + + // add cell to headerList + table.config.headerList[index] = this; + }); + + if (table.config.debug) { + benchmark("Built headers:", time); + log($tableHeaders); + } + + return $tableHeaders; + + }; + + // from: + // http://www.javascripttoolbox.com/lib/table/examples.php + // http://www.javascripttoolbox.com/temp/table_cellindex.html + + + function computeTableHeaderCellIndexes(t) { + var matrix = []; + var lookup = {}; + var thead = t.getElementsByTagName('THEAD')[0]; + var trs = thead.getElementsByTagName('TR'); + + for (var i = 0; i < trs.length; i++) { + var cells = trs[i].cells; + for (var j = 0; j < cells.length; j++) { + var c = cells[j]; + + var rowIndex = c.parentNode.rowIndex; + var cellId = rowIndex + "-" + c.cellIndex; + var rowSpan = c.rowSpan || 1; + var colSpan = c.colSpan || 1 + var firstAvailCol; + if (typeof(matrix[rowIndex]) == "undefined") { + matrix[rowIndex] = []; + } + // Find first available column in the first row + for (var k = 0; k < matrix[rowIndex].length + 1; k++) { + if (typeof(matrix[rowIndex][k]) == "undefined") { + firstAvailCol = k; + break; + } + } + lookup[cellId] = firstAvailCol; + for (var k = rowIndex; k < rowIndex + rowSpan; k++) { + if (typeof(matrix[k]) == "undefined") { + matrix[k] = []; + } + var matrixrow = matrix[k]; + for (var l = firstAvailCol; l < firstAvailCol + colSpan; l++) { + matrixrow[l] = "x"; + } + } + } + } + return lookup; + } + + function checkCellColSpan(table, rows, row) { + var arr = [], + r = table.tHead.rows, + c = r[row].cells; + + for (var i = 0; i < c.length; i++) { + var cell = c[i]; + + if (cell.colSpan > 1) { + arr = arr.concat(checkCellColSpan(table, headerArr, row++)); + } else { + if (table.tHead.length == 1 || (cell.rowSpan > 1 || !r[row + 1])) { + arr.push(cell); + } + // headerArr[row] = (i+row); + } + } + return arr; + }; + + function checkHeaderMetadata(cell) { + if (($.metadata) && ($(cell).metadata().sorter === false)) { + return true; + }; + return false; + } + + function checkHeaderOptions(table, i) { + if ((table.config.headers[i]) && (table.config.headers[i].sorter === false)) { + return true; + }; + return false; + } + + function checkHeaderOptionsSortingLocked(table, i) { + if ((table.config.headers[i]) && (table.config.headers[i].lockedOrder)) return table.config.headers[i].lockedOrder; + return false; + } + + function applyWidget(table) { + var c = table.config.widgets; + var l = c.length; + for (var i = 0; i < l; i++) { + + getWidgetById(c[i]).format(table); + } + + } + + function getWidgetById(name) { + var l = widgets.length; + for (var i = 0; i < l; i++) { + if (widgets[i].id.toLowerCase() == name.toLowerCase()) { + return widgets[i]; + } + } + }; + + function formatSortingOrder(v) { + if (typeof(v) != "Number") { + return (v.toLowerCase() == "desc") ? 1 : 0; + } else { + return (v == 1) ? 1 : 0; + } + } + + function isValueInArray(v, a) { + var l = a.length; + for (var i = 0; i < l; i++) { + if (a[i][0] == v) { + return true; + } + } + return false; + } + + function setHeadersCss(table, $headers, list, css) { + // remove all header information + $headers.removeClass(css[0]).removeClass(css[1]); + + var h = []; + $headers.each(function (offset) { + if (!this.sortDisabled) { + h[this.column] = $(this); + } + }); + + var l = list.length; + for (var i = 0; i < l; i++) { + h[list[i][0]].addClass(css[list[i][1]]); + } + } + + function fixColumnWidth(table, $headers) { + var c = table.config; + if (c.widthFixed) { + var colgroup = $(''); + $("tr:first td", table.tBodies[0]).each(function () { + colgroup.append($('').css('width', $(this).width())); + }); + $(table).prepend(colgroup); + }; + } + + function updateHeaderSortCount(table, sortList) { + var c = table.config, + l = sortList.length; + for (var i = 0; i < l; i++) { + var s = sortList[i], + o = c.headerList[s[0]]; + o.count = s[1]; + o.count++; + } + } + + /* sorting methods */ + + function multisort(table, sortList, cache) { + + if (table.config.debug) { + var sortTime = new Date(); + } + + var dynamicExp = "var sortWrapper = function(a,b) {", + l = sortList.length; + + // TODO: inline functions. + for (var i = 0; i < l; i++) { + + var c = sortList[i][0]; + var order = sortList[i][1]; + // var s = (getCachedSortType(table.config.parsers,c) == "text") ? + // ((order == 0) ? "sortText" : "sortTextDesc") : ((order == 0) ? + // "sortNumeric" : "sortNumericDesc"); + // var s = (table.config.parsers[c].type == "text") ? ((order == 0) + // ? makeSortText(c) : makeSortTextDesc(c)) : ((order == 0) ? + // makeSortNumeric(c) : makeSortNumericDesc(c)); + var s = (table.config.parsers[c].type == "text") ? ((order == 0) ? makeSortFunction("text", "asc", c) : makeSortFunction("text", "desc", c)) : ((order == 0) ? makeSortFunction("numeric", "asc", c) : makeSortFunction("numeric", "desc", c)); + var e = "e" + i; + + dynamicExp += "var " + e + " = " + s; // + "(a[" + c + "],b[" + c + // + "]); "; + dynamicExp += "if(" + e + ") { return " + e + "; } "; + dynamicExp += "else { "; + + } + + // if value is the same keep orignal order + var orgOrderCol = cache.normalized[0].length - 1; + dynamicExp += "return a[" + orgOrderCol + "]-b[" + orgOrderCol + "];"; + + for (var i = 0; i < l; i++) { + dynamicExp += "}; "; + } + + dynamicExp += "return 0; "; + dynamicExp += "}; "; + + if (table.config.debug) { + benchmark("Evaling expression:" + dynamicExp, new Date()); + } + + eval(dynamicExp); + + cache.normalized.sort(sortWrapper); + + if (table.config.debug) { + benchmark("Sorting on " + sortList.toString() + " and dir " + order + " time:", sortTime); + } + + return cache; + }; + + function makeSortFunction(type, direction, index) { + var a = "a[" + index + "]", + b = "b[" + index + "]"; + if (type == 'text' && direction == 'asc') { + return "(" + a + " == " + b + " ? 0 : (" + a + " === null ? Number.POSITIVE_INFINITY : (" + b + " === null ? Number.NEGATIVE_INFINITY : (" + a + " < " + b + ") ? -1 : 1 )));"; + } else if (type == 'text' && direction == 'desc') { + return "(" + a + " == " + b + " ? 0 : (" + a + " === null ? Number.POSITIVE_INFINITY : (" + b + " === null ? Number.NEGATIVE_INFINITY : (" + b + " < " + a + ") ? -1 : 1 )));"; + } else if (type == 'numeric' && direction == 'asc') { + return "(" + a + " === null && " + b + " === null) ? 0 :(" + a + " === null ? Number.POSITIVE_INFINITY : (" + b + " === null ? Number.NEGATIVE_INFINITY : " + a + " - " + b + "));"; + } else if (type == 'numeric' && direction == 'desc') { + return "(" + a + " === null && " + b + " === null) ? 0 :(" + a + " === null ? Number.POSITIVE_INFINITY : (" + b + " === null ? Number.NEGATIVE_INFINITY : " + b + " - " + a + "));"; + } + }; + + function makeSortText(i) { + return "((a[" + i + "] < b[" + i + "]) ? -1 : ((a[" + i + "] > b[" + i + "]) ? 1 : 0));"; + }; + + function makeSortTextDesc(i) { + return "((b[" + i + "] < a[" + i + "]) ? -1 : ((b[" + i + "] > a[" + i + "]) ? 1 : 0));"; + }; + + function makeSortNumeric(i) { + return "a[" + i + "]-b[" + i + "];"; + }; + + function makeSortNumericDesc(i) { + return "b[" + i + "]-a[" + i + "];"; + }; + + function sortText(a, b) { + if (table.config.sortLocaleCompare) return a.localeCompare(b); + return ((a < b) ? -1 : ((a > b) ? 1 : 0)); + }; + + function sortTextDesc(a, b) { + if (table.config.sortLocaleCompare) return b.localeCompare(a); + return ((b < a) ? -1 : ((b > a) ? 1 : 0)); + }; + + function sortNumeric(a, b) { + return a - b; + }; + + function sortNumericDesc(a, b) { + return b - a; + }; + + function getCachedSortType(parsers, i) { + return parsers[i].type; + }; /* public methods */ + this.construct = function (settings) { + return this.each(function () { + // if no thead or tbody quit. + if (!this.tHead || !this.tBodies) return; + // declare + var $this, $document, $headers, cache, config, shiftDown = 0, + sortOrder; + // new blank config object + this.config = {}; + // merge and extend. + config = $.extend(this.config, $.tablesorter.defaults, settings); + // store common expression for speed + $this = $(this); + // save the settings where they read + $.data(this, "tablesorter", config); + // build headers + $headers = buildHeaders(this); + // try to auto detect column type, and store in tables config + this.config.parsers = buildParserCache(this, $headers); + // build the cache for the tbody cells + cache = buildCache(this); + // get the css class names, could be done else where. + var sortCSS = [config.cssDesc, config.cssAsc]; + // fixate columns if the users supplies the fixedWidth option + fixColumnWidth(this); + // apply event handling to headers + // this is to big, perhaps break it out? + $headers.click( + + function (e) { + var totalRows = ($this[0].tBodies[0] && $this[0].tBodies[0].rows.length) || 0; + if (!this.sortDisabled && totalRows > 0) { + // Only call sortStart if sorting is + // enabled. + $this.trigger("sortStart"); + // store exp, for speed + var $cell = $(this); + // get current column index + var i = this.column; + // get current column sort order + this.order = this.count++ % 2; + // always sort on the locked order. + if(this.lockedOrder) this.order = this.lockedOrder; + + // user only whants to sort on one + // column + if (!e[config.sortMultiSortKey]) { + // flush the sort list + config.sortList = []; + if (config.sortForce != null) { + var a = config.sortForce; + for (var j = 0; j < a.length; j++) { + if (a[j][0] != i) { + config.sortList.push(a[j]); + } + } + } + // add column to sort list + config.sortList.push([i, this.order]); + // multi column sorting + } else { + // the user has clicked on an all + // ready sortet column. + if (isValueInArray(i, config.sortList)) { + // revers the sorting direction + // for all tables. + for (var j = 0; j < config.sortList.length; j++) { + var s = config.sortList[j], + o = config.headerList[s[0]]; + if (s[0] == i) { + o.count = s[1]; + o.count++; + s[1] = o.count % 2; + } + } + } else { + // add column to sort list array + config.sortList.push([i, this.order]); + } + }; + setTimeout(function () { + // set css for headers + setHeadersCss($this[0], $headers, config.sortList, sortCSS); + appendToTable( + $this[0], multisort( + $this[0], config.sortList, cache) + ); + }, 1); + // stop normal event by returning false + return false; + } + // cancel selection + }).mousedown(function () { + if (config.cancelSelection) { + this.onselectstart = function () { + return false + }; + return false; + } + }); + // apply easy methods that trigger binded events + $this.bind("update", function () { + var me = this; + setTimeout(function () { + // rebuild parsers. + me.config.parsers = buildParserCache( + me, $headers); + // rebuild the cache map + cache = buildCache(me); + }, 1); + }).bind("updateCell", function (e, cell) { + var config = this.config; + // get position from the dom. + var pos = [(cell.parentNode.rowIndex - 1), cell.cellIndex]; + // update cache + cache.normalized[pos[0]][pos[1]] = config.parsers[pos[1]].format( + getElementText(config, cell), cell); + }).bind("sorton", function (e, list) { + $(this).trigger("sortStart"); + config.sortList = list; + // update and store the sortlist + var sortList = config.sortList; + // update header count index + updateHeaderSortCount(this, sortList); + // set css for headers + setHeadersCss(this, $headers, sortList, sortCSS); + // sort the table and append it to the dom + appendToTable(this, multisort(this, sortList, cache)); + }).bind("appendCache", function () { + appendToTable(this, cache); + }).bind("applyWidgetId", function (e, id) { + getWidgetById(id).format(this); + }).bind("applyWidgets", function () { + // apply widgets + applyWidget(this); + }); + if ($.metadata && ($(this).metadata() && $(this).metadata().sortlist)) { + config.sortList = $(this).metadata().sortlist; + } + // if user has supplied a sort list to constructor. + if (config.sortList.length > 0) { + $this.trigger("sorton", [config.sortList]); + } + // apply widgets + applyWidget(this); + }); + }; + this.addParser = function (parser) { + var l = parsers.length, + a = true; + for (var i = 0; i < l; i++) { + if (parsers[i].id.toLowerCase() == parser.id.toLowerCase()) { + a = false; + } + } + if (a) { + parsers.push(parser); + }; + }; + this.addWidget = function (widget) { + widgets.push(widget); + }; + this.formatFloat = function (s) { + var i = parseFloat(s); + return (isNaN(i)) ? 0 : i; + }; + this.formatInt = function (s) { + var i = parseInt(s); + return (isNaN(i)) ? 0 : i; + }; + this.isDigit = function (s, config) { + // replace all an wanted chars and match. + return /^[-+]?\d*$/.test($.trim(s.replace(/[,.']/g, ''))); + }; + this.clearTableBody = function (table) { + if ($.browser.msie) { + function empty() { + while (this.firstChild) + this.removeChild(this.firstChild); + } + empty.apply(table.tBodies[0]); + } else { + table.tBodies[0].innerHTML = ""; + } + }; + } + }); + + // extend plugin scope + $.fn.extend({ + tablesorter: $.tablesorter.construct + }); + + // make shortcut + var ts = $.tablesorter; + + // add default parsers + ts.addParser({ + id: "text", + is: function (s) { + return true; + }, format: function (s) { + return $.trim(s.toLocaleLowerCase()); + }, type: "text" + }); + + ts.addParser({ + id: "digit", + is: function (s, table) { + var c = table.config; + return $.tablesorter.isDigit(s, c); + }, format: function (s) { + return $.tablesorter.formatFloat(s); + }, type: "numeric" + }); + + ts.addParser({ + id: "currency", + is: function (s) { + return /^[£$€?.]/.test(s); + }, format: function (s) { + return $.tablesorter.formatFloat(s.replace(new RegExp(/[£$€]/g), "")); + }, type: "numeric" + }); + + ts.addParser({ + id: "ipAddress", + is: function (s) { + return /^\d{2,3}[\.]\d{2,3}[\.]\d{2,3}[\.]\d{2,3}$/.test(s); + }, format: function (s) { + var a = s.split("."), + r = "", + l = a.length; + for (var i = 0; i < l; i++) { + var item = a[i]; + if (item.length == 2) { + r += "0" + item; + } else { + r += item; + } + } + return $.tablesorter.formatFloat(r); + }, type: "numeric" + }); + + ts.addParser({ + id: "url", + is: function (s) { + return /^(https?|ftp|file):\/\/$/.test(s); + }, format: function (s) { + return jQuery.trim(s.replace(new RegExp(/(https?|ftp|file):\/\//), '')); + }, type: "text" + }); + + ts.addParser({ + id: "isoDate", + is: function (s) { + return /^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(s); + }, format: function (s) { + return $.tablesorter.formatFloat((s != "") ? new Date(s.replace( + new RegExp(/-/g), "/")).getTime() : "0"); + }, type: "numeric" + }); + + ts.addParser({ + id: "percent", + is: function (s) { + return /\%$/.test($.trim(s)); + }, format: function (s) { + return $.tablesorter.formatFloat(s.replace(new RegExp(/%/g), "")); + }, type: "numeric" + }); + + ts.addParser({ + id: "usLongDate", + is: function (s) { + return s.match(new RegExp(/^[A-Za-z]{3,10}\.? [0-9]{1,2}, ([0-9]{4}|'?[0-9]{2}) (([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(AM|PM)))$/)); + }, format: function (s) { + return $.tablesorter.formatFloat(new Date(s).getTime()); + }, type: "numeric" + }); + + ts.addParser({ + id: "shortDate", + is: function (s) { + return /\d{1,2}[\/\-]\d{1,2}[\/\-]\d{2,4}/.test(s); + }, format: function (s, table) { + var c = table.config; + s = s.replace(/\-/g, "/"); + if (c.dateFormat == "us") { + // reformat the string in ISO format + s = s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/, "$3/$1/$2"); + } else if (c.dateFormat == "uk") { + // reformat the string in ISO format + s = s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/, "$3/$2/$1"); + } else if (c.dateFormat == "dd/mm/yy" || c.dateFormat == "dd-mm-yy") { + s = s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{2})/, "$1/$2/$3"); + } + return $.tablesorter.formatFloat(new Date(s).getTime()); + }, type: "numeric" + }); + ts.addParser({ + id: "time", + is: function (s) { + return /^(([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(am|pm)))$/.test(s); + }, format: function (s) { + return $.tablesorter.formatFloat(new Date("2000/01/01 " + s).getTime()); + }, type: "numeric" + }); + ts.addParser({ + id: "metadata", + is: function (s) { + return false; + }, format: function (s, table, cell) { + var c = table.config, + p = (!c.parserMetadataName) ? 'sortValue' : c.parserMetadataName; + return $(cell).metadata()[p]; + }, type: "numeric" + }); + // add default widgets + ts.addWidget({ + id: "zebra", + format: function (table) { + if (table.config.debug) { + var time = new Date(); + } + var $tr, row = -1, + odd; + // loop through the visible rows + $("tr:visible", table.tBodies[0]).each(function (i) { + $tr = $(this); + // style children rows the same way the parent + // row was styled + if (!$tr.hasClass(table.config.cssChildRow)) row++; + odd = (row % 2 == 0); + $tr.removeClass( + table.config.widgetZebra.css[odd ? 0 : 1]).addClass( + table.config.widgetZebra.css[odd ? 1 : 0]) + }); + if (table.config.debug) { + $.tablesorter.benchmark("Applying Zebra widget", time); + } + } + }); +})(jQuery); \ No newline at end of file diff --git a/include/jQuery/jquery.tablesorter.pager.js b/include/jQuery/jquery.tablesorter.pager.js new file mode 100644 index 00000000..5a34d825 --- /dev/null +++ b/include/jQuery/jquery.tablesorter.pager.js @@ -0,0 +1,184 @@ +(function($) { + $.extend({ + tablesorterPager: new function() { + + function updatePageDisplay(c) { + var s = $(c.cssPageDisplay,c.container).val((c.page+1) + c.seperator + c.totalPages); + } + + function setPageSize(table,size) { + var c = table.config; + c.size = size; + c.totalPages = Math.ceil(c.totalRows / c.size); + c.pagerPositionSet = false; + moveToPage(table); + fixPosition(table); + } + + function fixPosition(table) { + var c = table.config; + if(!c.pagerPositionSet && c.positionFixed) { + var c = table.config, o = $(table); + if(o.offset) { + c.container.css({ + top: o.offset().top + o.height() + 'px', + position: 'absolute' + }); + } + c.pagerPositionSet = true; + } + } + + function moveToFirstPage(table) { + var c = table.config; + c.page = 0; + moveToPage(table); + } + + function moveToLastPage(table) { + var c = table.config; + c.page = (c.totalPages-1); + moveToPage(table); + } + + function moveToNextPage(table) { + var c = table.config; + c.page++; + if(c.page >= (c.totalPages-1)) { + c.page = (c.totalPages-1); + } + moveToPage(table); + } + + function moveToPrevPage(table) { + var c = table.config; + c.page--; + if(c.page <= 0) { + c.page = 0; + } + moveToPage(table); + } + + + function moveToPage(table) { + var c = table.config; + if(c.page < 0 || c.page > (c.totalPages-1)) { + c.page = 0; + } + + renderTable(table,c.rowsCopy); + } + + function renderTable(table,rows) { + + var c = table.config; + var l = rows.length; + var s = (c.page * c.size); + var e = (s + c.size); + if(e > rows.length ) { + e = rows.length; + } + + + var tableBody = $(table.tBodies[0]); + + // clear the table body + + $.tablesorter.clearTableBody(table); + + for(var i = s; i < e; i++) { + + //tableBody.append(rows[i]); + + var o = rows[i]; + var l = o.length; + for(var j=0; j < l; j++) { + + tableBody[0].appendChild(o[j]); + + } + } + + fixPosition(table,tableBody); + + $(table).trigger("applyWidgets"); + + if( c.page >= c.totalPages ) { + moveToLastPage(table); + } + + updatePageDisplay(c); + } + + this.appender = function(table,rows) { + + var c = table.config; + + c.rowsCopy = rows; + c.totalRows = rows.length; + c.totalPages = Math.ceil(c.totalRows / c.size); + + renderTable(table,rows); + }; + + this.defaults = { + size: 10, + offset: 0, + page: 0, + totalRows: 0, + totalPages: 0, + container: null, + cssNext: '.next', + cssPrev: '.prev', + cssFirst: '.first', + cssLast: '.last', + cssPageDisplay: '.pagedisplay', + cssPageSize: '.pagesize', + seperator: "/", + positionFixed: true, + appender: this.appender + }; + + this.construct = function(settings) { + + return this.each(function() { + + config = $.extend(this.config, $.tablesorterPager.defaults, settings); + + var table = this, pager = config.container; + + $(this).trigger("appendCache"); + + config.size = parseInt($(".pagesize",pager).val()); + + $(config.cssFirst,pager).click(function() { + moveToFirstPage(table); + return false; + }); + $(config.cssNext,pager).click(function() { + moveToNextPage(table); + return false; + }); + $(config.cssPrev,pager).click(function() { + moveToPrevPage(table); + return false; + }); + $(config.cssLast,pager).click(function() { + moveToLastPage(table); + return false; + }); + $(config.cssPageSize,pager).change(function() { + setPageSize(table,parseInt($(this).val())); + return false; + }); + }); + }; + + } + }); + // extend plugin scope + $.fn.extend({ + tablesorterPager: $.tablesorterPager.construct + }); + +})(jQuery); \ No newline at end of file diff --git a/include/jQuery/languages.js b/include/jQuery/languages.js new file mode 100644 index 00000000..665116b5 --- /dev/null +++ b/include/jQuery/languages.js @@ -0,0 +1,989 @@ +/*! + * numeral.js language configuration + * language : belgium-dutch (be-nl) + * author : Dieter Luypaert : https://github.com/moeriki + */ +(function () { + var language = { + delimiters: { + thousands: ' ', + decimal : ',' + }, + abbreviations: { + thousand : 'k', + million : ' mln', + billion : ' mld', + trillion : ' bln' + }, + ordinal : function (number) { + var remainder = number % 100; + return (number !== 0 && remainder <= 1 || remainder === 8 || remainder >= 20) ? 'ste' : 'de'; + }, + currency: { + symbol: '€ ' + } + }; + + // Node + if (typeof module !== 'undefined' && module.exports) { + module.exports = language; + } + // Browser + if (typeof window !== 'undefined' && this.numeral && this.numeral.language) { + this.numeral.language('be-nl', language); + } +}()); +/*! + * numeral.js language configuration + * language : simplified chinese + * author : badplum : https://github.com/badplum + */ +(function () { + var language = { + delimiters: { + thousands: ',', + decimal: '.' + }, + abbreviations: { + thousand: '千', + million: '百万', + billion: '十亿', + trillion: '兆' + }, + ordinal: function (number) { + return '.'; + }, + currency: { + symbol: '¥' + } + }; + + // Node + if (typeof module !== 'undefined' && module.exports) { + module.exports = language; + } + // Browser + if (typeof window !== 'undefined' && this.numeral && this.numeral.language) { + this.numeral.language('chs', language); + } +}()); + +/*! + * numeral.js language configuration + * language : czech (cs) + * author : Anatoli Papirovski : https://github.com/apapirovski + */ +(function () { + var language = { + delimiters: { + thousands: ' ', + decimal: ',' + }, + abbreviations: { + thousand: 'tis.', + million: 'mil.', + billion: 'b', + trillion: 't' + }, + ordinal: function () { + return '.'; + }, + currency: { + symbol: 'Kč' + } + }; + + // Node + if (typeof module !== 'undefined' && module.exports) { + module.exports = language; + } + // Browser + if (typeof window !== 'undefined' && this.numeral && this.numeral.language) { + this.numeral.language('cs', language); + } +}()); + +/*! + * numeral.js language configuration + * language : danish denmark (dk) + * author : Michael Storgaard : https://github.com/mstorgaard + */ +(function () { + var language = { + delimiters: { + thousands: '.', + decimal: ',' + }, + abbreviations: { + thousand: 'k', + million: 'mio', + billion: 'mia', + trillion: 'b' + }, + ordinal: function (number) { + return '.'; + }, + currency: { + symbol: 'DKK' + } + }; + + // Node + if (typeof module !== 'undefined' && module.exports) { + module.exports = language; + } + // Browser + if (typeof window !== 'undefined' && this.numeral && this.numeral.language) { + this.numeral.language('da-dk', language); + } +}()); +/*! + * numeral.js language configuration + * language : German in Switzerland (de-ch) + * author : Michael Piefel : https://github.com/piefel (based on work from Marco Krage : https://github.com/sinky) + */ +(function () { + var language = { + delimiters: { + thousands: ' ', + decimal: ',' + }, + abbreviations: { + thousand: 'k', + million: 'm', + billion: 'b', + trillion: 't' + }, + ordinal: function (number) { + return '.'; + }, + currency: { + symbol: 'CHF' + } + }; + + // Node + if (typeof module !== 'undefined' && module.exports) { + module.exports = language; + } + // Browser + if (typeof window !== 'undefined' && this.numeral && this.numeral.language) { + this.numeral.language('de-ch', language); + } +}()); +/*! + * numeral.js language configuration + * language : German (de) – generally useful in Germany, Austria, Luxembourg, Belgium + * author : Marco Krage : https://github.com/sinky + */ +(function () { + var language = { + delimiters: { + thousands: ' ', + decimal: ',' + }, + abbreviations: { + thousand: 'k', + million: 'm', + billion: 'b', + trillion: 't' + }, + ordinal: function (number) { + return '.'; + }, + currency: { + symbol: '€' + } + }; + + // Node + if (typeof module !== 'undefined' && module.exports) { + module.exports = language; + } + // Browser + if (typeof window !== 'undefined' && this.numeral && this.numeral.language) { + this.numeral.language('de', language); + } +}()); +/*! + * numeral.js language configuration + * language : english united kingdom (uk) + * author : Dan Ristic : https://github.com/dristic + */ +(function () { + var language = { + delimiters: { + thousands: ',', + decimal: '.' + }, + abbreviations: { + thousand: 'k', + million: 'm', + billion: 'b', + trillion: 't' + }, + ordinal: function (number) { + var b = number % 10; + return (~~ (number % 100 / 10) === 1) ? 'th' : + (b === 1) ? 'st' : + (b === 2) ? 'nd' : + (b === 3) ? 'rd' : 'th'; + }, + currency: { + symbol: '£' + } + }; + + // Node + if (typeof module !== 'undefined' && module.exports) { + module.exports = language; + } + // Browser + if (typeof window !== 'undefined' && this.numeral && this.numeral.language) { + this.numeral.language('en-gb', language); + } +}()); +/*! + * numeral.js language configuration + * language : spanish Spain + * author : Hernan Garcia : https://github.com/hgarcia + */ +(function () { + var language = { + delimiters: { + thousands: '.', + decimal: ',' + }, + abbreviations: { + thousand: 'k', + million: 'mm', + billion: 'b', + trillion: 't' + }, + ordinal: function (number) { + var b = number % 10; + return (b === 1 || b === 3) ? 'er' : + (b === 2) ? 'do' : + (b === 7 || b === 0) ? 'mo' : + (b === 8) ? 'vo' : + (b === 9) ? 'no' : 'to'; + }, + currency: { + symbol: '€' + } + }; + + // Node + if (typeof module !== 'undefined' && module.exports) { + module.exports = language; + } + // Browser + if (typeof window !== 'undefined' && this.numeral && this.numeral.language) { + this.numeral.language('es', language); + } +}()); + +/*! + * numeral.js language configuration + * language : spanish + * author : Hernan Garcia : https://github.com/hgarcia + */ +(function () { + var language = { + delimiters: { + thousands: '.', + decimal: ',' + }, + abbreviations: { + thousand: 'k', + million: 'mm', + billion: 'b', + trillion: 't' + }, + ordinal: function (number) { + var b = number % 10; + return (b === 1 || b === 3) ? 'er' : + (b === 2) ? 'do' : + (b === 7 || b === 0) ? 'mo' : + (b === 8) ? 'vo' : + (b === 9) ? 'no' : 'to'; + }, + currency: { + symbol: '$' + } + }; + + // Node + if (typeof module !== 'undefined' && module.exports) { + module.exports = language; + } + // Browser + if (typeof window !== 'undefined' && this.numeral && this.numeral.language) { + this.numeral.language('es', language); + } +}()); + +/*! + * numeral.js language configuration + * language : Estonian + * author : Illimar Tambek : https://github.com/ragulka + * + * Note: in Estonian, abbreviations are always separated + * from numbers with a space + */ +(function () { + var language = { + delimiters: { + thousands: ' ', + decimal: ',' + }, + abbreviations: { + thousand: ' tuh', + million: ' mln', + billion: ' mld', + trillion: ' trl' + }, + ordinal: function (number) { + return '.'; + }, + currency: { + symbol: '€' + } + }; + + // Node + if (typeof module !== 'undefined' && module.exports) { + module.exports = language; + } + // Browser + if (typeof window !== 'undefined' && this.numeral && this.numeral.language) { + this.numeral.language('et', language); + } +}()); + +/*! + * numeral.js language configuration + * language : Finnish + * author : Sami Saada : https://github.com/samitheberber + */ +(function () { + var language = { + delimiters: { + thousands: ' ', + decimal: ',' + }, + abbreviations: { + thousand: 'k', + million: 'M', + billion: 'G', + trillion: 'T' + }, + ordinal: function (number) { + return '.'; + }, + currency: { + symbol: '€' + } + }; + + // Node + if (typeof module !== 'undefined' && module.exports) { + module.exports = language; + } + // Browser + if (typeof window !== 'undefined' && this.numeral && this.numeral.language) { + this.numeral.language('fi', language); + } +}()); + +/*! + * numeral.js language configuration + * language : french (Canada) (fr-CA) + * author : Léo Renaud-Allaire : https://github.com/renaudleo + */ +(function () { + var language = { + delimiters: { + thousands: ' ', + decimal: ',' + }, + abbreviations: { + thousand: 'k', + million: 'M', + billion: 'G', + trillion: 'T' + }, + ordinal : function (number) { + return number === 1 ? 'er' : 'e'; + }, + currency: { + symbol: '$' + } + }; + + // Node + if (typeof module !== 'undefined' && module.exports) { + module.exports = language; + } + // Browser + if (typeof window !== 'undefined' && this.numeral && this.numeral.language) { + this.numeral.language('fr-CA', language); + } +}()); +/*! + * numeral.js language configuration + * language : french (fr-ch) + * author : Adam Draper : https://github.com/adamwdraper + */ +(function () { + var language = { + delimiters: { + thousands: '\'', + decimal: '.' + }, + abbreviations: { + thousand: 'k', + million: 'm', + billion: 'b', + trillion: 't' + }, + ordinal : function (number) { + return number === 1 ? 'er' : 'e'; + }, + currency: { + symbol: 'CHF' + } + }; + + // Node + if (typeof module !== 'undefined' && module.exports) { + module.exports = language; + } + // Browser + if (typeof window !== 'undefined' && this.numeral && this.numeral.language) { + this.numeral.language('fr-ch', language); + } +}()); + +/*! + * numeral.js language configuration + * language : french (fr) + * author : Adam Draper : https://github.com/adamwdraper + */ +(function () { + var language = { + delimiters: { + thousands: ' ', + decimal: ',' + }, + abbreviations: { + thousand: 'k', + million: 'm', + billion: 'b', + trillion: 't' + }, + ordinal : function (number) { + return number === 1 ? 'er' : 'e'; + }, + currency: { + symbol: '€' + } + }; + + // Node + if (typeof module !== 'undefined' && module.exports) { + module.exports = language; + } + // Browser + if (typeof window !== 'undefined' && this.numeral && this.numeral.language) { + this.numeral.language('fr', language); + } +}()); +/*! + * numeral.js language configuration + * language : Hungarian (hu) + * author : Peter Bakondy : https://github.com/pbakondy + */ +(function () { + var language = { + delimiters: { + thousands: ' ', + decimal: ',' + }, + abbreviations: { + thousand: 'E', // ezer + million: 'M', // millió + billion: 'Mrd', // milliárd + trillion: 'T' // trillió + }, + ordinal: function (number) { + return '.'; + }, + currency: { + symbol: ' Ft' + } + }; + + // Node + if (typeof module !== 'undefined' && module.exports) { + module.exports = language; + } + // Browser + if (typeof window !== 'undefined' && this.numeral && this.numeral.language) { + this.numeral.language('hu', language); + } +}()); +/*! + * numeral.js language configuration + * language : italian Italy (it) + * author : Giacomo Trombi : http://cinquepunti.it + */ +(function () { + var language = { + delimiters: { + thousands: '.', + decimal: ',' + }, + abbreviations: { + thousand: 'mila', + million: 'mil', + billion: 'b', + trillion: 't' + }, + ordinal: function (number) { + return 'º'; + }, + currency: { + symbol: '€' + } + }; + + // Node + if (typeof module !== 'undefined' && module.exports) { + module.exports = language; + } + // Browser + if (typeof window !== 'undefined' && this.numeral && this.numeral.language) { + this.numeral.language('it', language); + } +}()); +/*! + * numeral.js language configuration + * language : japanese + * author : teppeis : https://github.com/teppeis + */ +(function () { + var language = { + delimiters: { + thousands: ',', + decimal: '.' + }, + abbreviations: { + thousand: '千', + million: '百万', + billion: '十億', + trillion: '兆' + }, + ordinal: function (number) { + return '.'; + }, + currency: { + symbol: '¥' + } + }; + + // Node + if (typeof module !== 'undefined' && module.exports) { + module.exports = language; + } + // Browser + if (typeof window !== 'undefined' && this.numeral && this.numeral.language) { + this.numeral.language('ja', language); + } +}()); + +/*! + * numeral.js language configuration + * language : netherlands-dutch (nl-nl) + * author : Dave Clayton : https://github.com/davedx + */ +(function () { + var language = { + delimiters: { + thousands: '.', + decimal : ',' + }, + abbreviations: { + thousand : 'k', + million : 'mln', + billion : 'mrd', + trillion : 'bln' + }, + ordinal : function (number) { + var remainder = number % 100; + return (number !== 0 && remainder <= 1 || remainder === 8 || remainder >= 20) ? 'ste' : 'de'; + }, + currency: { + symbol: '€ ' + } + }; + + // Node + if (typeof module !== 'undefined' && module.exports) { + module.exports = language; + } + // Browser + if (typeof window !== 'undefined' && this.numeral && this.numeral.language) { + this.numeral.language('nl-nl', language); + } +}()); +/*! + * numeral.js language configuration + * language : polish (pl) + * author : Dominik Bulaj : https://github.com/dominikbulaj + */ +(function () { + var language = { + delimiters: { + thousands: ' ', + decimal: ',' + }, + abbreviations: { + thousand: 'tys.', + million: 'mln', + billion: 'mld', + trillion: 'bln' + }, + ordinal: function (number) { + return '.'; + }, + currency: { + symbol: 'PLN' + } + }; + + // Node + if (typeof module !== 'undefined' && module.exports) { + module.exports = language; + } + // Browser + if (typeof window !== 'undefined' && this.numeral && this.numeral.language) { + this.numeral.language('pl', language); + } +}()); +/*! + * numeral.js language configuration + * language : portuguese brazil (pt-br) + * author : Ramiro Varandas Jr : https://github.com/ramirovjr + */ +(function () { + var language = { + delimiters: { + thousands: '.', + decimal: ',' + }, + abbreviations: { + thousand: 'mil', + million: 'milhões', + billion: 'b', + trillion: 't' + }, + ordinal: function (number) { + return 'º'; + }, + currency: { + symbol: 'R$' + } + }; + + // Node + if (typeof module !== 'undefined' && module.exports) { + module.exports = language; + } + // Browser + if (typeof window !== 'undefined' && this.numeral && this.numeral.language) { + this.numeral.language('pt-br', language); + } +}()); +/*! + * numeral.js language configuration + * language : portuguese (pt-pt) + * author : Diogo Resende : https://github.com/dresende + */ +(function () { + var language = { + delimiters: { + thousands: ' ', + decimal: ',' + }, + abbreviations: { + thousand: 'k', + million: 'm', + billion: 'b', + trillion: 't' + }, + ordinal : function (number) { + return 'º'; + }, + currency: { + symbol: '€' + } + }; + + // Node + if (typeof module !== 'undefined' && module.exports) { + module.exports = language; + } + // Browser + if (typeof window !== 'undefined' && this.numeral && this.numeral.language) { + this.numeral.language('pt-pt', language); + } +}()); + +// numeral.js language configuration +// language : Russian for the Ukraine (ru-UA) +// author : Anatoli Papirovski : https://github.com/apapirovski +(function () { + var language = { + delimiters: { + thousands: ' ', + decimal: ',' + }, + abbreviations: { + thousand: 'тыс.', + million: 'млн', + billion: 'b', + trillion: 't' + }, + ordinal: function () { + // not ideal, but since in Russian it can taken on + // different forms (masculine, feminine, neuter) + // this is all we can do + return '.'; + }, + currency: { + symbol: '\u20B4' + } + }; + + // Node + if (typeof module !== 'undefined' && module.exports) { + module.exports = language; + } + // Browser + if (typeof window !== 'undefined' && this.numeral && this.numeral.language) { + this.numeral.language('ru-UA', language); + } +}()); + +/*! + * numeral.js language configuration + * language : russian (ru) + * author : Anatoli Papirovski : https://github.com/apapirovski + */ +(function () { + var language = { + delimiters: { + thousands: ' ', + decimal: ',' + }, + abbreviations: { + thousand: 'тыс.', + million: 'млн', + billion: 'b', + trillion: 't' + }, + ordinal: function () { + // not ideal, but since in Russian it can taken on + // different forms (masculine, feminine, neuter) + // this is all we can do + return '.'; + }, + currency: { + symbol: 'руб.' + } + }; + + // Node + if (typeof module !== 'undefined' && module.exports) { + module.exports = language; + } + // Browser + if (typeof window !== 'undefined' && this.numeral && this.numeral.language) { + this.numeral.language('ru', language); + } +}()); + +/*! + * numeral.js language configuration + * language : slovak (sk) + * author : Ahmed Al Hafoudh : http://www.freevision.sk + */ +(function () { + var language = { + delimiters: { + thousands: ' ', + decimal: ',' + }, + abbreviations: { + thousand: 'tis.', + million: 'mil.', + billion: 'b', + trillion: 't' + }, + ordinal: function () { + return '.'; + }, + currency: { + symbol: '€' + } + }; + + // Node + if (typeof module !== 'undefined' && module.exports) { + module.exports = language; + } + // Browser + if (typeof window !== 'undefined' && this.numeral && this.numeral.language) { + this.numeral.language('sk', language); + } +}()); + +/*! + * numeral.js language configuration + * language : thai (th) + * author : Sathit Jittanupat : https://github.com/jojosati + */ +(function () { + var language = { + delimiters: { + thousands: ',', + decimal: '.' + }, + abbreviations: { + thousand: 'พัน', + million: 'ล้าน', + billion: 'พันล้าน', + trillion: 'ล้านล้าน' + }, + ordinal: function (number) { + return '.'; + }, + currency: { + symbol: '฿' + } + }; + + // Node + if (typeof module !== 'undefined' && module.exports) { + module.exports = language; + } + // Browser + if (typeof window !== 'undefined' && this.numeral && this.numeral.language) { + this.numeral.language('th', language); + } +}()); + +/*! + * numeral.js language configuration + * language : turkish (tr) + * author : Ecmel Ercan : https://github.com/ecmel, Erhan Gundogan : https://github.com/erhangundogan, Burak Yiğit Kaya: https://github.com/BYK + */ +(function () { + var suffixes = { + 1: '\'inci', + 5: '\'inci', + 8: '\'inci', + 70: '\'inci', + 80: '\'inci', + + 2: '\'nci', + 7: '\'nci', + 20: '\'nci', + 50: '\'nci', + + 3: '\'üncü', + 4: '\'üncü', + 100: '\'üncü', + + 6: '\'ncı', + + 9: '\'uncu', + 10: '\'uncu', + 30: '\'uncu', + + 60: '\'ıncı', + 90: '\'ıncı' + }, + language = { + delimiters: { + thousands: '.', + decimal: ',' + }, + abbreviations: { + thousand: 'bin', + million: 'milyon', + billion: 'milyar', + trillion: 'trilyon' + }, + ordinal: function (number) { + if (number === 0) { // special case for zero + return '\'ıncı'; + } + + var a = number % 10, + b = number % 100 - a, + c = number >= 100 ? 100 : null; + + return suffixes[a] || suffixes[b] || suffixes[c]; + }, + currency: { + symbol: '\u20BA' + } + }; + + // Node + if (typeof module !== 'undefined' && module.exports) { + module.exports = language; + } + // Browser + if (typeof window !== 'undefined' && this.numeral && this.numeral.language) { + this.numeral.language('tr', language); + } +}()); + +// numeral.js language configuration +// language : Ukrainian for the Ukraine (uk-UA) +// author : Michael Piefel : https://github.com/piefel (with help from Tetyana Kuzmenko) +(function () { + var language = { + delimiters: { + thousands: ' ', + decimal: ',' + }, + abbreviations: { + thousand: 'тис.', + million: 'млн', + billion: 'млрд', + trillion: 'блн' + }, + ordinal: function () { + // not ideal, but since in Ukrainian it can taken on + // different forms (masculine, feminine, neuter) + // this is all we can do + return ''; + }, + currency: { + symbol: '\u20B4' + } + }; + + // Node + if (typeof module !== 'undefined' && module.exports) { + module.exports = language; + } + // Browser + if (typeof window !== 'undefined' && this.numeral && this.numeral.language) { + this.numeral.language('uk-UA', language); + } +}()); diff --git a/include/jQuery/numeral.js b/include/jQuery/numeral.js new file mode 100644 index 00000000..b4fe7c84 --- /dev/null +++ b/include/jQuery/numeral.js @@ -0,0 +1,679 @@ +/*! + * numeral.js + * version : 1.5.3 + * author : Adam Draper + * license : MIT + * http://adamwdraper.github.com/Numeral-js/ + */ + +(function () { + + /************************************ + Constants + ************************************/ + + var numeral, + VERSION = '1.5.3', + // internal storage for language config files + languages = {}, + currentLanguage = 'en', + zeroFormat = null, + defaultFormat = '0,00', + // check for nodeJS + hasModule = (typeof module !== 'undefined' && module.exports); + + + /************************************ + Constructors + ************************************/ + + + // Numeral prototype object + function Numeral (number) { + this._value = number; + } + + /** + * Implementation of toFixed() that treats floats more like decimals + * + * Fixes binary rounding issues (eg. (0.615).toFixed(2) === '0.61') that present + * problems for accounting- and finance-related software. + */ + function toFixed (value, precision, roundingFunction, optionals) { + var power = Math.pow(10, precision), + optionalsRegExp, + output; + + //roundingFunction = (roundingFunction !== undefined ? roundingFunction : Math.round); + // Multiply up by precision, round accurately, then divide and use native toFixed(): + output = (roundingFunction(value * power) / power).toFixed(precision); + + if (optionals) { + optionalsRegExp = new RegExp('0{1,' + optionals + '}$'); + output = output.replace(optionalsRegExp, ''); + } + + return output; + } + + /************************************ + Formatting + ************************************/ + + // determine what type of formatting we need to do + function formatNumeral (n, format, roundingFunction) { + var output; + + // figure out what kind of format we are dealing with + if (format.indexOf('$') > -1) { // currency!!!!! + output = formatCurrency(n, format, roundingFunction); + } else if (format.indexOf('%') > -1) { // percentage + output = formatPercentage(n, format, roundingFunction); + } else if (format.indexOf(':') > -1) { // time + output = formatTime(n, format); + } else { // plain ol' numbers or bytes + output = formatNumber(n._value, format, roundingFunction); + } + + // return string + return output; + } + + // revert to number + function unformatNumeral (n, string) { + var stringOriginal = string, + thousandRegExp, + millionRegExp, + billionRegExp, + trillionRegExp, + suffixes = ['KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], + bytesMultiplier = false, + power; + + if (string.indexOf(':') > -1) { + n._value = unformatTime(string); + } else { + if (string === zeroFormat) { + n._value = 0; + } else { + if (languages[currentLanguage].delimiters.decimal !== '.') { + string = string.replace(/\./g,'').replace(languages[currentLanguage].delimiters.decimal, '.'); + } + + // see if abbreviations are there so that we can multiply to the correct number + thousandRegExp = new RegExp('[^a-zA-Z]' + languages[currentLanguage].abbreviations.thousand + '(?:\\)|(\\' + languages[currentLanguage].currency.symbol + ')?(?:\\))?)?$'); + millionRegExp = new RegExp('[^a-zA-Z]' + languages[currentLanguage].abbreviations.million + '(?:\\)|(\\' + languages[currentLanguage].currency.symbol + ')?(?:\\))?)?$'); + billionRegExp = new RegExp('[^a-zA-Z]' + languages[currentLanguage].abbreviations.billion + '(?:\\)|(\\' + languages[currentLanguage].currency.symbol + ')?(?:\\))?)?$'); + trillionRegExp = new RegExp('[^a-zA-Z]' + languages[currentLanguage].abbreviations.trillion + '(?:\\)|(\\' + languages[currentLanguage].currency.symbol + ')?(?:\\))?)?$'); + + // see if bytes are there so that we can multiply to the correct number + for (power = 0; power <= suffixes.length; power++) { + bytesMultiplier = (string.indexOf(suffixes[power]) > -1) ? Math.pow(1024, power + 1) : false; + + if (bytesMultiplier) { + break; + } + } + + // do some math to create our number + n._value = ((bytesMultiplier) ? bytesMultiplier : 1) * ((stringOriginal.match(thousandRegExp)) ? Math.pow(10, 3) : 1) * ((stringOriginal.match(millionRegExp)) ? Math.pow(10, 6) : 1) * ((stringOriginal.match(billionRegExp)) ? Math.pow(10, 9) : 1) * ((stringOriginal.match(trillionRegExp)) ? Math.pow(10, 12) : 1) * ((string.indexOf('%') > -1) ? 0.01 : 1) * (((string.split('-').length + Math.min(string.split('(').length-1, string.split(')').length-1)) % 2)? 1: -1) * Number(string.replace(/[^0-9\.]+/g, '')); + + // round if we are talking about bytes + n._value = (bytesMultiplier) ? Math.ceil(n._value) : n._value; + } + } + return n._value; + } + + function formatCurrency (n, format, roundingFunction) { + var symbolIndex = format.indexOf('$'), + openParenIndex = format.indexOf('('), + minusSignIndex = format.indexOf('-'), + space = '', + spliceIndex, + output; + + // check for space before or after currency + if (format.indexOf(' $') > -1) { + space = ' '; + format = format.replace(' $', ''); + } else if (format.indexOf('$ ') > -1) { + space = ' '; + format = format.replace('$ ', ''); + } else { + format = format.replace('$', ''); + } + + // format the number + output = formatNumber(n._value, format, roundingFunction); + + // position the symbol + if (symbolIndex <= 1) { + if (output.indexOf('(') > -1 || output.indexOf('-') > -1) { + output = output.split(''); + spliceIndex = 1; + if (symbolIndex < openParenIndex || symbolIndex < minusSignIndex){ + // the symbol appears before the "(" or "-" + spliceIndex = 0; + } + output.splice(spliceIndex, 0, languages[currentLanguage].currency.symbol + space); + output = output.join(''); + } else { + output = languages[currentLanguage].currency.symbol + space + output; + } + } else { + if (output.indexOf(')') > -1) { + output = output.split(''); + output.splice(-1, 0, space + languages[currentLanguage].currency.symbol); + output = output.join(''); + } else { + output = output + space + languages[currentLanguage].currency.symbol; + } + } + + return output; + } + + function formatPercentage (n, format, roundingFunction) { + var space = '', + output, + value = n._value * 100; + + // check for space before % + if (format.indexOf(' %') > -1) { + space = ' '; + format = format.replace(' %', ''); + } else { + format = format.replace('%', ''); + } + + output = formatNumber(value, format, roundingFunction); + + if (output.indexOf(')') > -1 ) { + output = output.split(''); + output.splice(-1, 0, space + '%'); + output = output.join(''); + } else { + output = output + space + '%'; + } + + return output; + } + + function formatTime (n) { + var hours = Math.floor(n._value/60/60), + minutes = Math.floor((n._value - (hours * 60 * 60))/60), + seconds = Math.round(n._value - (hours * 60 * 60) - (minutes * 60)); + return hours + ':' + ((minutes < 10) ? '0' + minutes : minutes) + ':' + ((seconds < 10) ? '0' + seconds : seconds); + } + + function unformatTime (string) { + var timeArray = string.split(':'), + seconds = 0; + // turn hours and minutes into seconds and add them all up + if (timeArray.length === 3) { + // hours + seconds = seconds + (Number(timeArray[0]) * 60 * 60); + // minutes + seconds = seconds + (Number(timeArray[1]) * 60); + // seconds + seconds = seconds + Number(timeArray[2]); + } else if (timeArray.length === 2) { + // minutes + seconds = seconds + (Number(timeArray[0]) * 60); + // seconds + seconds = seconds + Number(timeArray[1]); + } + return Number(seconds); + } + + function formatNumber (value, format, roundingFunction) { + var negP = false, + signed = false, + optDec = false, + abbr = '', + abbrK = false, // force abbreviation to thousands + abbrM = false, // force abbreviation to millions + abbrB = false, // force abbreviation to billions + abbrT = false, // force abbreviation to trillions + abbrForce = false, // force abbreviation + bytes = '', + ord = '', + abs = Math.abs(value), + suffixes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], + min, + max, + power, + w, + precision, + thousands, + d = '', + neg = false; + + // check if number is zero and a custom zero format has been set + if (value === 0 && zeroFormat !== null) { + return zeroFormat; + } else { + // see if we should use parentheses for negative number or if we should prefix with a sign + // if both are present we default to parentheses + if (format.indexOf('(') > -1) { + negP = true; + format = format.slice(1, -1); + } else if (format.indexOf('+') > -1) { + signed = true; + format = format.replace(/\+/g, ''); + } + + // see if abbreviation is wanted + if (format.indexOf('a') > -1) { + // check if abbreviation is specified + abbrK = format.indexOf('aK') >= 0; + abbrM = format.indexOf('aM') >= 0; + abbrB = format.indexOf('aB') >= 0; + abbrT = format.indexOf('aT') >= 0; + abbrForce = abbrK || abbrM || abbrB || abbrT; + + // check for space before abbreviation + if (format.indexOf(' a') > -1) { + abbr = ' '; + format = format.replace(' a', ''); + } else { + format = format.replace('a', ''); + } + + if (abs >= Math.pow(10, 12) && !abbrForce || abbrT) { + // trillion + abbr = abbr + languages[currentLanguage].abbreviations.trillion; + value = value / Math.pow(10, 12); + } else if (abs < Math.pow(10, 12) && abs >= Math.pow(10, 9) && !abbrForce || abbrB) { + // billion + abbr = abbr + languages[currentLanguage].abbreviations.billion; + value = value / Math.pow(10, 9); + } else if (abs < Math.pow(10, 9) && abs >= Math.pow(10, 6) && !abbrForce || abbrM) { + // million + abbr = abbr + languages[currentLanguage].abbreviations.million; + value = value / Math.pow(10, 6); + } else if (abs < Math.pow(10, 6) && abs >= Math.pow(10, 3) && !abbrForce || abbrK) { + // thousand + abbr = abbr + languages[currentLanguage].abbreviations.thousand; + value = value / Math.pow(10, 3); + } + } + + // see if we are formatting bytes + if (format.indexOf('b') > -1) { + // check for space before + if (format.indexOf(' b') > -1) { + bytes = ' '; + format = format.replace(' b', ''); + } else { + format = format.replace('b', ''); + } + + for (power = 0; power <= suffixes.length; power++) { + min = Math.pow(1024, power); + max = Math.pow(1024, power+1); + + if (value >= min && value < max) { + bytes = bytes + suffixes[power]; + if (min > 0) { + value = value / min; + } + break; + } + } + } + + // see if ordinal is wanted + if (format.indexOf('o') > -1) { + // check for space before + if (format.indexOf(' o') > -1) { + ord = ' '; + format = format.replace(' o', ''); + } else { + format = format.replace('o', ''); + } + + ord = ord + languages[currentLanguage].ordinal(value); + } + + if (format.indexOf('[.]') > -1) { + optDec = true; + format = format.replace('[.]', '.'); + } + + w = value.toString().split('.')[0]; + precision = format.split('.')[1]; + thousands = format.indexOf(','); + + if (precision) { + if (precision.indexOf('[') > -1) { + precision = precision.replace(']', ''); + precision = precision.split('['); + d = toFixed(value, (precision[0].length + precision[1].length), roundingFunction, precision[1].length); + } else { + d = toFixed(value, precision.length, roundingFunction); + } + + w = d.split('.')[0]; + + if (d.split('.')[1].length) { + d = languages[currentLanguage].delimiters.decimal + d.split('.')[1]; + } else { + d = ''; + } + + if (optDec && Number(d.slice(1)) === 0) { + d = ''; + } + } else { + w = toFixed(value, null, roundingFunction); + } + + // format number + if (w.indexOf('-') > -1) { + w = w.slice(1); + neg = true; + } + + if (thousands > -1) { + w = w.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1' + languages[currentLanguage].delimiters.thousands); + } + + if (format.indexOf('.') === 0) { + w = ''; + } + + return ((negP && neg) ? '(' : '') + ((!negP && neg) ? '-' : '') + ((!neg && signed) ? '+' : '') + w + d + ((ord) ? ord : '') + ((abbr) ? abbr : '') + ((bytes) ? bytes : '') + ((negP && neg) ? ')' : ''); + } + } + + /************************************ + Top Level Functions + ************************************/ + + numeral = function (input) { + if (numeral.isNumeral(input)) { + input = input.value(); + } else if (input === 0 || typeof input === 'undefined') { + input = 0; + } else if (!Number(input)) { + input = numeral.fn.unformat(input); + } + + return new Numeral(Number(input)); + }; + + // version number + numeral.version = VERSION; + + // compare numeral object + numeral.isNumeral = function (obj) { + return obj instanceof Numeral; + }; + + // This function will load languages and then set the global language. If + // no arguments are passed in, it will simply return the current global + // language key. + numeral.language = function (key, values) { + if (!key) { + return currentLanguage; + } + + if (key && !values) { + if(!languages[key]) { + throw new Error('Unknown language : ' + key); + } + currentLanguage = key; + } + + if (values || !languages[key]) { + loadLanguage(key, values); + } + + return numeral; + }; + + // This function provides access to the loaded language data. If + // no arguments are passed in, it will simply return the current + // global language object. + numeral.languageData = function (key) { + if (!key) { + return languages[currentLanguage]; + } + + if (!languages[key]) { + throw new Error('Unknown language : ' + key); + } + + return languages[key]; + }; + + numeral.language('en', { + delimiters: { + thousands: ',', + decimal: '.' + }, + abbreviations: { + thousand: 'k', + million: 'm', + billion: 'b', + trillion: 't' + }, + ordinal: function (number) { + var b = number % 10; + return (~~ (number % 100 / 10) === 1) ? 'th' : + (b === 1) ? 'st' : + (b === 2) ? 'nd' : + (b === 3) ? 'rd' : 'th'; + }, + currency: { + symbol: '$' + } + }); + + numeral.zeroFormat = function (format) { + zeroFormat = typeof(format) === 'string' ? format : null; + }; + + numeral.defaultFormat = function (format) { + defaultFormat = typeof(format) === 'string' ? format : '0.0'; + }; + + /************************************ + Helpers + ************************************/ + + function loadLanguage(key, values) { + languages[key] = values; + } + + /************************************ + Floating-point helpers + ************************************/ + + // The floating-point helper functions and implementation + // borrows heavily from sinful.js: http://guipn.github.io/sinful.js/ + + /** + * Array.prototype.reduce for browsers that don't support it + * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/Reduce#Compatibility + */ + if ('function' !== typeof Array.prototype.reduce) { + Array.prototype.reduce = function (callback, opt_initialValue) { + 'use strict'; + + if (null === this || 'undefined' === typeof this) { + // At the moment all modern browsers, that support strict mode, have + // native implementation of Array.prototype.reduce. For instance, IE8 + // does not support strict mode, so this check is actually useless. + throw new TypeError('Array.prototype.reduce called on null or undefined'); + } + + if ('function' !== typeof callback) { + throw new TypeError(callback + ' is not a function'); + } + + var index, + value, + length = this.length >>> 0, + isValueSet = false; + + if (1 < arguments.length) { + value = opt_initialValue; + isValueSet = true; + } + + for (index = 0; length > index; ++index) { + if (this.hasOwnProperty(index)) { + if (isValueSet) { + value = callback(value, this[index], index, this); + } else { + value = this[index]; + isValueSet = true; + } + } + } + + if (!isValueSet) { + throw new TypeError('Reduce of empty array with no initial value'); + } + + return value; + }; + } + + + /** + * Computes the multiplier necessary to make x >= 1, + * effectively eliminating miscalculations caused by + * finite precision. + */ + function multiplier(x) { + var parts = x.toString().split('.'); + if (parts.length < 2) { + return 1; + } + return Math.pow(10, parts[1].length); + } + + /** + * Given a variable number of arguments, returns the maximum + * multiplier that must be used to normalize an operation involving + * all of them. + */ + function correctionFactor() { + var args = Array.prototype.slice.call(arguments); + return args.reduce(function (prev, next) { + var mp = multiplier(prev), + mn = multiplier(next); + return mp > mn ? mp : mn; + }, -Infinity); + } + + + /************************************ + Numeral Prototype + ************************************/ + + + numeral.fn = Numeral.prototype = { + + clone : function () { + return numeral(this); + }, + + format : function (inputString, roundingFunction) { + return formatNumeral(this, + inputString ? inputString : defaultFormat, + (roundingFunction !== undefined) ? roundingFunction : Math.round + ); + }, + + unformat : function (inputString) { + if (Object.prototype.toString.call(inputString) === '[object Number]') { + return inputString; + } + return unformatNumeral(this, inputString ? inputString : defaultFormat); + }, + + value : function () { + return this._value; + }, + + valueOf : function () { + return this._value; + }, + + set : function (value) { + this._value = Number(value); + return this; + }, + + add : function (value) { + var corrFactor = correctionFactor.call(null, this._value, value); + function cback(accum, curr, currI, O) { + return accum + corrFactor * curr; + } + this._value = [this._value, value].reduce(cback, 0) / corrFactor; + return this; + }, + + subtract : function (value) { + var corrFactor = correctionFactor.call(null, this._value, value); + function cback(accum, curr, currI, O) { + return accum - corrFactor * curr; + } + this._value = [value].reduce(cback, this._value * corrFactor) / corrFactor; + return this; + }, + + multiply : function (value) { + function cback(accum, curr, currI, O) { + var corrFactor = correctionFactor(accum, curr); + return (accum * corrFactor) * (curr * corrFactor) / + (corrFactor * corrFactor); + } + this._value = [this._value, value].reduce(cback, 1); + return this; + }, + + divide : function (value) { + function cback(accum, curr, currI, O) { + var corrFactor = correctionFactor(accum, curr); + return (accum * corrFactor) / (curr * corrFactor); + } + this._value = [this._value, value].reduce(cback); + return this; + }, + + difference : function (value) { + return Math.abs(numeral(this._value).subtract(value).value()); + } + + }; + + /************************************ + Exposing Numeral + ************************************/ + + // CommonJS module is defined + if (hasModule) { + module.exports = numeral; + } + + /*global ender:false */ + if (typeof ender === 'undefined') { + // here, `this` means `window` in the browser, or `global` on the server + // add `numeral` as a global object via a string identifier, + // for Closure Compiler 'advanced' mode + this['numeral'] = numeral; + } + + /*global define:false */ + if (typeof define === 'function' && define.amd) { + define([], function () { + return numeral; + }); + } +}).call(this); diff --git a/include/jQuery/printerScripts.js b/include/jQuery/printerScripts.js new file mode 100755 index 00000000..f2dde386 --- /dev/null +++ b/include/jQuery/printerScripts.js @@ -0,0 +1,62 @@ +function checkPrint(module,id, pdf_opt){ + $('#sendreturn').html('Sprawdzam drukarkę...'); + $('#PrinterDivList').hide(); + $('#sendreturn').show(); + + var params = { + job : 'justPrinterCheck', + recid : id, + printer : $('#PrinterSelectList').val(), + check : '1', + type: $('#pdfPrintType').val(), + }; + $.ajax({ + type : "POST", + url : 'index.php?entryPoint=uploadAjaxFile', + dataType : "html", + async : false, + success : function(data) { + if (data == 'false') { + $('#sendreturn').html('Sprawdz czy drukarka jest włączona lub konfigurację!'); + + } else { + $('#sendreturn').html('Trwa drukowanie dokumentu...'); + justPrint(module,id, pdf_opt); + + } + //$(".loading_panel").css("display", "none"); + }, + data : params + }); + +} + +function justPrint(module,id, pdf_opt){ + + var params = { + job : 'justPrinterCheck', + recid : id, + printer : $('#PrinterSelectList').val(), + check : '0', + type: $('#pdfPrintType').val(), + module: module, + pdf_opt: pdf_opt, + }; + $.ajax({ + type : "POST", + url : 'index.php?entryPoint=uploadAjaxFile', + dataType : "html", + async : false, + success : function(data) { + if (data == 'false') { + $('#sendreturn').html('Nie można wydrukować dokumentu!'); + + } else { + $('#sendreturn').html('Polecenie drukowania zlecone!'); + + } + }, + data : params + }); + +} \ No newline at end of file diff --git a/include/jQuery/tablesorter/addons/pager/jquery.tablesorter.pager.js b/include/jQuery/tablesorter/addons/pager/jquery.tablesorter.pager.js new file mode 100755 index 00000000..5a34d825 --- /dev/null +++ b/include/jQuery/tablesorter/addons/pager/jquery.tablesorter.pager.js @@ -0,0 +1,184 @@ +(function($) { + $.extend({ + tablesorterPager: new function() { + + function updatePageDisplay(c) { + var s = $(c.cssPageDisplay,c.container).val((c.page+1) + c.seperator + c.totalPages); + } + + function setPageSize(table,size) { + var c = table.config; + c.size = size; + c.totalPages = Math.ceil(c.totalRows / c.size); + c.pagerPositionSet = false; + moveToPage(table); + fixPosition(table); + } + + function fixPosition(table) { + var c = table.config; + if(!c.pagerPositionSet && c.positionFixed) { + var c = table.config, o = $(table); + if(o.offset) { + c.container.css({ + top: o.offset().top + o.height() + 'px', + position: 'absolute' + }); + } + c.pagerPositionSet = true; + } + } + + function moveToFirstPage(table) { + var c = table.config; + c.page = 0; + moveToPage(table); + } + + function moveToLastPage(table) { + var c = table.config; + c.page = (c.totalPages-1); + moveToPage(table); + } + + function moveToNextPage(table) { + var c = table.config; + c.page++; + if(c.page >= (c.totalPages-1)) { + c.page = (c.totalPages-1); + } + moveToPage(table); + } + + function moveToPrevPage(table) { + var c = table.config; + c.page--; + if(c.page <= 0) { + c.page = 0; + } + moveToPage(table); + } + + + function moveToPage(table) { + var c = table.config; + if(c.page < 0 || c.page > (c.totalPages-1)) { + c.page = 0; + } + + renderTable(table,c.rowsCopy); + } + + function renderTable(table,rows) { + + var c = table.config; + var l = rows.length; + var s = (c.page * c.size); + var e = (s + c.size); + if(e > rows.length ) { + e = rows.length; + } + + + var tableBody = $(table.tBodies[0]); + + // clear the table body + + $.tablesorter.clearTableBody(table); + + for(var i = s; i < e; i++) { + + //tableBody.append(rows[i]); + + var o = rows[i]; + var l = o.length; + for(var j=0; j < l; j++) { + + tableBody[0].appendChild(o[j]); + + } + } + + fixPosition(table,tableBody); + + $(table).trigger("applyWidgets"); + + if( c.page >= c.totalPages ) { + moveToLastPage(table); + } + + updatePageDisplay(c); + } + + this.appender = function(table,rows) { + + var c = table.config; + + c.rowsCopy = rows; + c.totalRows = rows.length; + c.totalPages = Math.ceil(c.totalRows / c.size); + + renderTable(table,rows); + }; + + this.defaults = { + size: 10, + offset: 0, + page: 0, + totalRows: 0, + totalPages: 0, + container: null, + cssNext: '.next', + cssPrev: '.prev', + cssFirst: '.first', + cssLast: '.last', + cssPageDisplay: '.pagedisplay', + cssPageSize: '.pagesize', + seperator: "/", + positionFixed: true, + appender: this.appender + }; + + this.construct = function(settings) { + + return this.each(function() { + + config = $.extend(this.config, $.tablesorterPager.defaults, settings); + + var table = this, pager = config.container; + + $(this).trigger("appendCache"); + + config.size = parseInt($(".pagesize",pager).val()); + + $(config.cssFirst,pager).click(function() { + moveToFirstPage(table); + return false; + }); + $(config.cssNext,pager).click(function() { + moveToNextPage(table); + return false; + }); + $(config.cssPrev,pager).click(function() { + moveToPrevPage(table); + return false; + }); + $(config.cssLast,pager).click(function() { + moveToLastPage(table); + return false; + }); + $(config.cssPageSize,pager).change(function() { + setPageSize(table,parseInt($(this).val())); + return false; + }); + }); + }; + + } + }); + // extend plugin scope + $.fn.extend({ + tablesorterPager: $.tablesorterPager.construct + }); + +})(jQuery); \ No newline at end of file diff --git a/include/jQuery/tablesorter/build/ParseMaster.js b/include/jQuery/tablesorter/build/ParseMaster.js new file mode 100755 index 00000000..915a8b5d --- /dev/null +++ b/include/jQuery/tablesorter/build/ParseMaster.js @@ -0,0 +1,106 @@ +/* + ParseMaster, version 1.0.2 (2005-08-19) + Copyright 2005, Dean Edwards + License: http://creativecommons.org/licenses/LGPL/2.1/ +*/ + +/* a multi-pattern parser */ + +// KNOWN BUG: erroneous behavior when using escapeChar with a replacement value that is a function + +function ParseMaster() { + // constants + var $EXPRESSION = 0, $REPLACEMENT = 1, $LENGTH = 2; + // used to determine nesting levels + var $GROUPS = /\(/g, $SUB_REPLACE = /\$\d/, $INDEXED = /^\$\d+$/, + $TRIM = /(['"])\1\+(.*)\+\1\1$/, $$ESCAPE = /\\./g, $QUOTE = /'/, + $$DELETED = /\x01[^\x01]*\x01/g; + var self = this; + // public + this.add = function($expression, $replacement) { + if (!$replacement) $replacement = ""; + // count the number of sub-expressions + // - add one because each pattern is itself a sub-expression + var $length = (_internalEscape(String($expression)).match($GROUPS) || "").length + 1; + // does the pattern deal with sub-expressions? + if ($SUB_REPLACE.test($replacement)) { + // a simple lookup? (e.g. "$2") + if ($INDEXED.test($replacement)) { + // store the index (used for fast retrieval of matched strings) + $replacement = parseInt($replacement.slice(1)) - 1; + } else { // a complicated lookup (e.g. "Hello $2 $1") + // build a function to do the lookup + var i = $length; + var $quote = $QUOTE.test(_internalEscape($replacement)) ? '"' : "'"; + while (i) $replacement = $replacement.split("$" + i--).join($quote + "+a[o+" + i + "]+" + $quote); + $replacement = new Function("a,o", "return" + $quote + $replacement.replace($TRIM, "$1") + $quote); + } + } + // pass the modified arguments + _add($expression || "/^$/", $replacement, $length); + }; + // execute the global replacement + this.exec = function($string) { + _escaped.length = 0; + return _unescape(_escape($string, this.escapeChar).replace( + new RegExp(_patterns, this.ignoreCase ? "gi" : "g"), _replacement), this.escapeChar).replace($$DELETED, ""); + }; + // clear the patterns collection so that this object may be re-used + this.reset = function() { + _patterns.length = 0; + }; + + // private + var _escaped = []; // escaped characters + var _patterns = []; // patterns stored by index + var _toString = function(){return "(" + String(this[$EXPRESSION]).slice(1, -1) + ")"}; + _patterns.toString = function(){return this.join("|")}; + // create and add a new pattern to the patterns collection + function _add() { + arguments.toString = _toString; + // store the pattern - as an arguments object (i think this is quicker..?) + _patterns[_patterns.length] = arguments; + } + // this is the global replace function (it's quite complicated) + function _replacement() { + if (!arguments[0]) return ""; + var i = 1, j = 0, $pattern; + // loop through the patterns + while ($pattern = _patterns[j++]) { + // do we have a result? + if (arguments[i]) { + var $replacement = $pattern[$REPLACEMENT]; + switch (typeof $replacement) { + case "function": return $replacement(arguments, i); + case "number": return arguments[$replacement + i]; + } + var $delete = (arguments[i].indexOf(self.escapeChar) == -1) ? "" : + "\x01" + arguments[i] + "\x01"; + return $delete + $replacement; + // skip over references to sub-expressions + } else i += $pattern[$LENGTH]; + } + }; + // encode escaped characters + function _escape($string, $escapeChar) { + return $escapeChar ? $string.replace(new RegExp("\\" + $escapeChar + "(.)", "g"), function($match, $char) { + _escaped[_escaped.length] = $char; + return $escapeChar; + }) : $string; + }; + // decode escaped characters + function _unescape($string, $escapeChar) { + var i = 0; + return $escapeChar ? $string.replace(new RegExp("\\" + $escapeChar, "g"), function() { + return $escapeChar + (_escaped[i++] || ""); + }) : $string; + }; + function _internalEscape($string) { + return $string.replace($$ESCAPE, ""); + }; +}; +ParseMaster.prototype = { + constructor: ParseMaster, + ignoreCase: false, + escapeChar: "" +}; diff --git a/include/jQuery/tablesorter/build/jsmin.js b/include/jQuery/tablesorter/build/jsmin.js new file mode 100755 index 00000000..1ef29cf1 --- /dev/null +++ b/include/jQuery/tablesorter/build/jsmin.js @@ -0,0 +1,316 @@ +/* jsmin.js - 2006-08-31 +Author: Franck Marcia +This work is an adaptation of jsminc.c published by Douglas Crockford. +Permission is hereby granted to use the Javascript version under the same +conditions as the jsmin.c on which it is based. + +jsmin.c +2006-05-04 + +Copyright (c) 2002 Douglas Crockford (www.crockford.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +The Software shall be used for Good, not Evil. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +Update: + add level: + 1: minimal, keep linefeeds if single + 2: normal, the standard algorithm + 3: agressive, remove any linefeed and doesn't take care of potential + missing semicolons (can be regressive) + store stats + jsmin.oldSize + jsmin.newSize +*/ + +String.prototype.has = function(c) { + return this.indexOf(c) > -1; +}; + +function jsmin(comment, input, level) { + + if (input === undefined) { + input = comment; + comment = ''; + level = 2; + } else if (level === undefined || level < 1 || level > 3) { + level = 2; + } + + if (comment.length > 0) { + comment += '\n'; + } + + var a = '', + b = '', + EOF = -1, + LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz', + DIGITS = '0123456789', + ALNUM = LETTERS + DIGITS + '_$\\', + theLookahead = EOF; + + + /* isAlphanum -- return true if the character is a letter, digit, underscore, + dollar sign, or non-ASCII character. + */ + + function isAlphanum(c) { + return c != EOF && (ALNUM.has(c) || c.charCodeAt(0) > 126); + } + + + /* get -- return the next character. Watch out for lookahead. If the + character is a control character, translate it to a space or + linefeed. + */ + + function get() { + + var c = theLookahead; + if (get.i == get.l) { + return EOF; + } + theLookahead = EOF; + if (c == EOF) { + c = input.charAt(get.i); + ++get.i; + } + if (c >= ' ' || c == '\n') { + return c; + } + if (c == '\r') { + return '\n'; + } + return ' '; + } + + get.i = 0; + get.l = input.length; + + + /* peek -- get the next character without getting it. + */ + + function peek() { + theLookahead = get(); + return theLookahead; + } + + + /* next -- get the next character, excluding comments. peek() is used to see + if a '/' is followed by a '/' or '*'. + */ + + function next() { + + var c = get(); + if (c == '/') { + switch (peek()) { + case '/': + for (;;) { + c = get(); + if (c <= '\n') { + return c; + } + } + break; + case '*': + get(); + for (;;) { + switch (get()) { + case '*': + if (peek() == '/') { + get(); + return ' '; + } + break; + case EOF: + throw 'Error: Unterminated comment.'; + } + } + break; + default: + return c; + } + } + return c; + } + + + /* action -- do something! What you do is determined by the argument: + 1 Output A. Copy B to A. Get the next B. + 2 Copy B to A. Get the next B. (Delete A). + 3 Get the next B. (Delete B). + action treats a string as a single character. Wow! + action recognizes a regular expression if it is preceded by ( or , or =. + */ + + function action(d) { + + var r = []; + + if (d == 1) { + r.push(a); + } + + if (d < 3) { + a = b; + if (a == '\'' || a == '"') { + for (;;) { + r.push(a); + a = get(); + if (a == b) { + break; + } + if (a <= '\n') { + throw 'Error: unterminated string literal: ' + a; + } + if (a == '\\') { + r.push(a); + a = get(); + } + } + } + } + + b = next(); + + if (b == '/' && '(,=:[!&|'.has(a)) { + r.push(a); + r.push(b); + for (;;) { + a = get(); + if (a == '/') { + break; + } else if (a =='\\') { + r.push(a); + a = get(); + } else if (a <= '\n') { + throw 'Error: unterminated Regular Expression literal'; + } + r.push(a); + } + b = next(); + } + + return r.join(''); + } + + + /* m -- Copy the input to the output, deleting the characters which are + insignificant to JavaScript. Comments will be removed. Tabs will be + replaced with spaces. Carriage returns will be replaced with + linefeeds. + Most spaces and linefeeds will be removed. + */ + + function m() { + + var r = []; + a = '\n'; + + r.push(action(3)); + + while (a != EOF) { + switch (a) { + case ' ': + if (isAlphanum(b)) { + r.push(action(1)); + } else { + r.push(action(2)); + } + break; + case '\n': + switch (b) { + case '{': + case '[': + case '(': + case '+': + case '-': + r.push(action(1)); + break; + case ' ': + r.push(action(3)); + break; + default: + if (isAlphanum(b)) { + r.push(action(1)); + } else { + if (level == 1 && b != '\n') { + r.push(action(1)); + } else { + r.push(action(2)); + } + } + } + break; + default: + switch (b) { + case ' ': + if (isAlphanum(a)) { + r.push(action(1)); + break; + } + r.push(action(3)); + break; + case '\n': + if (level == 1 && a != '\n') { + r.push(action(1)); + } else { + switch (a) { + case '}': + case ']': + case ')': + case '+': + case '-': + case '"': + case '\'': + if (level == 3) { + r.push(action(3)); + } else { + r.push(action(1)); + } + break; + default: + if (isAlphanum(a)) { + r.push(action(1)); + } else { + r.push(action(3)); + } + } + } + break; + default: + r.push(action(1)); + break; + } + } + } + + return r.join(''); + } + + jsmin.oldSize = input.length; + ret = m(input); + jsmin.newSize = ret.length; + + return comment + ret; + +} diff --git a/include/jQuery/tablesorter/build/min.js b/include/jQuery/tablesorter/build/min.js new file mode 100755 index 00000000..da11096f --- /dev/null +++ b/include/jQuery/tablesorter/build/min.js @@ -0,0 +1,5 @@ +load("build/jsmin.js", "build/writeFile.js"); + +var f = jsmin('', readFile(arguments[0]), 3); + +writeFile( arguments[1], f ); diff --git a/include/jQuery/tablesorter/build/pack.js b/include/jQuery/tablesorter/build/pack.js new file mode 100755 index 00000000..13557039 --- /dev/null +++ b/include/jQuery/tablesorter/build/pack.js @@ -0,0 +1,5 @@ +load("build/ParseMaster.js", "build/packer.js", "build/writeFile.js"); + +var out = readFile( arguments[0] ); + +writeFile( arguments[1], pack( out, 62, true, false ) ); diff --git a/include/jQuery/tablesorter/build/packer.js b/include/jQuery/tablesorter/build/packer.js new file mode 100755 index 00000000..56bfdd1a --- /dev/null +++ b/include/jQuery/tablesorter/build/packer.js @@ -0,0 +1,316 @@ +/* + packer, version 2.0.2 (2005-08-19) + Copyright 2004-2005, Dean Edwards + License: http://creativecommons.org/licenses/LGPL/2.1/ +*/ + +function pack(_script, _encoding, _fastDecode, _specialChars) { + // constants + var $IGNORE = "$1"; + + // validate parameters + _script += "\n"; + _encoding = Math.min(parseInt(_encoding), 95); + + // apply all parsing routines + function _pack($script) { + var i, $parse; + for (i = 0; ($parse = _parsers[i]); i++) { + $script = $parse($script); + } + return $script; + }; + + // unpacking function - this is the boot strap function + // data extracted from this packing routine is passed to + // this function when decoded in the target + var _unpack = function($packed, $ascii, $count, $keywords, $encode, $decode) { + while ($count--) + if ($keywords[$count]) + $packed = $packed.replace(new RegExp('\\b' + $encode($count) + '\\b', 'g'), $keywords[$count]); + return $packed; + }; + + // code-snippet inserted into the unpacker to speed up decoding + var _decode = function() { + // does the browser support String.replace where the + // replacement value is a function? + if (!''.replace(/^/, String)) { + // decode all the values we need + while ($count--) $decode[$encode($count)] = $keywords[$count] || $encode($count); + // global replacement function + $keywords = [function($encoded){return $decode[$encoded]}]; + // generic match + $encode = function(){return'\\w+'}; + // reset the loop counter - we are now doing a global replace + $count = 1; + } + }; + + // keep a list of parsing functions, they'll be executed all at once + var _parsers = []; + function _addParser($parser) { + _parsers[_parsers.length] = $parser; + }; + + // zero encoding - just removal of white space and comments + function _basicCompression($script) { + var $parser = new ParseMaster; + // make safe + $parser.escapeChar = "\\"; + // protect strings + $parser.add(/'[^'\n\r]*'/, $IGNORE); + $parser.add(/"[^"\n\r]*"/, $IGNORE); + // remove comments + $parser.add(/\/\/[^\n\r]*[\n\r]/, " "); + $parser.add(/\/\*[^*]*\*+([^\/][^*]*\*+)*\//, " "); + // protect regular expressions + $parser.add(/\s+(\/[^\/\n\r\*][^\/\n\r]*\/g?i?)/, "$2"); // IGNORE + $parser.add(/[^\w\x24\/'"*)\?:]\/[^\/\n\r\*][^\/\n\r]*\/g?i?/, $IGNORE); + // remove: ;;; doSomething(); + if (_specialChars) $parser.add(/;;;[^\n\r]+[\n\r]/); + // remove redundant semi-colons + $parser.add(/\(;;\)/, $IGNORE); // protect for (;;) loops + $parser.add(/;+\s*([};])/, "$2"); + // apply the above + $script = $parser.exec($script); + + // remove white-space + $parser.add(/(\b|\x24)\s+(\b|\x24)/, "$2 $3"); + $parser.add(/([+\-])\s+([+\-])/, "$2 $3"); + $parser.add(/\s+/, ""); + // done + return $parser.exec($script); + }; + + function _encodeSpecialChars($script) { + var $parser = new ParseMaster; + // replace: $name -> n, $$name -> na + $parser.add(/((\x24+)([a-zA-Z$_]+))(\d*)/, function($match, $offset) { + var $length = $match[$offset + 2].length; + var $start = $length - Math.max($length - $match[$offset + 3].length, 0); + return $match[$offset + 1].substr($start, $length) + $match[$offset + 4]; + }); + // replace: _name -> _0, double-underscore (__name) is ignored + var $regexp = /\b_[A-Za-z\d]\w*/; + // build the word list + var $keywords = _analyze($script, _globalize($regexp), _encodePrivate); + // quick ref + var $encoded = $keywords.$encoded; + $parser.add($regexp, function($match, $offset) { + return $encoded[$match[$offset]]; + }); + return $parser.exec($script); + }; + + function _encodeKeywords($script) { + // escape high-ascii values already in the script (i.e. in strings) + if (_encoding > 62) $script = _escape95($script); + // create the parser + var $parser = new ParseMaster; + var $encode = _getEncoder(_encoding); + // for high-ascii, don't encode single character low-ascii + var $regexp = (_encoding > 62) ? /\w\w+/ : /\w+/; + // build the word list + $keywords = _analyze($script, _globalize($regexp), $encode); + var $encoded = $keywords.$encoded; + // encode + $parser.add($regexp, function($match, $offset) { + return $encoded[$match[$offset]]; + }); + // if encoded, wrap the script in a decoding function + return $script && _bootStrap($parser.exec($script), $keywords); + }; + + function _analyze($script, $regexp, $encode) { + // analyse + // retreive all words in the script + var $all = $script.match($regexp); + var $$sorted = []; // list of words sorted by frequency + var $$encoded = {}; // dictionary of word->encoding + var $$protected = {}; // instances of "protected" words + if ($all) { + var $unsorted = []; // same list, not sorted + var $protected = {}; // "protected" words (dictionary of word->"word") + var $values = {}; // dictionary of charCode->encoding (eg. 256->ff) + var $count = {}; // word->count + var i = $all.length, j = 0, $word; + // count the occurrences - used for sorting later + do { + $word = "$" + $all[--i]; + if (!$count[$word]) { + $count[$word] = 0; + $unsorted[j] = $word; + // make a dictionary of all of the protected words in this script + // these are words that might be mistaken for encoding + $protected["$" + ($values[j] = $encode(j))] = j++; + } + // increment the word counter + $count[$word]++; + } while (i); + // prepare to sort the word list, first we must protect + // words that are also used as codes. we assign them a code + // equivalent to the word itself. + // e.g. if "do" falls within our encoding range + // then we store keywords["do"] = "do"; + // this avoids problems when decoding + i = $unsorted.length; + do { + $word = $unsorted[--i]; + if ($protected[$word] != null) { + $$sorted[$protected[$word]] = $word.slice(1); + $$protected[$protected[$word]] = true; + $count[$word] = 0; + } + } while (i); + // sort the words by frequency + $unsorted.sort(function($match1, $match2) { + return $count[$match2] - $count[$match1]; + }); + j = 0; + // because there are "protected" words in the list + // we must add the sorted words around them + do { + if ($$sorted[i] == null) $$sorted[i] = $unsorted[j++].slice(1); + $$encoded[$$sorted[i]] = $values[i]; + } while (++i < $unsorted.length); + } + return {$sorted: $$sorted, $encoded: $$encoded, $protected: $$protected}; + }; + + // build the boot function used for loading and decoding + function _bootStrap($packed, $keywords) { + var $ENCODE = _safeRegExp("$encode\\($count\\)", "g"); + + // $packed: the packed script + $packed = "'" + _escape($packed) + "'"; + + // $ascii: base for encoding + var $ascii = Math.min($keywords.$sorted.length, _encoding) || 1; + + // $count: number of words contained in the script + var $count = $keywords.$sorted.length; + + // $keywords: list of words contained in the script + for (var i in $keywords.$protected) $keywords.$sorted[i] = ""; + // convert from a string to an array + $keywords = "'" + $keywords.$sorted.join("|") + "'.split('|')"; + + // $encode: encoding function (used for decoding the script) + var $encode = _encoding > 62 ? _encode95 : _getEncoder($ascii); + $encode = String($encode).replace(/_encoding/g, "$ascii").replace(/arguments\.callee/g, "$encode"); + var $inline = "$count" + ($ascii > 10 ? ".toString($ascii)" : ""); + + // $decode: code snippet to speed up decoding + if (_fastDecode) { + // create the decoder + var $decode = _getFunctionBody(_decode); + if (_encoding > 62) $decode = $decode.replace(/\\\\w/g, "[\\xa1-\\xff]"); + // perform the encoding inline for lower ascii values + else if ($ascii < 36) $decode = $decode.replace($ENCODE, $inline); + // special case: when $count==0 there are no keywords. I want to keep + // the basic shape of the unpacking funcion so i'll frig the code... + if (!$count) $decode = $decode.replace(_safeRegExp("($count)\\s*=\\s*1"), "$1=0"); + } + + // boot function + var $unpack = String(_unpack); + if (_fastDecode) { + // insert the decoder + $unpack = $unpack.replace(/\{/, "{" + $decode + ";"); + } + $unpack = $unpack.replace(/"/g, "'"); + if (_encoding > 62) { // high-ascii + // get rid of the word-boundaries for regexp matches + $unpack = $unpack.replace(/'\\\\b'\s*\+|\+\s*'\\\\b'/g, ""); + } + if ($ascii > 36 || _encoding > 62 || _fastDecode) { + // insert the encode function + $unpack = $unpack.replace(/\{/, "{$encode=" + $encode + ";"); + } else { + // perform the encoding inline + $unpack = $unpack.replace($ENCODE, $inline); + } + // pack the boot function too + $unpack = pack($unpack, 0, false, true); + + // arguments + var $params = [$packed, $ascii, $count, $keywords]; + if (_fastDecode) { + // insert placeholders for the decoder + $params = $params.concat(0, "{}"); + } + + // the whole thing + return "eval(" + $unpack + "(" + $params + "))\n"; + }; + + // mmm.. ..which one do i need ?? + function _getEncoder($ascii) { + return $ascii > 10 ? $ascii > 36 ? $ascii > 62 ? _encode95 : _encode62 : _encode36 : _encode10; + }; + + // zero encoding + // characters: 0123456789 + var _encode10 = function($charCode) { + return $charCode; + }; + + // inherent base36 support + // characters: 0123456789abcdefghijklmnopqrstuvwxyz + var _encode36 = function($charCode) { + return $charCode.toString(36); + }; + + // hitch a ride on base36 and add the upper case alpha characters + // characters: 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ + var _encode62 = function($charCode) { + return ($charCode < _encoding ? '' : arguments.callee(parseInt($charCode / _encoding))) + + (($charCode = $charCode % _encoding) > 35 ? String.fromCharCode($charCode + 29) : $charCode.toString(36)); + }; + + // use high-ascii values + var _encode95 = function($charCode) { + return ($charCode < _encoding ? '' : arguments.callee($charCode / _encoding)) + + String.fromCharCode($charCode % _encoding + 161); + }; + + // special _chars + var _encodePrivate = function($charCode) { + return "_" + $charCode; + }; + + // protect characters used by the parser + function _escape($script) { + return $script.replace(/([\\'])/g, "\\$1"); + }; + + // protect high-ascii characters already in the script + function _escape95($script) { + return $script.replace(/[\xa1-\xff]/g, function($match) { + return "\\x" + $match.charCodeAt(0).toString(16); + }); + }; + + function _safeRegExp($string, $flags) { + return new RegExp($string.replace(/\$/g, "\\$"), $flags); + }; + + // extract the body of a function + function _getFunctionBody($function) { + with (String($function)) return slice(indexOf("{") + 1, lastIndexOf("}")); + }; + + // set the global flag on a RegExp (you have to create a new one) + function _globalize($regexp) { + return new RegExp(String($regexp).slice(1, -1), "g"); + }; + + // build the parsing routine + _addParser(_basicCompression); + if (_specialChars) _addParser(_encodeSpecialChars); + if (_encoding) _addParser(_encodeKeywords); + + // go! + return _pack(_script); +}; diff --git a/include/jQuery/tablesorter/build/writeFile.js b/include/jQuery/tablesorter/build/writeFile.js new file mode 100755 index 00000000..43b1eb24 --- /dev/null +++ b/include/jQuery/tablesorter/build/writeFile.js @@ -0,0 +1,19 @@ +importPackage(java.io); + +function writeFile( file, stream ) { + var buffer = new PrintWriter( new FileWriter( file ) ); + buffer.print( stream ); + buffer.close(); +} + +function read( file ) { + var jq = new File(file); + var reader = new BufferedReader(new FileReader(jq)); + var line = null; + var buffer = new java.lang.StringBuffer(jq.length()); + while( (line = reader.readLine()) != null) { + buffer.append(line); + buffer.append("\n"); + } + return buffer.toString(); +} \ No newline at end of file diff --git a/include/jQuery/tablesorter/docs/js/docs.js b/include/jQuery/tablesorter/docs/js/docs.js new file mode 100755 index 00000000..79351628 --- /dev/null +++ b/include/jQuery/tablesorter/docs/js/docs.js @@ -0,0 +1,23 @@ +/* Stop IE flicker */ +if ($.browser.msie == true) document.execCommand('BackgroundImageCache', false, true); +ChiliBook.recipeFolder = "js/chili/"; +ChiliBook.stylesheetFolder = "js/chili/" + +jQuery.fn.antispam = function() { + return this.each(function(){ + var email = $(this).text().toLowerCase().replace(/\sdot/g,'.').replace(/\sat/g,'@').replace(/\s+/g,''); + var URI = "mailto:" + email; + $(this).hide().before( + $("").attr("href",URI).addClass("external").text(email) + ); + }); +}; + + +$(function() { + $("pre.javascript").chili(); + $("pre.html").chili(); + $("pre.css").chili(); + $("a.external").each(function() {this.target = '_new'}); + $("span.email").antispam(); +}); \ No newline at end of file diff --git a/include/jQuery/tablesorter/docs/js/examples.js b/include/jQuery/tablesorter/docs/js/examples.js new file mode 100755 index 00000000..16eed264 --- /dev/null +++ b/include/jQuery/tablesorter/docs/js/examples.js @@ -0,0 +1,29 @@ +$(function() { + + // get javascript source + $("#javascript pre").text($("#js").html()); + + if($("#demo").size() > 0) { + // old school chaining... + var html = $("#demo").html() + .toLowerCase() + .replace(/\n|\t|\r/g,'') + .replace(//g,'\n') + .replace(//g,'\n') + .replace(/<\/tr>/g,'\t\t') + .replace(//g,'\n\t\t\n') + .replace(/') + .replace(/<\/thead>/g,'\n\t') + .replace(//g,'\n\t') + .replace(/<\/table>/g,'\n') + .replace(/-->/g,'-->\n'); + + $("#html pre").text(html); + } + $("pre.javascript").chili(); + $("pre.html").chili(); + $("pre.css").chili(); +}); \ No newline at end of file diff --git a/include/jQuery/tablesorter/jquery-latest.js b/include/jQuery/tablesorter/jquery-latest.js new file mode 100755 index 00000000..7c243080 --- /dev/null +++ b/include/jQuery/tablesorter/jquery-latest.js @@ -0,0 +1,154 @@ +/*! + * jQuery JavaScript Library v1.4.2 + * http://jquery.com/ + * + * Copyright 2010, John Resig + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * Includes Sizzle.js + * http://sizzlejs.com/ + * Copyright 2010, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * + * Date: Sat Feb 13 22:33:48 2010 -0500 + */ +(function(A,w){function ma(){if(!c.isReady){try{s.documentElement.doScroll("left")}catch(a){setTimeout(ma,1);return}c.ready()}}function Qa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function X(a,b,d,f,e,j){var i=a.length;if(typeof b==="object"){for(var o in b)X(a,o,b[o],f,e,d);return a}if(d!==w){f=!j&&f&&c.isFunction(d);for(o=0;o)[^>]*$|^#([\w-]+)$/,Ua=/^.[^:#\[\.,]*$/,Va=/\S/, +Wa=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,Xa=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,P=navigator.userAgent,xa=false,Q=[],L,$=Object.prototype.toString,aa=Object.prototype.hasOwnProperty,ba=Array.prototype.push,R=Array.prototype.slice,ya=Array.prototype.indexOf;c.fn=c.prototype={init:function(a,b){var d,f;if(!a)return this;if(a.nodeType){this.context=this[0]=a;this.length=1;return this}if(a==="body"&&!b){this.context=s;this[0]=s.body;this.selector="body";this.length=1;return this}if(typeof a==="string")if((d=Ta.exec(a))&& +(d[1]||!b))if(d[1]){f=b?b.ownerDocument||b:s;if(a=Xa.exec(a))if(c.isPlainObject(b)){a=[s.createElement(a[1])];c.fn.attr.call(a,b,true)}else a=[f.createElement(a[1])];else{a=sa([d[1]],[f]);a=(a.cacheable?a.fragment.cloneNode(true):a.fragment).childNodes}return c.merge(this,a)}else{if(b=s.getElementById(d[2])){if(b.id!==d[2])return T.find(a);this.length=1;this[0]=b}this.context=s;this.selector=a;return this}else if(!b&&/^\w+$/.test(a)){this.selector=a;this.context=s;a=s.getElementsByTagName(a);return c.merge(this, +a)}else return!b||b.jquery?(b||T).find(a):c(b).find(a);else if(c.isFunction(a))return T.ready(a);if(a.selector!==w){this.selector=a.selector;this.context=a.context}return c.makeArray(a,this)},selector:"",jquery:"1.4.2",length:0,size:function(){return this.length},toArray:function(){return R.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this.slice(a)[0]:this[a]},pushStack:function(a,b,d){var f=c();c.isArray(a)?ba.apply(f,a):c.merge(f,a);f.prevObject=this;f.context=this.context;if(b=== +"find")f.selector=this.selector+(this.selector?" ":"")+d;else if(b)f.selector=this.selector+"."+b+"("+d+")";return f},each:function(a,b){return c.each(this,a,b)},ready:function(a){c.bindReady();if(c.isReady)a.call(s,c);else Q&&Q.push(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(R.apply(this,arguments),"slice",R.call(arguments).join(","))},map:function(a){return this.pushStack(c.map(this, +function(b,d){return a.call(b,d,b)}))},end:function(){return this.prevObject||c(null)},push:ba,sort:[].sort,splice:[].splice};c.fn.init.prototype=c.fn;c.extend=c.fn.extend=function(){var a=arguments[0]||{},b=1,d=arguments.length,f=false,e,j,i,o;if(typeof a==="boolean"){f=a;a=arguments[1]||{};b=2}if(typeof a!=="object"&&!c.isFunction(a))a={};if(d===b){a=this;--b}for(;b
    a"; +var e=d.getElementsByTagName("*"),j=d.getElementsByTagName("a")[0];if(!(!e||!e.length||!j)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(j.getAttribute("style")),hrefNormalized:j.getAttribute("href")==="/a",opacity:/^0.55$/.test(j.style.opacity),cssFloat:!!j.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:s.createElement("select").appendChild(s.createElement("option")).selected, +parentNode:d.removeChild(d.appendChild(s.createElement("div"))).parentNode===null,deleteExpando:true,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null};b.type="text/javascript";try{b.appendChild(s.createTextNode("window."+f+"=1;"))}catch(i){}a.insertBefore(b,a.firstChild);if(A[f]){c.support.scriptEval=true;delete A[f]}try{delete b.test}catch(o){c.support.deleteExpando=false}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function k(){c.support.noCloneEvent= +false;d.detachEvent("onclick",k)});d.cloneNode(true).fireEvent("onclick")}d=s.createElement("div");d.innerHTML="";a=s.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var k=s.createElement("div");k.style.width=k.style.paddingLeft="1px";s.body.appendChild(k);c.boxModel=c.support.boxModel=k.offsetWidth===2;s.body.removeChild(k).style.display="none"});a=function(k){var n= +s.createElement("div");k="on"+k;var r=k in n;if(!r){n.setAttribute(k,"return;");r=typeof n[k]==="function"}return r};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=e=j=null}})();c.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var G="jQuery"+J(),Ya=0,za={};c.extend({cache:{},expando:G,noData:{embed:true,object:true, +applet:true},data:function(a,b,d){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var f=a[G],e=c.cache;if(!f&&typeof b==="string"&&d===w)return null;f||(f=++Ya);if(typeof b==="object"){a[G]=f;e[f]=c.extend(true,{},b)}else if(!e[f]){a[G]=f;e[f]={}}a=e[f];if(d!==w)a[b]=d;return typeof b==="string"?a[b]:a}},removeData:function(a,b){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var d=a[G],f=c.cache,e=f[d];if(b){if(e){delete e[b];c.isEmptyObject(e)&&c.removeData(a)}}else{if(c.support.deleteExpando)delete a[c.expando]; +else a.removeAttribute&&a.removeAttribute(c.expando);delete f[d]}}}});c.fn.extend({data:function(a,b){if(typeof a==="undefined"&&this.length)return c.data(this[0]);else if(typeof a==="object")return this.each(function(){c.data(this,a)});var d=a.split(".");d[1]=d[1]?"."+d[1]:"";if(b===w){var f=this.triggerHandler("getData"+d[1]+"!",[d[0]]);if(f===w&&this.length)f=c.data(this[0],a);return f===w&&d[1]?this.data(d[0]):f}else return this.trigger("setData"+d[1]+"!",[d[0],b]).each(function(){c.data(this, +a,b)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var f=c.data(a,b);if(!d)return f||[];if(!f||c.isArray(d))f=c.data(a,b,c.makeArray(d));else f.push(d);return f}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),f=d.shift();if(f==="inprogress")f=d.shift();if(f){b==="fx"&&d.unshift("inprogress");f.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b=== +w)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]||a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var Aa=/[\n\t]/g,ca=/\s+/,Za=/\r/g,$a=/href|src|style/,ab=/(button|input)/i,bb=/(button|input|object|select|textarea)/i, +cb=/^(a|area)$/i,Ba=/radio|checkbox/;c.fn.extend({attr:function(a,b){return X(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(n){var r=c(this);r.addClass(a.call(this,n,r.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(ca),d=0,f=this.length;d-1)return true;return false},val:function(a){if(a===w){var b=this[0];if(b){if(c.nodeName(b,"option"))return(b.attributes.value||{}).specified?b.value:b.text;if(c.nodeName(b,"select")){var d=b.selectedIndex,f=[],e=b.options;b=b.type==="select-one";if(d<0)return null;var j=b?d:0;for(d=b?d+1:e.length;j=0;else if(c.nodeName(this,"select")){var u=c.makeArray(r);c("option",this).each(function(){this.selected= +c.inArray(c(this).val(),u)>=0});if(!u.length)this.selectedIndex=-1}else this.value=r}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,d,f){if(!a||a.nodeType===3||a.nodeType===8)return w;if(f&&b in c.attrFn)return c(a)[b](d);f=a.nodeType!==1||!c.isXMLDoc(a);var e=d!==w;b=f&&c.props[b]||b;if(a.nodeType===1){var j=$a.test(b);if(b in a&&f&&!j){if(e){b==="type"&&ab.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed"); +a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&b.specified?b.value:bb.test(a.nodeName)||cb.test(a.nodeName)&&a.href?0:w;return a[b]}if(!c.support.style&&f&&b==="style"){if(e)a.style.cssText=""+d;return a.style.cssText}e&&a.setAttribute(b,""+d);a=!c.support.hrefNormalized&&f&&j?a.getAttribute(b,2):a.getAttribute(b);return a===null?w:a}return c.style(a,b,d)}});var O=/\.(.*)$/,db=function(a){return a.replace(/[^\w\s\.\|`]/g, +function(b){return"\\"+b})};c.event={add:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){if(a.setInterval&&a!==A&&!a.frameElement)a=A;var e,j;if(d.handler){e=d;d=e.handler}if(!d.guid)d.guid=c.guid++;if(j=c.data(a)){var i=j.events=j.events||{},o=j.handle;if(!o)j.handle=o=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(o.elem,arguments):w};o.elem=a;b=b.split(" ");for(var k,n=0,r;k=b[n++];){j=e?c.extend({},e):{handler:d,data:f};if(k.indexOf(".")>-1){r=k.split("."); +k=r.shift();j.namespace=r.slice(0).sort().join(".")}else{r=[];j.namespace=""}j.type=k;j.guid=d.guid;var u=i[k],z=c.event.special[k]||{};if(!u){u=i[k]=[];if(!z.setup||z.setup.call(a,f,r,o)===false)if(a.addEventListener)a.addEventListener(k,o,false);else a.attachEvent&&a.attachEvent("on"+k,o)}if(z.add){z.add.call(a,j);if(!j.handler.guid)j.handler.guid=d.guid}u.push(j);c.event.global[k]=true}a=null}}},global:{},remove:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){var e,j=0,i,o,k,n,r,u,z=c.data(a), +C=z&&z.events;if(z&&C){if(b&&b.type){d=b.handler;b=b.type}if(!b||typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(e in C)c.event.remove(a,e+b)}else{for(b=b.split(" ");e=b[j++];){n=e;i=e.indexOf(".")<0;o=[];if(!i){o=e.split(".");e=o.shift();k=new RegExp("(^|\\.)"+c.map(o.slice(0).sort(),db).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(r=C[e])if(d){n=c.event.special[e]||{};for(B=f||0;B=0){a.type= +e=e.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[e]&&c.each(c.cache,function(){this.events&&this.events[e]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===8)return w;a.result=w;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(f=c.data(d,"handle"))&&f.apply(d,b);f=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+e]&&d["on"+e].apply(d,b)===false)a.result=false}catch(j){}if(!a.isPropagationStopped()&& +f)c.event.trigger(a,b,f,true);else if(!a.isDefaultPrevented()){f=a.target;var i,o=c.nodeName(f,"a")&&e==="click",k=c.event.special[e]||{};if((!k._default||k._default.call(d,a)===false)&&!o&&!(f&&f.nodeName&&c.noData[f.nodeName.toLowerCase()])){try{if(f[e]){if(i=f["on"+e])f["on"+e]=null;c.event.triggered=true;f[e]()}}catch(n){}if(i)f["on"+e]=i;c.event.triggered=false}}},handle:function(a){var b,d,f,e;a=arguments[0]=c.event.fix(a||A.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive; +if(!b){d=a.type.split(".");a.type=d.shift();f=new RegExp("(^|\\.)"+d.slice(0).sort().join("\\.(?:.*\\.)?")+"(\\.|$)")}e=c.data(this,"events");d=e[a.type];if(e&&d){d=d.slice(0);e=0;for(var j=d.length;e-1?c.map(a.options,function(f){return f.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},fa=function(a,b){var d=a.target,f,e;if(!(!da.test(d.nodeName)||d.readOnly)){f=c.data(d,"_change_data");e=Fa(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data", +e);if(!(f===w||e===f))if(f!=null||e){a.type="change";return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:fa,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return fa.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return fa.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a, +"_change_data",Fa(a))}},setup:function(){if(this.type==="file")return false;for(var a in ea)c.event.add(this,a+".specialChange",ea[a]);return da.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return da.test(this.nodeName)}};ea=c.event.special.change.filters}s.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(f){f=c.event.fix(f);f.type=b;return c.event.handle.call(this,f)}c.event.special[b]={setup:function(){this.addEventListener(a, +d,true)},teardown:function(){this.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,f,e){if(typeof d==="object"){for(var j in d)this[b](j,f,d[j],e);return this}if(c.isFunction(f)){e=f;f=w}var i=b==="one"?c.proxy(e,function(k){c(this).unbind(k,i);return e.apply(this,arguments)}):e;if(d==="unload"&&b!=="one")this.one(d,f,e);else{j=0;for(var o=this.length;j0){y=t;break}}t=t[g]}m[q]=y}}}var f=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, +e=0,j=Object.prototype.toString,i=false,o=true;[0,0].sort(function(){o=false;return 0});var k=function(g,h,l,m){l=l||[];var q=h=h||s;if(h.nodeType!==1&&h.nodeType!==9)return[];if(!g||typeof g!=="string")return l;for(var p=[],v,t,y,S,H=true,M=x(h),I=g;(f.exec(""),v=f.exec(I))!==null;){I=v[3];p.push(v[1]);if(v[2]){S=v[3];break}}if(p.length>1&&r.exec(g))if(p.length===2&&n.relative[p[0]])t=ga(p[0]+p[1],h);else for(t=n.relative[p[0]]?[h]:k(p.shift(),h);p.length;){g=p.shift();if(n.relative[g])g+=p.shift(); +t=ga(g,t)}else{if(!m&&p.length>1&&h.nodeType===9&&!M&&n.match.ID.test(p[0])&&!n.match.ID.test(p[p.length-1])){v=k.find(p.shift(),h,M);h=v.expr?k.filter(v.expr,v.set)[0]:v.set[0]}if(h){v=m?{expr:p.pop(),set:z(m)}:k.find(p.pop(),p.length===1&&(p[0]==="~"||p[0]==="+")&&h.parentNode?h.parentNode:h,M);t=v.expr?k.filter(v.expr,v.set):v.set;if(p.length>0)y=z(t);else H=false;for(;p.length;){var D=p.pop();v=D;if(n.relative[D])v=p.pop();else D="";if(v==null)v=h;n.relative[D](y,v,M)}}else y=[]}y||(y=t);y||k.error(D|| +g);if(j.call(y)==="[object Array]")if(H)if(h&&h.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&E(h,y[g])))l.push(t[g])}else for(g=0;y[g]!=null;g++)y[g]&&y[g].nodeType===1&&l.push(t[g]);else l.push.apply(l,y);else z(y,l);if(S){k(S,q,l,m);k.uniqueSort(l)}return l};k.uniqueSort=function(g){if(B){i=o;g.sort(B);if(i)for(var h=1;h":function(g,h){var l=typeof h==="string";if(l&&!/\W/.test(h)){h=h.toLowerCase();for(var m=0,q=g.length;m=0))l||m.push(v);else if(l)h[p]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()}, +CHILD:function(g){if(g[1]==="nth"){var h=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=h[1]+(h[2]||1)-0;g[3]=h[3]-0}g[0]=e++;return g},ATTR:function(g,h,l,m,q,p){h=g[1].replace(/\\/g,"");if(!p&&n.attrMap[h])g[1]=n.attrMap[h];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,h,l,m,q){if(g[1]==="not")if((f.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=k(g[3],null,null,h);else{g=k.filter(g[3],h,l,true^q);l||m.push.apply(m, +g);return false}else if(n.match.POS.test(g[0])||n.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,h,l){return!!k(l[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)}, +text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}}, +setFilters:{first:function(g,h){return h===0},last:function(g,h,l,m){return h===m.length-1},even:function(g,h){return h%2===0},odd:function(g,h){return h%2===1},lt:function(g,h,l){return hl[3]-0},nth:function(g,h,l){return l[3]-0===h},eq:function(g,h,l){return l[3]-0===h}},filter:{PSEUDO:function(g,h,l,m){var q=h[1],p=n.filters[q];if(p)return p(g,l,h,m);else if(q==="contains")return(g.textContent||g.innerText||a([g])||"").indexOf(h[3])>=0;else if(q==="not"){h= +h[3];l=0;for(m=h.length;l=0}},ID:function(g,h){return g.nodeType===1&&g.getAttribute("id")===h},TAG:function(g,h){return h==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===h},CLASS:function(g,h){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(h)>-1},ATTR:function(g,h){var l=h[1];g=n.attrHandle[l]?n.attrHandle[l](g):g[l]!=null?g[l]:g.getAttribute(l);l=g+"";var m=h[2];h=h[4];return g==null?m==="!=":m=== +"="?l===h:m==="*="?l.indexOf(h)>=0:m==="~="?(" "+l+" ").indexOf(h)>=0:!h?l&&g!==false:m==="!="?l!==h:m==="^="?l.indexOf(h)===0:m==="$="?l.substr(l.length-h.length)===h:m==="|="?l===h||l.substr(0,h.length+1)===h+"-":false},POS:function(g,h,l,m){var q=n.setFilters[h[2]];if(q)return q(g,l,h,m)}}},r=n.match.POS;for(var u in n.match){n.match[u]=new RegExp(n.match[u].source+/(?![^\[]*\])(?![^\(]*\))/.source);n.leftMatch[u]=new RegExp(/(^(?:.|\r|\n)*?)/.source+n.match[u].source.replace(/\\(\d+)/g,function(g, +h){return"\\"+(h-0+1)}))}var z=function(g,h){g=Array.prototype.slice.call(g,0);if(h){h.push.apply(h,g);return h}return g};try{Array.prototype.slice.call(s.documentElement.childNodes,0)}catch(C){z=function(g,h){h=h||[];if(j.call(g)==="[object Array]")Array.prototype.push.apply(h,g);else if(typeof g.length==="number")for(var l=0,m=g.length;l";var l=s.documentElement;l.insertBefore(g,l.firstChild);if(s.getElementById(h)){n.find.ID=function(m,q,p){if(typeof q.getElementById!=="undefined"&&!p)return(q=q.getElementById(m[1]))?q.id===m[1]||typeof q.getAttributeNode!=="undefined"&& +q.getAttributeNode("id").nodeValue===m[1]?[q]:w:[]};n.filter.ID=function(m,q){var p=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&p&&p.nodeValue===q}}l.removeChild(g);l=g=null})();(function(){var g=s.createElement("div");g.appendChild(s.createComment(""));if(g.getElementsByTagName("*").length>0)n.find.TAG=function(h,l){l=l.getElementsByTagName(h[1]);if(h[1]==="*"){h=[];for(var m=0;l[m];m++)l[m].nodeType===1&&h.push(l[m]);l=h}return l};g.innerHTML=""; +if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")n.attrHandle.href=function(h){return h.getAttribute("href",2)};g=null})();s.querySelectorAll&&function(){var g=k,h=s.createElement("div");h.innerHTML="

    ";if(!(h.querySelectorAll&&h.querySelectorAll(".TEST").length===0)){k=function(m,q,p,v){q=q||s;if(!v&&q.nodeType===9&&!x(q))try{return z(q.querySelectorAll(m),p)}catch(t){}return g(m,q,p,v)};for(var l in g)k[l]=g[l];h=null}}(); +(function(){var g=s.createElement("div");g.innerHTML="
    ";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){n.order.splice(1,0,"CLASS");n.find.CLASS=function(h,l,m){if(typeof l.getElementsByClassName!=="undefined"&&!m)return l.getElementsByClassName(h[1])};g=null}}})();var E=s.compareDocumentPosition?function(g,h){return!!(g.compareDocumentPosition(h)&16)}: +function(g,h){return g!==h&&(g.contains?g.contains(h):true)},x=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false},ga=function(g,h){var l=[],m="",q;for(h=h.nodeType?[h]:h;q=n.match.PSEUDO.exec(g);){m+=q[0];g=g.replace(n.match.PSEUDO,"")}g=n.relative[g]?g+"*":g;q=0;for(var p=h.length;q=0===d})};c.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),d=0,f=0,e=this.length;f0)for(var j=d;j0},closest:function(a,b){if(c.isArray(a)){var d=[],f=this[0],e,j= +{},i;if(f&&a.length){e=0;for(var o=a.length;e-1:c(f).is(e)){d.push({selector:i,elem:f});delete j[i]}}f=f.parentNode}}return d}var k=c.expr.match.POS.test(a)?c(a,b||this.context):null;return this.map(function(n,r){for(;r&&r.ownerDocument&&r!==b;){if(k?k.index(r)>-1:c(r).is(a))return r;r=r.parentNode}return null})},index:function(a){if(!a||typeof a=== +"string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){a=typeof a==="string"?c(a,b||this.context):c.makeArray(a);b=c.merge(this.get(),a);return this.pushStack(qa(a[0])||qa(b[0])?b:c.unique(b))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode", +d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")? +a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,b){c.fn[a]=function(d,f){var e=c.map(this,b,d);eb.test(a)||(f=d);if(f&&typeof f==="string")e=c.filter(f,e);e=this.length>1?c.unique(e):e;if((this.length>1||gb.test(f))&&fb.test(a))e=e.reverse();return this.pushStack(e,a,R.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return c.find.matches(a,b)},dir:function(a,b,d){var f=[];for(a=a[b];a&&a.nodeType!==9&&(d===w||a.nodeType!==1||!c(a).is(d));){a.nodeType=== +1&&f.push(a);a=a[b]}return f},nth:function(a,b,d){b=b||1;for(var f=0;a;a=a[d])if(a.nodeType===1&&++f===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var Ja=/ jQuery\d+="(?:\d+|null)"/g,V=/^\s+/,Ka=/(<([\w:]+)[^>]*?)\/>/g,hb=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,La=/<([\w:]+)/,ib=/"},F={option:[1,""],legend:[1,"
    ","
    "],thead:[1,"","
    "],tr:[2,"","
    "],td:[3,"","
    "],col:[2,"","
    "],area:[1,"",""],_default:[0,"",""]};F.optgroup=F.option;F.tbody=F.tfoot=F.colgroup=F.caption=F.thead;F.th=F.td;if(!c.support.htmlSerialize)F._default=[1,"div
    ","
    "];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d= +c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==w)return this.empty().append((this[0]&&this[0].ownerDocument||s).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this}, +wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})}, +prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b, +this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,f;(f=this[d])!=null;d++)if(!a||c.filter(a,[f]).length){if(!b&&f.nodeType===1){c.cleanData(f.getElementsByTagName("*"));c.cleanData([f])}f.parentNode&&f.parentNode.removeChild(f)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild); +return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,f=this.ownerDocument;if(!d){d=f.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(Ja,"").replace(/=([^="'>\s]+\/)>/g,'="$1">').replace(V,"")],f)[0]}else return this.cloneNode(true)});if(a===true){ra(this,b);ra(this.find("*"),b.find("*"))}return b},html:function(a){if(a===w)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Ja, +""):null;else if(typeof a==="string"&&!ta.test(a)&&(c.support.leadingWhitespace||!V.test(a))&&!F[(La.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Ka,Ma);try{for(var b=0,d=this.length;b0||e.cacheable||this.length>1?k.cloneNode(true):k)}o.length&&c.each(o,Qa)}return this}});c.fragments={};c.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var f=[];d=c(d);var e=this.length===1&&this[0].parentNode;if(e&&e.nodeType===11&&e.childNodes.length===1&&d.length===1){d[b](this[0]); +return this}else{e=0;for(var j=d.length;e0?this.clone(true):this).get();c.fn[b].apply(c(d[e]),i);f=f.concat(i)}return this.pushStack(f,a,d.selector)}}});c.extend({clean:function(a,b,d,f){b=b||s;if(typeof b.createElement==="undefined")b=b.ownerDocument||b[0]&&b[0].ownerDocument||s;for(var e=[],j=0,i;(i=a[j])!=null;j++){if(typeof i==="number")i+="";if(i){if(typeof i==="string"&&!jb.test(i))i=b.createTextNode(i);else if(typeof i==="string"){i=i.replace(Ka,Ma);var o=(La.exec(i)||["", +""])[1].toLowerCase(),k=F[o]||F._default,n=k[0],r=b.createElement("div");for(r.innerHTML=k[1]+i+k[2];n--;)r=r.lastChild;if(!c.support.tbody){n=ib.test(i);o=o==="table"&&!n?r.firstChild&&r.firstChild.childNodes:k[1]===""&&!n?r.childNodes:[];for(k=o.length-1;k>=0;--k)c.nodeName(o[k],"tbody")&&!o[k].childNodes.length&&o[k].parentNode.removeChild(o[k])}!c.support.leadingWhitespace&&V.test(i)&&r.insertBefore(b.createTextNode(V.exec(i)[0]),r.firstChild);i=r.childNodes}if(i.nodeType)e.push(i);else e= +c.merge(e,i)}}if(d)for(j=0;e[j];j++)if(f&&c.nodeName(e[j],"script")&&(!e[j].type||e[j].type.toLowerCase()==="text/javascript"))f.push(e[j].parentNode?e[j].parentNode.removeChild(e[j]):e[j]);else{e[j].nodeType===1&&e.splice.apply(e,[j+1,0].concat(c.makeArray(e[j].getElementsByTagName("script"))));d.appendChild(e[j])}return e},cleanData:function(a){for(var b,d,f=c.cache,e=c.event.special,j=c.support.deleteExpando,i=0,o;(o=a[i])!=null;i++)if(d=o[c.expando]){b=f[d];if(b.events)for(var k in b.events)e[k]? +c.event.remove(o,k):Ca(o,k,b.handle);if(j)delete o[c.expando];else o.removeAttribute&&o.removeAttribute(c.expando);delete f[d]}}});var kb=/z-?index|font-?weight|opacity|zoom|line-?height/i,Na=/alpha\([^)]*\)/,Oa=/opacity=([^)]*)/,ha=/float/i,ia=/-([a-z])/ig,lb=/([A-Z])/g,mb=/^-?\d+(?:px)?$/i,nb=/^-?\d/,ob={position:"absolute",visibility:"hidden",display:"block"},pb=["Left","Right"],qb=["Top","Bottom"],rb=s.defaultView&&s.defaultView.getComputedStyle,Pa=c.support.cssFloat?"cssFloat":"styleFloat",ja= +function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){return X(this,a,b,true,function(d,f,e){if(e===w)return c.curCSS(d,f);if(typeof e==="number"&&!kb.test(f))e+="px";c.style(d,f,e)})};c.extend({style:function(a,b,d){if(!a||a.nodeType===3||a.nodeType===8)return w;if((b==="width"||b==="height")&&parseFloat(d)<0)d=w;var f=a.style||a,e=d!==w;if(!c.support.opacity&&b==="opacity"){if(e){f.zoom=1;b=parseInt(d,10)+""==="NaN"?"":"alpha(opacity="+d*100+")";a=f.filter||c.curCSS(a,"filter")||"";f.filter= +Na.test(a)?a.replace(Na,b):b}return f.filter&&f.filter.indexOf("opacity=")>=0?parseFloat(Oa.exec(f.filter)[1])/100+"":""}if(ha.test(b))b=Pa;b=b.replace(ia,ja);if(e)f[b]=d;return f[b]},css:function(a,b,d,f){if(b==="width"||b==="height"){var e,j=b==="width"?pb:qb;function i(){e=b==="width"?a.offsetWidth:a.offsetHeight;f!=="border"&&c.each(j,function(){f||(e-=parseFloat(c.curCSS(a,"padding"+this,true))||0);if(f==="margin")e+=parseFloat(c.curCSS(a,"margin"+this,true))||0;else e-=parseFloat(c.curCSS(a, +"border"+this+"Width",true))||0})}a.offsetWidth!==0?i():c.swap(a,ob,i);return Math.max(0,Math.round(e))}return c.curCSS(a,b,d)},curCSS:function(a,b,d){var f,e=a.style;if(!c.support.opacity&&b==="opacity"&&a.currentStyle){f=Oa.test(a.currentStyle.filter||"")?parseFloat(RegExp.$1)/100+"":"";return f===""?"1":f}if(ha.test(b))b=Pa;if(!d&&e&&e[b])f=e[b];else if(rb){if(ha.test(b))b="float";b=b.replace(lb,"-$1").toLowerCase();e=a.ownerDocument.defaultView;if(!e)return null;if(a=e.getComputedStyle(a,null))f= +a.getPropertyValue(b);if(b==="opacity"&&f==="")f="1"}else if(a.currentStyle){d=b.replace(ia,ja);f=a.currentStyle[b]||a.currentStyle[d];if(!mb.test(f)&&nb.test(f)){b=e.left;var j=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;e.left=d==="fontSize"?"1em":f||0;f=e.pixelLeft+"px";e.left=b;a.runtimeStyle.left=j}}return f},swap:function(a,b,d){var f={};for(var e in b){f[e]=a.style[e];a.style[e]=b[e]}d.call(a);for(e in b)a.style[e]=f[e]}});if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b= +a.offsetWidth,d=a.offsetHeight,f=a.nodeName.toLowerCase()==="tr";return b===0&&d===0&&!f?true:b>0&&d>0&&!f?false:c.curCSS(a,"display")==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var sb=J(),tb=//gi,ub=/select|textarea/i,vb=/color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,N=/=\?(&|$)/,ka=/\?/,wb=/(\?|&)_=.*?(&|$)/,xb=/^(\w+:)?\/\/([^\/?#]+)/,yb=/%20/g,zb=c.fn.load;c.fn.extend({load:function(a,b,d){if(typeof a!== +"string")return zb.call(this,a);else if(!this.length)return this;var f=a.indexOf(" ");if(f>=0){var e=a.slice(f,a.length);a=a.slice(0,f)}f="GET";if(b)if(c.isFunction(b)){d=b;b=null}else if(typeof b==="object"){b=c.param(b,c.ajaxSettings.traditional);f="POST"}var j=this;c.ajax({url:a,type:f,dataType:"html",data:b,complete:function(i,o){if(o==="success"||o==="notmodified")j.html(e?c("
    ").append(i.responseText.replace(tb,"")).find(e):i.responseText);d&&j.each(d,[i.responseText,o,i])}});return this}, +serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||ub.test(this.nodeName)||vb.test(this.type))}).map(function(a,b){a=c(this).val();return a==null?null:c.isArray(a)?c.map(a,function(d){return{name:b.name,value:d}}):{name:b.name,value:a}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "), +function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:f})},getScript:function(a,b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:f})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href, +global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:A.XMLHttpRequest&&(A.location.protocol!=="file:"||!A.ActiveXObject)?function(){return new A.XMLHttpRequest}:function(){try{return new A.ActiveXObject("Microsoft.XMLHTTP")}catch(a){}},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},etag:{},ajax:function(a){function b(){e.success&& +e.success.call(k,o,i,x);e.global&&f("ajaxSuccess",[x,e])}function d(){e.complete&&e.complete.call(k,x,i);e.global&&f("ajaxComplete",[x,e]);e.global&&!--c.active&&c.event.trigger("ajaxStop")}function f(q,p){(e.context?c(e.context):c.event).trigger(q,p)}var e=c.extend(true,{},c.ajaxSettings,a),j,i,o,k=a&&a.context||e,n=e.type.toUpperCase();if(e.data&&e.processData&&typeof e.data!=="string")e.data=c.param(e.data,e.traditional);if(e.dataType==="jsonp"){if(n==="GET")N.test(e.url)||(e.url+=(ka.test(e.url)? +"&":"?")+(e.jsonp||"callback")+"=?");else if(!e.data||!N.test(e.data))e.data=(e.data?e.data+"&":"")+(e.jsonp||"callback")+"=?";e.dataType="json"}if(e.dataType==="json"&&(e.data&&N.test(e.data)||N.test(e.url))){j=e.jsonpCallback||"jsonp"+sb++;if(e.data)e.data=(e.data+"").replace(N,"="+j+"$1");e.url=e.url.replace(N,"="+j+"$1");e.dataType="script";A[j]=A[j]||function(q){o=q;b();d();A[j]=w;try{delete A[j]}catch(p){}z&&z.removeChild(C)}}if(e.dataType==="script"&&e.cache===null)e.cache=false;if(e.cache=== +false&&n==="GET"){var r=J(),u=e.url.replace(wb,"$1_="+r+"$2");e.url=u+(u===e.url?(ka.test(e.url)?"&":"?")+"_="+r:"")}if(e.data&&n==="GET")e.url+=(ka.test(e.url)?"&":"?")+e.data;e.global&&!c.active++&&c.event.trigger("ajaxStart");r=(r=xb.exec(e.url))&&(r[1]&&r[1]!==location.protocol||r[2]!==location.host);if(e.dataType==="script"&&n==="GET"&&r){var z=s.getElementsByTagName("head")[0]||s.documentElement,C=s.createElement("script");C.src=e.url;if(e.scriptCharset)C.charset=e.scriptCharset;if(!j){var B= +false;C.onload=C.onreadystatechange=function(){if(!B&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){B=true;b();d();C.onload=C.onreadystatechange=null;z&&C.parentNode&&z.removeChild(C)}}}z.insertBefore(C,z.firstChild);return w}var E=false,x=e.xhr();if(x){e.username?x.open(n,e.url,e.async,e.username,e.password):x.open(n,e.url,e.async);try{if(e.data||a&&a.contentType)x.setRequestHeader("Content-Type",e.contentType);if(e.ifModified){c.lastModified[e.url]&&x.setRequestHeader("If-Modified-Since", +c.lastModified[e.url]);c.etag[e.url]&&x.setRequestHeader("If-None-Match",c.etag[e.url])}r||x.setRequestHeader("X-Requested-With","XMLHttpRequest");x.setRequestHeader("Accept",e.dataType&&e.accepts[e.dataType]?e.accepts[e.dataType]+", */*":e.accepts._default)}catch(ga){}if(e.beforeSend&&e.beforeSend.call(k,x,e)===false){e.global&&!--c.active&&c.event.trigger("ajaxStop");x.abort();return false}e.global&&f("ajaxSend",[x,e]);var g=x.onreadystatechange=function(q){if(!x||x.readyState===0||q==="abort"){E|| +d();E=true;if(x)x.onreadystatechange=c.noop}else if(!E&&x&&(x.readyState===4||q==="timeout")){E=true;x.onreadystatechange=c.noop;i=q==="timeout"?"timeout":!c.httpSuccess(x)?"error":e.ifModified&&c.httpNotModified(x,e.url)?"notmodified":"success";var p;if(i==="success")try{o=c.httpData(x,e.dataType,e)}catch(v){i="parsererror";p=v}if(i==="success"||i==="notmodified")j||b();else c.handleError(e,x,i,p);d();q==="timeout"&&x.abort();if(e.async)x=null}};try{var h=x.abort;x.abort=function(){x&&h.call(x); +g("abort")}}catch(l){}e.async&&e.timeout>0&&setTimeout(function(){x&&!E&&g("timeout")},e.timeout);try{x.send(n==="POST"||n==="PUT"||n==="DELETE"?e.data:null)}catch(m){c.handleError(e,x,null,m);d()}e.async||g();return x}},handleError:function(a,b,d,f){if(a.error)a.error.call(a.context||a,b,d,f);if(a.global)(a.context?c(a.context):c.event).trigger("ajaxError",[b,a,f])},active:0,httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status=== +1223||a.status===0}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"),f=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(f)c.etag[b]=f;return a.status===304||a.status===0},httpData:function(a,b,d){var f=a.getResponseHeader("content-type")||"",e=b==="xml"||!b&&f.indexOf("xml")>=0;a=e?a.responseXML:a.responseText;e&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b=== +"json"||!b&&f.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&f.indexOf("javascript")>=0)c.globalEval(a);return a},param:function(a,b){function d(i,o){if(c.isArray(o))c.each(o,function(k,n){b||/\[\]$/.test(i)?f(i,n):d(i+"["+(typeof n==="object"||c.isArray(n)?k:"")+"]",n)});else!b&&o!=null&&typeof o==="object"?c.each(o,function(k,n){d(i+"["+k+"]",n)}):f(i,o)}function f(i,o){o=c.isFunction(o)?o():o;e[e.length]=encodeURIComponent(i)+"="+encodeURIComponent(o)}var e=[];if(b===w)b=c.ajaxSettings.traditional; +if(c.isArray(a)||a.jquery)c.each(a,function(){f(this.name,this.value)});else for(var j in a)d(j,a[j]);return e.join("&").replace(yb,"+")}});var la={},Ab=/toggle|show|hide/,Bb=/^([+-]=)?([\d+-.]+)(.*)$/,W,va=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b){if(a||a===0)return this.animate(K("show",3),a,b);else{a=0;for(b=this.length;a").appendTo("body");f=e.css("display");if(f==="none")f="block";e.remove();la[d]=f}c.data(this[a],"olddisplay",f)}}a=0;for(b=this.length;a=0;f--)if(d[f].elem===this){b&&d[f](true);d.splice(f,1)}});b||this.dequeue();return this}});c.each({slideDown:K("show",1),slideUp:K("hide",1),slideToggle:K("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(a,b){c.fn[a]=function(d,f){return this.animate(b,d,f)}});c.extend({speed:function(a,b,d){var f=a&&typeof a==="object"?a:{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};f.duration=c.fx.off?0:typeof f.duration=== +"number"?f.duration:c.fx.speeds[f.duration]||c.fx.speeds._default;f.old=f.complete;f.complete=function(){f.queue!==false&&c(this).dequeue();c.isFunction(f.old)&&f.old.call(this)};return f},easing:{linear:function(a,b,d,f){return d+f*a},swing:function(a,b,d,f){return(-Math.cos(a*Math.PI)/2+0.5)*f+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]|| +c.fx.step._default)(this);if((this.prop==="height"||this.prop==="width")&&this.elem.style)this.elem.style.display="block"},cur:function(a){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];return(a=parseFloat(c.css(this.elem,this.prop,a)))&&a>-10000?a:parseFloat(c.curCSS(this.elem,this.prop))||0},custom:function(a,b,d){function f(j){return e.step(j)}this.startTime=J();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start; +this.pos=this.state=0;var e=this;f.elem=this.elem;if(f()&&c.timers.push(f)&&!W)W=setInterval(c.fx.tick,13)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(a){var b=J(),d=true;if(a||b>=this.options.duration+this.startTime){this.now= +this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var f in this.options.curAnim)if(this.options.curAnim[f]!==true)d=false;if(d){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;a=c.data(this.elem,"olddisplay");this.elem.style.display=a?a:this.options.display;if(c.css(this.elem,"display")==="none")this.elem.style.display="block"}this.options.hide&&c(this.elem).hide();if(this.options.hide||this.options.show)for(var e in this.options.curAnim)c.style(this.elem, +e,this.options.orig[e]);this.options.complete.call(this.elem)}return false}else{e=b-this.startTime;this.state=e/this.options.duration;a=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||a](this.state,e,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a=c.timers,b=0;b
    "; +a.insertBefore(b,a.firstChild);d=b.firstChild;f=d.firstChild;e=d.nextSibling.firstChild.firstChild;this.doesNotAddBorder=f.offsetTop!==5;this.doesAddBorderForTableAndCells=e.offsetTop===5;f.style.position="fixed";f.style.top="20px";this.supportsFixedPosition=f.offsetTop===20||f.offsetTop===15;f.style.position=f.style.top="";d.style.overflow="hidden";d.style.position="relative";this.subtractsBorderForOverflowNotVisible=f.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==j;a.removeChild(b); +c.offset.initialize=c.noop},bodyOffset:function(a){var b=a.offsetTop,d=a.offsetLeft;c.offset.initialize();if(c.offset.doesNotIncludeMarginInBodyOffset){b+=parseFloat(c.curCSS(a,"marginTop",true))||0;d+=parseFloat(c.curCSS(a,"marginLeft",true))||0}return{top:b,left:d}},setOffset:function(a,b,d){if(/static/.test(c.curCSS(a,"position")))a.style.position="relative";var f=c(a),e=f.offset(),j=parseInt(c.curCSS(a,"top",true),10)||0,i=parseInt(c.curCSS(a,"left",true),10)||0;if(c.isFunction(b))b=b.call(a, +d,e);d={top:b.top-e.top+j,left:b.left-e.left+i};"using"in b?b.using.call(a,d):f.css(d)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),f=/^body|html$/i.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.curCSS(a,"marginTop",true))||0;d.left-=parseFloat(c.curCSS(a,"marginLeft",true))||0;f.top+=parseFloat(c.curCSS(b[0],"borderTopWidth",true))||0;f.left+=parseFloat(c.curCSS(b[0],"borderLeftWidth",true))||0;return{top:d.top- +f.top,left:d.left-f.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||s.body;a&&!/^body|html$/i.test(a.nodeName)&&c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(f){var e=this[0],j;if(!e)return null;if(f!==w)return this.each(function(){if(j=wa(this))j.scrollTo(!a?f:c(j).scrollLeft(),a?f:c(j).scrollTop());else this[d]=f});else return(j=wa(e))?"pageXOffset"in j?j[a?"pageYOffset": +"pageXOffset"]:c.support.boxModel&&j.document.documentElement[d]||j.document.body[d]:e[d]}});c.each(["Height","Width"],function(a,b){var d=b.toLowerCase();c.fn["inner"+b]=function(){return this[0]?c.css(this[0],d,false,"padding"):null};c.fn["outer"+b]=function(f){return this[0]?c.css(this[0],d,false,f?"margin":"border"):null};c.fn[d]=function(f){var e=this[0];if(!e)return f==null?null:this;if(c.isFunction(f))return this.each(function(j){var i=c(this);i[d](f.call(this,j,i[d]()))});return"scrollTo"in +e&&e.document?e.document.compatMode==="CSS1Compat"&&e.document.documentElement["client"+b]||e.document.body["client"+b]:e.nodeType===9?Math.max(e.documentElement["client"+b],e.body["scroll"+b],e.documentElement["scroll"+b],e.body["offset"+b],e.documentElement["offset"+b]):f===w?c.css(e,d):this.css(d,typeof f==="string"?f:f+"px")}});A.jQuery=A.$=c})(window); diff --git a/include/jQuery/tablesorter/jquery.metadata.js b/include/jQuery/tablesorter/jquery.metadata.js new file mode 100755 index 00000000..6a984dbc --- /dev/null +++ b/include/jQuery/tablesorter/jquery.metadata.js @@ -0,0 +1,122 @@ +/* + * Metadata - jQuery plugin for parsing metadata from elements + * + * Copyright (c) 2006 John Resig, Yehuda Katz, J�örn Zaefferer, Paul McLanahan + * + * Dual licensed under the MIT and GPL licenses: + * http://www.opensource.org/licenses/mit-license.php + * http://www.gnu.org/licenses/gpl.html + * + * Revision: $Id$ + * + */ + +/** + * Sets the type of metadata to use. Metadata is encoded in JSON, and each property + * in the JSON will become a property of the element itself. + * + * There are three supported types of metadata storage: + * + * attr: Inside an attribute. The name parameter indicates *which* attribute. + * + * class: Inside the class attribute, wrapped in curly braces: { } + * + * elem: Inside a child element (e.g. a script tag). The + * name parameter indicates *which* element. + * + * The metadata for an element is loaded the first time the element is accessed via jQuery. + * + * As a result, you can define the metadata type, use $(expr) to load the metadata into the elements + * matched by expr, then redefine the metadata type and run another $(expr) for other elements. + * + * @name $.metadata.setType + * + * @example

    This is a p

    + * @before $.metadata.setType("class") + * @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label" + * @desc Reads metadata from the class attribute + * + * @example

    This is a p

    + * @before $.metadata.setType("attr", "data") + * @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label" + * @desc Reads metadata from a "data" attribute + * + * @example

    This is a p

    + * @before $.metadata.setType("elem", "script") + * @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label" + * @desc Reads metadata from a nested script element + * + * @param String type The encoding type + * @param String name The name of the attribute to be used to get metadata (optional) + * @cat Plugins/Metadata + * @descr Sets the type of encoding to be used when loading metadata for the first time + * @type undefined + * @see metadata() + */ + +(function($) { + +$.extend({ + metadata : { + defaults : { + type: 'class', + name: 'metadata', + cre: /({.*})/, + single: 'metadata' + }, + setType: function( type, name ){ + this.defaults.type = type; + this.defaults.name = name; + }, + get: function( elem, opts ){ + var settings = $.extend({},this.defaults,opts); + // check for empty string in single property + if ( !settings.single.length ) settings.single = 'metadata'; + + var data = $.data(elem, settings.single); + // returned cached data if it already exists + if ( data ) return data; + + data = "{}"; + + if ( settings.type == "class" ) { + var m = settings.cre.exec( elem.className ); + if ( m ) + data = m[1]; + } else if ( settings.type == "elem" ) { + if( !elem.getElementsByTagName ) + return undefined; + var e = elem.getElementsByTagName(settings.name); + if ( e.length ) + data = $.trim(e[0].innerHTML); + } else if ( elem.getAttribute != undefined ) { + var attr = elem.getAttribute( settings.name ); + if ( attr ) + data = attr; + } + + if ( data.indexOf( '{' ) <0 ) + data = "{" + data + "}"; + + data = eval("(" + data + ")"); + + $.data( elem, settings.single, data ); + return data; + } + } +}); + +/** + * Returns the metadata object for the first member of the jQuery object. + * + * @name metadata + * @descr Returns element's metadata object + * @param Object opts An object contianing settings to override the defaults + * @type jQuery + * @cat Plugins/Metadata + */ +$.fn.metadata = function( opts ){ + return $.metadata.get( this[0], opts ); +}; + +})(jQuery); \ No newline at end of file diff --git a/include/jQuery/tablesorter/jquery.tablesorter.js b/include/jQuery/tablesorter/jquery.tablesorter.js new file mode 100755 index 00000000..e8e23234 --- /dev/null +++ b/include/jQuery/tablesorter/jquery.tablesorter.js @@ -0,0 +1,1031 @@ +/* + * + * TableSorter 2.0 - Client-side table sorting with ease! + * Version 2.0.5b + * @requires jQuery v1.2.3 + * + * Copyright (c) 2007 Christian Bach + * Examples and docs at: http://tablesorter.com + * Dual licensed under the MIT and GPL licenses: + * http://www.opensource.org/licenses/mit-license.php + * http://www.gnu.org/licenses/gpl.html + * + */ +/** + * + * @description Create a sortable table with multi-column sorting capabilitys + * + * @example $('table').tablesorter(); + * @desc Create a simple tablesorter interface. + * + * @example $('table').tablesorter({ sortList:[[0,0],[1,0]] }); + * @desc Create a tablesorter interface and sort on the first and secound column column headers. + * + * @example $('table').tablesorter({ headers: { 0: { sorter: false}, 1: {sorter: false} } }); + * + * @desc Create a tablesorter interface and disableing the first and second column headers. + * + * + * @example $('table').tablesorter({ headers: { 0: {sorter:"integer"}, 1: {sorter:"currency"} } }); + * + * @desc Create a tablesorter interface and set a column parser for the first + * and second column. + * + * + * @param Object + * settings An object literal containing key/value pairs to provide + * optional settings. + * + * + * @option String cssHeader (optional) A string of the class name to be appended + * to sortable tr elements in the thead of the table. Default value: + * "header" + * + * @option String cssAsc (optional) A string of the class name to be appended to + * sortable tr elements in the thead on a ascending sort. Default value: + * "headerSortUp" + * + * @option String cssDesc (optional) A string of the class name to be appended + * to sortable tr elements in the thead on a descending sort. Default + * value: "headerSortDown" + * + * @option String sortInitialOrder (optional) A string of the inital sorting + * order can be asc or desc. Default value: "asc" + * + * @option String sortMultisortKey (optional) A string of the multi-column sort + * key. Default value: "shiftKey" + * + * @option String textExtraction (optional) A string of the text-extraction + * method to use. For complex html structures inside td cell set this + * option to "complex", on large tables the complex option can be slow. + * Default value: "simple" + * + * @option Object headers (optional) An array containing the forces sorting + * rules. This option let's you specify a default sorting rule. Default + * value: null + * + * @option Array sortList (optional) An array containing the forces sorting + * rules. This option let's you specify a default sorting rule. Default + * value: null + * + * @option Array sortForce (optional) An array containing forced sorting rules. + * This option let's you specify a default sorting rule, which is + * prepended to user-selected rules. Default value: null + * + * @option Boolean sortLocaleCompare (optional) Boolean flag indicating whatever + * to use String.localeCampare method or not. Default set to true. + * + * + * @option Array sortAppend (optional) An array containing forced sorting rules. + * This option let's you specify a default sorting rule, which is + * appended to user-selected rules. Default value: null + * + * @option Boolean widthFixed (optional) Boolean flag indicating if tablesorter + * should apply fixed widths to the table columns. This is usefull when + * using the pager companion plugin. This options requires the dimension + * jquery plugin. Default value: false + * + * @option Boolean cancelSelection (optional) Boolean flag indicating if + * tablesorter should cancel selection of the table headers text. + * Default value: true + * + * @option Boolean debug (optional) Boolean flag indicating if tablesorter + * should display debuging information usefull for development. + * + * @type jQuery + * + * @name tablesorter + * + * @cat Plugins/Tablesorter + * + * @author Christian Bach/christian.bach@polyester.se + */ + +(function ($) { + $.extend({ + tablesorter: new + function () { + + var parsers = [], + widgets = []; + + this.defaults = { + cssHeader: "header", + cssAsc: "headerSortUp", + cssDesc: "headerSortDown", + cssChildRow: "expand-child", + sortInitialOrder: "asc", + sortMultiSortKey: "shiftKey", + sortForce: null, + sortAppend: null, + sortLocaleCompare: true, + textExtraction: "simple", + parsers: {}, widgets: [], + widgetZebra: { + css: ["even", "odd"] + }, headers: {}, widthFixed: false, + cancelSelection: true, + sortList: [], + headerList: [], + dateFormat: "us", + decimal: '/\.|\,/g', + onRenderHeader: null, + selectorHeaders: 'thead th', + debug: false + }; + + /* debuging utils */ + + function benchmark(s, d) { + log(s + "," + (new Date().getTime() - d.getTime()) + "ms"); + } + + this.benchmark = benchmark; + + function log(s) { + if (typeof console != "undefined" && typeof console.debug != "undefined") { + console.log(s); + } else { + alert(s); + } + } + + /* parsers utils */ + + function buildParserCache(table, $headers) { + + if (table.config.debug) { + var parsersDebug = ""; + } + + if (table.tBodies.length == 0) return; // In the case of empty tables + var rows = table.tBodies[0].rows; + + if (rows[0]) { + + var list = [], + cells = rows[0].cells, + l = cells.length; + + for (var i = 0; i < l; i++) { + + var p = false; + + if ($.metadata && ($($headers[i]).metadata() && $($headers[i]).metadata().sorter)) { + + p = getParserById($($headers[i]).metadata().sorter); + + } else if ((table.config.headers[i] && table.config.headers[i].sorter)) { + + p = getParserById(table.config.headers[i].sorter); + } + if (!p) { + + p = detectParserForColumn(table, rows, -1, i); + } + + if (table.config.debug) { + parsersDebug += "column:" + i + " parser:" + p.id + "\n"; + } + + list.push(p); + } + } + + if (table.config.debug) { + log(parsersDebug); + } + + return list; + }; + + function detectParserForColumn(table, rows, rowIndex, cellIndex) { + var l = parsers.length, + node = false, + nodeValue = false, + keepLooking = true; + while (nodeValue == '' && keepLooking) { + rowIndex++; + if (rows[rowIndex]) { + node = getNodeFromRowAndCellIndex(rows, rowIndex, cellIndex); + nodeValue = trimAndGetNodeText(table.config, node); + if (table.config.debug) { + log('Checking if value was empty on row:' + rowIndex); + } + } else { + keepLooking = false; + } + } + for (var i = 1; i < l; i++) { + if (parsers[i].is(nodeValue, table, node)) { + return parsers[i]; + } + } + // 0 is always the generic parser (text) + return parsers[0]; + } + + function getNodeFromRowAndCellIndex(rows, rowIndex, cellIndex) { + return rows[rowIndex].cells[cellIndex]; + } + + function trimAndGetNodeText(config, node) { + return $.trim(getElementText(config, node)); + } + + function getParserById(name) { + var l = parsers.length; + for (var i = 0; i < l; i++) { + if (parsers[i].id.toLowerCase() == name.toLowerCase()) { + return parsers[i]; + } + } + return false; + } + + /* utils */ + + function buildCache(table) { + + if (table.config.debug) { + var cacheTime = new Date(); + } + + var totalRows = (table.tBodies[0] && table.tBodies[0].rows.length) || 0, + totalCells = (table.tBodies[0].rows[0] && table.tBodies[0].rows[0].cells.length) || 0, + parsers = table.config.parsers, + cache = { + row: [], + normalized: [] + }; + + for (var i = 0; i < totalRows; ++i) { + + /** Add the table data to main data array */ + var c = $(table.tBodies[0].rows[i]), + cols = []; + + // if this is a child row, add it to the last row's children and + // continue to the next row + if (c.hasClass(table.config.cssChildRow)) { + cache.row[cache.row.length - 1] = cache.row[cache.row.length - 1].add(c); + // go to the next for loop + continue; + } + + cache.row.push(c); + + for (var j = 0; j < totalCells; ++j) { + cols.push(parsers[j].format(getElementText(table.config, c[0].cells[j]), table, c[0].cells[j])); + } + + cols.push(cache.normalized.length); // add position for rowCache + cache.normalized.push(cols); + cols = null; + }; + + if (table.config.debug) { + benchmark("Building cache for " + totalRows + " rows:", cacheTime); + } + + return cache; + }; + + function getElementText(config, node) { + + var text = ""; + + if (!node) return ""; + + if (!config.supportsTextContent) config.supportsTextContent = node.textContent || false; + + if (config.textExtraction == "simple") { + if (config.supportsTextContent) { + text = node.textContent; + } else { + if (node.childNodes[0] && node.childNodes[0].hasChildNodes()) { + text = node.childNodes[0].innerHTML; + } else { + text = node.innerHTML; + } + } + } else { + if (typeof(config.textExtraction) == "function") { + text = config.textExtraction(node); + } else { + text = $(node).text(); + } + } + return text; + } + + function appendToTable(table, cache) { + + if (table.config.debug) { + var appendTime = new Date() + } + + var c = cache, + r = c.row, + n = c.normalized, + totalRows = n.length, + checkCell = (n[0].length - 1), + tableBody = $(table.tBodies[0]), + rows = []; + + + for (var i = 0; i < totalRows; i++) { + var pos = n[i][checkCell]; + + rows.push(r[pos]); + + if (!table.config.appender) { + + //var o = ; + var l = r[pos].length; + for (var j = 0; j < l; j++) { + tableBody[0].appendChild(r[pos][j]); + } + + // + } + } + + + + if (table.config.appender) { + + table.config.appender(table, rows); + } + + rows = null; + + if (table.config.debug) { + benchmark("Rebuilt table:", appendTime); + } + + // apply table widgets + applyWidget(table); + + // trigger sortend + setTimeout(function () { + $(table).trigger("sortEnd"); + }, 0); + + }; + + function buildHeaders(table) { + + if (table.config.debug) { + var time = new Date(); + } + + var meta = ($.metadata) ? true : false; + + var header_index = computeTableHeaderCellIndexes(table); + + $tableHeaders = $(table.config.selectorHeaders, table).each(function (index) { + + this.column = header_index[this.parentNode.rowIndex + "-" + this.cellIndex]; + // this.column = index; + this.order = formatSortingOrder(table.config.sortInitialOrder); + + + this.count = this.order; + + if (checkHeaderMetadata(this) || checkHeaderOptions(table, index)) this.sortDisabled = true; + if (checkHeaderOptionsSortingLocked(table, index)) this.order = this.lockedOrder = checkHeaderOptionsSortingLocked(table, index); + + if (!this.sortDisabled) { + var $th = $(this).addClass(table.config.cssHeader); + if (table.config.onRenderHeader) table.config.onRenderHeader.apply($th); + } + + // add cell to headerList + table.config.headerList[index] = this; + }); + + if (table.config.debug) { + benchmark("Built headers:", time); + log($tableHeaders); + } + + return $tableHeaders; + + }; + + // from: + // http://www.javascripttoolbox.com/lib/table/examples.php + // http://www.javascripttoolbox.com/temp/table_cellindex.html + + + function computeTableHeaderCellIndexes(t) { + var matrix = []; + var lookup = {}; + var thead = t.getElementsByTagName('THEAD')[0]; + var trs = thead.getElementsByTagName('TR'); + + for (var i = 0; i < trs.length; i++) { + var cells = trs[i].cells; + for (var j = 0; j < cells.length; j++) { + var c = cells[j]; + + var rowIndex = c.parentNode.rowIndex; + var cellId = rowIndex + "-" + c.cellIndex; + var rowSpan = c.rowSpan || 1; + var colSpan = c.colSpan || 1 + var firstAvailCol; + if (typeof(matrix[rowIndex]) == "undefined") { + matrix[rowIndex] = []; + } + // Find first available column in the first row + for (var k = 0; k < matrix[rowIndex].length + 1; k++) { + if (typeof(matrix[rowIndex][k]) == "undefined") { + firstAvailCol = k; + break; + } + } + lookup[cellId] = firstAvailCol; + for (var k = rowIndex; k < rowIndex + rowSpan; k++) { + if (typeof(matrix[k]) == "undefined") { + matrix[k] = []; + } + var matrixrow = matrix[k]; + for (var l = firstAvailCol; l < firstAvailCol + colSpan; l++) { + matrixrow[l] = "x"; + } + } + } + } + return lookup; + } + + function checkCellColSpan(table, rows, row) { + var arr = [], + r = table.tHead.rows, + c = r[row].cells; + + for (var i = 0; i < c.length; i++) { + var cell = c[i]; + + if (cell.colSpan > 1) { + arr = arr.concat(checkCellColSpan(table, headerArr, row++)); + } else { + if (table.tHead.length == 1 || (cell.rowSpan > 1 || !r[row + 1])) { + arr.push(cell); + } + // headerArr[row] = (i+row); + } + } + return arr; + }; + + function checkHeaderMetadata(cell) { + if (($.metadata) && ($(cell).metadata().sorter === false)) { + return true; + }; + return false; + } + + function checkHeaderOptions(table, i) { + if ((table.config.headers[i]) && (table.config.headers[i].sorter === false)) { + return true; + }; + return false; + } + + function checkHeaderOptionsSortingLocked(table, i) { + if ((table.config.headers[i]) && (table.config.headers[i].lockedOrder)) return table.config.headers[i].lockedOrder; + return false; + } + + function applyWidget(table) { + var c = table.config.widgets; + var l = c.length; + for (var i = 0; i < l; i++) { + + getWidgetById(c[i]).format(table); + } + + } + + function getWidgetById(name) { + var l = widgets.length; + for (var i = 0; i < l; i++) { + if (widgets[i].id.toLowerCase() == name.toLowerCase()) { + return widgets[i]; + } + } + }; + + function formatSortingOrder(v) { + if (typeof(v) != "Number") { + return (v.toLowerCase() == "desc") ? 1 : 0; + } else { + return (v == 1) ? 1 : 0; + } + } + + function isValueInArray(v, a) { + var l = a.length; + for (var i = 0; i < l; i++) { + if (a[i][0] == v) { + return true; + } + } + return false; + } + + function setHeadersCss(table, $headers, list, css) { + // remove all header information + $headers.removeClass(css[0]).removeClass(css[1]); + + var h = []; + $headers.each(function (offset) { + if (!this.sortDisabled) { + h[this.column] = $(this); + } + }); + + var l = list.length; + for (var i = 0; i < l; i++) { + h[list[i][0]].addClass(css[list[i][1]]); + } + } + + function fixColumnWidth(table, $headers) { + var c = table.config; + if (c.widthFixed) { + var colgroup = $(''); + $("tr:first td", table.tBodies[0]).each(function () { + colgroup.append($('').css('width', $(this).width())); + }); + $(table).prepend(colgroup); + }; + } + + function updateHeaderSortCount(table, sortList) { + var c = table.config, + l = sortList.length; + for (var i = 0; i < l; i++) { + var s = sortList[i], + o = c.headerList[s[0]]; + o.count = s[1]; + o.count++; + } + } + + /* sorting methods */ + + function multisort(table, sortList, cache) { + + if (table.config.debug) { + var sortTime = new Date(); + } + + var dynamicExp = "var sortWrapper = function(a,b) {", + l = sortList.length; + + // TODO: inline functions. + for (var i = 0; i < l; i++) { + + var c = sortList[i][0]; + var order = sortList[i][1]; + // var s = (getCachedSortType(table.config.parsers,c) == "text") ? + // ((order == 0) ? "sortText" : "sortTextDesc") : ((order == 0) ? + // "sortNumeric" : "sortNumericDesc"); + // var s = (table.config.parsers[c].type == "text") ? ((order == 0) + // ? makeSortText(c) : makeSortTextDesc(c)) : ((order == 0) ? + // makeSortNumeric(c) : makeSortNumericDesc(c)); + var s = (table.config.parsers[c].type == "text") ? ((order == 0) ? makeSortFunction("text", "asc", c) : makeSortFunction("text", "desc", c)) : ((order == 0) ? makeSortFunction("numeric", "asc", c) : makeSortFunction("numeric", "desc", c)); + var e = "e" + i; + + dynamicExp += "var " + e + " = " + s; // + "(a[" + c + "],b[" + c + // + "]); "; + dynamicExp += "if(" + e + ") { return " + e + "; } "; + dynamicExp += "else { "; + + } + + // if value is the same keep orignal order + var orgOrderCol = cache.normalized[0].length - 1; + dynamicExp += "return a[" + orgOrderCol + "]-b[" + orgOrderCol + "];"; + + for (var i = 0; i < l; i++) { + dynamicExp += "}; "; + } + + dynamicExp += "return 0; "; + dynamicExp += "}; "; + + if (table.config.debug) { + benchmark("Evaling expression:" + dynamicExp, new Date()); + } + + eval(dynamicExp); + + cache.normalized.sort(sortWrapper); + + if (table.config.debug) { + benchmark("Sorting on " + sortList.toString() + " and dir " + order + " time:", sortTime); + } + + return cache; + }; + + function makeSortFunction(type, direction, index) { + var a = "a[" + index + "]", + b = "b[" + index + "]"; + if (type == 'text' && direction == 'asc') { + return "(" + a + " == " + b + " ? 0 : (" + a + " === null ? Number.POSITIVE_INFINITY : (" + b + " === null ? Number.NEGATIVE_INFINITY : (" + a + " < " + b + ") ? -1 : 1 )));"; + } else if (type == 'text' && direction == 'desc') { + return "(" + a + " == " + b + " ? 0 : (" + a + " === null ? Number.POSITIVE_INFINITY : (" + b + " === null ? Number.NEGATIVE_INFINITY : (" + b + " < " + a + ") ? -1 : 1 )));"; + } else if (type == 'numeric' && direction == 'asc') { + return "(" + a + " === null && " + b + " === null) ? 0 :(" + a + " === null ? Number.POSITIVE_INFINITY : (" + b + " === null ? Number.NEGATIVE_INFINITY : " + a + " - " + b + "));"; + } else if (type == 'numeric' && direction == 'desc') { + return "(" + a + " === null && " + b + " === null) ? 0 :(" + a + " === null ? Number.POSITIVE_INFINITY : (" + b + " === null ? Number.NEGATIVE_INFINITY : " + b + " - " + a + "));"; + } + }; + + function makeSortText(i) { + return "((a[" + i + "] < b[" + i + "]) ? -1 : ((a[" + i + "] > b[" + i + "]) ? 1 : 0));"; + }; + + function makeSortTextDesc(i) { + return "((b[" + i + "] < a[" + i + "]) ? -1 : ((b[" + i + "] > a[" + i + "]) ? 1 : 0));"; + }; + + function makeSortNumeric(i) { + return "a[" + i + "]-b[" + i + "];"; + }; + + function makeSortNumericDesc(i) { + return "b[" + i + "]-a[" + i + "];"; + }; + + function sortText(a, b) { + if (table.config.sortLocaleCompare) return a.localeCompare(b); + return ((a < b) ? -1 : ((a > b) ? 1 : 0)); + }; + + function sortTextDesc(a, b) { + if (table.config.sortLocaleCompare) return b.localeCompare(a); + return ((b < a) ? -1 : ((b > a) ? 1 : 0)); + }; + + function sortNumeric(a, b) { + return a - b; + }; + + function sortNumericDesc(a, b) { + return b - a; + }; + + function getCachedSortType(parsers, i) { + return parsers[i].type; + }; /* public methods */ + this.construct = function (settings) { + return this.each(function () { + // if no thead or tbody quit. + if (!this.tHead || !this.tBodies) return; + // declare + var $this, $document, $headers, cache, config, shiftDown = 0, + sortOrder; + // new blank config object + this.config = {}; + // merge and extend. + config = $.extend(this.config, $.tablesorter.defaults, settings); + // store common expression for speed + $this = $(this); + // save the settings where they read + $.data(this, "tablesorter", config); + // build headers + $headers = buildHeaders(this); + // try to auto detect column type, and store in tables config + this.config.parsers = buildParserCache(this, $headers); + // build the cache for the tbody cells + cache = buildCache(this); + // get the css class names, could be done else where. + var sortCSS = [config.cssDesc, config.cssAsc]; + // fixate columns if the users supplies the fixedWidth option + fixColumnWidth(this); + // apply event handling to headers + // this is to big, perhaps break it out? + $headers.click( + + function (e) { + var totalRows = ($this[0].tBodies[0] && $this[0].tBodies[0].rows.length) || 0; + if (!this.sortDisabled && totalRows > 0) { + // Only call sortStart if sorting is + // enabled. + $this.trigger("sortStart"); + // store exp, for speed + var $cell = $(this); + // get current column index + var i = this.column; + // get current column sort order + this.order = this.count++ % 2; + // always sort on the locked order. + if(this.lockedOrder) this.order = this.lockedOrder; + + // user only whants to sort on one + // column + if (!e[config.sortMultiSortKey]) { + // flush the sort list + config.sortList = []; + if (config.sortForce != null) { + var a = config.sortForce; + for (var j = 0; j < a.length; j++) { + if (a[j][0] != i) { + config.sortList.push(a[j]); + } + } + } + // add column to sort list + config.sortList.push([i, this.order]); + // multi column sorting + } else { + // the user has clicked on an all + // ready sortet column. + if (isValueInArray(i, config.sortList)) { + // revers the sorting direction + // for all tables. + for (var j = 0; j < config.sortList.length; j++) { + var s = config.sortList[j], + o = config.headerList[s[0]]; + if (s[0] == i) { + o.count = s[1]; + o.count++; + s[1] = o.count % 2; + } + } + } else { + // add column to sort list array + config.sortList.push([i, this.order]); + } + }; + setTimeout(function () { + // set css for headers + setHeadersCss($this[0], $headers, config.sortList, sortCSS); + appendToTable( + $this[0], multisort( + $this[0], config.sortList, cache) + ); + }, 1); + // stop normal event by returning false + return false; + } + // cancel selection + }).mousedown(function () { + if (config.cancelSelection) { + this.onselectstart = function () { + return false + }; + return false; + } + }); + // apply easy methods that trigger binded events + $this.bind("update", function () { + var me = this; + setTimeout(function () { + // rebuild parsers. + me.config.parsers = buildParserCache( + me, $headers); + // rebuild the cache map + cache = buildCache(me); + }, 1); + }).bind("updateCell", function (e, cell) { + var config = this.config; + // get position from the dom. + var pos = [(cell.parentNode.rowIndex - 1), cell.cellIndex]; + // update cache + cache.normalized[pos[0]][pos[1]] = config.parsers[pos[1]].format( + getElementText(config, cell), cell); + }).bind("sorton", function (e, list) { + $(this).trigger("sortStart"); + config.sortList = list; + // update and store the sortlist + var sortList = config.sortList; + // update header count index + updateHeaderSortCount(this, sortList); + // set css for headers + setHeadersCss(this, $headers, sortList, sortCSS); + // sort the table and append it to the dom + appendToTable(this, multisort(this, sortList, cache)); + }).bind("appendCache", function () { + appendToTable(this, cache); + }).bind("applyWidgetId", function (e, id) { + getWidgetById(id).format(this); + }).bind("applyWidgets", function () { + // apply widgets + applyWidget(this); + }); + if ($.metadata && ($(this).metadata() && $(this).metadata().sortlist)) { + config.sortList = $(this).metadata().sortlist; + } + // if user has supplied a sort list to constructor. + if (config.sortList.length > 0) { + $this.trigger("sorton", [config.sortList]); + } + // apply widgets + applyWidget(this); + }); + }; + this.addParser = function (parser) { + var l = parsers.length, + a = true; + for (var i = 0; i < l; i++) { + if (parsers[i].id.toLowerCase() == parser.id.toLowerCase()) { + a = false; + } + } + if (a) { + parsers.push(parser); + }; + }; + this.addWidget = function (widget) { + widgets.push(widget); + }; + this.formatFloat = function (s) { + var i = parseFloat(s); + return (isNaN(i)) ? 0 : i; + }; + this.formatInt = function (s) { + var i = parseInt(s); + return (isNaN(i)) ? 0 : i; + }; + this.isDigit = function (s, config) { + // replace all an wanted chars and match. + return /^[-+]?\d*$/.test($.trim(s.replace(/[,.']/g, ''))); + }; + this.clearTableBody = function (table) { + if ($.browser.msie) { + function empty() { + while (this.firstChild) + this.removeChild(this.firstChild); + } + empty.apply(table.tBodies[0]); + } else { + table.tBodies[0].innerHTML = ""; + } + }; + } + }); + + // extend plugin scope + $.fn.extend({ + tablesorter: $.tablesorter.construct + }); + + // make shortcut + var ts = $.tablesorter; + + // add default parsers + ts.addParser({ + id: "text", + is: function (s) { + return true; + }, format: function (s) { + return $.trim(s.toLocaleLowerCase()); + }, type: "text" + }); + + ts.addParser({ + id: "digit", + is: function (s, table) { + var c = table.config; + return $.tablesorter.isDigit(s, c); + }, format: function (s) { + return $.tablesorter.formatFloat(s); + }, type: "numeric" + }); + + ts.addParser({ + id: "currency", + is: function (s) { + return /^[£$€?.]/.test(s); + }, format: function (s) { + return $.tablesorter.formatFloat(s.replace(new RegExp(/[£$€]/g), "")); + }, type: "numeric" + }); + + ts.addParser({ + id: "ipAddress", + is: function (s) { + return /^\d{2,3}[\.]\d{2,3}[\.]\d{2,3}[\.]\d{2,3}$/.test(s); + }, format: function (s) { + var a = s.split("."), + r = "", + l = a.length; + for (var i = 0; i < l; i++) { + var item = a[i]; + if (item.length == 2) { + r += "0" + item; + } else { + r += item; + } + } + return $.tablesorter.formatFloat(r); + }, type: "numeric" + }); + + ts.addParser({ + id: "url", + is: function (s) { + return /^(https?|ftp|file):\/\/$/.test(s); + }, format: function (s) { + return jQuery.trim(s.replace(new RegExp(/(https?|ftp|file):\/\//), '')); + }, type: "text" + }); + + ts.addParser({ + id: "isoDate", + is: function (s) { + return /^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(s); + }, format: function (s) { + return $.tablesorter.formatFloat((s != "") ? new Date(s.replace( + new RegExp(/-/g), "/")).getTime() : "0"); + }, type: "numeric" + }); + + ts.addParser({ + id: "percent", + is: function (s) { + return /\%$/.test($.trim(s)); + }, format: function (s) { + return $.tablesorter.formatFloat(s.replace(new RegExp(/%/g), "")); + }, type: "numeric" + }); + + ts.addParser({ + id: "usLongDate", + is: function (s) { + return s.match(new RegExp(/^[A-Za-z]{3,10}\.? [0-9]{1,2}, ([0-9]{4}|'?[0-9]{2}) (([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(AM|PM)))$/)); + }, format: function (s) { + return $.tablesorter.formatFloat(new Date(s).getTime()); + }, type: "numeric" + }); + + ts.addParser({ + id: "shortDate", + is: function (s) { + return /\d{1,2}[\/\-]\d{1,2}[\/\-]\d{2,4}/.test(s); + }, format: function (s, table) { + var c = table.config; + s = s.replace(/\-/g, "/"); + if (c.dateFormat == "us") { + // reformat the string in ISO format + s = s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/, "$3/$1/$2"); + } else if (c.dateFormat == "uk") { + // reformat the string in ISO format + s = s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/, "$3/$2/$1"); + } else if (c.dateFormat == "dd/mm/yy" || c.dateFormat == "dd-mm-yy") { + s = s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{2})/, "$1/$2/$3"); + } + return $.tablesorter.formatFloat(new Date(s).getTime()); + }, type: "numeric" + }); + ts.addParser({ + id: "time", + is: function (s) { + return /^(([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(am|pm)))$/.test(s); + }, format: function (s) { + return $.tablesorter.formatFloat(new Date("2000/01/01 " + s).getTime()); + }, type: "numeric" + }); + ts.addParser({ + id: "metadata", + is: function (s) { + return false; + }, format: function (s, table, cell) { + var c = table.config, + p = (!c.parserMetadataName) ? 'sortValue' : c.parserMetadataName; + return $(cell).metadata()[p]; + }, type: "numeric" + }); + // add default widgets + ts.addWidget({ + id: "zebra", + format: function (table) { + if (table.config.debug) { + var time = new Date(); + } + var $tr, row = -1, + odd; + // loop through the visible rows + $("tr:visible", table.tBodies[0]).each(function (i) { + $tr = $(this); + // style children rows the same way the parent + // row was styled + if (!$tr.hasClass(table.config.cssChildRow)) row++; + odd = (row % 2 == 0); + $tr.removeClass( + table.config.widgetZebra.css[odd ? 0 : 1]).addClass( + table.config.widgetZebra.css[odd ? 1 : 0]) + }); + if (table.config.debug) { + $.tablesorter.benchmark("Applying Zebra widget", time); + } + } + }); +})(jQuery); \ No newline at end of file diff --git a/include/jQuery/tablesorter/jquery.tablesorter.min.js b/include/jQuery/tablesorter/jquery.tablesorter.min.js new file mode 100755 index 00000000..b8605df1 --- /dev/null +++ b/include/jQuery/tablesorter/jquery.tablesorter.min.js @@ -0,0 +1,4 @@ + +(function($){$.extend({tablesorter:new +function(){var parsers=[],widgets=[];this.defaults={cssHeader:"header",cssAsc:"headerSortUp",cssDesc:"headerSortDown",cssChildRow:"expand-child",sortInitialOrder:"asc",sortMultiSortKey:"shiftKey",sortForce:null,sortAppend:null,sortLocaleCompare:true,textExtraction:"simple",parsers:{},widgets:[],widgetZebra:{css:["even","odd"]},headers:{},widthFixed:false,cancelSelection:true,sortList:[],headerList:[],dateFormat:"us",decimal:'/\.|\,/g',onRenderHeader:null,selectorHeaders:'thead th',debug:false};function benchmark(s,d){log(s+","+(new Date().getTime()-d.getTime())+"ms");}this.benchmark=benchmark;function log(s){if(typeof console!="undefined"&&typeof console.debug!="undefined"){console.log(s);}else{alert(s);}}function buildParserCache(table,$headers){if(table.config.debug){var parsersDebug="";}if(table.tBodies.length==0)return;var rows=table.tBodies[0].rows;if(rows[0]){var list=[],cells=rows[0].cells,l=cells.length;for(var i=0;i1){arr=arr.concat(checkCellColSpan(table,headerArr,row++));}else{if(table.tHead.length==1||(cell.rowSpan>1||!r[row+1])){arr.push(cell);}}}return arr;};function checkHeaderMetadata(cell){if(($.metadata)&&($(cell).metadata().sorter===false)){return true;};return false;}function checkHeaderOptions(table,i){if((table.config.headers[i])&&(table.config.headers[i].sorter===false)){return true;};return false;}function checkHeaderOptionsSortingLocked(table,i){if((table.config.headers[i])&&(table.config.headers[i].lockedOrder))return table.config.headers[i].lockedOrder;return false;}function applyWidget(table){var c=table.config.widgets;var l=c.length;for(var i=0;i');$("tr:first td",table.tBodies[0]).each(function(){colgroup.append($('').css('width',$(this).width()));});$(table).prepend(colgroup);};}function updateHeaderSortCount(table,sortList){var c=table.config,l=sortList.length;for(var i=0;i b["+i+"]) ? 1 : 0));";};function makeSortTextDesc(i){return"((b["+i+"] < a["+i+"]) ? -1 : ((b["+i+"] > a["+i+"]) ? 1 : 0));";};function makeSortNumeric(i){return"a["+i+"]-b["+i+"];";};function makeSortNumericDesc(i){return"b["+i+"]-a["+i+"];";};function sortText(a,b){if(table.config.sortLocaleCompare)return a.localeCompare(b);return((ab)?1:0));};function sortTextDesc(a,b){if(table.config.sortLocaleCompare)return b.localeCompare(a);return((ba)?1:0));};function sortNumeric(a,b){return a-b;};function sortNumericDesc(a,b){return b-a;};function getCachedSortType(parsers,i){return parsers[i].type;};this.construct=function(settings){return this.each(function(){if(!this.tHead||!this.tBodies)return;var $this,$document,$headers,cache,config,shiftDown=0,sortOrder;this.config={};config=$.extend(this.config,$.tablesorter.defaults,settings);$this=$(this);$.data(this,"tablesorter",config);$headers=buildHeaders(this);this.config.parsers=buildParserCache(this,$headers);cache=buildCache(this);var sortCSS=[config.cssDesc,config.cssAsc];fixColumnWidth(this);$headers.click(function(e){var totalRows=($this[0].tBodies[0]&&$this[0].tBodies[0].rows.length)||0;if(!this.sortDisabled&&totalRows>0){$this.trigger("sortStart");var $cell=$(this);var i=this.column;this.order=this.count++%2;if(this.lockedOrder)this.order=this.lockedOrder;if(!e[config.sortMultiSortKey]){config.sortList=[];if(config.sortForce!=null){var a=config.sortForce;for(var j=0;j0){$this.trigger("sorton",[config.sortList]);}applyWidget(this);});};this.addParser=function(parser){var l=parsers.length,a=true;for(var i=0;i-1){var cur=cookie.substring(0,end);cookie=cookie.substring(end+1,cookie.length);var name=cur.substring(0,cur.indexOf('='));var value=cur.substring(cur.indexOf('=')+1,cur.length);cookies[name]=value;end=cookie.indexOf('#')}} +return cookies;} +function subs_to_cookie(cookies){var cookie='';for(var i in cookies) +{if(typeof(cookies[i])!="function"){cookie+=i+'='+cookies[i]+'#';}} +return cookie;} \ No newline at end of file diff --git a/include/javascript/dashlets.js b/include/javascript/dashlets.js new file mode 100755 index 00000000..4d5da0ab --- /dev/null +++ b/include/javascript/dashlets.js @@ -0,0 +1,37 @@ +/********************************************************************************* + * SugarCRM is a customer relationship management program developed by + * SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc. + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU Affero General Public License version 3 as published by the + * Free Software Foundation with the addition of the following permission added + * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK + * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY + * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS. + * + * 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 Affero General Public License for more + * details. + * + * You should have received a copy of the GNU Affero General Public License along with + * this program; if not, see http://www.gnu.org/licenses or write to the Free + * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301 USA. + * + * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road, + * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com. + * + * The interactive user interfaces in modified source and object code versions + * of this program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU Affero General Public License version 3. + * + * In accordance with Section 7(b) of the GNU Affero General Public License version 3, + * these Appropriate Legal Notices must retain the display of the "Powered by + * SugarCRM" logo. If the display of the logo is not reasonably feasible for + * technical reasons, the Appropriate Legal Notices must display the words + * "Powered by SugarCRM". + ********************************************************************************/ +SUGAR.dashlets=function(){return{postForm:function(theForm,callback){var success=function(data){if(data){callback(data.responseText);}} +YAHOO.util.Connect.setForm(theForm);var cObj=YAHOO.util.Connect.asyncRequest('POST','index.php',{success:success,failure:success});return false;},callMethod:function(dashletId,methodName,postData,refreshAfter,callback){ajaxStatus.showStatus(SUGAR.language.get('app_strings','LBL_SAVING'));response=function(data){ajaxStatus.hideStatus();if(refreshAfter)SUGAR.mySugar.retrieveDashlet(dashletId);if(callback){callback(data.responseText);}} +post='to_pdf=1&module=Home&action=CallMethodDashlet&method='+methodName+'&id='+dashletId+'&'+postData;var cObj=YAHOO.util.Connect.asyncRequest('POST','index.php',{success:response,failure:response},post);}};}(); \ No newline at end of file diff --git a/include/javascript/include.js b/include/javascript/include.js new file mode 100755 index 00000000..846fe293 --- /dev/null +++ b/include/javascript/include.js @@ -0,0 +1,18 @@ +/* + Copyright (c) 2008, Yahoo! Inc. All rights reserved. + Code licensed under the BSD License: + http://developer.yahoo.net/yui/license.txt + version: 2.6.0 + */ +(function(){YAHOO.util.Config=function(D){if(D){this.init(D);}};var B=YAHOO.lang,C=YAHOO.util.CustomEvent,A=YAHOO.util.Config;A.CONFIG_CHANGED_EVENT="configChanged";A.BOOLEAN_TYPE="boolean";A.prototype={owner:null,queueInProgress:false,config:null,initialConfig:null,eventQueue:null,configChangedEvent:null,init:function(D){this.owner=D;this.configChangedEvent=this.createEvent(A.CONFIG_CHANGED_EVENT);this.configChangedEvent.signature=C.LIST;this.queueInProgress=false;this.config={};this.initialConfig={};this.eventQueue=[];},checkBoolean:function(D){return(typeof D==A.BOOLEAN_TYPE);},checkNumber:function(D){return(!isNaN(D));},fireEvent:function(D,F){var E=this.config[D];if(E&&E.event){E.event.fire(F);}},addProperty:function(E,D){E=E.toLowerCase();this.config[E]=D;D.event=this.createEvent(E,{scope:this.owner});D.event.signature=C.LIST;D.key=E;if(D.handler){D.event.subscribe(D.handler,this.owner);}this.setProperty(E,D.value,true);if(!D.suppressEvent){this.queueProperty(E,D.value);}},getConfig:function(){var D={},F=this.config,G,E;for(G in F){if(B.hasOwnProperty(F,G)){E=F[G];if(E&&E.event){D[G]=E.value;}}}return D;},getProperty:function(D){var E=this.config[D.toLowerCase()];if(E&&E.event){return E.value;}else{return undefined;}},resetProperty:function(D){D=D.toLowerCase();var E=this.config[D];if(E&&E.event){if(this.initialConfig[D]&&!B.isUndefined(this.initialConfig[D])){this.setProperty(D,this.initialConfig[D]);return true;}}else{return false;}},setProperty:function(E,G,D){var F;E=E.toLowerCase();if(this.queueInProgress&&!D){this.queueProperty(E,G);return true;}else{F=this.config[E];if(F&&F.event){if(F.validator&&!F.validator(G)){return false;}else{F.value=G;if(!D){this.fireEvent(E,G);this.configChangedEvent.fire([E,G]);}return true;}}else{return false;}}},queueProperty:function(S,P){S=S.toLowerCase();var R=this.config[S],K=false,J,G,H,I,O,Q,F,M,N,D,L,T,E;if(R&&R.event){if(!B.isUndefined(P)&&R.validator&&!R.validator(P)){return false;}else{if(!B.isUndefined(P)){R.value=P;}else{P=R.value;}K=false;J=this.eventQueue.length;for(L=0;L0){G=F-1;do{D=E.subscribers[G];if(D&&D.obj==I&&D.fn==H){return true;}}while(G--);}return false;};YAHOO.lang.augmentProto(A,YAHOO.util.EventProvider);}());(function(){YAHOO.widget.Module=function(Q,P){if(Q){this.init(Q,P);}else{}};var F=YAHOO.util.Dom,D=YAHOO.util.Config,M=YAHOO.util.Event,L=YAHOO.util.CustomEvent,G=YAHOO.widget.Module,H,O,N,E,A={"BEFORE_INIT":"beforeInit","INIT":"init","APPEND":"append","BEFORE_RENDER":"beforeRender","RENDER":"render","CHANGE_HEADER":"changeHeader","CHANGE_BODY":"changeBody","CHANGE_FOOTER":"changeFooter","CHANGE_CONTENT":"changeContent","DESTORY":"destroy","BEFORE_SHOW":"beforeShow","SHOW":"show","BEFORE_HIDE":"beforeHide","HIDE":"hide"},I={"VISIBLE":{key:"visible",value:true,validator:YAHOO.lang.isBoolean},"EFFECT":{key:"effect",suppressEvent:true,supercedes:["visible"]},"MONITOR_RESIZE":{key:"monitorresize",value:true},"APPEND_TO_DOCUMENT_BODY":{key:"appendtodocumentbody",value:false}};G.IMG_ROOT=null;G.IMG_ROOT_SSL=null;G.CSS_MODULE="yui-module";G.CSS_HEADER="hd";G.CSS_BODY="bd";G.CSS_FOOTER="ft";G.RESIZE_MONITOR_SECURE_URL="javascript:false;";G.textResizeEvent=new L("textResize");function K(){if(!H){H=document.createElement("div");H.innerHTML=('
    '+'
    ');O=H.firstChild;N=O.nextSibling;E=N.nextSibling;}return H;}function J(){if(!O){K();}return(O.cloneNode(false));}function B(){if(!N){K();}return(N.cloneNode(false));}function C(){if(!E){K();}return(E.cloneNode(false));}G.prototype={constructor:G,element:null,header:null,body:null,footer:null,id:null,imageRoot:G.IMG_ROOT,initEvents:function(){var P=L.LIST;this.beforeInitEvent=this.createEvent(A.BEFORE_INIT);this.beforeInitEvent.signature=P;this.initEvent=this.createEvent(A.INIT);this.initEvent.signature=P;this.appendEvent=this.createEvent(A.APPEND);this.appendEvent.signature=P;this.beforeRenderEvent=this.createEvent(A.BEFORE_RENDER);this.beforeRenderEvent.signature=P;this.renderEvent=this.createEvent(A.RENDER);this.renderEvent.signature=P;this.changeHeaderEvent=this.createEvent(A.CHANGE_HEADER);this.changeHeaderEvent.signature=P;this.changeBodyEvent=this.createEvent(A.CHANGE_BODY);this.changeBodyEvent.signature=P;this.changeFooterEvent=this.createEvent(A.CHANGE_FOOTER);this.changeFooterEvent.signature=P;this.changeContentEvent=this.createEvent(A.CHANGE_CONTENT);this.changeContentEvent.signature=P;this.destroyEvent=this.createEvent(A.DESTORY);this.destroyEvent.signature=P;this.beforeShowEvent=this.createEvent(A.BEFORE_SHOW);this.beforeShowEvent.signature=P;this.showEvent=this.createEvent(A.SHOW);this.showEvent.signature=P;this.beforeHideEvent=this.createEvent(A.BEFORE_HIDE);this.beforeHideEvent.signature=P;this.hideEvent=this.createEvent(A.HIDE);this.hideEvent.signature=P;},platform:function(){var P=navigator.userAgent.toLowerCase();if(P.indexOf("windows")!=-1||P.indexOf("win32")!=-1){return"windows";}else{if(P.indexOf("macintosh")!=-1){return"mac";}else{return false;}}}(),browser:function(){var P=navigator.userAgent.toLowerCase();if(P.indexOf("opera")!=-1){return"opera";}else{if(P.indexOf("msie 7")!=-1){return"ie7";}else{if(P.indexOf("msie")!=-1){return"ie";}else{if(P.indexOf("safari")!=-1){return"safari";}else{if(P.indexOf("gecko")!=-1){return"gecko";}else{return false;}}}}}}(),isSecure:function(){if(window.location.href.toLowerCase().indexOf("https")===0){return true;}else{return false;}}(),initDefaultConfig:function(){this.cfg.addProperty(I.VISIBLE.key,{handler:this.configVisible,value:I.VISIBLE.value,validator:I.VISIBLE.validator});this.cfg.addProperty(I.EFFECT.key,{suppressEvent:I.EFFECT.suppressEvent,supercedes:I.EFFECT.supercedes});this.cfg.addProperty(I.MONITOR_RESIZE.key,{handler:this.configMonitorResize,value:I.MONITOR_RESIZE.value});this.cfg.addProperty(I.APPEND_TO_DOCUMENT_BODY.key,{value:I.APPEND_TO_DOCUMENT_BODY.value});},init:function(U,T){var R,V;this.initEvents();this.beforeInitEvent.fire(G);this.cfg=new D(this);if(this.isSecure){this.imageRoot=G.IMG_ROOT_SSL;}if(typeof U=="string"){R=U;U=document.getElementById(U);if(!U){U=(K()).cloneNode(false);U.id=R;}}this.element=U;if(U.id){this.id=U.id;}V=this.element.firstChild;if(V){var Q=false,P=false,S=false;do{if(1==V.nodeType){if(!Q&&F.hasClass(V,G.CSS_HEADER)){this.header=V;Q=true;}else{if(!P&&F.hasClass(V,G.CSS_BODY)){this.body=V;P=true;}else{if(!S&&F.hasClass(V,G.CSS_FOOTER)){this.footer=V;S=true;}}}}}while((V=V.nextSibling));}this.initDefaultConfig();F.addClass(this.element,G.CSS_MODULE);if(T){this.cfg.applyConfig(T,true);}if(!D.alreadySubscribed(this.renderEvent,this.cfg.fireQueue,this.cfg)){this.renderEvent.subscribe(this.cfg.fireQueue,this.cfg,true);}this.initEvent.fire(G);},initResizeMonitor:function(){var Q=(YAHOO.env.ua.gecko&&this.platform=="windows");if(Q){var P=this;setTimeout(function(){P._initResizeMonitor();},0);}else{this._initResizeMonitor();}},_initResizeMonitor:function(){var P,R,T;function V(){G.textResizeEvent.fire();}if(!YAHOO.env.ua.opera){R=F.get("_yuiResizeMonitor");var U=this._supportsCWResize();if(!R){R=document.createElement("iframe");if(this.isSecure&&G.RESIZE_MONITOR_SECURE_URL&&YAHOO.env.ua.ie){R.src=G.RESIZE_MONITOR_SECURE_URL;}if(!U){T=["', ""); + } + SED.quickCreateDialog.setBody(ret.html ? ret.html : " "); + SED.quickCreateDialog.render(); + SUGAR.util.evalScript(ret.html + ''); + + SED.quickCreateDialog.ieId = ret.ieId; + SED.quickCreateDialog.uid = ret.uid; + SED.quickCreateDialog.mbox = ret.mbox; + SED.quickCreateDialog.qcmodule = ret.module; + + SED.quickCreateDialog.show(); + + var editForm = document.getElementById('form_EmailQCView_' + ret.module); + if (editForm) { + editForm.module.value = 'Emails'; + var count = SUGAR.EmailAddressWidget.count[ret.module] ? SUGAR.EmailAddressWidget.count[ret.module] : 0; + var tableId = YAHOO.util.Dom.getElementsByClassName('emailaddresses', 'table', editForm)[0].id; + var instId = ret.module + count; + SED.quickCreateEmailsToAdd = ret.emailAddress; + SED.quickCreateEmailCallback = function(instId, tableId) { + var eaw = SUGAR.EmailAddressWidget.instances[instId]; + if (typeof(eaw) == "undefined") + window.setTimeout("SUGAR.email2.detailView.quickCreateEmailCallback('" + + instId + "','" + tableId + "');", 100); + eaw.prefillEmailAddresses(tableId, SUGAR.email2.detailView.quickCreateEmailsToAdd); + } + window.setTimeout("SUGAR.email2.detailView.quickCreateEmailCallback('" + + instId + "','" + tableId + "');", 100); + } + }, + + saveQuickCreateForm : function(o) { + hideOverlay(); + SUGAR.email2.detailView.quickCreateDialog.hide(); + validate['EditView'] = [ ]; + }, + + saveQuickCreateFormAndReply : function(o) { + hideOverlay(); + var ret = JSON.parse(o.responseText); + SUGAR.email2.detailView.quickCreateDialog.hide(); + var qcd = SUGAR.email2.detailView.quickCreateDialog; + var type = (qcd.qcmodule == 'Cases') ? 'replyCase' : 'reply'; + if (ret) { + var emailID = ret.id; + SUGAR.email2.composeLayout.c0_replyForwardEmail(null, ret.id, 'sugar::Emails', type); + } else { + SUGAR.email2.composeLayout.c0_replyForwardEmail(qcd.ieId, qcd.uid, qcd.mbox, type); + } + //Cean the validate cache to prevent errors on the next call + validate['EditView'] = [ ]; + }, + + saveQuickCreateFormAndAddToAddressBook : function(o) { + hideOverlay(); + SUGAR.email2.detailView.quickCreateDialog.hide(); + SUGAR.email2.complexLayout.findPanel('contactsTab').show(); + validate['EditView'] = [ ]; + }, + + handleAssignmentDialogAssignAction : function() { + + + var assign_user_id = window.document.forms['Distribute'].elements['assigned_user_id'].value; + + var dist = 'direct'; + var users = false; + var rules = false; + var get = ""; + var found_teams = false; + var warning_message = mod_strings.LBL_WARN_NO_USERS; + if(!found_teams && assign_user_id == '' ) + { + alert(warning_message); + return; + } + + var emailUids = SUGAR.email2.listView.getUidsFromSelection(); + var uids = ""; + for(i=0; i'; + } + overlay(SUGAR.language.get('Emails','LBL_IMPORT_STATUS_TITLE'), statusString, 'alert'); + } + SE.listView.refreshGrid(); + +}, +failure : AjaxObject.handleFailure, +timeout : AjaxObject.timeout, +scope : AjaxObject + +}; +var callbackComposeCache = { + success : AjaxObject.composeCache, + failure : AjaxObject.handleFailure, + timeout : AjaxObject.timeout, + scope : AjaxObject +}; +var callbackDelete = { + success : AjaxObject.handleDeleteReturn, + failure : AjaxObject.handleFailure, + timeout : AjaxObject.timeout, + scope : AjaxObject +}; +var callbackEmailDetailMultiple = { + success : function(o) { + hideOverlay(); + var retMulti = JSON.parse(o.responseText); + var ret = new Object(); + + for(var i=0; i 0) { + for (i = 0 ; i < tabArray.length ; i++) { + var tabObject = tabArray[i]; + if (tabObject.get("id") == ("composeTab" + idx)) { + var tabLabel = a.name; + if (tabLabel != null && tabLabel.length > 25) { + tabLabel = tabLabel.substring(0, 25) + "..."; + } // if + tabObject.get("labelEl").firstChild.data = tabLabel; + break; + } + } + } + + //SUGAR.email2.innerLayout.regions.center.getPanel('composeLayout' + idx).setTitle(a.name); + if (a.parent_name != null && a.parent_name != "") { + document.getElementById('data_parent_name' + idx).value = a.parent_name; + } + if (a.parent_type != null && a.parent_type != "") { + document.getElementById('data_parent_type' + idx).value = a.parent_type; + } + if (a.parent_id != null && a.parent_id != "") { + document.getElementById('data_parent_id' + idx).value = a.parent_id; + } + if (a.fromAccounts.status) { + var addressFrom = document.getElementById('addressFrom' + idx); + SUGAR.email2.util.emptySelectOptions(addressFrom); + var fromAccountOpts = a.fromAccounts.data; + for(i=0; i"; + } + } + function attachIcon(cell, record, column, value) { + if(value == "1") { + cell.innerHTML = ""; + } + } + + var colModel = + [ + { + label: "", + width: 10, + sortable: false, + fixed: true, + resizeable: true, + formatter: attachIcon, + key: 'hasAttach' + }, + { + label: "!", + width: widths[0], + sortable: true, + fixed: true, + resizeable: true, + formatter: flaggedIcon, + key: 'flagged' + }, + { + label: "", + width: widths[1], + sortable: true, + fixed: true, + resizeable: false, + formatter: repliedIcon, + key: 'status' + }, + { + label: app_strings.LBL_EMAIL_FROM, + width: widths[2], + sortable: true, + resizeable: true, + key: 'from' + }, + { + label: app_strings.LBL_EMAIL_SUBJECT, + width: widths[3], + sortable: true, + resizeable: true, + key: 'subject' + }, + { + label: mod_strings.LBL_LIST_DATE, + width: widths[4], + sortable: true, + resizeable: true, + key: 'date' + }, + { + label: app_strings.LBL_EMAIL_TO, + width: widths[5], + sortable: false, + resizeable: true, + key: 'to_addrs' + }, + { + label: 'uid', + hidden: true, + key: 'uid' + }, + { + label: 'mbox', + hidden: true, + key: 'mbox' + }, + { + label: 'ieId', + hidden: true, + key: 'ieId' + }, + { + label: 'site_url', + hidden: true, + key: 'site_url' + }, + { label: 'seen', + hidden: true, + key: 'seen' + }, + { label: 'type', + hidden: true, + key: 'type' + } + ]; + + var dataModel = new YAHOO.util.DataSource(urlBase + "?", { + responseType: YAHOO.util.DataSource.TYPE_JSON, + responseSchema: { + resultsList: 'Email', + fields: ['flagged', 'status', 'from', 'subject', 'date','to_addrs', 'uid', 'mbox', 'ieId', 'site_url', 'seen', 'type', 'AssignedTo','hasAttach'], + metaFields: {total: 'TotalCount', unread:"UnreadCount", fromCache: "FromCache"} + } + }); + var params = { + to_pdf : "true", + module : "Emails", + action : "EmailUIAjax", + emailUIAction : "getMessageList", + mbox : "INBOX", + ieId : "", + forceRefresh : "false" + }; + if(lazyLoadFolder != null) { + params['mbox'] = lazyLoadFolder.folder; + params['ieId'] = lazyLoadFolder.ieId; + //Check if the folder is a Sugar Folder + var test = new String(lazyLoadFolder.folder); + if(test.match(/SUGAR\./)) { + params['emailUIAction'] = 'getMessageListSugarFolders'; + params['mbox'] = test.substr(6); + } + } + //dataModel.initPaging(urlBase, SUGAR.email2.userPrefs.emailSettings.showNumInList); + + // create the Grid + var grid = SUGAR.email2.grid = new YAHOO.SUGAR.SelectionGrid('emailGrid', colModel, dataModel, { + MSG_EMPTY: SUGAR.language.get("Emails", "LBL_EMPTY_FOLDER"), + dynamicData: true, + paginator: new YAHOO.widget.Paginator({ + rowsPerPage:parseInt(SUGAR.email2.userPrefs.emailSettings.showNumInList), + containers : ["dt-pag-nav"], + template: "", + firstPageLinkLabel: "", + previousPageLinkLabel: "", + nextPageLinkLabel: "", + lastPageLinkLabel: "" + }), + initialRequest:SUGAR.util.paramsToUrl(params), + width: "800px", + height: "400px" + }); + + initRowDD(); + + //Override Paging request construction + grid.set("generateRequest", function(oState, oSelf) { + oState = oState || {pagination:null, sortedBy:null}; + var sort = (oState.sortedBy) ? oState.sortedBy.key : oSelf.getColumnSet().keys[1].getKey(); + var dir = (oState.sortedBy && oState.sortedBy.dir === YAHOO.widget.DataTable.CLASS_DESC) ? "desc" : "asc"; + var startIndex = (oState.pagination) ? oState.pagination.recordOffset : 0; + var results = (oState.pagination) ? oState.pagination.rowsPerPage : null; + // Build the request + var ret = + SUGAR.util.paramsToUrl(oSelf.params) + + "&sort=" + sort + + "&dir=" + dir + + "&start=" + startIndex + + ((results !== null) ? "&limit=" + results : ""); + return ret; + }); + + + grid.handleDataReturnPayload = function(oRequest, oResponse, oPayload) { + oPayload = oPayload || { }; + + oPayload.totalRecords = oResponse.meta.total; + oPayload.unreadRecords = oResponse.meta.unread; + + var tabObject = SE.innerLayout.get("tabs")[0]; + var mboxTitle = ""; + if (this.params.mbox != null) { + mboxTitle = this.params.mbox; + } + var tabtext = mboxTitle + " (" + oResponse.meta.total + " " + app_strings.LBL_EMAIL_MESSAGES + " )"; + tabObject.get("labelEl").firstChild.data = tabtext; + + if (SE.tree) { + var node = SE.tree.getNodeByProperty('id', this.params.ieId) || SE.tree.getNodeByProperty('origText', this.params.mbox); + if (node) { + node.data.unseen = oResponse.meta.unread; + SE.accounts.renderTree(); + } + } + return oPayload; + } + + var resize = grid.resizeGrid = function () { + SUGAR.email2.grid.set("width", SUGAR.email2.grid.get("element").parentNode.clientWidth + "px"); + SUGAR.email2.grid.set("height", (SUGAR.email2.grid.get("element").parentNode.clientHeight - 47) + "px"); + } + grid.convertDDRows = function() { + var rowEl = this.getFirstTrEl(); + while (rowEl != null) { + new this.DDRow(this, this.getRecord(rowEl), rowEl); + rowEl = this.getNextTrEl(rowEl); + } + } + + + grid.on("columnResizeEvent", function(o) { + //Find the index of the column + var colSet = SUGAR.email2.grid.getColumnSet().flat; + for (var i=0; i < colSet.length; i++) { + if (o.column == colSet[i]) { + //Store it in the cookie + Ck.setSub("EmailGridWidths", i + "", o.width, {expires: SUGAR.email2.nextYear}); + } + } + //this.resizeGrid(); + }, null, grid); + + grid.on("postRenderEvent", function() {this.convertDDRows()}, null, grid); + grid.on("rowClickEvent", SUGAR.email2.listView.handleClick); + grid.on("rowDblclickEvent", SUGAR.email2.listView.getEmail); + grid.render(); + SUGAR.email2.listViewLayout.on("render", resize); + resize(); + + //Setup the default load parameters + SUGAR.email2.grid.params = params; + + grid.on('postRenderEvent', SUGAR.email2.listView.setEmailListStyles); + dataModel.subscribe("requestEvent", grid.disable, grid, true); + dataModel.subscribe("responseParseEvent", grid.undisable, grid, true); + } + }; + e2Grid.init(); +}; + + +function initRowDD() { + var sg = SUGAR.email2.grid, + Dom = YAHOO.util.Dom; + sg.DDRow = function(oDataTable, oRecord, elTr) { + if(oDataTable && oRecord && elTr) { + this.ddtable = oDataTable; + this.table = oDataTable.getTableEl(); + this.row = oRecord; + this.rowEl = elTr; + this.newIndex = null; + this.init(elTr); + this.initFrame(); // Needed for DDProxy + this.invalidHandleTypes = {}; + } + }; + + YAHOO.extend(sg.DDRow, YAHOO.util.DDProxy, { + _resizeProxy: function() { + this.constructor.superclass._resizeProxy.apply(this, arguments); + var dragEl = this.getDragEl(), + el = this.getEl(); + var xy = Dom.getXY(el); + + Dom.setStyle(dragEl, 'height', this.rowEl.offsetHeight + "px"); + Dom.setStyle(dragEl, 'width', (parseInt(Dom.getStyle(dragEl, 'width'),10) + 4) + 'px'); + Dom.setXY(dragEl, [xy[0] - 100, xy[1] - 20] ); + Dom.setStyle(dragEl, 'display', ""); + }, + + startDrag: function(x, y) { + //Check if we should be dragging a set of rows rather than just the one. + var selectedRows = this.ddtable.getSelectedRows(); + var iSelected = false; + for (var i in selectedRows) { + if (this.rowEl.id == selectedRows[i]) { + iSelected = true; + break + } + } + if (iSelected) { + this.rows = []; + for (var i in selectedRows) { + this.rows[i] = this.ddtable.getRecord(selectedRows[i]); + } + } else { + this.rows = [this.row]; + this.ddtable.unselectAllRows(); + this.ddtable.selectRow(this.row); + } + + //Initialize the dragable proxy + var dragEl = this.getDragEl(); + var clickEl = this.getEl(); + Dom.setStyle(clickEl, "opacity", "0.25"); + dragEl.innerHTML = "" + clickEl.innerHTML + "
    "; + Dom.addClass(dragEl, "yui-dt-liner"); + Dom.setStyle(dragEl, "opacity", "0.5"); + Dom.setStyle(dragEl, "height", (clickEl.clientHeight - 2) + "px"); + Dom.setStyle(dragEl, "backgroundColor", Dom.getStyle(clickEl, "backgroundColor")); + Dom.setStyle(dragEl, "border", "2px solid gray"); + }, + + clickValidator: function(e) { + if (this.row.getData()[0] == " ") + return false; + var target = YAHOO.util.Event.getTarget(e); + return ( this.isValidHandleChild(target) && + (this.id == this.handleElId || this.DDM.handleWasClicked(target, this.id)) ); + }, + /** + * This funciton checks that the target of the drag is a table row in this + * DDGroup and simply moves the sourceEL to that location as a preview. + */ + onDragOver: function(ev, id) { + var node = SUGAR.email2.tree.getNodeByElement(Dom.get(id)); + if (node && node != this.targetNode) { + this.targetNode = node; + SUGAR.email2.folders.unhighliteAll(); + node.highlight(); + } + }, + + onDragOut: function(e, id) { + if (this.targetNode) { + SUGAR.email2.folders.unhighliteAll(); + this.targetNode = false; + } + }, + endDrag: function() { + Dom.setStyle(this.getEl(), "opacity", ""); + Dom.setStyle(this.getDragEl(), "display", "none"); + if (this.targetNode) { + SUGAR.email2.folders.handleDrop(this.rows, this.targetNode); + } + SUGAR.email2.folders.unhighliteAll(); + this.rows = null; + } + }); +} + +function AddressSearchGridInit() { + function moduleIcon(elCell, oRecord, oColumn, oData) { + elCell.innerHTML = ""; + }; + function selectionCheckBox(elCell, oRecord, oColumn, oData) { + elCell.innerHTML = ''; + }; + var checkHeader = '{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}
    ", + firstPageLinkLabel: "", + previousPageLinkLabel: "", + nextPageLinkLabel: "", + lastPageLinkLabel: "" + }), + initialRequest:SUGAR.util.paramsToUrl(dataModel.params), + width: "560px", + height: "250px" + }); + //Override Paging request construction + grid.set("generateRequest", function(oState, oSelf) { + oState = oState || {pagination:null, sortedBy:null}; + var sort = (oState.sortedBy) ? oState.sortedBy.key : oSelf.getColumnSet().keys[0].getKey(); + var dir = (oState.sortedBy && oState.sortedBy.dir === YAHOO.widget.DataTable.CLASS_DESC) ? "desc" : "asc"; + var startIndex = (oState.pagination) ? oState.pagination.recordOffset : 0; + var results = (oState.pagination) ? oState.pagination.rowsPerPage : null; + // Build the request + var ret = + SUGAR.util.paramsToUrl(oSelf.getDataSource().params) + + "&sort=" + sort + "&dir=" + dir + "&start=" + startIndex + + ((results !== null) ? "&limit=" + results : ""); + return ret; + }); + + grid.handleDataReturnPayload = function(oRequest, oResponse, oPayload) { + oPayload = oPayload || { }; + oPayload.totalRecords = oResponse.meta.total; + return oPayload; + } + + grid.clickToggleSelect= function(args) { + var isIE = (args.event.target == null); + var targetElement = isIE ? args.event.srcElement : args.event.target; + if(targetElement.type == null || targetElement.type != 'checkbox') { + SUGAR.email2.addressBook.grid.toggleSelect(args.target.id); + } + } + + grid.reSelectRowsOnRender = function (){ + var rows = SUGAR.email2.addressBook.grid.getRecordSet().getRecords(); + for (var i = 0; i < rows.length; i++) + { + var emailAddress = rows[i].getData("email"); + var alreadyAdded = SUGAR.email2.addressBook.doesEmailAdddressExistInResultTable(emailAddress); + if(alreadyAdded) + { + rows[i].setData("selected", true); + SUGAR.email2.addressBook.grid.selectRow(rows[i]); + } + else + { + rows[i].setData("selected", false); + SUGAR.email2.addressBook.grid.unselectRow(rows[i]); + } + } + } + grid.subscribe("rowMouseoverEvent", grid.onEventHighlightRow); + grid.subscribe("rowMouseoutEvent", grid.onEventUnhighlightRow); + grid.subscribe("rowClickEvent", grid.clickToggleSelect); + grid.subscribe("postRenderEvent", grid.reSelectRowsOnRender); + + grid.render(); + dataModel.subscribe("requestEvent", grid.disable, grid, true); + dataModel.subscribe("responseParseEvent", grid.undisable, grid, true); + + grid.toggleSelectCheckbox = function(id,checked){ + var row = SUGAR.email2.addressBook.grid.getRecord(id); + row.setData("checked",checked); + }; + grid.toggleSelect = function(id, checked) { + var row = SUGAR.email2.addressBook.grid.getRecord(id); + checked = row.getData("selected"); + if (!checked) + { + SUGAR.email2.addressBook.grid.selectRow(row); + SE.addressBook.insertContactRowToResultTable(id,null) + } else + { + SUGAR.email2.addressBook.grid.unselectRow(row); + SE.addressBook.removeRowFromGridResults(id,row.getData("email")); + } + row.setData("selected", !checked); + }; + + grid.toggleSelectAll = function(checked) { + rows = SUGAR.email2.addressBook.grid.getRecordSet().getRecords(); + for (var i = 0; i < rows.length; i++) { + if (typeof(rows[i]) != "undefined") + rows[i].setData("checked", checked); + } + var checkBoxes = SUGAR.email2.addressBook.grid.get("element").getElementsByTagName('input'); + for (var i = 0; i < checkBoxes.length; i++) { + checkBoxes[i].checked = checked; + } + }; + + //Initialize the grid result table. + AddressSearchResultsGridInit(); +} + + + +/** +* Initalize the results table for the address book selection. +* +*/ +function AddressSearchResultsGridInit() +{ + + /* Full name sort funciton to compare by last name if available */ + var fullNameSort = function(a, b, desc) { + // Deal with empty values + if(!YAHOO.lang.isValue(a)) + return (!YAHOO.lang.isValue(b)) ? 0 : 1; + else if(!YAHOO.lang.isValue(b)) + return -1; + + var aNames = a.getData("name").split(' '); + var bNames = b.getData("name").split(' '); + + var aSortField = (aNames.length == 2) ? aNames[1] : a.getData("name"); + var bSortField = (bNames.length == 2) ? bNames[1] : b.getData("name"); + + return YAHOO.util.Sort.compare(aSortField,bSortField, desc); + + }; + + var typeDdOptions = [app_strings.LBL_EMAIL_ADDRESS_BOOK_ADD_TO.replace(/:$/,'') , + app_strings.LBL_EMAIL_ADDRESS_BOOK_ADD_CC.replace(/:$/,''), + app_strings.LBL_EMAIL_ADDRESS_BOOK_ADD_BCC.replace(/:$/,'')]; + + var ColumnDefs = [{key:'type',label:app_strings.LBL_EMAIL_ADDRESS_BOOK_ADRRESS_TYPE, width: 60, sortable: true, editor: new YAHOO.widget.RadioCellEditor({radioOptions:typeDdOptions,disableBtns:true})}, + {key:'name',label:app_strings.LBL_EMAIL_ACCOUNTS_NAME,width: 280,sortable: true, sortOptions:{sortFunction:fullNameSort}}]; + + var myDataSource = new YAHOO.util.DataSource([]); + myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSARRAY; + myDataSource.responseSchema = { + fields: ["name","type","email_address","display_email_address","bean_id","idx"] + }; + + var gridResults = SUGAR.email2.addressBook.gridResults = new YAHOO.widget.ScrollingDataTable("addrSearchResultGrid", ColumnDefs, myDataSource, { + width: "350px",height: "250px", MSG_EMPTY: " "}); + + var highlightEditableCell = function(oArgs) { + var elCell = oArgs.target; + if(YAHOO.util.Dom.hasClass(elCell, "yui-dt-editable")) { + this.highlightCell(elCell); + } + }; + + gridResults.subscribe("cellMouseoverEvent", highlightEditableCell); + gridResults.subscribe("cellMouseoutEvent", gridResults.onEventUnhighlightCell); + gridResults.subscribe("cellClickEvent", gridResults.onEventShowCellEditor); + gridResults.subscribe("rowMouseoverEvent", gridResults.onEventHighlightRow); + gridResults.subscribe("rowMouseoutEvent", gridResults.onEventUnhighlightRow); + + //Setup the context menus + var onContextMenuClick = function(p_sType, p_aArgs, p_myDataTable) { + var task = p_aArgs[1]; + if(task) + { + var elRow = this.contextEventTarget; + elRow = p_myDataTable.getTrEl(elRow); + + if(elRow) + { + switch(task.index) + { + case 0: + var oRecord = p_myDataTable.getRecord(elRow); + p_myDataTable.deleteRow(elRow); + SUGAR.email2.addressBook.grid.reSelectRowsOnRender(); + } + } + } + }; + var contextMenu = new YAHOO.widget.ContextMenu("contextmenu", + {trigger:gridResults.getTbodyEl()}); + contextMenu.addItem(app_strings.LBL_EMAIL_DELETE); + contextMenu.render("addrSearchResultGrid"); + contextMenu.clickEvent.subscribe(onContextMenuClick, gridResults); +} +// End of File modules/Emails/javascript/grid.js + +/********************************************************************************* + * SugarCRM is a customer relationship management program developed by + * SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc. + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU Affero General Public License version 3 as published by the + * Free Software Foundation with the addition of the following permission added + * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK + * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY + * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS. + * + * 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 Affero General Public License for more + * details. + * + * You should have received a copy of the GNU Affero General Public License along with + * this program; if not, see http://www.gnu.org/licenses or write to the Free + * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301 USA. + * + * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road, + * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com. + * + * The interactive user interfaces in modified source and object code versions + * of this program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU Affero General Public License version 3. + * + * In accordance with Section 7(b) of the GNU Affero General Public License version 3, + * these Appropriate Legal Notices must retain the display of the "Powered by + * SugarCRM" logo. If the display of the logo is not reasonably feasible for + * technical reasons, the Appropriate Legal Notices must display the words + * "Powered by SugarCRM". + ********************************************************************************/ +/** + Complex layout init + */ +function complexLayoutInit() { + var se = SUGAR.email2; + var Dom = YAHOO.util.Dom; + se.e2Layout = { + getInnerLayout : function(rows) { + se.listViewLayout = new YAHOO.widget.Layout('listViewDiv', { + parent: se.complexLayout, + border:true, + hideOnLayout: true, + height: 400, + units: [{ + position: "center", + scroll:false, // grid should autoScroll itself + split:true, + body: "
    " + },{ + position: "bottom", + scroll:true, + collapse: false, + resize: true, + useShim:true, + height:'250', + body: "
    " + },{ + position: "right", + scroll:true, + collapse: false, + resize: true, + useShim:true, + width:'250', + body: "
    ", + titlebar: false //,header: "right" + }] + }); + se.complexLayout.on("render", function(){ + var height = SUGAR.email2.innerLayout.get("element").clientHeight - 30; + SUGAR.email2.innerLayout.get("activeTab").get("contentEl").parentNode.style.height = height + "px"; + SUGAR.email2.listViewLayout.set("height", height); + SUGAR.email2.listViewLayout.render(); + }); + se.listViewLayout.render(); + //CSS hack for now + se.listViewLayout.get("element").parentNode.parentNode.style.padding = "0px" + var rp = se.listViewLayout.resizePreview = function() { + var pre = Dom.get("displayEmailFramePreview"); + if (pre) { + var parent = Dom.getAncestorByClassName(pre, "yui-layout-bd"); + pre.style.height = (parent.clientHeight - pre.offsetTop) + "px"; + } + }; + se.listViewLayout.getUnitByPosition("bottom").on("heightChange", se.autoSetLayout); + se.listViewLayout.getUnitByPosition("right").on("endResize", se.autoSetLayout); + se.e2Layout.setPreviewPanel(rows); + se.previewLayout = se.listViewLayout; + return se.listViewLayout; + }, + + getInnerLayout2Rows : function() { + return this.getInnerLayout(true); + }, + getInnerLayout2Columns : function() { + return this.getInnerLayout(false); + }, + + init : function(){ + // initialize state manager, we will use cookies +// Ext.state.Manager.setProvider(new Ext.state.CookieProvider()); + var viewHeight = document.documentElement ? document.documentElement.clientHeight : self.innerHeight; + se.complexLayout = new YAHOO.widget.Layout("container", { + border:true, + hideOnLayout: true, + height: Dom.getViewportHeight() - (document.getElementById('header').clientHeight ) - 65, + width: Dom.getViewportWidth() - 40, + units: [{ + position: "center", + scroll:false, + body: "
    " + }, + { + position: "left", + scroll: true, + body: "
    ", + collapse: true, + width: 210, + minWidth: 100, + resize:true, + useShim:true, + titlebar: true, + header: " " + }, + { + header: Dom.get('footerLinks').innerHTML, + position: 'bottom', + id: 'mbfooter', + height: 22, + border: false + }] + }); + se.complexLayout.render(); + var tp = se.innerLayout = new YAHOO.widget.TabView("emailtabs"); + tp.addTab(new YAHOO.widget.Tab({ + label: "Inbox", + scroll : true, + content : "
    ", + id : "center", + active : true + })); + var centerEl = se.complexLayout.getUnitByPosition('center').get('wrap'); + tp.appendTo(centerEl); + //CSS hack for now + tp.get("element").style.borderRight = "1px solid #666" + + var listV = this.getInnerLayout2Rows(); + listV.set("height", tp.get("element").clientHeight - 25); + listV.render(); + + se.leftTabs = new YAHOO.widget.TabView("lefttabs"); + var folderTab = new YAHOO.widget.Tab({ + label: app_strings.LBL_EMAIL_FOLDERS_SHORT, + scroll : true, + content : "
    ", + id : "tree", + active : true + }); + folderTab.on("activeChange", function(o){ + if (o.newValue) { + se.complexLayout.getUnitByPosition("left").set("header", app_strings.LBL_EMAIL_FOLDERS); + } + }); + se.leftTabs.addTab(folderTab); + + var tabContent = SUGAR.util.getAndRemove("searchTab"); + var searchTab = new YAHOO.widget.Tab({ + label: app_strings.LBL_EMAIL_SEARCH_SHORT, + scroll : true, + content : tabContent.innerHTML, + id : tabContent.id + }); + searchTab.on("activeChange", function(o){ + if (o.newValue) + { + se.complexLayout.getUnitByPosition("left").set("header", app_strings.LBL_EMAIL_SEARCH); + //Setup the calendars if needed + Calendar.setup ({inputField : "searchDateFrom", ifFormat : calFormat, showsTime : false, button : "jscal_trigger_from", singleClick : true, step : 1, weekNumbers:false}); + Calendar.setup ({inputField : "searchDateTo", ifFormat : calFormat, showsTime : false, button : "jscal_trigger_to", singleClick : true, step : 1, weekNumbers:false}); + + //Initalize sqs object for assigned user name + se.e2Layout.initSQSObject('advancedSearchForm','assigned_user_name'); + + //Attach event handler for when the relate module option is selected for the correct sqs object + var parentSearchArgs = {'formName':'advancedSearchForm','fieldName':'data_parent_name_search', + 'moduleSelectField':'data_parent_type_search','fieldId':'data_parent_id_search'}; + YAHOO.util.Event.addListener('data_parent_type_search', 'change',function(){ + SUGAR.email2.composeLayout.enableQuickSearchRelate(null,parentSearchArgs) }); + + //If enter key is pressed, perform search + var addKeyPressFields = ['searchSubject','searchFrom','searchTo','data_parent_name_search','searchDateTo','searchDateFrom','attachmentsSearch','assigned_user_name']; + for(var i=0; i < addKeyPressFields.length;i++) + { + YAHOO.util.Event.addListener(window.document.forms['advancedSearchForm'].elements[addKeyPressFields[i]],"keydown", function(e){ + if (e.keyCode == 13) { + YAHOO.util.Event.stopEvent(e); + SUGAR.email2.search.searchAdvanced(); + } + }); + } + //Initiate quick search for the search tab. Do this only when the tab is selected rather than onDomLoad for perf. gains. + enableQS(true); + //Clear parent values if selecting another parent type. + YAHOO.util.Event.addListener('data_parent_type_search','change', + function(){ + document.getElementById('data_parent_id_search').value =''; + document.getElementById('data_parent_name_search').value =''; + }); + + } + }); + se.leftTabs.addTab(searchTab); + + var resizeTabBody = function() { + var height = SUGAR.email2.leftTabs.get("element").clientHeight - 30; + SUGAR.email2.leftTabs.get("activeTab").get("contentEl").parentNode.style.height = height + "px"; + } + resizeTabBody(); + se.complexLayout.on("render", resizeTabBody); + se.leftTabs.on("activeTabChange", resizeTabBody); + //hack to allow left pane scroll bar to fully show + var lefttabsDiv = document.getElementById('lefttabs'); + var lefttabsDivParent = Dom.getAncestorBy(lefttabsDiv); + var lefttabsDivGParent = Dom.getAncestorBy(lefttabsDivParent); + lefttabsDivParent.style.width = lefttabsDivGParent.offsetWidth - 10 + "px"; + + }, + initSQSObject: function(formName,fieldName) + { + var fullFieldName = formName + '_' + fieldName; //SQS Convention + var resultName = fullFieldName + '_' + 'results'; + + if (QSFieldsArray[fullFieldName] != null) + { + QSFieldsArray[fullFieldName].destroy(); + delete QSFieldsArray[fullFieldName]; + } + if (QSProcessedFieldsArray[fullFieldName]) + QSProcessedFieldsArray[fullFieldName] = false; + + if( Dom.get(resultName) ) + { + var obj = document.getElementById(resultName); + obj.parentNode.removeChild(obj); + } + }, + setPreviewPanel: function(rows) { + if (rows) { + SUGAR.email2.listViewLayout.getUnitByPosition("right").set("width", 0); + SUGAR.email2.listViewLayout.getUnitByPosition("bottom").set("height", 250); + Dom.get("listRight").innerHTML = ""; + Dom.get("listBottom").innerHTML = "
    "; + } else { + SUGAR.email2.listViewLayout.getUnitByPosition("bottom").set("height", 0); + SUGAR.email2.listViewLayout.getUnitByPosition("right").set("width", 250); + Dom.get("listBottom").innerHTML = ""; + Dom.get("listRight").innerHTML = "
    "; + } + } + }; + se.e2Layout.init(); +} + +var myBufferedListenerObject = new Object(); +myBufferedListenerObject.refit = function() { + if(SUGAR.email2.grid) { + SUGAR.email2.grid.autoSize(); + } +} +// End of File modules/Emails/javascript/complexLayout.js + +/********************************************************************************* + * SugarCRM is a customer relationship management program developed by + * SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc. + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU Affero General Public License version 3 as published by the + * Free Software Foundation with the addition of the following permission added + * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK + * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY + * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS. + * + * 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 Affero General Public License for more + * details. + * + * You should have received a copy of the GNU Affero General Public License along with + * this program; if not, see http://www.gnu.org/licenses or write to the Free + * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301 USA. + * + * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road, + * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com. + * + * The interactive user interfaces in modified source and object code versions + * of this program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU Affero General Public License version 3. + * + * In accordance with Section 7(b) of the GNU Affero General Public License version 3, + * these Appropriate Legal Notices must retain the display of the "Powered by + * SugarCRM" logo. If the display of the logo is not reasonably feasible for + * technical reasons, the Appropriate Legal Notices must display the words + * "Powered by SugarCRM". + ********************************************************************************/ + +/****************************************************************************** + * Initialize Email 2.0 Application + */ + +//Override Sugar Languge so quick creates work properly + + +function email2init() { + + //Init Tiny MCE + // var tinyConfig = "code,bold,italic,underline,strikethrough,separator,justifyleft,justifycenter,justifyright,justifyfull," + + // "separator,bullist,numlist,outdent,indent,separator,forecolor,backcolor,fontselect,fontsizeselect"; + if (!SUGAR.util.isTouchScreen()) { + tinyMCE.init({ + convert_urls : false, + theme_advanced_toolbar_align : tinyConfig.theme_advanced_toolbar_align, + width: tinyConfig.width, + theme: tinyConfig.theme, + theme_advanced_toolbar_location : tinyConfig.theme_advanced_toolbar_location, + theme_advanced_buttons1 : tinyConfig.theme_advanced_buttons1, + theme_advanced_buttons2 : tinyConfig.theme_advanced_buttons2, + theme_advanced_buttons3 : tinyConfig.theme_advanced_buttons3, + plugins : tinyConfig.plugins, + elements : tinyConfig.elements, + language : tinyConfig.language, + extended_valid_elements : tinyConfig.extended_valid_elements, + mode: tinyConfig.mode, + strict_loading_mode : true, + force_br_newlines : true, + forced_root_block : '' + }); + } + //alert('loadedTiny'); + + // initialze message overlay + SUGAR.email2.e2overlay = new YAHOO.widget.Dialog("SUGAR.email2.e2overlay", { + //iframe : true, + modal : false, + autoTabs : true, + width : 300, + height : 120, + shadow : true + } + ); + // Hide Sugar menu + if (SUGAR.themes.tempHideLeftCol) + SUGAR.themes.tempHideLeftCol(); + + // add key listener for kb shortcust - disable backspace nav in mozilla/ie +// YAHOO.util.Event.addListener(window.document, 'keypress', SUGAR.email2.keys.overall); + + // set defaults for YAHOO.util.DragDropManager + YAHOO.util.DDM.mode = 0; // point mode, default is point (0) + + SUGAR.email2.nextYear = new Date(); + SUGAR.email2.nextYear.setDate(SUGAR.email2.nextYear.getDate() + 360); + + + // initialize and display UI framework (complexLayout.js) + complexLayoutInit(); + + // initialize and display grid (grid.js) + gridInit(); + + // initialize treeview for folders + //onloadTreeinit(); + SUGAR.email2.folders.rebuildFolders(true); + + + //Setup the Message Box overlay + /*Ext.MessageBox.maxWidth = 350; + Ext.MessageBox.minProgressWidth = 350; + + /////////////////////////////////////////////////////////////////////////// + //// CONTEXT MENUS + // detailView array + SUGAR.email2.contextMenus.detailViewContextMenus = new Object(); +*/ + var SEC = SUGAR.email2.contextMenus; + + //Grid menu + var emailMenu = SEC.emailListContextMenu = new YAHOO.widget.ContextMenu("emailContextMenu", { + trigger: SUGAR.email2.grid.get("element"), + lazyload: true + }); + emailMenu.subscribe("beforeShow", function() { + var oTarget = this.contextEventTarget; + if (typeof(oTarget) == "undefined") + return; + var grid = SUGAR.email2.grid; + var selectedRows = grid.getSelectedRows(); + var multipleSelected = (selectedRows.length > 1) ? true: false; + if (!multipleSelected) + { + grid.unselectAllRows(); + grid.selectRow(oTarget); + SUGAR.email2.contextMenus.showEmailsListMenu(grid, grid.getRecord(oTarget)); + } + else if(multipleSelected) + { + SUGAR.email2.contextMenus.showEmailsListMenu(grid, grid.getRecord(oTarget)); + } + }); + + //When we need to access menu items later we can only do so by indexes so we create a mapping to allow + //us to access individual elements easier by name rather than by index + emailMenu.itemsMapping = {'viewRelationships':0, 'openMultiple': 1, 'archive' : 2, 'reply' : 3,'replyAll' : 4,'forward' : 5, + 'delete' : 6,'print' : 7,'mark' : 8,'assignTo' : 9, 'relateTo' : 10}; + emailMenu.addItems([ + { + text: "" + app_strings.LBL_EMAIL_VIEW_RELATIONSHIPS, + id: 'showDetailView', + onclick: { fn: SEC.showDetailView } + }, + { + text: "" + app_strings.LBL_EMAIL_OPEN_ALL, + onclick: { fn: SEC.openMultiple } + }, + { + text: "" + app_strings.LBL_EMAIL_ARCHIVE_TO_SUGAR, + onclick: { fn: SEC.archiveToSugar } + }, + { + text: ""+ app_strings.LBL_EMAIL_REPLY, + id: 'reply', + onclick: { fn: SEC.replyForwardEmailContext } + }, + { + text: "" + app_strings.LBL_EMAIL_REPLY_ALL, + id: 'replyAll', + onclick: { fn: SEC.replyForwardEmailContext } + }, + { + text: "" + app_strings.LBL_EMAIL_FORWARD, + id: 'forward', + onclick: { fn: SEC.replyForwardEmailContext } + }, + { + text: "" + app_strings.LBL_EMAIL_DELETE, + id: 'delete', + onclick: { fn: SEC.markDeleted } + }, + { + text: "" + app_strings.LBL_EMAIL_PRINT, + id: 'print', + onclick: { fn: SEC.viewPrintable } + }, + // Mark... submenu + { + text: "" + app_strings.LBL_EMAIL_MARK, + submenu: { + id: "markEmailMenu", + itemdata : [ + { + text: app_strings.LBL_EMAIL_MARK + " " + app_strings.LBL_EMAIL_MARK_UNREAD, + onclick: { fn: SEC.markUnread } + }, + { + text: app_strings.LBL_EMAIL_MARK + " " + app_strings.LBL_EMAIL_MARK_READ, + onclick: { fn: SEC.markRead } + }, + { + text: app_strings.LBL_EMAIL_MARK + " " + app_strings.LBL_EMAIL_MARK_FLAGGED, + onclick: { fn: SEC.markFlagged } + }, + { + text: app_strings.LBL_EMAIL_MARK + " " + app_strings.LBL_EMAIL_MARK_UNFLAGGED, + onclick: { fn: SEC.markUnflagged } + } + ] + } + }, + { + text: "" + app_strings.LBL_EMAIL_ASSIGN_TO, + id: 'assignTo', + onclick: { fn: SEC.assignEmailsTo } + }, + { + text: "" + app_strings.LBL_EMAIL_RELATE_TO, + id: 'relateTo', + onclick: { fn: SEC.relateTo } + } + ]); + SEC.emailListContextMenu.render(); + + //Handle the Tree folder menu trigger ourselves + YAHOO.util.Event.addListener(YAHOO.util.Dom.get("emailtree"), "contextmenu", SUGAR.email2.folders.handleRightClick) + + + //Folder Menu + SEC.frameFoldersContextMenu = new YAHOO.widget.ContextMenu("folderContextMenu", { + trigger: "", + lazyload: true + }); + SEC.frameFoldersContextMenu.addItems([ + { text: "" + app_strings.LBL_EMAIL_CHECK, + //helptext: "" + app_strings.LBL_EMAIL_MENU_HELP_ADD_FOLDER + "", + onclick: { fn: function() { + var node = SUGAR.email2.clickedFolderNode; + if (node.data.ieId) { + SUGAR.email2.folders.startEmailCheckOneAccount(node.data.ieId, false)}; + }} + }, + { text: app_strings.LBL_EMAIL_MENU_SYNCHRONIZE, + //helptext: "" + app_strings.LBL_EMAIL_MENU_HELP_ADD_FOLDER + "", + onclick: { fn: function() { + var node = SUGAR.email2.clickedFolderNode; + if (node.data.ieId) { + SUGAR.email2.folders.startEmailCheckOneAccount(node.data.ieId, true)}; + }} + }, + { + text: app_strings.LBL_EMAIL_MENU_ADD_FOLDER, + //helptext: "" + app_strings.LBL_EMAIL_MENU_HELP_ADD_FOLDER + "", + onclick: { fn: SUGAR.email2.folders.folderAdd } + }, + { + text: app_strings.LBL_EMAIL_MENU_DELETE_FOLDER, + //helptext: "" + app_strings.LBL_EMAIL_MENU_HELP_DELETE_FOLDER + "", + onclick: { fn: SUGAR.email2.folders.folderDelete } + }, + { + text: app_strings.LBL_EMAIL_MENU_RENAME_FOLDER, + //helptext: "" + app_strings.LBL_EMAIL_MENU_HELP_RENAME_FOLDER + "", + onclick: { fn: SUGAR.email2.folders.folderRename } + }, + { + text: app_strings.LBL_EMAIL_MENU_EMPTY_TRASH, + //helptext: "" + app_strings.LBL_EMAIL_MENU_HELP_EMPTY_TRASH + "", + onclick: { fn: SUGAR.email2.folders.emptyTrash } + }, + { + text: app_strings.LBL_EMAIL_MENU_CLEAR_CACHE, + onclick: { fn: function() { + var node = SUGAR.email2.clickedFolderNode; + if (node.data.ieId) { + SUGAR.email2.folders.clearCacheFiles(node.data.ieId)}; + }} + } + ]); + SEC.frameFoldersContextMenu.render(); + + SEC.initContactsMenu = function() { + // contacts + SEC.contactsContextMenu = new YAHOO.widget.ContextMenu("contactsMenu", { + trigger: "contacts", + lazyload: true + }); + SEC.contactsContextMenu.addItems([ + { + text: app_strings.LBL_EMAIL_MENU_REMOVE, + onclick:{ fn: SUGAR.email2.addressBook.removeContact } + }, + { + text: app_strings.LBL_EMAIL_MENU_COMPOSE, + onclick:{ fn: function() {SUGAR.email2.addressBook.composeTo('contacts')}} + } + ]); + SEC.contactsContextMenu.subscribe("beforeShow", function() { + var oTarget = this.contextEventTarget, grid = SUGAR.email2.contactView; + if (oTarget && !grid.isSelected(oTarget)) { + grid.unselectAllRows(); + grid.selectRow(oTarget); + } + }); + SEC.contactsContextMenu.render(); + } + + + // set auto-check timer + SUGAR.email2.folders.startCheckTimer(); + // check if we're coming from an email-link click + setTimeout("SUGAR.email2.composeLayout.composePackage()", 2000); + + YAHOO.util.Event.on(window, 'resize', SUGAR.email2.autoSetLayout); + + //Init fix for YUI 2.7.0 datatable sort. + SUGAR.email2.addressBook.initFixForDatatableSort(); +} + +function createTreePanel(treeData, params) { + var tree = new YAHOO.widget.TreeView(params.id); + var root = tree.getRoot(); + + //if (treeData.nodes && treeData[0].id == "Home") + // treeData = treeData[0]; + + addChildNodes(root, treeData); + + return tree; +} + +function addChildNodes(parentNode, parentData) { + var Ck = YAHOO.util.Cookie; + var nextyear = SUGAR.email2.nextYear; + var nodes = parentData.nodes || parentData.children; + for (i in nodes) { + if (typeof(nodes[i]) == 'object') { + if (nodes[i].data) { + nodes[i].data.href = '#'; + var node = new YAHOO.widget.TextNode(nodes[i].data, parentNode) + node.action = nodes[i].data.action; + } else { + if (nodes[i].id == SUGAR.language.get('app_strings','LBL_EMAIL_HOME_FOLDER')) { + addChildNodes(parentNode, nodes[i]); + return; + } + nodes[i].expanded = Ck.getSub("EmailTreeLayout", nodes[i].id + "") == "true"; + Ck.setSub("EmailTreeLayout", nodes[i].id + "", nodes[i].expanded ? true : false, {expires: SUGAR.email2.nextYear}); + if (nodes[i].cls) { + nodes[i].className = nodes[i].cls; + } + nodes[i].href = "#"; + if (nodes[i].text) nodes[i].label = nodes[i].text; + //Override YUI child node creation + if (nodes[i].children) { + nodes[i].nodes = nodes[i].children; + nodes[i].children = [ ]; + } + var node = new YAHOO.widget.TextNode(nodes[i], parentNode); + } + + if (typeof(nodes[i].nodes) == 'object') { + addChildNodes(node, nodes[i]); + } + } + } +} + +/** + * Custom TreeView initialization sequence to setup DragDrop targets for every tree node + */ +function email2treeinit(tree, treedata, treediv, params) { + //ensure the tree data is not corrupt + if (!treedata) { + return; + } + if (SUGAR.email2.tree) { + SUGAR.email2.tree.destroy(); + SUGAR.email2.tree = null; + } + + var tree = SUGAR.email2.tree = createTreePanel({nodes : {}}, { + id: 'emailtree' + }); + + tree.subscribe("clickEvent", SUGAR.email2.folders.handleClick); + tree.subscribe("collapseComplete", function(node){YAHOO.util.Cookie.setSub("EmailTreeLayout", node.data.id + "", false, {expires: SUGAR.email2.nextYear});}); + tree.subscribe("expandComplete", function(node){ + YAHOO.util.Cookie.setSub("EmailTreeLayout", node.data.id + "", true, {expires: SUGAR.email2.nextYear}); + for (var i in node.children) { + SE.accounts.setupDDTarget(node.children[i]); + } + }); + tree.setCollapseAnim("TVSlideOut"); + tree.setExpandAnim("TVSlideIn"); + var root = tree.root; + while (root.hasChildren()) { + var node = root.children[0]; + node.destroy(); + tree.removeNode(root.children[0], false); + } + addChildNodes(root, treedata); + tree.render(); + SUGAR.email2.accounts.renderTree(); +} + +SUGAR.email2.folders.folderDD = function(id, sGroup, config) { + SUGAR.email2.folders.folderDD.superclass.constructor.call(this, id, sGroup, config); +}; + + +YAHOO.extend(SUGAR.email2.folders.folderDD, YAHOO.util.DDProxy, { + startDrag: function(x, y) { + var Dom = YAHOO.util.Dom; + this.dragNode = SUGAR.email2.tree.getNodeByElement(this.getEl()); + + this.dragId = ""; + var dragEl = this.getDragEl(); + var clickEl = this.getEl(); + Dom.setStyle(clickEl, "color", "#AAA"); + Dom.setStyle(clickEl, "opacity", "0.25"); + dragEl.innerHTML = clickEl.innerHTML; + + Dom.addClass(dragEl, "ygtvcell"); + Dom.addClass(dragEl, "ygtvcontent"); + Dom.addClass(dragEl, "folderDragProxy"); + Dom.setStyle(dragEl, "height", (clickEl.clientHeight - 5) + "px"); + Dom.setStyle(dragEl, "width", (clickEl.clientWidth - 5) + "px"); + Dom.setStyle(dragEl, "backgroundColor", "#FFF"); + Dom.setStyle(dragEl, "opacity", "0.5"); + Dom.setStyle(dragEl, "border", "1px solid #AAA"); + }, + + onDragOver: function(ev, id) { + var Dom = YAHOO.util.Dom; + if (id != this.dragId) + { + var node = SUGAR.email2.tree.getNodeByElement(YAHOO.util.Dom.get(id)); + if(node.data.cls != "sugarFolder") { + SUGAR.email2.folders.unhighliteAll(); + return; + } + this.dragId = id; + this.targetNode = node; + SUGAR.email2.folders.unhighliteAll(); + node.highlight(); + } + }, + + onDragOut: function(e, id) { + if (this.targetNode) { + SUGAR.email2.folders.unhighliteAll(); + this.targetNode = false; + this.dragId = false; + } + }, + + endDrag: function() { + YAHOO.util.Dom.setStyle(this.getEl(), "opacity", "1.0"); + if (this.targetNode) { + SUGAR.email2.folders.moveFolder(this.dragNode.data.id, this.targetNode.data.id); + } + } +});// End of File modules/Emails/javascript/init.js + +/********************************************************************************* + * SugarCRM is a customer relationship management program developed by + * SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc. + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU Affero General Public License version 3 as published by the + * Free Software Foundation with the addition of the following permission added + * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK + * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY + * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS. + * + * 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 Affero General Public License for more + * details. + * + * You should have received a copy of the GNU Affero General Public License along with + * this program; if not, see http://www.gnu.org/licenses or write to the Free + * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301 USA. + * + * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road, + * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com. + * + * The interactive user interfaces in modified source and object code versions + * of this program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU Affero General Public License version 3. + * + * In accordance with Section 7(b) of the GNU Affero General Public License version 3, + * these Appropriate Legal Notices must retain the display of the "Powered by + * SugarCRM" logo. If the display of the logo is not reasonably feasible for + * technical reasons, the Appropriate Legal Notices must display the words + * "Powered by SugarCRM". + ********************************************************************************/ +SUGAR.email2.templates['compose'] = '
    ' + +'
    ' + +'
    ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +'
    ' + +' ' + +' ' + +' ' + +' ' + +'  {mod_strings.LBL_EMAIL_RELATE}:  ' + +' ' + +' ' + +'
    ' + +'
    ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' '+ +' '+ +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +'
    ' + +' {app_strings.LBL_EMAIL_FROM}:' + +' ' + +'
    ' + +'   ' + +'
    ' + +'
    ' + +' ' + +' ' + +'
    ' + +'   ' + +' ' + +'
    ' + +'
    ' + +'
       {mod_strings.LBL_ADD_CC} {mod_strings.LBL_ADD_CC_BCC_SEP} {mod_strings.LBL_ADD_BCC}
    ' + +' ' + +' ' + +'
    ' + +'   ' + +' ' + +'
    ' + +'
    ' + +'
    ' + +' ' + +' ' + +'
    ' + +'   ' + +' ' + +'
    ' + +'
    ' + +'
    ' + +' {app_strings.LBL_EMAIL_SUBJECT}:' + +' ' + +'
    ' + +'   ' + +'
    ' + +'
    ' + +'
    ' + +'
    ' + +' ' + +'
    ' + +'
    ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +'
    ' + +' {app_strings.LBL_EMAIL_ATTACHMENTS}' + +'
    ' + +'  ' + +'
    ' + +' ' + +'
    ' + +'
    ' + +'  ' + +'
    ' + +'  ' + +'
    ' + +' {app_strings.LBL_EMAIL_ATTACHMENTS2}' + +'
    ' + +'  ' + +'
    ' + +' ' + +'
    ' + //
    ' + +'
    ' + +'  ' + +'
    ' + +'  ' + +'
    ' + +' ' + +'
    ' + +'  ' + +'
    ' + +'
    ' + +'
    ' + +'
    ' + +'
    ' + +'
    ' + +'
    ' + +'
    ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +'
    ' + +' {app_strings.LBL_EMAIL_TEMPLATES}:' + +'
    ' + +' ' + +'
    ' + +'
    ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +'
    ' + +' {app_strings.LBL_EMAIL_SIGNATURES}:' + +'
    ' + +' ' + +'
    ' + +' ' + +' ' + +' ' + +' ' + +'
    ' + +'  ' + +' {mod_strings.LBL_SEND_IN_PLAIN_TEXT}' + +'
    ' + +'
    ' + +'
    ' + +'
    ' + +'
    '; +// End of File modules/Emails/javascript/composeEmailTemplate.js + +/********************************************************************************* + * SugarCRM is a customer relationship management program developed by + * SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc. + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU Affero General Public License version 3 as published by the + * Free Software Foundation with the addition of the following permission added + * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK + * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY + * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS. + * + * 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 Affero General Public License for more + * details. + * + * You should have received a copy of the GNU Affero General Public License along with + * this program; if not, see http://www.gnu.org/licenses or write to the Free + * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301 USA. + * + * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road, + * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com. + * + * The interactive user interfaces in modified source and object code versions + * of this program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU Affero General Public License version 3. + * + * In accordance with Section 7(b) of the GNU Affero General Public License version 3, + * these Appropriate Legal Notices must retain the display of the "Powered by + * SugarCRM" logo. If the display of the logo is not reasonably feasible for + * technical reasons, the Appropriate Legal Notices must display the words + * "Powered by SugarCRM". + ********************************************************************************/ +SUGAR.email2.templates['displayOneEmail'] = +'
    ' + +'
    ' + +'
    ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +'
    ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' {meta.cc}' + +' {email.attachments}' + +'
    ' + +' {app_strings.LBL_EMAIL_FROM}:' + +' ' + +' {email.from_addr}' + +'
    ' + +' {app_strings.LBL_EMAIL_SUBJECT}:' + +' ' + +' {email.name}' + +'
    ' + +' {app_strings.LBL_EMAIL_DATE_SENT_BY_SENDER}:' + +' ' + +' {email.date_start} {email.time_start}' + +'
    ' + +' {app_strings.LBL_EMAIL_TO}:' + +' ' + +' {email.toaddrs}' + +'
    ' + +'
    ' + +//' {email.description}' + +'
    ' +;// End of File modules/Emails/javascript/displayOneEmailTemplate.js + +/********************************************************************************* + * SugarCRM is a customer relationship management program developed by + * SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc. + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU Affero General Public License version 3 as published by the + * Free Software Foundation with the addition of the following permission added + * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK + * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY + * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS. + * + * 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 Affero General Public License for more + * details. + * + * You should have received a copy of the GNU Affero General Public License along with + * this program; if not, see http://www.gnu.org/licenses or write to the Free + * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301 USA. + * + * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road, + * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com. + * + * The interactive user interfaces in modified source and object code versions + * of this program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU Affero General Public License version 3. + * + * In accordance with Section 7(b) of the GNU Affero General Public License version 3, + * these Appropriate Legal Notices must retain the display of the "Powered by + * SugarCRM" logo. If the display of the logo is not reasonably feasible for + * technical reasons, the Appropriate Legal Notices must display the words + * "Powered by SugarCRM". + ********************************************************************************/ +SUGAR.email2.templates['viewPrintable'] = '' + +'' + +'' + +'
    ' + +'' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +'
    ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' ' + +' {email.cc}' + +' {email.attachments}' + +'
    ' + +' {app_strings.LBL_EMAIL_FROM}:' + +' ' + +' {email.from_name} <{email.from_addr}>' + +'
    ' + +' {app_strings.LBL_EMAIL_SUBJECT}:' + +' ' + +' {email.name}' + +'
    ' + +' {app_strings.LBL_EMAIL_DATE_SENT_BY_SENDER}:' + +' ' + +' {email.date_start} {email.time_start}' + +'
    ' + +' {app_strings.LBL_EMAIL_TO}:' + +' ' + +' {email.toaddrs}' + +'
    ' + +'
    ' + +' ' + +' ' + +' ' + +' ' + +'
    ' + +'
    ' + + '{email.description}' + +'
    ' + +'
    ' + +'
    ' + +'
    ' + +''; +// End of File modules/Emails/javascript/viewPrintable.js + +/********************************************************************************* + * SugarCRM is a customer relationship management program developed by + * SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc. + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU Affero General Public License version 3 as published by the + * Free Software Foundation with the addition of the following permission added + * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK + * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY + * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS. + * + * 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 Affero General Public License for more + * details. + * + * You should have received a copy of the GNU Affero General Public License along with + * this program; if not, see http://www.gnu.org/licenses or write to the Free + * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301 USA. + * + * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road, + * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com. + * + * The interactive user interfaces in modified source and object code versions + * of this program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU Affero General Public License version 3. + * + * In accordance with Section 7(b) of the GNU Affero General Public License version 3, + * these Appropriate Legal Notices must retain the display of the "Powered by + * SugarCRM" logo. If the display of the logo is not reasonably feasible for + * technical reasons, the Appropriate Legal Notices must display the words + * "Powered by SugarCRM". + ********************************************************************************/ +function enableQS(noReload){YAHOO.util.Event.onDOMReady(function(){if(typeof sqs_objects=='undefined'){return;} +var Dom=YAHOO.util.Dom;var qsFields=Dom.getElementsByClassName('sqsEnabled');for(qsField in qsFields){if(typeof qsFields[qsField]=='function'||typeof qsFields[qsField].id=='undefined'){continue;} +form_id=qsFields[qsField].form.getAttribute('id');if(typeof form_id=='object'&&qsFields[qsField].form.getAttribute('real_id')){form_id=qsFields[qsField].form.getAttribute('real_id');} +qs_index_id=form_id+'_'+qsFields[qsField].name;if(typeof sqs_objects[qs_index_id]=='undefined'){qs_index_id=qsFields[qsField].name;if(typeof sqs_objects[qs_index_id]=='undefined'){continue;}} +if(QSProcessedFieldsArray[qs_index_id]){continue;} +var qs_obj=sqs_objects[qs_index_id];var loaded=false;if(!document.forms[qs_obj.form]){continue;} +if(!document.forms[qs_obj.form].elements[qsFields[qsField].id].readOnly&&qs_obj['disable']!=true){combo_id=qs_obj.form+'_'+qsFields[qsField].id;if(Dom.get(combo_id+"_results")){loaded=true} +if(!loaded){QSProcessedFieldsArray[qs_index_id]=true;qsFields[qsField].form_id=form_id;var sqs=sqs_objects[qs_index_id];var resultDiv=document.createElement('div');resultDiv.id=combo_id+"_results";Dom.insertAfter(resultDiv,qsFields[qsField]);var fields=qs_obj.field_list.slice();fields[fields.length]="module";var ds=new YAHOO.util.DataSource("index.php?",{responseType:YAHOO.util.XHRDataSource.TYPE_JSON,responseSchema:{resultsList:'fields',total:'totalCount',fields:fields,metaNode:"fields",metaFields:{total:'totalCount',fields:"fields"}},connMethodPost:true});var forceSelect=!((qsFields[qsField].form&&typeof(qsFields[qsField].form)=='object'&&qsFields[qsField].form.name=='search_form')||qsFields[qsField].className.match('sqsNoAutofill')!=null);var search=new YAHOO.widget.AutoComplete(qsFields[qsField],resultDiv,ds,{typeAhead:forceSelect,forceSelection:forceSelect,fields:fields,sqs:sqs,animSpeed:0.25,qs_obj:qs_obj,generateRequest:function(sQuery){var out=SUGAR.util.paramsToUrl({to_pdf:'true',module:'Home',action:'quicksearchQuery',data:encodeURIComponent(YAHOO.lang.JSON.stringify(this.sqs)),query:sQuery});return out;},setFields:function(data,filter){for(var i in this.fields){for(var key in this.qs_obj.field_list){if(this.fields[i]==this.qs_obj.field_list[key]&&document.forms[this.qs_obj.form].elements[this.qs_obj.populate_list[key]]&&this.qs_obj.populate_list[key].match(filter)){document.forms[this.qs_obj.form].elements[this.qs_obj.populate_list[key]].value=data[i];}}}},clearFields:function(){for(var key in this.qs_obj.field_list){if(document.forms[this.qs_obj.form].elements[this.qs_obj.populate_list[key]]){document.forms[this.qs_obj.form].elements[this.qs_obj.populate_list[key]].value="";}} +this.oldValue="";}});search.itemSelectEvent.subscribe(function(e,args){var data=args[2];var fields=this.fields;this.setFields(data,/\S/);if(typeof(this.qs_obj['post_onblur_function'])!='undefined'){collection_extended=new Array();for(var i in fields){for(var key in this.qs_obj.field_list){if(fields[i]==this.qs_obj.field_list[key]){collection_extended[this.qs_obj.field_list[key]]=data[i];}}} +eval(this.qs_obj['post_onblur_function']+'(collection_extended, this.qs_obj.id)');}});search.textboxFocusEvent.subscribe(function(){this.oldValue=this.getInputEl().value;});search.selectionEnforceEvent.subscribe(function(e,args){if(this.oldValue!=args[1]){this.clearFields();}else{this.getInputEl().value=this.oldValue;}});search.dataReturnEvent.subscribe(function(e,args){if(this.getInputEl().value.length==0&&args[2].length>0){var data=[];for(var key in this.qs_obj.field_list){data[data.length]=args[2][0][this.qs_obj.field_list[key]];} +this.getInputEl().value=data[this.key];this.itemSelectEvent.fire(this,"",data);}});if(typeof QSFieldsArray[combo_id]=='undefined'&&qsFields[qsField].id){QSFieldsArray[combo_id]=search;}}}}});} +function registerSingleSmartInputListener(input){if((c=input.className)&&(c.indexOf("sqsEnabled")!=-1)){enableQS(true);}} +if(typeof QSFieldsArray=='undefined'){QSFieldsArray=new Array();QSProcessedFieldsArray=new Array();}// End of File include/javascript/quicksearch.js + diff --git a/include/javascript/sugar_grp_overlib.js b/include/javascript/sugar_grp_overlib.js new file mode 100755 index 00000000..d5259a89 --- /dev/null +++ b/include/javascript/sugar_grp_overlib.js @@ -0,0 +1,384 @@ +/* + Artistic License 2.0 + + Copyright (c) 2000-2006, The Perl Foundation. + + Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. + Preamble + + This license establishes the terms under which a given free software Package may be copied, modified, distributed, and/or redistributed. The intent is that the Copyright Holder maintains some artistic control over the development of that Package while still keeping the Package available as open source and free software. + + You are always permitted to make arrangements wholly outside of this license directly with the Copyright Holder of a given Package. If the terms of this license do not permit the full use that you propose to make of the Package, you should contact the Copyright Holder and seek a different licensing arrangement. + Definitions + + "Copyright Holder" means the individual(s) or organization(s) named in the copyright notice for the entire Package. + + "Contributor" means any party that has contributed code or other material to the Package, in accordance with the Copyright Holder's procedures. + + "You" and "your" means any person who would like to copy, distribute, or modify the Package. + + "Package" means the collection of files distributed by the Copyright Holder, and derivatives of that collection and/or of those files. A given Package may consist of either the Standard Version, or a Modified Version. + + "Distribute" means providing a copy of the Package or making it accessible to anyone else, or in the case of a company or organization, to others outside of your company or organization. + + "Distributor Fee" means any fee that you charge for Distributing this Package or providing support for this Package to another party. It does not mean licensing fees. + + "Standard Version" refers to the Package if it has not been modified, or has been modified only in ways explicitly requested by the Copyright Holder. + + "Modified Version" means the Package, if it has been changed, and such changes were not explicitly requested by the Copyright Holder. + + "Original License" means this Artistic License as Distributed with the Standard Version of the Package, in its current version or as it may be modified by The Perl Foundation in the future. + + "Source" form means the source code, documentation source, and configuration files for the Package. + + "Compiled" form means the compiled bytecode, object code, binary, or any other form resulting from mechanical transformation or translation of the Source form. + Permission for Use and Modification Without Distribution + + (1) You are permitted to use the Standard Version and create and use Modified Versions for any purpose without restriction, provided that you do not Distribute the Modified Version. + Permissions for Redistribution of the Standard Version + + (2) You may Distribute verbatim copies of the Source form of the Standard Version of this Package in any medium without restriction, either gratis or for a Distributor Fee, provided that you duplicate all of the original copyright notices and associated disclaimers. At your discretion, such verbatim copies may or may not include a Compiled form of the Package. + + (3) You may apply any bug fixes, portability changes, and other modifications made available from the Copyright Holder. The resulting Package will still be considered the Standard Version, and as such will be subject to the Original License. + Distribution of Modified Versions of the Package as Source + + (4) You may Distribute your Modified Version as Source (either gratis or for a Distributor Fee, and with or without a Compiled form of the Modified Version) provided that you clearly document how it differs from the Standard Version, including, but not limited to, documenting any non-standard features, executables, or modules, and provided that you do at least ONE of the following: + + (a) make the Modified Version available to the Copyright Holder of the Standard Version, under the Original License, so that the Copyright Holder may include your modifications in the Standard Version. + (b) ensure that installation of your Modified Version does not prevent the user installing or running the Standard Version. In addition, the Modified Version must bear a name that is different from the name of the Standard Version. + (c) allow anyone who receives a copy of the Modified Version to make the Source form of the Modified Version available to others under + (i) the Original License or + (ii) a license that permits the licensee to freely copy, modify and redistribute the Modified Version using the same licensing terms that apply to the copy that the licensee received, and requires that the Source form of the Modified Version, and of any works derived from it, be made freely available in that license fees are prohibited but Distributor Fees are allowed. + Distribution of Compiled Forms of the Standard Version or Modified Versions without the Source + + (5) You may Distribute Compiled forms of the Standard Version without the Source, provided that you include complete instructions on how to get the Source of the Standard Version. Such instructions must be valid at the time of your distribution. If these instructions, at any time while you are carrying out such distribution, become invalid, you must provide new instructions on demand or cease further distribution. If you provide valid instructions or cease distribution within thirty days after you become aware that the instructions are invalid, then you do not forfeit any of your rights under this license. + + (6) You may Distribute a Modified Version in Compiled form without the Source, provided that you comply with Section 4 with respect to the Source of the Modified Version. + Aggregating or Linking the Package + + (7) You may aggregate the Package (either the Standard Version or Modified Version) with other packages and Distribute the resulting aggregation provided that you do not charge a licensing fee for the Package. Distributor Fees are permitted, and licensing fees for other components in the aggregation are permitted. The terms of this license apply to the use and Distribution of the Standard or Modified Versions as included in the aggregation. + + (8) You are permitted to link Modified and Standard Versions with other works, to embed the Package in a larger work of your own, or to build stand-alone binary or bytecode versions of applications that include the Package, and Distribute the result without restriction, provided the result does not expose a direct interface to the Package. + Items That are Not Considered Part of a Modified Version + + (9) Works (including, but not limited to, modules and scripts) that merely extend or make use of the Package, do not, by themselves, cause the Package to be a Modified Version. In addition, such works are not considered parts of the Package itself, and are not subject to the terms of this license. + General Provisions + + (10) Any use, modification, and distribution of the Standard or Modified Versions is governed by this Artistic License. By using, modifying or distributing the Package, you accept this license. Do not use, modify, or distribute the Package, if you do not accept this license. + + (11) If your Modified Version has been derived from a Modified Version made by someone other than you, you are nevertheless required to ensure that your Modified Version complies with the requirements of this license. + + (12) This license does not grant you the right to use any trademark, service mark, tradename, or logo of the Copyright Holder. + + (13) This license includes the non-exclusive, worldwide, free-of-charge patent license to make, have made, use, offer to sell, sell, import and otherwise transfer the Package with respect to any patent claims licensable by the Copyright Holder that are necessarily infringed by the Package. If you institute patent litigation (including a cross-claim or counterclaim) against any party alleging that the Package constitutes direct or contributory patent infringement, then this Artistic License to you shall terminate on the date that such litigation is filed. + + (14) Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +var OLloaded=0,pmCnt=1,pMtr=new Array(),OLcmdLine=new Array(),OLrunTime=new Array(),OLv,OLudf,OLpct=new Array("83%","67%","83%","100%","117%","150%","200%","267%"),OLrefXY,OLbubblePI=0,OLcrossframePI=0,OLdebugPI=0,OLdraggablePI=0,OLexclusivePI=0,OLfilterPI=0,OLfunctionPI=0,OLhidePI=0,OLiframePI=0,OLovertwoPI=0,OLscrollPI=0,OLshadowPI=0,OLprintPI=0;if(typeof OLgateOK=='undefined')var OLgateOK=1;var OLp1or2c='inarray,caparray,caption,closetext,right,left,center,autostatuscap,padx,pady,' ++'below,above,vcenter,donothing',OLp1or2co='nofollow,background,offsetx,offsety,fgcolor,' ++'bgcolor,cgcolor,textcolor,capcolor,width,wrap,wrapmax,height,border,base,status,autostatus,' ++'snapx,snapy,fixx,fixy,relx,rely,midx,midy,ref,refc,refp,refx,refy,fgbackground,bgbackground,' ++'cgbackground,fullhtml,capicon,textfont,captionfont,textsize,captionsize,timeout,delay,hauto,' ++'vauto,nojustx,nojusty,fgclass,bgclass,cgclass,capbelow,textpadding,textfontclass,' ++'captionpadding,captionfontclass,sticky,noclose,mouseoff,offdelay,closecolor,closefont,' ++'closesize,closeclick,closetitle,closefontclass,decode',OLp1or2o='text,cap,close,hpos,vpos,' ++'padxl,padxr,padyt,padyb',OLp1co='label',OLp1or2=OLp1or2co+','+OLp1or2o,OLp1=OLp1co+','+'frame';OLregCmds(OLp1or2c+','+OLp1or2co+','+OLp1co);function OLud(v){return eval('typeof ol_'+v+'=="undefined"')?1:0;} +if(OLud('fgcolor'))var ol_fgcolor="#ccccff";if(OLud('bgcolor'))var ol_bgcolor="#333399";if(OLud('cgcolor'))var ol_cgcolor="#333399";if(OLud('textcolor'))var ol_textcolor="#000000";if(OLud('capcolor'))var ol_capcolor="#ffffff";if(OLud('closecolor'))var ol_closecolor="#eeeeff";if(OLud('textfont'))var ol_textfont="Verdana,Arial,Helvetica";if(OLud('captionfont'))var ol_captionfont="Verdana,Arial,Helvetica";if(OLud('closefont'))var ol_closefont="Verdana,Arial,Helvetica";if(OLud('textsize'))var ol_textsize=1;if(OLud('captionsize'))var ol_captionsize=1;if(OLud('closesize'))var ol_closesize=1;if(OLud('fgclass'))var ol_fgclass="";if(OLud('bgclass'))var ol_bgclass="";if(OLud('cgclass'))var ol_cgclass="";if(OLud('textpadding'))var ol_textpadding=2;if(OLud('textfontclass'))var ol_textfontclass="";if(OLud('captionpadding'))var ol_captionpadding=2;if(OLud('captionfontclass'))var ol_captionfontclass="";if(OLud('closefontclass'))var ol_closefontclass="";if(OLud('close'))var ol_close="Close";if(OLud('closeclick'))var ol_closeclick=0;if(OLud('closetitle'))var ol_closetitle="Click to Close";if(OLud('text'))var ol_text="Default Text";if(OLud('cap'))var ol_cap="";if(OLud('capbelow'))var ol_capbelow=0;if(OLud('background'))var ol_background="";if(OLud('width'))var ol_width=200;if(OLud('wrap'))var ol_wrap=0;if(OLud('wrapmax'))var ol_wrapmax=0;if(OLud('height'))var ol_height=-1;if(OLud('border'))var ol_border=1;if(OLud('base'))var ol_base=0;if(OLud('offsetx'))var ol_offsetx=10;if(OLud('offsety'))var ol_offsety=10;if(OLud('sticky'))var ol_sticky=0;if(OLud('nofollow'))var ol_nofollow=0;if(OLud('noclose'))var ol_noclose=0;if(OLud('mouseoff'))var ol_mouseoff=0;if(OLud('offdelay'))var ol_offdelay=300;if(OLud('hpos'))var ol_hpos=RIGHT;if(OLud('vpos'))var ol_vpos=BELOW;if(OLud('status'))var ol_status="";if(OLud('autostatus'))var ol_autostatus=0;if(OLud('snapx'))var ol_snapx=0;if(OLud('snapy'))var ol_snapy=0;if(OLud('fixx'))var ol_fixx=-1;if(OLud('fixy'))var ol_fixy=-1;if(OLud('relx'))var ol_relx=null;if(OLud('rely'))var ol_rely=null;if(OLud('midx'))var ol_midx=null;if(OLud('midy'))var ol_midy=null;if(OLud('ref'))var ol_ref="";if(OLud('refc'))var ol_refc='UL';if(OLud('refp'))var ol_refp='UL';if(OLud('refx'))var ol_refx=0;if(OLud('refy'))var ol_refy=0;if(OLud('fgbackground'))var ol_fgbackground="";if(OLud('bgbackground'))var ol_bgbackground="";if(OLud('cgbackground'))var ol_cgbackground="";if(OLud('padxl'))var ol_padxl=1;if(OLud('padxr'))var ol_padxr=1;if(OLud('padyt'))var ol_padyt=1;if(OLud('padyb'))var ol_padyb=1;if(OLud('fullhtml'))var ol_fullhtml=0;if(OLud('capicon'))var ol_capicon="";if(OLud('frame'))var ol_frame=self;if(OLud('timeout'))var ol_timeout=0;if(OLud('delay'))var ol_delay=0;if(OLud('hauto'))var ol_hauto=0;if(OLud('vauto'))var ol_vauto=0;if(OLud('nojustx'))var ol_nojustx=0;if(OLud('nojusty'))var ol_nojusty=0;if(OLud('label'))var ol_label="";if(OLud('decode'))var ol_decode=0;if(OLud('texts'))var ol_texts=new Array("Text 0","Text 1");if(OLud('caps'))var ol_caps=new Array("Caption 0","Caption 1");var o3_text="",o3_cap="",o3_sticky=0,o3_nofollow=0,o3_background="",o3_noclose=0,o3_mouseoff=0,o3_offdelay=300,o3_hpos=RIGHT,o3_offsetx=10,o3_offsety=10,o3_fgcolor="",o3_bgcolor="",o3_cgcolor="",o3_textcolor="",o3_capcolor="",o3_closecolor="",o3_width=200,o3_wrap=0,o3_wrapmax=0,o3_height=-1,o3_border=1,o3_base=0,o3_status="",o3_autostatus=0,o3_snapx=0,o3_snapy=0,o3_fixx=-1,o3_fixy=-1,o3_relx=null,o3_rely=null,o3_midx=null,o3_midy=null,o3_ref="",o3_refc='UL',o3_refp='UL',o3_refx=0,o3_refy=0,o3_fgbackground="",o3_bgbackground="",o3_cgbackground="",o3_padxl=0,o3_padxr=0,o3_padyt=0,o3_padyb=0,o3_fullhtml=0,o3_vpos=BELOW,o3_capicon="",o3_textfont="Verdana,Arial,Helvetica",o3_captionfont="",o3_closefont="",o3_textsize=1,o3_captionsize=1,o3_closesize=1,o3_frame=self,o3_timeout=0,o3_delay=0,o3_hauto=0,o3_vauto=0,o3_nojustx=0,o3_nojusty=0,o3_close="",o3_closeclick=0,o3_closetitle="",o3_fgclass="",o3_bgclass="",o3_cgclass="",o3_textpadding=2,o3_textfontclass="",o3_captionpadding=2,o3_captionfontclass="",o3_closefontclass="",o3_capbelow=0,o3_label="",o3_decode=0,CSSOFF=DONOTHING,CSSCLASS=DONOTHING,OLdelayid=0,OLtimerid=0,OLshowid=0,OLndt=0,over=null,OLfnRef="",OLhover=0,OLx=0,OLy=0,OLshowingsticky=0,OLallowmove=0,OLcC=null,OLua=navigator.userAgent.toLowerCase(),OLns4=(navigator.appName=='Netscape'&&parseInt(navigator.appVersion)==4),OLns6=(document.getElementById)?1:0,OLie4=(document.all)?1:0,OLgek=(OLv=OLua.match(/gecko\/(\d{8})/i))?parseInt(OLv[1]):0,OLmac=(OLua.indexOf('mac')>=0)?1:0,OLsaf=(OLua.indexOf('safari')>=0)?1:0,OLkon=(OLua.indexOf('konqueror')>=0)?1:0,OLkht=(OLsaf||OLkon)?1:0,OLopr=(OLua.indexOf('opera')>=0)?1:0,OLop7=(OLopr&&document.createTextNode)?1:0;if(OLopr){OLns4=OLns6=0;if(!OLop7)OLie4=0;} +var OLieM=((OLie4&&OLmac)&&!(OLkht||OLopr))?1:0,OLie5=0,OLie55=0;if(OLie4&&!OLop7){if((OLv=OLua.match(/msie (\d\.\d+)\.*/i))&&(OLv=parseFloat(OLv[1]))>=5.0){OLie5=1;OLns6=0;if(OLv>=5.5)OLie55=1;}if(OLns6)OLie4=0;} +if(OLns4)window.onresize=function(){location.reload();} +var OLchkMh=1,OLdw;if(OLns4||OLie4||OLns6)OLmh();else{overlib=nd=cClick=OLpageDefaults=no_overlib;} +function overlib(){if(!(OLloaded&&OLgateOK))return;if((OLexclusivePI)&&OLisExclusive(arguments))return true;if(OLchkMh)OLmh();if(OLndt&&!OLtimerid)OLndt=0;if(over)cClick();OLload(OLp1or2);OLload(OLp1);OLfnRef="";OLhover=0;OLsetRunTimeVar();OLparseTokens('o3_',arguments);if(!(over=OLmkLyr()))return false;if(o3_decode)OLdecode();if(OLprintPI)OLchkPrint();if(OLbubblePI)OLchkForBubbleEffect();if(OLdebugPI)OLsetDebugCanShow();if(OLshadowPI)OLinitShadow();if(OLiframePI)OLinitIfs();if(OLfilterPI)OLinitFilterLyr();if(OLexclusivePI&&o3_exclusive&&o3_exclusivestatus!="")o3_status=o3_exclusivestatus;else if(o3_autostatus==2&&o3_cap!="")o3_status=o3_cap;else if(o3_autostatus==1&&o3_text!="")o3_status=o3_text;if(!o3_delay){return OLmain();}else{OLdelayid=setTimeout("OLmain()",o3_delay);if(o3_status!=""){self.status=o3_status;return true;} +else if(!(OLop7&&event&&event.type=='mouseover'))return false;}} +function nd(time){if(OLloaded&&OLgateOK){if(!((OLexclusivePI)&&OLisExclusive())){if(time&&over&&!o3_delay){if(OLtimerid>0)clearTimeout(OLtimerid);OLtimerid=(OLhover&&o3_frame==self&&!OLcursorOff())?0:setTimeout("cClick()",(o3_timeout=OLndt=time));}else{if(!OLshowingsticky){OLallowmove=0;if(over)OLhideObject(over);}}}} +return false;} +function cClick(){if(OLloaded&&OLgateOK){OLhover=0;if(over){if(OLovertwoPI&&over==over2)cClick2();OLhideObject(over);OLshowingsticky=0;}} +return false;} +function OLpageDefaults(){OLparseTokens('ol_',arguments);} +function no_overlib(){return false;} +function OLmain(){o3_delay=0;if(o3_frame==self){if(o3_noclose)OLoptMOUSEOFF(0);else if(o3_mouseoff)OLoptMOUSEOFF(1);} +if(o3_sticky)OLshowingsticky=1;OLdoLyr();OLallowmove=0;if(o3_timeout>0){if(OLtimerid>0)clearTimeout(OLtimerid);OLtimerid=setTimeout("cClick()",o3_timeout);} +if(o3_ref){OLrefXY=OLgetRefXY(o3_ref);if(OLrefXY[0]==null){o3_ref="";o3_midx=0;o3_midy=0;}} +OLdisp(o3_status);if(OLdraggablePI)OLcheckDrag();if(o3_status!="")return true;else if(!(OLop7&&event&&event.type=='mouseover'))return false;} +function OLload(c){var i,m=c.split(',');for(i=0;i
    ');d=fd.all[id];}else{d=fd.createElement('div');if(d){d.id=id;fd.body.appendChild(d);}}if(!d)return null;if(OLns4)d.zIndex=z;else{var o=d.style;o.position='absolute';o.visibility='hidden';o.zIndex=z;}} +return d;} +function OLdoLyr(){if(o3_background==''&&!o3_fullhtml){if(o3_fgbackground!='')o3_fgbackground=' background="'+o3_fgbackground+'"';if(o3_bgbackground!='')o3_bgbackground=' background="'+o3_bgbackground+'"';if(o3_cgbackground!='')o3_cgbackground=' background="'+o3_cgbackground+'"';if(o3_fgcolor!='')o3_fgcolor=' bgcolor="'+o3_fgcolor+'"';if(o3_bgcolor!='')o3_bgcolor=' bgcolor="'+o3_bgcolor+'"';if(o3_cgcolor!='')o3_cgcolor=' bgcolor="'+o3_cgcolor+'"';if(o3_height>0)o3_height=' height="'+o3_height+'"';else o3_height='';} +if(!OLns4)OLrepositionTo(over,(OLns6?20:0),0);var lyrHtml=OLdoLGF();if(o3_sticky&&OLtimerid>0){clearTimeout(OLtimerid);OLtimerid=0;} +if(o3_wrap&&!o3_fullhtml){OLlayerWrite(lyrHtml);o3_width=(OLns4?over.clip.width:over.offsetWidth);if(OLns4&&o3_wrapmax<1)o3_wrapmax=o3_frame.innerWidth-40;o3_wrap=0;if(o3_wrapmax>0&&o3_width>o3_wrapmax)o3_width=o3_wrapmax;lyrHtml=OLdoLGF();} +OLlayerWrite(lyrHtml);o3_width=(OLns4?over.clip.width:over.offsetWidth);if(OLbubblePI)OLgenerateBubble(lyrHtml);} +function OLcontentSimple(txt){var t=OLbgLGF()+OLfgLGF(txt)+OLbaseLGF();OLsetBackground('');return t;} +function OLcontentCaption(txt,title,close){var closing=(OLprintPI?OLprintCapLGF():''),closeevent='onmouseover',caption,t,cC='javascript:return '+OLfnRef+(OLovertwoPI&&over==over2?'cClick2();':'cClick();');if(o3_closeclick)closeevent=(o3_closetitle?'title="'+o3_closetitle+'" ':'')+'onclick';if(o3_capicon!='')o3_capicon=' ';if(close){closing+='':'>'+OLlgfUtil(0,'','span',o3_closecolor,o3_closefont,o3_closesize))+close ++(o3_closefontclass?'':OLlgfUtil(1,'','span'))+'';} +caption='':'>')+(o3_captionfontclass?'
    ':'' ++OLlgfUtil(0,'','',o3_capcolor,o3_captionfont,o3_captionsize))+o3_capicon+title ++OLlgfUtil(1,'','')+(o3_captionfontclass?'':'')+closing+'
    ';t=OLbgLGF()+(o3_capbelow?OLfgLGF(txt)+caption:caption+OLfgLGF(txt))+OLbaseLGF();OLsetBackground('');return t;} +function OLcontentBackground(txt,image,hasfullhtml){var t;if(hasfullhtml){t=txt;}else{t='' ++OLlgfUtil(0,o3_textfontclass,'div',o3_textcolor,o3_textfont,o3_textsize)+txt+ +OLlgfUtil(1,'','div')+'';} +OLsetBackground(image);return t;} +function OLbgLGF(){return'';} +function OLfgLGF(t){return'' ++OLlgfUtil(0,o3_textfontclass,'div',o3_textcolor,o3_textfont,o3_textsize)+t ++(OLprintPI?OLprintFgLGF():'')+OLlgfUtil(1,'','div')+'';} +function OLlgfUtil(end,tfc,ele,col,fac,siz){if(end)return('');else return(tfc?'
    ':('<'+(OLns4?'font color="'+col+'" face="'+OLquoteMultiNameFonts(fac)+'" size="'+siz:ele ++' style="color:'+col+';font-family:'+OLquoteMultiNameFonts(fac)+';font-size:'+siz+';' ++(ele=='span'?'text-decoration:underline;':''))+'">'));} +function OLquoteMultiNameFonts(f){var i,v,pM=f.split(',');for(i=0;i0&&!o3_wrap)?('
    '):'')+'';} +function OLwd(a){return(o3_wrap?'':' width="'+(!a?'100%':(a==1?o3_width:(o3_width-o3_padxl-o3_padxr)))+'"');} +function OLsetBackground(i){if(i==''){if(OLns4)over.background.src=null;else{if(OLns6)over.style.width='';over.style.backgroundImage='none';}}else{if(OLns4)over.background.src=i;else{if(OLns6)over.style.width=o3_width+'px';over.style.backgroundImage='url('+i+')';}}} +function OLdisp(s){if(!OLallowmove){if(OLshadowPI)OLdispShadow();if(OLiframePI)OLdispIfs();OLplaceLayer();if(OLndt)OLshowObject(over);else OLshowid=setTimeout("OLshowObject(over)",1);OLallowmove=(o3_sticky||o3_nofollow)?0:1;}OLndt=0;if(s!="")self.status=s;} +function OLplaceLayer(){var snp,X,Y,pgLeft,pgTop,pWd=o3_width,pHt,iWd=100,iHt=100,SB=0,LM=0,CX=0,TM=0,BM=0,CY=0,o=OLfd(),nsb=(OLgek>=20010505&&!o3_frame.scrollbars.visible)?1:0;if(!OLkht&&o&&o.clientWidth)iWd=o.clientWidth;else if(o3_frame.innerWidth){SB=Math.ceil(1.4*(o3_frame.outerWidth-o3_frame.innerWidth));if(SB>20)SB=20;iWd=o3_frame.innerWidth;} +pgLeft=(OLie4)?o.scrollLeft:o3_frame.pageXOffset;if(OLie55&&OLfilterPI&&o3_filter&&o3_filtershadow)SB=CX=5;else +if((OLshadowPI)&&bkdrop&&o3_shadow&&o3_shadowx){SB+=((o3_shadowx>0)?o3_shadowx:0);LM=((o3_shadowx<0)?Math.abs(o3_shadowx):0);CX=Math.abs(o3_shadowx);} +if(o3_ref!=""||o3_fixx>-1||o3_relx!=null||o3_midx!=null){if(o3_ref!=""){X=OLrefXY[0];if(OLie55&&OLfilterPI&&o3_filter&&o3_filtershadow){if(o3_refp=='UR'||o3_refp=='LR')X-=5;} +else if((OLshadowPI)&&bkdrop&&o3_shadow&&o3_shadowx){if(o3_shadowx<0&&(o3_refp=='UL'||o3_refp=='LL'))X-=o3_shadowx;else +if(o3_shadowx>0&&(o3_refp=='UR'||o3_refp=='LR'))X-=o3_shadowx;}}else{if(o3_midx!=null){X=parseInt(pgLeft+((iWd-pWd-SB-LM)/2)+o3_midx);}else{if(o3_relx!=null){if(o3_relx>=0)X=pgLeft+o3_relx+LM;else X=pgLeft+o3_relx+iWd-pWd-SB;}else{X=o3_fixx+LM;}}}}else{if(o3_hauto){if(o3_hpos==LEFT&&OLx-pgLeftiWd/2&&OLx+pWd+o3_offsetx>pgLeft+iWd-SB)o3_hpos=LEFT;} +X=(o3_hpos==CENTER)?parseInt(OLx-((pWd+CX)/2)+o3_offsetx):(o3_hpos==LEFT)?OLx-o3_offsetx-pWd:OLx+o3_offsetx;if(o3_snapx>1){snp=X%o3_snapx;if(o3_hpos==LEFT){X=X-(o3_snapx+snp);}else{X=X+(o3_snapx-snp);}}} +if(!o3_nojustx&&X+pWd>pgLeft+iWd-SB) +X=iWd+pgLeft-pWd-SB;if(!o3_nojustx&&X-LM0)?o3_shadowy:0;CY=Math.abs(o3_shadowy);} +if(o3_ref!=""||o3_fixy>-1||o3_rely!=null||o3_midy!=null){if(o3_ref!=""){Y=OLrefXY[1];if(OLie55&&OLfilterPI&&o3_filter&&o3_filtershadow){if(o3_refp=='LL'||o3_refp=='LR')Y-=5;}else if((OLshadowPI)&&bkdrop&&o3_shadow&&o3_shadowy){if(o3_shadowy<0&&(o3_refp=='UL'||o3_refp=='UR'))Y-=o3_shadowy;else +if(o3_shadowy>0&&(o3_refp=='LL'||o3_refp=='LR'))Y-=o3_shadowy;}}else{if(o3_midy!=null){Y=parseInt(pgTop+((iHt-pHt-CY)/2)+o3_midy);}else{if(o3_rely!=null){if(o3_rely>=0)Y=pgTop+o3_rely+TM;else Y=pgTop+o3_rely+iHt-pHt-BM;}else{Y=o3_fixy+TM;}}}}else{if(o3_vauto){if(o3_vpos==ABOVE&&OLy-pgTopiHt/2&&OLy+pHt+o3_offsety+((OLns4||OLkht)?17:0)>pgTop+iHt-BM) +o3_vpos=ABOVE;}Y=(o3_vpos==VCENTER)?parseInt(OLy-((pHt+CY)/2)+o3_offsety):(o3_vpos==ABOVE)?OLy-(pHt+o3_offsety+BM):OLy+o3_offsety+TM;if(o3_snapy>1){snp=Y%o3_snapy;if(pHt>0&&o3_vpos==ABOVE){Y=Y-(o3_snapy+snp);}else{Y=Y+(o3_snapy-snp);}}} +if(!o3_nojusty&&Y+pHt+BM>pgTop+iHt)Y=pgTop+iHt-pHt-BM;if(!o3_nojusty&&Y-TM1){ob=o[0];rXY[0]+=o[0].x+o[1].pageX;rXY[1]+=o[0].y+o[1].pageY;}else{if((o.toString().indexOf('Image')!=-1)||(o.toString().indexOf('Anchor')!=-1)){rXY[0]+=o.x;rXY[1]+=o.y;}else{rXY[0]+=o.pageX;rXY[1]+=o.pageY;}}}else{rXY[0]+=OLpageLoc(o,'Left');rXY[1]+=OLpageLoc(o,'Top');} +of=OLgetRefOffsets(ob);rXY[0]+=of[0];rXY[1]+=of[1];return rXY;} +function OLgetRef(l){var r=OLgetRefById(l);return(r)?r:OLgetRefByName(l);} +function OLgetRefById(l,d){var r="",j;l=(l||'overDiv');d=(d||o3_frame.document);if(OLie4&&d.all){return d.all[l];}else if(d.getElementById){return d.getElementById(l);}else if(d.layers&&d.layers.length>0){if(d.layers[l])return d.layers[l];for(j=0;j0){for(j=0;j0)return r;else if(r)return[r,d.layers[j]];}} +return null;} +function OLgetRefOffsets(o){var c=o3_refc.toUpperCase(),p=o3_refp.toUpperCase(),W=0,H=0,pW=0,pH=0,of=[0,0];pW=(OLbubblePI&&o3_bubble)?o3_width:OLns4?over.clip.width:over.offsetWidth;pH=(OLbubblePI&&o3_bubble)?OLbubbleHt:OLns4?over.clip.height:over.offsetHeight;if((!OLop7)&&o.toString().indexOf('Image')!=-1){W=o.width;H=o.height;}else if((!OLop7)&&o.toString().indexOf('Anchor')!=-1){c=o3_refc='UL';}else{W=(OLns4)?o.clip.width:o.offsetWidth;H=(OLns4)?o.clip.height:o.offsetHeight;} +if((OLns4||(OLns6&&OLgek))&&o.border){W+=2*parseInt(o.border);H+=2*parseInt(o.border);} +if(c=='UL'){of=(p=='UR')?[-pW,0]:(p=='LL')?[0,-pH]:(p=='LR')?[-pW,-pH]:[0,0];}else if(c=='UR'){of=(p=='UR')?[W-pW,0]:(p=='LL')?[W,-pH]:(p=='LR')?[W-pW,-pH]:[W,0];}else if(c=='LL'){of=(p=='UR')?[-pW,H]:(p=='LL')?[0,H-pH]:(p=='LR')?[-pW,H-pH]:[0,H];}else if(c=='LR'){of=(p=='UR')?[W-pW,H]:(p=='LL')?[W,H-pH]:(p=='LR')?[W-pW,H-pH]:[W,H];} +return of;} +function OLpageLoc(o,t){var l=0;while(o.offsetParent&&o.offsetParent.tagName.toLowerCase()!='html'){l+=o['offset'+t];o=o.offsetParent;}l+=o['offset'+t];return l;} +function OLmouseMove(e){var e=(e||event);OLcC=(OLovertwoPI&&over2&&over==over2?cClick2:cClick);OLx=(e.pageX||e.clientX+OLfd().scrollLeft);OLy=(e.pageY||e.clientY+OLfd().scrollTop);if((OLallowmove&&over)&&(o3_frame==self||over==OLgetRefById())){OLplaceLayer();if(OLhidePI)OLhideUtil(0,1,1,0,0,0);} +if(OLhover&&over&&o3_frame==self&&OLcursorOff())if(o3_offdelay<1)OLcC();else +{if(OLtimerid>0)clearTimeout(OLtimerid);OLtimerid=setTimeout("OLcC()",o3_offdelay);}} +function OLmh(){var fN,f,j,k,s,mh=OLmouseMove,w=(OLns4&&window.onmousemove),re=/function[ ]*(\w*)\(/;OLdw=document;if(document.onmousemove||w){if(w)OLdw=window;f=OLdw.onmousemove.toString();fN=f.match(re);if(!fN||fN[1]=='anonymous'||fN[1]=='OLmouseMove'){OLchkMh=0;return;} +if(fN[1])s=fN[1]+'(e)';else{j=f.indexOf('{');k=f.lastIndexOf('}')+1;s=f.substring(j,k);} +s+=';OLmouseMove(e);';mh=new Function('e',s);} +OLdw.onmousemove=mh;if(OLns4)OLdw.captureEvents(Event.MOUSEMOVE);} +function OLparseTokens(pf,ar){var i,v,md=-1,par=(pf!='ol_'),p=OLpar,q=OLparQuo,t=OLtoggle;OLudf=(par&&!ar.length?1:0);for(i=0;i=0)?1:0');} +function OLhasDims(s){return/[%\-a-z]+$/.test(s);} +function OLfontSize(){var i;if(OLhasDims(o3_textsize)){if(OLns4)o3_textsize="2";}else +if(!OLns4){i=parseInt(o3_textsize);o3_textsize=(i>0&&i<8)?OLpct[i]:OLpct[0];} +if(OLhasDims(o3_captionsize)){if(OLns4)o3_captionsize="2";}else +if(!OLns4){i=parseInt(o3_captionsize);o3_captionsize=(i>0&&i<8)?OLpct[i]:OLpct[0];} +if(OLhasDims(o3_closesize)){if(OLns4)o3_closesize="2";}else +if(!OLns4){i=parseInt(o3_closesize);o3_closesize=(i>0&&i<8)?OLpct[i]:OLpct[0];} +if(OLprintPI)OLprintDims();} +function OLdecode(){var re=/%[0-9A-Fa-f]{2,}/,t=o3_text,c=o3_cap,u=unescape,d=!OLns4&&(!OLgek||OLgek>=20020826)&&typeof decodeURIComponent?decodeURIComponent:u;if(typeof(window.TypeError)=='function'){if(re.test(t)){eval(new Array('try{','o3_text=d(t);','}catch(e){','o3_text=u(t);','}').join('\n'))};if(c&&re.test(c)){eval(new Array('try{','o3_cap=d(c);','}catch(e){','o3_cap=u(c);','}').join('\n'))}}else{if(re.test(t))o3_text=u(t);if(c&&re.test(c))o3_cap=u(c);}} +function OLlayerWrite(t){t+="\n";if(OLns4){over.document.write(t);over.document.close();}else if(typeof over.innerHTML!='undefined'){if(OLieM)over.innerHTML='';over.innerHTML=t;}else{range=o3_frame.document.createRange();range.setStartAfter(over);domfrag=range.createContextualFragment(t);while(over.hasChildNodes()){over.removeChild(over.lastChild);} +over.appendChild(domfrag);} +if(OLprintPI)over.print=o3_print?t:null;} +function OLshowObject(o){OLshowid=0;o=(OLns4)?o:o.style;if(((OLfilterPI)&&!OLchkFilter(o))||!OLfilterPI)o.visibility="visible";if(OLshadowPI)OLshowShadow();if(OLiframePI)OLshowIfs();if(OLhidePI)OLhideUtil(1,1,0);} +function OLhideObject(o){if(OLshowid>0){clearTimeout(OLshowid);OLshowid=0;} +if(OLtimerid>0)clearTimeout(OLtimerid);if(OLdelayid>0)clearTimeout(OLdelayid);OLtimerid=0;OLdelayid=0;self.status="";o3_label=ol_label;if(o3_frame!=self)o=OLgetRefById();if(o){if(o.onmouseover)o.onmouseover=null;if(OLscrollPI&&o==over)OLclearScroll();if(OLdraggablePI)OLclearDrag();if(OLfilterPI)OLcleanupFilter(o);if(OLshadowPI)OLhideShadow();var os=(OLns4)?o:o.style;os.visibility="hidden";if(OLhidePI&&o==over)OLhideUtil(0,0,1);if(OLiframePI)OLhideIfs(o);}} +function OLrepositionTo(o,xL,yL){o=(OLns4)?o:o.style;if(o.setAttribute){o.setAttribute('left',OLns4?xL:xL+'px');o.setAttribute('top',OLns4?yL:yL+'px');}else{o.left=(OLns4?xL:xL+'px');o.top=(OLns4?yL:yL+'px');}} +function OLoptMOUSEOFF(c){if(!c)o3_close="";over.onmouseover=function(){OLhover=1;if(OLtimerid>0){clearTimeout(OLtimerid);OLtimerid=0;}}} +function OLcursorOff(){var o=(OLns4?over:over.style),pHt=OLns4?over.clip.height:over.offsetHeight,left=parseInt(o.left),top=parseInt(o.top),right=left+o3_width,bottom=top+((OLbubblePI&&o3_bubble)?OLbubbleHt:pHt);if(OLxright||OLybottom)return true;return false;} +function OLsetRunTimeVar(){if(OLrunTime.length)for(var k=0;k-1){i=j;break;}}} +return i;} +function OLregCmds(c){if(typeof c!='string')return;var pM=c.split(',');pMtr=pMtr.concat(pM);for(var i=0;i" + + // remove button + "" + + // file icon + "" + + // hidden id field + "" + + // file name + ((ret.nameForDisplay != null) ? ret.nameForDisplay + " " : ret.name + " ") + + "
    " + + "
    "; + overall.innerHTML += out; + if(SUGAR.email2.util.isIe()) { + document.getElementById('addedFiles' + idx).innerHTML = document.getElementById('addedFiles' + idx).innerHTML; + } + + // hide popup + SUGAR.email2.addFileDialog.hide(); + // focus attachments + SUGAR.email2.composeLayout.showAttachmentPanel(idx); + } +}; + + +/////////////////////////////////////////////////////////////////////////// +//// PER MODULE CALLBACK OBJECTS +AjaxObject.accounts = { + saveOutboundCleanup : function(o) { + SUGAR.email2.accounts.refreshOuboundAccountTable(); + SUGAR.email2.accounts.outboundDialog.hide(); + var id = o.responseText; + SUGAR.email2.accounts.newAddedOutboundId = id; + }, + saveDefaultOutboundCleanup: function(o){ + + }, + callbackEditOutbound : { + success : function(o) + { + var ret = JSON.parse(o.responseText); + // show overlay + SUGAR.email2.accounts.showAddSmtp(); + + // fill values + document.getElementById("mail_id").value = ret.id; + document.getElementById("type").value = ret.type; + document.getElementById("mail_sendtype").value = ret.mail_sendtype; + document.getElementById("mail_name").value = ret.name; + document.getElementById("mail_smtpserver").value = ret.mail_smtpserver; + document.getElementById("outboundEmailForm").mail_smtptype.value = ret.mail_smtptype; + document.getElementById("mail_smtpport").value = ret.mail_smtpport; + document.getElementById("mail_smtpuser").value = ret.mail_smtpuser; + document.getElementById("mail_smtppass").value = ret.mail_smtppass; + document.getElementById("mail_smtpauth_req").checked = (ret.mail_smtpauth_req == 1) ? true : false; + SUGAR.email2.accounts.smtp_authenticate_field_display(); + document.getElementById("mail_smtpssl").options[ret.mail_smtpssl].selected = true; + + if(ret.type == 'system-override') { + SUGAR.email2.accounts.toggleOutboundAccountDisabledFields(true); + SUGAR.email2.accounts.changeEmailScreenDisplay(ret.mail_smtptype,true); + } + else { + SUGAR.email2.accounts.toggleOutboundAccountDisabledFields(false); + SUGAR.email2.accounts.changeEmailScreenDisplay(ret.mail_smtptype,false); + } + + + }, + failure : AjaxObject.handleFailure, + timeout : AjaxObject.timeout, + scope : AjaxObject + }, + callbackDeleteOutbound : { + success : function(o) { + var ret = JSON.parse(o.responseText); + if(ret.is_error) + { + if(confirm(ret.error_message)) + { + overlay(app_strings.LBL_EMAIL_IE_DELETE, app_strings.LBL_EMAIL_ONE_MOMENT); + AjaxObject.startRequest(AjaxObject.accounts.callbackDeleteOutbound, urlStandard + "&emailUIAction=deleteOutbound&confirm=true&outbound_email=" + ret.outbound_email); + } + else + hideOverlay(); + } + else + { + hideOverlay(); + SUGAR.email2.accounts.refreshOuboundAccountTable(); + } + }, + + failure : AjaxObject.handleFailure, + timeout : AjaxObject.timeout, + scope : AjaxObject + }, + + callbackCheckMailProgress : { + success : function(o) { + if (typeof(SUGAR.email2.accounts.totalMsgCount) == "undefined") { + SUGAR.email2.accounts.totalMsgCount = -1; + } + + //Check for server timeout / errors + var ret = JSON.parse(o.responseText); + var done = false; + + if (typeof(o.responseText) == 'undefined' || o.responseText == "" || ret == false) { + hideOverlay(); + overlay(app_strings.LBL_EMAIL_ERROR_DESC, app_strings.LBL_EMAIL_ERROR_TIMEOUT, 'alert'); + SUGAR.email2.accounts.totalMsgCount = -1; + //SUGAR.email2.folders.rebuildFolders(); + done = true; + } + + var currIeId = ret['ieid']; + + + var serverCount = ret.count; + + if (ret['status'] == 'done') { + for(i=0; i < SUGAR.email2.accounts.ieIds.length; i++) { + if (i == SUGAR.email2.accounts.ieIds.length - 1) { + //We are all done + done = true; + break; + } else if (SUGAR.email2.accounts.ieIds[i] == currIeId) { + //Go to next account + currIeId = SUGAR.email2.accounts.ieIds[i+1]; + ret.count = 0; + SUGAR.email2.accounts.totalMsgCount = -1; + break; + } + } + } + else if (ret.mbox && ret.totalcount && ret.count) { + SUGAR.email2.accounts.totalMsgCount = ret.totalcount; + if (ret.count >= ret.totalcount) { + serverCount = 0; + } + } else if (SUGAR.email2.accounts.totalMsgCount < 0 && ret.totalcount) { + SUGAR.email2.accounts.totalMsgCount = ret.totalcount; + } else { + hideOverlay(); + overlay(app_strings.LBL_EMAIL_ERROR_DESC, app_strings.LBL_EMAIL_ERROR_TIMEOUT, 'alert'); + SUGAR.email2.accounts.totalMsgCount = -1; + done = true; + } + + if (done) { + SUGAR.email2.accounts.totalMsgCount = -1; + hideOverlay(); + SUGAR.email2.folders.rebuildFolders(); + SE.listView.refreshGrid(); + } else if (SUGAR.email2.accounts.totalMsgCount < 0) { + YAHOO.SUGAR.MessageBox.updateProgress(0, mod_strings.LBL_CHECKING_ACCOUNT + ' '+ (i + 2) + ' '+ mod_strings.LBL_OF + ' ' + SUGAR.email2.accounts.ieIds.length); + AjaxObject.startRequest(AjaxObject.accounts.callbackCheckMailProgress, urlStandard + + '&emailUIAction=checkEmailProgress&ieId=' + currIeId + "¤tCount=0&synch=" + ret.synch); + } else { + YAHOO.SUGAR.MessageBox.updateProgress((ret.count / SUGAR.email2.accounts.totalMsgCount) * 100, + app_strings.LBL_EMAIL_DOWNLOAD_STATUS.replace(/\[\[count\]\]/, ret.count).replace(/\[\[total\]\]/, SUGAR.email2.accounts.totalMsgCount)); + AjaxObject.startRequest(AjaxObject.accounts.callbackCheckMailProgress, urlStandard + + '&emailUIAction=checkEmailProgress&ieId=' + currIeId + "¤tCount=" + serverCount + + '&mbox=' + ret.mbox + '&synch=' + ret.synch + '&totalcount=' + SUGAR.email2.accounts.totalMsgCount); + } + }, + failure : AjaxObject.handleFailure, + timeout : AjaxObject.timeout, + scope : AjaxObject + } +}; + +/////////////////////////////////////////////////////////////////////////////// +//// COMPOSE LAYOUT +AjaxObject.composeLayout = { + /** + * Populates the record id + */ + saveDraftCleanup : function(o) { + hideOverlay(); + var ret = JSON.parse(o.responseText); + if(ret) + SUGAR.email2.composeLayout.forceCloseCompose(ret.composeLayoutId); + else if (o.responseText) + overlay(mod_strings.LBL_ERROR_SAVING_DRAFT, o.responseText, 'alert'); + } +}; + +AjaxObject.composeLayout.callback = { + saveDraft : { + success : AjaxObject.composeLayout.saveDraftCleanup, + failure : AjaxObject.handleFailure, + timeout : AjaxObject.timeout, + scope : AjaxObject + } +}; + +AjaxObject.detailView = { + /** + * Pops-up a printable view of an email + */ + displayPrintable : function(o) { + var ret = JSON.parse(o.responseText); + var displayTemplate = new YAHOO.SUGAR.Template(SUGAR.email2.templates['viewPrintable']); + // 2 below must be in global context + meta = ret.meta; + meta['panelId'] = SUGAR.email2.util.getPanelId(); + email = ret.meta.email; + if (typeof(email.cc) == 'undefined') { + email.cc = ""; + } + + var out = displayTemplate.exec({ + 'app_strings' : app_strings, + 'theme' : theme, + 'idx' : 'Preview', + 'meta' : meta, + 'email' : meta.email + }); + + // open popup window + var popup = window.open('modules/Emails/templates/_blank.html', 'printwin' , + 'scrollbars=yes,menubar=no,height=600,width=800,resizable=yes,toolbar=no,location=no,status=no'); + + popup.document.write(out); + popup.document.close(); + }, + + /** + * Takes formatted response and creates a modal pop-over containing a title and content + */ + displayView : function(o) { + var SED = SUGAR.email2.detailView; + var ret = JSON.parse(o.responseText); + + if(!SED.viewDialog) { + SED.viewDialog = new YAHOO.widget.Dialog("viewDialog", { + modal:true, + visible:true, + fixedcenter:true, + constraintoviewport: true, + shadow : true + }); + SED.viewDialog.renderEvent.subscribe(function() { + var content = this.body.firstChild; + var viewH = YAHOO.util.Dom.getViewportHeight(); + if (content) { + this.body.style.overflow = "auto"; + this.body.style.width = "800px"; + this.body.style.height = (viewH - 75 > content.clientHeight ? (content.clientHeight) : (viewH - 75)) + "px"; + } + }, SED.viewDialog); + } // end lazy load + SED.viewDialog.setHeader(ret.title); + SED.viewDialog.setBody(ret.html); + SED.viewDialog.render(); + SED.viewDialog.show(); + }, + + /** + * Generates a modal popup to populate with the contents of bean's full EditView + */ + showQuickCreateForm : function(o) { + var SED = SUGAR.email2.detailView; + var ret = JSON.parse(o.responseText); + + if(!SED.quickCreateDialog) { + SED.quickCreateDialog = new YAHOO.widget.Dialog("quickCreate", { + modal:true, + visible:true, + fixedcenter:true, + constraintoviewport: true, + shadow : true + }); + + SED.quickCreateDialog.renderEvent.subscribe(function() { + var viewH = YAHOO.util.Dom.getViewportHeight(); + var contH = 0; + for (var i in this.body.childNodes) { + if (this.body.childNodes[i].clientHeight) { + contH += this.body.childNodes[i].clientHeight; + } else if (this.body.childNodes[i].offsetHeight) { + contH += this.body.childNodes[i].offsetHeight; + } // if + } + this.body.style.width = "800px"; + this.body.style.height = (viewH - 75 > contH ? (contH + 10) : (viewH - 75)) + "px"; + this.body.style.overflow = "auto"; + }, SED.quickCreateDialog); + + SED.quickCreateDialog.hideEvent.subscribe(function(){ + var qsFields = YAHOO.util.Dom.getElementsByClassName('.sqsEnabled', null, this.body); + /*for(var qsField in qsFields){ + if (typeof QSFieldsArray[qsFields[qsField].id] != 'undefined') + Ext.getCmp('combobox_'+qsFields[qsField].id).destroy(); + }*/ + }); + SED.quickCreateDialog.setHeader(app_strings.LBL_EMAIL_QUICK_CREATE); + } // end lazy load + if (ret.html) { + ret.html = ret.html.replace('', ""); + } + SED.quickCreateDialog.setBody(ret.html ? ret.html : " "); + SED.quickCreateDialog.render(); + SUGAR.util.evalScript(ret.html + ''); + + SED.quickCreateDialog.ieId = ret.ieId; + SED.quickCreateDialog.uid = ret.uid; + SED.quickCreateDialog.mbox = ret.mbox; + SED.quickCreateDialog.qcmodule = ret.module; + + SED.quickCreateDialog.show(); + + var editForm = document.getElementById('form_EmailQCView_' + ret.module); + if (editForm) { + editForm.module.value = 'Emails'; + var count = SUGAR.EmailAddressWidget.count[ret.module] ? SUGAR.EmailAddressWidget.count[ret.module] : 0; + var tableId = YAHOO.util.Dom.getElementsByClassName('emailaddresses', 'table', editForm)[0].id; + var instId = ret.module + count; + SED.quickCreateEmailsToAdd = ret.emailAddress; + SED.quickCreateEmailCallback = function(instId, tableId) { + var eaw = SUGAR.EmailAddressWidget.instances[instId]; + if (typeof(eaw) == "undefined") + window.setTimeout("SUGAR.email2.detailView.quickCreateEmailCallback('" + + instId + "','" + tableId + "');", 100); + eaw.prefillEmailAddresses(tableId, SUGAR.email2.detailView.quickCreateEmailsToAdd); + } + window.setTimeout("SUGAR.email2.detailView.quickCreateEmailCallback('" + + instId + "','" + tableId + "');", 100); + } + }, + + saveQuickCreateForm : function(o) { + hideOverlay(); + SUGAR.email2.detailView.quickCreateDialog.hide(); + validate['EditView'] = [ ]; + }, + + saveQuickCreateFormAndReply : function(o) { + hideOverlay(); + var ret = JSON.parse(o.responseText); + SUGAR.email2.detailView.quickCreateDialog.hide(); + var qcd = SUGAR.email2.detailView.quickCreateDialog; + var type = (qcd.qcmodule == 'Cases') ? 'replyCase' : 'reply'; + if (ret) { + var emailID = ret.id; + SUGAR.email2.composeLayout.c0_replyForwardEmail(null, ret.id, 'sugar::Emails', type); + } else { + SUGAR.email2.composeLayout.c0_replyForwardEmail(qcd.ieId, qcd.uid, qcd.mbox, type); + } + //Cean the validate cache to prevent errors on the next call + validate['EditView'] = [ ]; + }, + + saveQuickCreateFormAndAddToAddressBook : function(o) { + hideOverlay(); + SUGAR.email2.detailView.quickCreateDialog.hide(); + SUGAR.email2.complexLayout.findPanel('contactsTab').show(); + validate['EditView'] = [ ]; + }, + + handleAssignmentDialogAssignAction : function() { + + + var assign_user_id = window.document.forms['Distribute'].elements['assigned_user_id'].value; + + var dist = 'direct'; + var users = false; + var rules = false; + var get = ""; + var found_teams = false; + var warning_message = mod_strings.LBL_WARN_NO_USERS; + if(!found_teams && assign_user_id == '' ) + { + alert(warning_message); + return; + } + + var emailUids = SUGAR.email2.listView.getUidsFromSelection(); + var uids = ""; + for(i=0; i'; + } + overlay(SUGAR.language.get('Emails','LBL_IMPORT_STATUS_TITLE'), statusString, 'alert'); + } + SE.listView.refreshGrid(); + +}, +failure : AjaxObject.handleFailure, +timeout : AjaxObject.timeout, +scope : AjaxObject + +}; +var callbackComposeCache = { + success : AjaxObject.composeCache, + failure : AjaxObject.handleFailure, + timeout : AjaxObject.timeout, + scope : AjaxObject +}; +var callbackDelete = { + success : AjaxObject.handleDeleteReturn, + failure : AjaxObject.handleFailure, + timeout : AjaxObject.timeout, + scope : AjaxObject +}; +var callbackEmailDetailMultiple = { + success : function(o) { + hideOverlay(); + var retMulti = JSON.parse(o.responseText); + var ret = new Object(); + + for(var i=0; i 0) { + for (i = 0 ; i < tabArray.length ; i++) { + var tabObject = tabArray[i]; + if (tabObject.get("id") == ("composeTab" + idx)) { + var tabLabel = a.name; + if (tabLabel != null && tabLabel.length > 25) { + tabLabel = tabLabel.substring(0, 25) + "..."; + } // if + tabObject.get("labelEl").firstChild.data = tabLabel; + break; + } + } + } + + //SUGAR.email2.innerLayout.regions.center.getPanel('composeLayout' + idx).setTitle(a.name); + if (a.parent_name != null && a.parent_name != "") { + document.getElementById('data_parent_name' + idx).value = a.parent_name; + } + if (a.parent_type != null && a.parent_type != "") { + document.getElementById('data_parent_type' + idx).value = a.parent_type; + } + if (a.parent_id != null && a.parent_id != "") { + document.getElementById('data_parent_id' + idx).value = a.parent_id; + } + if (a.fromAccounts.status) { + var addressFrom = document.getElementById('addressFrom' + idx); + SUGAR.email2.util.emptySelectOptions(addressFrom); + var fromAccountOpts = a.fromAccounts.data; + for(i=0; i"; + } + } + function attachIcon(cell, record, column, value) { + if(value == "1") { + cell.innerHTML = ""; + } + } + + var colModel = + [ + { + label: "", + width: 10, + sortable: false, + fixed: true, + resizeable: true, + formatter: attachIcon, + key: 'hasAttach' + }, + { + label: "!", + width: widths[0], + sortable: true, + fixed: true, + resizeable: true, + formatter: flaggedIcon, + key: 'flagged' + }, + { + label: "", + width: widths[1], + sortable: true, + fixed: true, + resizeable: false, + formatter: repliedIcon, + key: 'status' + }, + { + label: app_strings.LBL_EMAIL_FROM, + width: widths[2], + sortable: true, + resizeable: true, + key: 'from' + }, + { + label: app_strings.LBL_EMAIL_SUBJECT, + width: widths[3], + sortable: true, + resizeable: true, + key: 'subject' + }, + { + label: mod_strings.LBL_LIST_DATE, + width: widths[4], + sortable: true, + resizeable: true, + key: 'date' + }, + { + label: app_strings.LBL_EMAIL_TO, + width: widths[5], + sortable: false, + resizeable: true, + key: 'to_addrs' + }, + { + label: 'uid', + hidden: true, + key: 'uid' + }, + { + label: 'mbox', + hidden: true, + key: 'mbox' + }, + { + label: 'ieId', + hidden: true, + key: 'ieId' + }, + { + label: 'site_url', + hidden: true, + key: 'site_url' + }, + { label: 'seen', + hidden: true, + key: 'seen' + }, + { label: 'type', + hidden: true, + key: 'type' + } + ]; + + var dataModel = new YAHOO.util.DataSource(urlBase + "?", { + responseType: YAHOO.util.DataSource.TYPE_JSON, + responseSchema: { + resultsList: 'Email', + fields: ['flagged', 'status', 'from', 'subject', 'date','to_addrs', 'uid', 'mbox', 'ieId', 'site_url', 'seen', 'type', 'AssignedTo','hasAttach'], + metaFields: {total: 'TotalCount', unread:"UnreadCount", fromCache: "FromCache"} + } + }); + var params = { + to_pdf : "true", + module : "Emails", + action : "EmailUIAjax", + emailUIAction : "getMessageList", + mbox : "INBOX", + ieId : "", + forceRefresh : "false" + }; + if(lazyLoadFolder != null) { + params['mbox'] = lazyLoadFolder.folder; + params['ieId'] = lazyLoadFolder.ieId; + //Check if the folder is a Sugar Folder + var test = new String(lazyLoadFolder.folder); + if(test.match(/SUGAR\./)) { + params['emailUIAction'] = 'getMessageListSugarFolders'; + params['mbox'] = test.substr(6); + } + } + //dataModel.initPaging(urlBase, SUGAR.email2.userPrefs.emailSettings.showNumInList); + + // create the Grid + var grid = SUGAR.email2.grid = new YAHOO.SUGAR.SelectionGrid('emailGrid', colModel, dataModel, { + MSG_EMPTY: SUGAR.language.get("Emails", "LBL_EMPTY_FOLDER"), + dynamicData: true, + paginator: new YAHOO.widget.Paginator({ + rowsPerPage:parseInt(SUGAR.email2.userPrefs.emailSettings.showNumInList), + containers : ["dt-pag-nav"], + template: "", + firstPageLinkLabel: "", + previousPageLinkLabel: "", + nextPageLinkLabel: "", + lastPageLinkLabel: "" + }), + initialRequest:SUGAR.util.paramsToUrl(params), + width: "800px", + height: "400px" + }); + + initRowDD(); + + //Override Paging request construction + grid.set("generateRequest", function(oState, oSelf) { + oState = oState || {pagination:null, sortedBy:null}; + var sort = (oState.sortedBy) ? oState.sortedBy.key : oSelf.getColumnSet().keys[1].getKey(); + var dir = (oState.sortedBy && oState.sortedBy.dir === YAHOO.widget.DataTable.CLASS_DESC) ? "desc" : "asc"; + var startIndex = (oState.pagination) ? oState.pagination.recordOffset : 0; + var results = (oState.pagination) ? oState.pagination.rowsPerPage : null; + // Build the request + var ret = + SUGAR.util.paramsToUrl(oSelf.params) + + "&sort=" + sort + + "&dir=" + dir + + "&start=" + startIndex + + ((results !== null) ? "&limit=" + results : ""); + return ret; + }); + + + grid.handleDataReturnPayload = function(oRequest, oResponse, oPayload) { + oPayload = oPayload || { }; + + oPayload.totalRecords = oResponse.meta.total; + oPayload.unreadRecords = oResponse.meta.unread; + + var tabObject = SE.innerLayout.get("tabs")[0]; + var mboxTitle = ""; + if (this.params.mbox != null) { + mboxTitle = this.params.mbox; + } + var tabtext = mboxTitle + " (" + oResponse.meta.total + " " + app_strings.LBL_EMAIL_MESSAGES + " )"; + tabObject.get("labelEl").firstChild.data = tabtext; + + if (SE.tree) { + var node = SE.tree.getNodeByProperty('id', this.params.ieId) || SE.tree.getNodeByProperty('origText', this.params.mbox); + if (node) { + node.data.unseen = oResponse.meta.unread; + SE.accounts.renderTree(); + } + } + return oPayload; + } + + var resize = grid.resizeGrid = function () { + SUGAR.email2.grid.set("width", SUGAR.email2.grid.get("element").parentNode.clientWidth + "px"); + SUGAR.email2.grid.set("height", (SUGAR.email2.grid.get("element").parentNode.clientHeight - 47) + "px"); + } + grid.convertDDRows = function() { + var rowEl = this.getFirstTrEl(); + while (rowEl != null) { + new this.DDRow(this, this.getRecord(rowEl), rowEl); + rowEl = this.getNextTrEl(rowEl); + } + } + + + grid.on("columnResizeEvent", function(o) { + //Find the index of the column + var colSet = SUGAR.email2.grid.getColumnSet().flat; + for (var i=0; i < colSet.length; i++) { + if (o.column == colSet[i]) { + //Store it in the cookie + Ck.setSub("EmailGridWidths", i + "", o.width, {expires: SUGAR.email2.nextYear}); + } + } + //this.resizeGrid(); + }, null, grid); + + grid.on("postRenderEvent", function() {this.convertDDRows()}, null, grid); + grid.on("rowClickEvent", SUGAR.email2.listView.handleClick); + grid.on("rowDblclickEvent", SUGAR.email2.listView.getEmail); + grid.render(); + SUGAR.email2.listViewLayout.on("render", resize); + resize(); + + //Setup the default load parameters + SUGAR.email2.grid.params = params; + + grid.on('postRenderEvent', SUGAR.email2.listView.setEmailListStyles); + dataModel.subscribe("requestEvent", grid.disable, grid, true); + dataModel.subscribe("responseParseEvent", grid.undisable, grid, true); + } + }; + e2Grid.init(); +}; + + +function initRowDD() { + var sg = SUGAR.email2.grid, + Dom = YAHOO.util.Dom; + sg.DDRow = function(oDataTable, oRecord, elTr) { + if(oDataTable && oRecord && elTr) { + this.ddtable = oDataTable; + this.table = oDataTable.getTableEl(); + this.row = oRecord; + this.rowEl = elTr; + this.newIndex = null; + this.init(elTr); + this.initFrame(); // Needed for DDProxy + this.invalidHandleTypes = {}; + } + }; + + YAHOO.extend(sg.DDRow, YAHOO.util.DDProxy, { + _resizeProxy: function() { + this.constructor.superclass._resizeProxy.apply(this, arguments); + var dragEl = this.getDragEl(), + el = this.getEl(); + var xy = Dom.getXY(el); + + Dom.setStyle(dragEl, 'height', this.rowEl.offsetHeight + "px"); + Dom.setStyle(dragEl, 'width', (parseInt(Dom.getStyle(dragEl, 'width'),10) + 4) + 'px'); + Dom.setXY(dragEl, [xy[0] - 100, xy[1] - 20] ); + Dom.setStyle(dragEl, 'display', ""); + }, + + startDrag: function(x, y) { + //Check if we should be dragging a set of rows rather than just the one. + var selectedRows = this.ddtable.getSelectedRows(); + var iSelected = false; + for (var i in selectedRows) { + if (this.rowEl.id == selectedRows[i]) { + iSelected = true; + break + } + } + if (iSelected) { + this.rows = []; + for (var i in selectedRows) { + this.rows[i] = this.ddtable.getRecord(selectedRows[i]); + } + } else { + this.rows = [this.row]; + this.ddtable.unselectAllRows(); + this.ddtable.selectRow(this.row); + } + + //Initialize the dragable proxy + var dragEl = this.getDragEl(); + var clickEl = this.getEl(); + Dom.setStyle(clickEl, "opacity", "0.25"); + dragEl.innerHTML = "" + clickEl.innerHTML + "
    "; + Dom.addClass(dragEl, "yui-dt-liner"); + Dom.setStyle(dragEl, "opacity", "0.5"); + Dom.setStyle(dragEl, "height", (clickEl.clientHeight - 2) + "px"); + Dom.setStyle(dragEl, "backgroundColor", Dom.getStyle(clickEl, "backgroundColor")); + Dom.setStyle(dragEl, "border", "2px solid gray"); + }, + + clickValidator: function(e) { + if (this.row.getData()[0] == " ") + return false; + var target = YAHOO.util.Event.getTarget(e); + return ( this.isValidHandleChild(target) && + (this.id == this.handleElId || this.DDM.handleWasClicked(target, this.id)) ); + }, + /** + * This funciton checks that the target of the drag is a table row in this + * DDGroup and simply moves the sourceEL to that location as a preview. + */ + onDragOver: function(ev, id) { + var node = SUGAR.email2.tree.getNodeByElement(Dom.get(id)); + if (node && node != this.targetNode) { + this.targetNode = node; + SUGAR.email2.folders.unhighliteAll(); + node.highlight(); + } + }, + + onDragOut: function(e, id) { + if (this.targetNode) { + SUGAR.email2.folders.unhighliteAll(); + this.targetNode = false; + } + }, + endDrag: function() { + Dom.setStyle(this.getEl(), "opacity", ""); + Dom.setStyle(this.getDragEl(), "display", "none"); + if (this.targetNode) { + SUGAR.email2.folders.handleDrop(this.rows, this.targetNode); + } + SUGAR.email2.folders.unhighliteAll(); + this.rows = null; + } + }); +} + +function AddressSearchGridInit() { + function moduleIcon(elCell, oRecord, oColumn, oData) { + elCell.innerHTML = ""; + }; + function selectionCheckBox(elCell, oRecord, oColumn, oData) { + elCell.innerHTML = ''; + }; + var checkHeader = '{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}
    ", + firstPageLinkLabel: "", + previousPageLinkLabel: "", + nextPageLinkLabel: "", + lastPageLinkLabel: "" + }), + initialRequest:SUGAR.util.paramsToUrl(dataModel.params), + width: "560px", + height: "250px" + }); + //Override Paging request construction + grid.set("generateRequest", function(oState, oSelf) { + oState = oState || {pagination:null, sortedBy:null}; + var sort = (oState.sortedBy) ? oState.sortedBy.key : oSelf.getColumnSet().keys[0].getKey(); + var dir = (oState.sortedBy && oState.sortedBy.dir === YAHOO.widget.DataTable.CLASS_DESC) ? "desc" : "asc"; + var startIndex = (oState.pagination) ? oState.pagination.recordOffset : 0; + var results = (oState.pagination) ? oState.pagination.rowsPerPage : null; + // Build the request + var ret = + SUGAR.util.paramsToUrl(oSelf.getDataSource().params) + + "&sort=" + sort + "&dir=" + dir + "&start=" + startIndex + + ((results !== null) ? "&limit=" + results : ""); + return ret; + }); + + grid.handleDataReturnPayload = function(oRequest, oResponse, oPayload) { + oPayload = oPayload || { }; + oPayload.totalRecords = oResponse.meta.total; + return oPayload; + } + + grid.clickToggleSelect= function(args) { + var isIE = (args.event.target == null); + var targetElement = isIE ? args.event.srcElement : args.event.target; + if(targetElement.type == null || targetElement.type != 'checkbox') { + SUGAR.email2.addressBook.grid.toggleSelect(args.target.id); + } + } + + grid.reSelectRowsOnRender = function (){ + var rows = SUGAR.email2.addressBook.grid.getRecordSet().getRecords(); + for (var i = 0; i < rows.length; i++) + { + var emailAddress = rows[i].getData("email"); + var alreadyAdded = SUGAR.email2.addressBook.doesEmailAdddressExistInResultTable(emailAddress); + if(alreadyAdded) + { + rows[i].setData("selected", true); + SUGAR.email2.addressBook.grid.selectRow(rows[i]); + } + else + { + rows[i].setData("selected", false); + SUGAR.email2.addressBook.grid.unselectRow(rows[i]); + } + } + } + grid.subscribe("rowMouseoverEvent", grid.onEventHighlightRow); + grid.subscribe("rowMouseoutEvent", grid.onEventUnhighlightRow); + grid.subscribe("rowClickEvent", grid.clickToggleSelect); + grid.subscribe("postRenderEvent", grid.reSelectRowsOnRender); + + grid.render(); + dataModel.subscribe("requestEvent", grid.disable, grid, true); + dataModel.subscribe("responseParseEvent", grid.undisable, grid, true); + + grid.toggleSelectCheckbox = function(id,checked){ + var row = SUGAR.email2.addressBook.grid.getRecord(id); + row.setData("checked",checked); + }; + grid.toggleSelect = function(id, checked) { + var row = SUGAR.email2.addressBook.grid.getRecord(id); + checked = row.getData("selected"); + if (!checked) + { + SUGAR.email2.addressBook.grid.selectRow(row); + SE.addressBook.insertContactRowToResultTable(id,null) + } else + { + SUGAR.email2.addressBook.grid.unselectRow(row); + SE.addressBook.removeRowFromGridResults(id,row.getData("email")); + } + row.setData("selected", !checked); + }; + + grid.toggleSelectAll = function(checked) { + rows = SUGAR.email2.addressBook.grid.getRecordSet().getRecords(); + for (var i = 0; i < rows.length; i++) { + if (typeof(rows[i]) != "undefined") + rows[i].setData("checked", checked); + } + var checkBoxes = SUGAR.email2.addressBook.grid.get("element").getElementsByTagName('input'); + for (var i = 0; i < checkBoxes.length; i++) { + checkBoxes[i].checked = checked; + } + }; + + //Initialize the grid result table. + AddressSearchResultsGridInit(); +} + + + +/** +* Initalize the results table for the address book selection. +* +*/ +function AddressSearchResultsGridInit() +{ + + /* Full name sort funciton to compare by last name if available */ + var fullNameSort = function(a, b, desc) { + // Deal with empty values + if(!YAHOO.lang.isValue(a)) + return (!YAHOO.lang.isValue(b)) ? 0 : 1; + else if(!YAHOO.lang.isValue(b)) + return -1; + + var aNames = a.getData("name").split(' '); + var bNames = b.getData("name").split(' '); + + var aSortField = (aNames.length == 2) ? aNames[1] : a.getData("name"); + var bSortField = (bNames.length == 2) ? bNames[1] : b.getData("name"); + + return YAHOO.util.Sort.compare(aSortField,bSortField, desc); + + }; + + var typeDdOptions = [app_strings.LBL_EMAIL_ADDRESS_BOOK_ADD_TO.replace(/:$/,'') , + app_strings.LBL_EMAIL_ADDRESS_BOOK_ADD_CC.replace(/:$/,''), + app_strings.LBL_EMAIL_ADDRESS_BOOK_ADD_BCC.replace(/:$/,'')]; + + var ColumnDefs = [{key:'type',label:app_strings.LBL_EMAIL_ADDRESS_BOOK_ADRRESS_TYPE, width: 60, sortable: true, editor: new YAHOO.widget.RadioCellEditor({radioOptions:typeDdOptions,disableBtns:true})}, + {key:'name',label:app_strings.LBL_EMAIL_ACCOUNTS_NAME,width: 280,sortable: true, sortOptions:{sortFunction:fullNameSort}}]; + + var myDataSource = new YAHOO.util.DataSource([]); + myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSARRAY; + myDataSource.responseSchema = { + fields: ["name","type","email_address","display_email_address","bean_id","idx"] + }; + + var gridResults = SUGAR.email2.addressBook.gridResults = new YAHOO.widget.ScrollingDataTable("addrSearchResultGrid", ColumnDefs, myDataSource, { + width: "350px",height: "250px", MSG_EMPTY: " "}); + + var highlightEditableCell = function(oArgs) { + var elCell = oArgs.target; + if(YAHOO.util.Dom.hasClass(elCell, "yui-dt-editable")) { + this.highlightCell(elCell); + } + }; + + gridResults.subscribe("cellMouseoverEvent", highlightEditableCell); + gridResults.subscribe("cellMouseoutEvent", gridResults.onEventUnhighlightCell); + gridResults.subscribe("cellClickEvent", gridResults.onEventShowCellEditor); + gridResults.subscribe("rowMouseoverEvent", gridResults.onEventHighlightRow); + gridResults.subscribe("rowMouseoutEvent", gridResults.onEventUnhighlightRow); + + //Setup the context menus + var onContextMenuClick = function(p_sType, p_aArgs, p_myDataTable) { + var task = p_aArgs[1]; + if(task) + { + var elRow = this.contextEventTarget; + elRow = p_myDataTable.getTrEl(elRow); + + if(elRow) + { + switch(task.index) + { + case 0: + var oRecord = p_myDataTable.getRecord(elRow); + p_myDataTable.deleteRow(elRow); + SUGAR.email2.addressBook.grid.reSelectRowsOnRender(); + } + } + } + }; + var contextMenu = new YAHOO.widget.ContextMenu("contextmenu", + {trigger:gridResults.getTbodyEl()}); + contextMenu.addItem(app_strings.LBL_EMAIL_DELETE); + contextMenu.render("addrSearchResultGrid"); + contextMenu.clickEvent.subscribe(onContextMenuClick, gridResults); +} +// End of File modules/Emails/javascript/grid.js + +/********************************************************************************* + * SugarCRM is a customer relationship management program developed by + * SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc. + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU Affero General Public License version 3 as published by the + * Free Software Foundation with the addition of the following permission added + * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK + * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY + * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS. + * + * 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 Affero General Public License for more + * details. + * + * You should have received a copy of the GNU Affero General Public License along with + * this program; if not, see http://www.gnu.org/licenses or write to the Free + * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301 USA. + * + * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road, + * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com. + * + * The interactive user interfaces in modified source and object code versions + * of this program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU Affero General Public License version 3. + * + * In accordance with Section 7(b) of the GNU Affero General Public License version 3, + * these Appropriate Legal Notices must retain the display of the "Powered by + * SugarCRM" logo. If the display of the logo is not reasonably feasible for + * technical reasons, the Appropriate Legal Notices must display the words + * "Powered by SugarCRM". + ********************************************************************************/ + (function() { + var sw = YAHOO.SUGAR, + Event = YAHOO.util.Event, + Connect = YAHOO.util.Connect, + Dom = YAHOO.util.Dom + SE = SUGAR.email2; + +/////////////////////////////////////////////////////////////////////////////// +//// ADDRESS BOOK +SE.addressBook = { + _contactCache : new Array(), // cache of contacts + _dd : new Array(), // filtered list, same format as _contactCache + _ddLists : new Array(), // list of Lists + _dd_mlUsed : new Array(), // contacts in mailing list edit view column1 + _dd_mlAvailable : new Array(), // contacts in mailing list edit view column2 + clickBubble : true, // hack to get around onclick event bubbling + relatedBeanId : '', + relatedBeanType : '', + idx : 0, + + itemSpacing : 'white-space:nowrap; padding:2px;', + reGUID : SE.reGUID, + + + + /** + * YUI bug fix 2527707. Causes nested datatable's in to cause 404 errors whens earching. + */ + initFixForDatatableSort: function () { + //Workaround for YUI bug 2527707: http://yuilibrary.com/projects/yui2/ticket/913efafad48ce433199f3e72e4847b18, should be removed when YUI 2.8+ is used + YAHOO.widget.DataTable.prototype.getColumn = function(column) { + var oColumn = this._oColumnSet.getColumn(column); + + if(!oColumn) { + // Validate TD element + var elCell = column.nodeName.toLowerCase() != "th" ? this.getTdEl(column) : false; + if(elCell) { + oColumn = this._oColumnSet.getColumn(elCell.cellIndex); + } + // Validate TH element + else { + elCell = this.getThEl(column); + if(elCell) { + // Find by TH el ID + var allColumns = this._oColumnSet.flat; + for(var i=0, len=allColumns.length; i 0) { + SE.composeLayout.handleDrop( + (type == 'contacts') ? SE.contactView : SE.emailListsView, + null, rows, 'addressTO' + idx ); + } else { + alert(app_strings.LBL_EMAIL_MENU_MAKE_SELECTION); + } + }, + + editContact : function() { + SE.contextMenus.contactsContextMenu.hide(); + var element = SE.contactView.getSelectedNodes()[0]; + var elementId = ""; + if (element.className.indexOf('address-contact') > -1) { + elementId = element.id; + } else if (element.className.indexOf('address-exp-contact') > -1) { + elementId = element.id.substring(2); + } + }, + + + /** + * Filters contact entries based on user input + */ + filter : function(inputEl) { + var ret = new Object(); + var re = new RegExp(inputEl.value, "gi"); + + for(var i in this._contactCache) { + if(this._contactCache[i].name.match(re)) { + ret[i] = this._contactCache[i]; + } + } + + this.buildContactList(ret); + }, + + fullForm : function(id, module) { + document.location = "index.php?return_module=Emails&return_action=index&module=" + module + "&action=EditView&record=" + id; + }, + + /** + * returns a formatted email address from the addressBook cache + */ + getFormattedAddress : function(id) { + var o = this._contactCache[id]; + var primaryEmail = ''; + + for(var i=0; i]+)>)/ig, "").replace(/'/gi,'\''); + var ret = finalName + " <" + finalEmail.replace(/'/gi,'\'') + ">"; + + return ret; + }, + + /** + * Sets up async call to query for matching contacts, users, etc. + */ + searchContacts : function() { + var fn = document.getElementById('input_searchField').value; + var pe = document.getElementById('input_searchPerson').value; + + var rb = document.getElementById('hasRelatedBean').checked; + if (rb) { + var idx = this.idx; + var relatedBeanId = document.getElementById('data_parent_id' + idx).value; + var relatedBeanType = document.getElementById('data_parent_type' + idx).value; + this.addressBookDataModel.params['related_bean_id'] = relatedBeanId; + this.addressBookDataModel.params['related_bean_type'] = relatedBeanType; + } else { + this.addressBookDataModel.params['related_bean_id'] = ''; + } + + this.addressBookDataModel.params['search_field'] = fn; + this.addressBookDataModel.params['person'] = pe; + this.addressBookDataModel.params['emailUIAction'] = 'getAddressSearchResults'; + this.grid._oDataSource = this.addressBookDataModel; + this.grid.getDataSource().sendRequest(SUGAR.util.paramsToUrl(this.addressBookDataModel.params), this.grid.onDataReturnInitializeTable, this.grid); + }, + + /** + * Clear Search Crieteria For Addressbook + */ + clearAddressBookSearch : function() { + document.getElementById('input_searchField').value = ""; + document.getElementById('input_searchPerson').selectedIndex = 0; + }, + + /** + * Opens modal select window to add contacts to addressbook + */ + selectContactsDialogue : function(destId) { + if(!this.contactsDialogue) { + var dlg = this.contactsDialogue = new YAHOO.widget.Dialog("contactsDialogue", { + modal:true, + visible:false, + draggable: false, + constraintoviewport: true, + width : 980, + buttons : [{text: app_strings.LBL_EMAIL_ADDRESS_BOOK_ADD, isDefault: true, handler: this.populateEmailAddressFieldsFromResultTable}, + {text: app_strings.LBL_EMAIL_ADDRESS_BOOK_CLEAR, isDefault: true, handler: this.clearAllEmailAddressFieldsFromResultTable} ] + }); + dlg.setHeader(app_strings.LBL_EMAIL_ADDRESS_BOOK_SELECT_TITLE); + + var body = SUGAR.util.getAndRemove("contactsDialogueHTML"); + dlg.setBody(body.innerHTML); + dlg.renderEvent.subscribe(function() { + var iev = YAHOO.util.Dom.get("contactsDialogueBody"); + if (iev && !SUGAR.isIE) { + this.body.style.width = "950px"; + } + }, dlg); + + + dlg.beforeRenderEvent.subscribe(function() { + var dd = new YAHOO.util.DDProxy(dlg.element); + dd.setHandleElId(dlg.header); + dd.on('endDragEvent', function() { + dlg.show(); + }); + }, dlg, true); + dlg.render(); + + var tp = new YAHOO.widget.TabView("contactsSearchTabs"); + + var tabContent = SUGAR.util.getAndRemove("searchForm"); + tp.addTab(new YAHOO.widget.Tab({ + label: app_strings.LBL_EMAIL_ADDRESS_BOOK_TITLE, + scroll : true, + content : tabContent.innerHTML, + id : "addressSearchTab", + active : true + })); + + var addListenerFields = ['input_searchPerson','input_searchField' ] + YAHOO.util.Event.addListener(addListenerFields,"keydown", function(e){ + if (e.keyCode == 13) { + YAHOO.util.Event.stopEvent(e); + SUGAR.email2.addressBook.searchContacts(); + } + }); + + this.contactsDialogue.render(); + dlg.center(); + } + //Quick Compose does not have an innerLayout component and will always be referenced with ix 0. + if (typeof(SUGAR.email2.innerLayout) == 'undefined') + var idx = 0; + else + { + var activePanel = SUGAR.email2.innerLayout.get("activeTab").get("id"); + var idx = activePanel.substring(10); + } + SE.addressBook.idx = idx; + + var relatedBeanId; + if ((hasRelatedBeanId = document.getElementById('data_parent_id' + idx).value) != '') { + document.getElementById('relatedBeanColumn').style.display = ''; + var relatedBeanName = document.getElementById('data_parent_name' + idx).value; + var relatedBeanType = document.getElementById('data_parent_type' + idx).value; + relatedBeanId = document.getElementById('data_parent_id' + idx).value; + document.getElementById('relatedBeanInfo').innerHTML = ' ' + relatedBeanType + ' ' + relatedBeanName + ''; + SE.addressBook.relatedBeanType = relatedBeanType; + } else { + document.getElementById('relatedBeanColumn').style.display = 'none'; + document.getElementById('hasRelatedBean').checked = false; + } + + if (!SE.addressBook.grid) + { + if (hasRelatedBeanId) { + document.getElementById('hasRelatedBean').checked = true; + } + AddressSearchGridInit(); + SE.addressBook.relatedBeanId = relatedBeanId; + } + else + { + if (typeof(relatedBeanId) != 'undefined' && relatedBeanId != SE.addressBook.relatedBeanId) + { + SE.addressBook.relatedBeanId = relatedBeanId; + document.getElementById('hasRelatedBean').checked = true; + } + if (document.getElementById('hasRelatedBean').checked == true) + { + SE.addressBook.addressBookDataModel.params['related_bean_id'] = relatedBeanId; + SE.addressBook.addressBookDataModel.params['related_bean_type'] = relatedBeanType; + } else { + SE.addressBook.addressBookDataModel.params['related_bean_id'] = ''; + SE.addressBook.addressBookDataModel.params['related_bean_type'] = ''; + } + SE.addressBook.addressBookDataModel.params['search_field'] = document.getElementById('input_searchField').value;; + SE.addressBook.addressBookDataModel.params['person'] = document.getElementById('input_searchPerson').value; + SE.addressBook.grid.getDataSource().sendRequest(SUGAR.util.paramsToUrl(SE.addressBook.addressBookDataModel.params), SE.addressBook.grid.onDataReturnInitializeTable, SE.addressBook.grid); + } + + //Remove any lingering rows in the result set table if the module was closed. + SE.addressBook.gridResults.deleteRows(0, SUGAR.email2.addressBook.gridResults.getRecordSet().getLength()); + //Repopulate + SE.addressBook.populateResulstTableEmailAddresses(); + + this.contactsDialogue.show(); + }, + /** + * Clear all email addresses from result table. + * + */ + clearAllEmailAddressFieldsFromResultTable: function () { + SUGAR.email2.addressBook.gridResults.deleteRows(0, SUGAR.email2.addressBook.gridResults.getRecordSet().getLength()); + //Unhighlight any rows currently selected if the emails were cleared. + SUGAR.email2.addressBook.grid.toggleSelectAll(false); + SUGAR.email2.addressBook.grid.reSelectRowsOnRender(); + }, + /** + * Take all email address listed in the compose tab To|Cc|Bcc fields and re-populates the + * results table. This function is called when the address book is displayed. + */ + populateResulstTableEmailAddresses: function () { + + var idx = SE.addressBook.idx; + var emailFields = ['to','cc','bcc']; + + for(var k=0;k'; + if(t_name == '') + t_name = displayEmail = t_emailAddr; + + var addressType = SE.addressBook.translateAddresType(emailFields[k],true); + SUGAR.email2.addressBook.gridResults.addRow({'type':addressType,'name':t_name,'email_address': t_emailAddr, + 'display_email_address': displayEmail,'bean_id': -1,'idx' : SE.addressBook.idx}); + } + } + }, + + /** + * Checks all entries in the result table against a particular email address, returning true + * if the email address is found, false otherwise. + */ + doesEmailAdddressExistInResultTable: function(emailAddress) + { + if(trim(emailAddress) == '') + return false; + + var emailAddressFound = false; + var contacts = SE.addressBook.gridResults.getRecordSet().getRecords(); + for (var i=0; i < contacts.length; i++) + { + var data = SE.addressBook.gridResults.getRecord(contacts[i]).getData(); + //If we are adding to cc or bcc fields, make them visible. + if(data.email_address == emailAddress) + { + emailAddressFound = true; + break; + } + } + + return emailAddressFound; + }, + /** + * Takes all email addresses that the users wishes to add from the address book and populates the To + * fields on the compose tab. + */ + populateEmailAddressFieldsFromResultTable: function() + { + //Clear the fields first, all email addresses are stored in the address book + var idx = SE.addressBook.idx; + var emailFields = ['to','cc','bcc']; + for(var k=0;k'; + if(addressType == null) + addressType = app_strings.LBL_EMAIL_ADDRESS_BOOK_ADD_TO.replace(/:$/,''); //Default to To when using the plus icon. + SUGAR.email2.addressBook.gridResults.addRow({'type':addressType,'name':name,'email_address': data.email,'display_email_address': ea,'bean_id': data.bean_id,'idx' : SE.addressBook.idx}); + }, + /** + * Remove a row from the gridsResult table. + */ + removeRowFromGridResults : function(rowId,emailAddress) + { + var contacts = SE.addressBook.gridResults.getRecordSet().getRecords(); + for (var i=0; i < contacts.length; i++) + { + var rec = SE.addressBook.gridResults.getRecord(contacts[i]); + var data = rec.getData(); + if(data.email_address == emailAddress) + { + SUGAR.email2.addressBook.gridResults.deleteRow(rec.getId()); + break; + } + } + + SUGAR.email2.addressBook.toggleSearchRowIcon(rowId,true); + }, + /** + * Translates between the addressType To|Cc|Bcc labels/keys. + */ + translateAddresType: function(addressType,fromKey) + { + var displayTo = app_strings.LBL_EMAIL_ADDRESS_BOOK_ADD_TO.replace(/:$/,''); + var displayCc = app_strings.LBL_EMAIL_ADDRESS_BOOK_ADD_CC.replace(/:$/,''); + var displayBcc = app_strings.LBL_EMAIL_ADDRESS_BOOK_ADD_BCC.replace(/:$/,''); + var mappingObject = {}; + + if(fromKey) + mappingObject = {'to':displayTo, 'cc':displayCc, 'bcc':displayBcc}; + else + { + mappingObject[displayTo] = 'to'; //Cant use object literal with variable variable. + mappingObject[displayCc] = 'cc'; + mappingObject[displayBcc] = 'bcc'; + } + + return typeof(mappingObject[addressType]) != 'undefined' ? mappingObject[addressType] : ''; + + }, + /** + * + */ + toggleSearchRowIcon : function(rowId,show) + { + if(show) + { + var idToShow = rowId + '_add_img'; + var idToHide = rowId + '_rm_img'; + } + else + { + var idToShow = rowId + '_rm_img'; + var idToHide = rowId + '_add_img'; + } + + + Dom.addClass(idToHide, "yui-hidden"); + Dom.removeClass(idToShow, "yui-hidden"); + }, + /** + * Determine if an entry has already been added to the grid results table to prevent duplicates. + */ + doesGridResultsEntryExist: function(emailAddrs) + { + + var contactExists = false; + var contacts = SE.addressBook.gridResults.getRecordSet().getRecords(); + for (var i=0; i < contacts.length; i++) + { + var data = SE.addressBook.gridResults.getRecord(contacts[i]).getData(); + if(data.email_address == emailAddrs) + { + contactExists = true; + break; + } + } + return contactExists; + }, + + /** + * adds an email address to a string, but first checks if it exists + * @param string concat The string we are appending email addresses to + * @param string addr Email address to add + * @return string + */ + smartAddEmailAddressToComposeField : function(concat, addr) { + var re = new RegExp(addr); + + if(!concat.match(re)) { + if(concat != "") { + concat += "; " + addr; + } else { + concat = addr; + } + } + + return concat; + } +}; +//// END ADDRESS BOOK +/////////////////////////////////////////////////////////////////////////////// + + + +/////////////////////////////////////////////////////////////////////////////// +//// AUTOCOMPLETE +/** + * Auto-complete object + */ +SE.autoComplete = { + config : { + delimChar : [";", ","], + useShadow : false, + useIFrame : false, + typeAhead : true, + prehighlightClassName : "yui-ac-prehighlight", + queryDelay : 0 + }, + instances : new Array(), + + /** + * Parses an addressBook entry looking for primary address. If not found, it will return the last found address. + * @param object Contact from AddressBook + * @return string + */ + getPrimaryAddress : function(contact) { + var address = app_strings.LBL_EMAIL_ADDRESS_BOOK_NOT_FOUND; + + for(var eIndex in contact.email) { + address = contact.email[eIndex].email_address; + if(contact.email[eIndex].primary_address == 1) { + return contact.email[eIndex].email_address; + } + } + return address; + }, + + + /** + * initializes autocomplete widgets for a given compose view + * @param int idx + */ + init : function(idx) { + var ds = new YAHOO.widget.DS_JSArray(this.returnDataSource(SE.addressBook._contactCache), { + "queryMatchContains" : false, + "queryMatchSubset" : true + }); + + this.instances[idx] = { + to : null, + cc : null, + bcc : null + }; + + + // instantiate the autoComplete widgets + this.instances[idx]['to'] = new YAHOO.widget.AutoComplete('addressTO'+idx, "addressToAC"+idx, ds, this.config); + this.instances[idx]['cc'] = new YAHOO.widget.AutoComplete('addressCC'+idx, "addressCcAC"+idx, ds, this.config); + this.instances[idx]['bcc'] = new YAHOO.widget.AutoComplete('addressBCC'+idx, "addressBccAC"+idx, ds, this.config); + + // enable hiding of interfering textareas + this.instances[idx]['to'].containerExpandEvent.subscribe(SE.autoComplete.toggleTextareaHide); + this.instances[idx]['cc'].containerExpandEvent.subscribe(SE.autoComplete.toggleTextareaHide); + this.instances[idx]['bcc'].containerExpandEvent.subscribe(SE.autoComplete.toggleTextareaHide); + + // enable reshowing of hidden textareas + this.instances[idx]['to'].containerCollapseEvent.subscribe(SE.autoComplete.toggleTextareaShow); + this.instances[idx]['cc'].containerCollapseEvent.subscribe(SE.autoComplete.toggleTextareaShow); + this.instances[idx]['bcc'].containerCollapseEvent.subscribe(SE.autoComplete.toggleTextareaShow); + + // enable refreshes of contact lists + this.instances[idx]['to'].textboxFocusEvent.subscribe(SE.autoComplete.refreshDataSource); + this.instances[idx]['cc'].textboxFocusEvent.subscribe(SE.autoComplete.refreshDataSource); + this.instances[idx]['bcc'].textboxFocusEvent.subscribe(SE.autoComplete.refreshDataSource); + }, + + refreshDataSource : function(sType, aArgs) { + var textBoxId = aArgs[0].getInputEl().id; // "addressTo0" + var idx; + var refresh = SE.autoComplete.returnDataSource(SE.addressBook._contactCache); + + if(textBoxId.indexOf("addressTO") > -1 || textBoxId.indexOf("addressCC") > -1) { + idx = textBoxId.substr(9); + } else { + idx = textBoxId.substr(10); + } + + SE.autoComplete.instances[idx]['to'].dataSource.data = refresh; + SE.autoComplete.instances[idx]['cc'].dataSource.data = refresh; + SE.autoComplete.instances[idx]['bcc'].dataSource.data = refresh; + }, + + /** + * Parses AddressBook entries to return an appropriate DataSource array for YUI.autoComplete + */ + returnDataSource : function(contacts) { + var ret = new Array(); + for(var id in contacts) { + if (contacts[id].name) { + var primary = this.getPrimaryAddress(contacts[id]); + + ret[ret.length] = contacts[id].name.replace(/<[\/]*b>/gi, '') + " <" + primary + ">"; + //ret[ret.length] = contacts[id].name + " <" + primary + ">"; + + for(var emailIndex in contacts[id].email) { + ret[ret.length] = contacts[id].email[emailIndex].email_address; + } + } + } + + return ret; + }, + + /** + * Hides address textareas to prevent autocomplete dropdown from being obscured + */ + toggleTextareaHide : function(sType, aArgs) { + var textBoxId = aArgs[0]._oTextbox.id; // "addressTo0" + var type = ""; + var idx = -1; + + if(textBoxId.indexOf("addressTO") > -1) { + type = "to"; + } else if(textBoxId.indexOf("addressCC") > -1) { + type = "cc"; + } + idx = textBoxId.substr(9); + + // follow through if not BCC + if(type != "") { + var cc = document.getElementById("addressCC" + idx); + var bcc = document.getElementById("addressBCC" + idx); + + switch(type) { + case "to": + cc.style.visibility = 'hidden'; + case "cc": + bcc.style.visibility = 'hidden'; + break; + } + } + }, + + /** + * Redisplays the textareas after an address is commited + */ + toggleTextareaShow : function(sType, aArgs) { + var textBoxId = aArgs[0]._oTextbox.id; // "addressTo0" + var type = ""; + var idx = -1; + + if(textBoxId.indexOf("addressTO") > -1) { + type = "to"; + } else if(textBoxId.indexOf("addressCC") > -1) { + type = "cc"; + } + idx = textBoxId.substr(9); + + // follow through if not BCC + if(type != "") { + document.getElementById("addressCC" + idx).style.visibility = 'visible'; + document.getElementById("addressBCC" + idx).style.visibility = 'visible'; + } + } +}; + +//// END AUTOCOMPLETE +/////////////////////////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////////////////////////// +//// COMPOSE & SEND +/** + * expands the options sidebar + */ +SE.composeLayout = { + currentInstanceId : 0, + ccHidden : true, + bccHidden : true, + outboundAccountErrors : null, + loadedTinyInstances : {}, //Tracks which tinyMCE editors have initalized with html content. + + showAddressDetails : function(e) { + var linkElement = document.getElementById("More"+e.id); + var spanElement = document.getElementById("Detail"+e.id); + var emailAddressList = e.value; + if(e.value.length > 96) + { + var resultArray = SE.composeLayout._getEmailArrayFromString(emailAddressList); + var displayArray = []; + for (var i=0; i<' + t_emailAddr + '>'); + else + displayArray.push(t_name + '
    <' + t_emailAddr + '>'); + } + + var result = displayArray.join('
    '); + // Display + linkElement.style.display = "inline"; + linkElement.style.height="10px"; + linkElement.style.overflow="visible"; + spanElement.innerHTML = result; + } + else + linkElement.style.display = "none"; + + }, + + /** + * Given a string of email address, return an array containing the name portion (if available) + * and email portion. + */ + _getEmailArrayFromString : function (emailAddressList){ + + var reg = /@.*?;/g; + while ((results = reg.exec(emailAddressList)) != null) + { + orignial = results[0]; + parsedResult = results[0].replace(';', ':::::'); + emailAddressList = emailAddressList.replace (orignial, parsedResult); + } + + reg = /@.*?,/g; + while ((results = reg.exec(emailAddressList)) != null) + { + orignial = results[0]; + parsedResult = results[0].replace(',', ':::::'); + emailAddressList = emailAddressList.replace (orignial, parsedResult); + } + //Administrator ;1@somwhe.com;2@somwherecomplex.com,3@somwherecomplex.com;4@somwherecomplex.com,5@somwherecomplex.com, + var emailArr = emailAddressList.split(":::::"); + var resultsArray = []; + var newArr = []; + for (var i=0; i'); + + if(trim(emailArr[i]) != '') + { + if(rposition != -1 && lposition != -1) + { + var t_name = emailArr[i].substr(0, rposition-1); + var t_emailAddr = emailArr[i].substr(rposition+1, (lposition-1 - rposition) ); + resultsArray.push({'name':t_name, 'email_address': t_emailAddr}); + } + else + { + resultsArray.push({'name':'', 'email_address': emailArr[i]}); + } + } + } + return resultsArray; + }, + /////////////////////////////////////////////////////////////////////////// + //// COMPOSE FLOW + /** + * Prepare bucket DIV and yui-ext tab panels + */ + _0_yui : function() { + var idx = this.currentInstanceId; + + var composeTab = new YAHOO.SUGAR.ClosableTab({ + label: mod_strings.LNK_NEW_SEND_EMAIL, + scroll : true, + content : "
    ", + id : "composeTab" + idx, + closeMsg: app_strings.LBL_EMAIL_CONFIRM_CLOSE, + active : true + }, SE.innerLayout); + SE.innerLayout.addTab(composeTab); + + // get template engine with template + if (!SE.composeLayout.composeTemplate) { + SE.composeLayout.composeTemplate = new YAHOO.SUGAR.Template(SE.templates['compose']); + } + + // create Tab inner layout + var composePanel = this.getComposeLayout(); + composePanel.getUnitByPosition("right").collapse(); + composePanel.autoSize(); + + }, + /** + * Generate the quick compose layout + * @method getQuickComposeLayout + * @param {Pannel} parentPanel Parent pannel + * @param {Object} o Options + * @return {} none + **/ + getQuickComposeLayout : function (parentPanel,o) { + var idx = SE.composeLayout.currentInstanceId; + + //Before rendering the parent pannel we need to initalize the grid layout + parentPanel.beforeRenderEvent.subscribe(function() { + + YAHOO.util.Event.onAvailable('htmleditordiv' + idx, function() { + SE.composeLayout._createComposeLayout(idx); + SE.composeLayout[idx].set('height', 350); + SE.composeLayout[idx].render(); + }); + }); + + //Wait until the Compose Layout has rendered, then add the + //options tab and perform the tiny initialization. + parentPanel.renderEvent.subscribe(function() { + + YAHOO.util.Event.onAvailable('htmleditordiv' + idx, function() { + SE.composeLayout._initComposeOptionTabs(idx); + SE.composeLayout[idx].getUnitByPosition("right").collapse(); + //Initialize tinyMCE + if (!SUGAR.util.isTouchScreen()) + SE.composeLayout._1_tiny(); + //Init templates and address book + SE.composeLayout._2_final(); + + SE.composeLayout.quickCreateComposePackage(o); + + }); + }); + + //Check if we have the div override for the shortcut bar + if(typeof o.menu_id != 'undefined') { + parentPanel.render(o.menu_id); + } else { + parentPanel.render(document.body); + } + + return SE.composeLayout[idx]; + }, + /** + * Fill in all fields into the quick compose layout. + * @method quickCreateComposePackage + * @param {Object} o Options + * @return {} none + **/ + quickCreateComposePackage: function(o) + { + //If we have a compose package fill in defaults. + if (typeof(o.composePackage) != 'undefined') + { + composePackage = o.composePackage; //Set the compose data object + //Hijack this method called by composePackage as it's not need for quick creates. + SE.composeLayout.c0_composeNewEmail = function(){}; + SE.composeLayout.composePackage(); //Fill in defaults. + } + }, + getComposeLayout : function() { + var idx = SE.composeLayout.currentInstanceId; + + this._createComposeLayout(idx); + SE.composeLayout[idx].render(); + this._initComposeOptionTabs(idx); + + return SE.composeLayout[idx]; + }, + + /** + * Create the layout manager for the compose window. + */ + _createComposeLayout : function(idx) + { + SE.composeLayout[idx] = new YAHOO.widget.Layout('htmleditordiv' + idx, { + parent: SE.complexLayout, + border:true, + hideOnLayout: true, + height: 400, + units: [{ + position: "center", + animate: false, + scroll: false, + split:true, + body: + SE.composeLayout.composeTemplate.exec({ + 'app_strings':app_strings, + 'mod_strings':mod_strings, + 'theme': theme, + 'linkbeans_options' : linkBeans, + 'idx' : SE.composeLayout.currentInstanceId + }) + },{ + position: "right", + scroll:true, + collapse: true, + collapsed: true, + resize: true, + border:true, + animate: false, + width:'230', + body: "
    ", + titlebar: true, + split: true, + header: app_strings.LBL_EMAIL_OPTIONS + }] + }); + }, + + /** + * Create compose tab which will populate the 'right' container in the compose window. + */ + _initComposeOptionTabs : function(idx) + { + var cTabs = new YAHOO.widget.TabView("composeRightTabs" + idx); + var tab = new YAHOO.widget.Tab({ + label: app_strings.LBL_EMAIL_ATTACHMENT, + scroll : true, + content : SUGAR.util.getAndRemove("divAttachments" + idx).innerHTML, + id : "divAttachments" + idx, + active : true + }); + + tab.layout = SE.composeLayout[idx]; + + tab.on("activeChange", function(o){ + if (o.newValue) { + this.layout.getUnitByPosition("right").set("header", app_strings.LBL_EMAIL_ATTACHMENT); + } + }); + + cTabs.addTab(tab); + + tab = new YAHOO.widget.Tab({ + label: app_strings.LBL_EMAIL_OPTIONS, + scroll : true, + content : SUGAR.util.getAndRemove("divOptions" + idx).innerHTML, + id : "divOptions" + idx, + active : false + }); + + tab.layout = SE.composeLayout[idx]; + tab.on("activeChange", function(o){ + if (o.newValue) { + this.layout.getUnitByPosition("right").set("header", app_strings.LBL_EMAIL_OPTIONS); + } + }); + cTabs.addTab(tab); + + SE.composeLayout[idx].autoSize = function() { + var pEl = this.get("element").parentNode.parentNode.parentNode; + this.set("height", pEl.clientHeight-30); + this.render(); + } + + SE.composeLayout[idx].rightTabs = cTabs; + }, + isParentTypeValid : function(idx) { + var parentTypeValue = document.getElementById('data_parent_type' + idx).value; + var parentNameValue = document.getElementById('data_parent_name' + idx).value; + if (trim(parentTypeValue) == ""){ + alert(mod_strings.LBL_ERROR_SELECT_MODULE); + return false; + } // if + return true; + }, + + isParentTypeAndNameValid : function(idx) { + var parentTypeValue = document.getElementById('data_parent_type' + idx).value; + var parentNameValue = document.getElementById('data_parent_name' + idx).value; + var parentIdValue = document.getElementById('data_parent_id' + idx).value; + if ((trim(parentTypeValue) != "" && trim(parentNameValue) == "") || + (trim(parentTypeValue) != "" && trim(parentNameValue) != "" && parentIdValue == "")){ + alert(mod_strings.LBL_ERROR_SELECT_MODULE_SELECT); + return false; + } // if + return true; + }, + + callopenpopupForEmail2 : function(idx,options) { + + var formName = 'emailCompose' + idx; + + if(typeof(options) != 'undefined' && typeof(options.form_name) != 'undefined') + formName = options.form_name; + + var parentTypeValue = document.getElementById('data_parent_type' + idx).value; + var parentNameValue = document.getElementById('data_parent_name' + idx).value; + if (!SE.composeLayout.isParentTypeValid(idx)) { + return; + } // if + open_popup(document.getElementById('data_parent_type' + idx).value,600,400,'&tree=ProductsProd',true,false, + { + call_back_function:"SE.composeLayout.popupAddEmail", + form_name:formName, + field_to_name_array:{ + id:'data_parent_id' + idx, + name:'data_parent_name' + idx, + email1:'email1'} + }); + }, + + popupAddEmail : function(o) + { + var nameKey = "data_parent_name" + SE.composeLayout.currentInstanceId; + var data = o.name_to_value_array; + if (typeof (data[nameKey]) != "undefined" && data[nameKey] != "" + && typeof (data["email1"]) != "undefined" && data["email1"] != "" && data["email1"] != "undefined") + { + var target = Dom.get("addressTO" + SE.composeLayout.currentInstanceId); + target.value = SE.addressBook.smartAddEmailAddressToComposeField(target.value, data[nameKey] + "<" + data.email1 + ">"); + } + set_return(o); + }, + /** + * Prepare TinyMCE + */ + _1_tiny : function() { + var idx = SE.composeLayout.currentInstanceId; + var elId = SE.tinyInstances.currentHtmleditor = 'htmleditor' + idx; + SE.tinyInstances[elId] = { }; + SE.tinyInstances[elId].ready = false; + var t = tinyMCE.getInstanceById(elId); + + if(typeof(t) == 'undefined') { + tinyMCE.execCommand('mceAddControl', false, elId); + YAHOO.util.Event.onAvailable(elId + "_parent", function() { + SE.composeLayout.resizeEditor(idx); + setTimeout("SUGAR.email2.composeLayout.setSignature('" + idx + "')", 1000); + }, this); + } + }, + + resizeEditor : function(idx) + { + var cof = Dom.get('composeOverFrame' + idx); + var head = Dom.get('composeHeaderTable' + idx); + var targetHeight = cof.clientHeight - head.clientHeight; + var instance = tinyMCE.get(SE.tinyInstances.currentHtmleditor); + + var parentEl = Dom.get(instance.editorId + '_parent'); + var toolbar = Dom.getElementsByClassName("mceFirst", "tr", parentEl)[0]; + var contentEl = instance.contentAreaContainer; + var iFrame = contentEl.firstChild; + var tinMceToolbarOffset = 18; + iFrame.style.height = (targetHeight - toolbar.offsetHeight - tinMceToolbarOffset) + "px"; + }, + + /** + * Initializes d&d, auto-complete, email templates + */ + _2_final : function() { + var idx = SE.composeLayout.currentInstanceId; + + if(this.emailTemplates) { + this.setComposeOptions(idx); + } else { + //populate email template cache + AjaxObject.target = ''; + AjaxObject.startRequest(callbackComposeCache, urlStandard + "&emailUIAction=fillComposeCache"); + } + + // handle drop targets for addressBook + var to = new YAHOO.util.DDTarget('addressTO' +idx, 'addressBookDD', {notifyDrop:this.handleDrop}); + var cc = new YAHOO.util.DDTarget('addressCC' +idx, 'addressBookDD', {notifyDrop:this.handleDrop}); + var bcc = new YAHOO.util.DDTarget('addressBCC'+idx, 'addressBookDD', {notifyDrop:this.handleDrop}); + to.notifyDrop = cc.notifyDrop = bcc.notifyDrop = this.handleDrop; + + // auto-complete setup + SE.autoComplete.init(idx); + + // set focus on to: + document.getElementById("addressTO" + idx).focus(); + }, + + /** + * hide tinyMCE tool bar if send email as plaintext is checked + */ + renderTinyMCEToolBar : function (idx, hide) { + if (hide) { + document.getElementById('htmleditor' + idx + '_toolbar1').style.display = 'none'; + } else { + document.getElementById('htmleditor' + idx + '_toolbar1').style.display = ''; + } + }, + + c1_composeEmail : function(isReplyForward, retry) { + if (!retry) { + this._0_yui(); + } + if (typeof(tinyMCE) == 'undefined' || typeof(tinyMCE.settings) == 'undefined'){ + setTimeout("SE.composeLayout.c1_composeEmail(" + isReplyForward + ", true);", 500); + } else { + this._1_tiny(); + this._2_final(); + + if(isReplyForward) { + this.replyForwardEmailStage2(); + } + } + }, + + /** + * takes draft info and prepopulates + */ + c0_composeDraft : function() { + this.getNewInstanceId(); + inCompose = true; + document.getElementById('_blank').innerHTML = ''; + var idx = SE.composeLayout.currentInstanceId; + SE.composeLayout.draftObject = new Object(); + SE.composeLayout.draftObject.id = idx; + SE.composeLayout.draftObject.isDraft = true; + SE.composeLayout.currentInstanceId = idx; + SE.tinyInstances.currentHtmleditor = 'htmleditor' + SE.composeLayout.currentInstanceId; + SE.tinyInstances[SE.tinyInstances.currentHtmleditor] = new Object(); + SE.tinyInstances[SE.tinyInstances.currentHtmleditor].ready = false; + + SE.composeLayout._0_yui(); + SE.composeLayout._1_tiny(); + + // final touches + SE.composeLayout._2_final(); + + /* Draft-specific final processing. Need a delay to allow Tiny to render before calling setText() */ + setTimeout("AjaxObject.handleReplyForwardForDraft(SE.o);", 1000); + }, + + /** + * Strip & Prep editor hidden fields + */ + c0_composeNewEmail : function() { + this.getNewInstanceId(); + this.c1_composeEmail(false); + }, + + /** + * Sends async request to get the compose view. + * Requests come from "reply" or "forwards" + */ + c0_replyForwardEmail : function(ieId, uid, mbox, type) { + SE.composeLayout.replyForwardObj = new Object(); + SE.composeLayout.replyForwardObj.ieId = ieId; + SE.composeLayout.replyForwardObj.uid = uid; + SE.composeLayout.replyForwardObj.mbox = mbox; + SE.composeLayout.replyForwardObj.type = type; + + if(mbox == 'sugar::Emails') { + SE.composeLayout.replyForwardObj.sugarEmail = true; + } + + SE.composeLayout.getNewInstanceId(); + SE.composeLayout.c1_composeEmail(true); + }, + //// END COMPOSE FLOW + /////////////////////////////////////////////////////////////////////////// + + /** + * Called when a contact, email, or mailinglist is dropped + * into one of the compose fields. + */ + handleDrop : function (source, event, data, target) { + var nodes; + if (!target) { + target = event.getTarget(); + if (data.single) { + data.nodes = [data.nodes]; + } + nodes = data.nodes; + } else { + target = document.getElementById(target); + nodes = data; + } + + if (target.id.indexOf('address') > -1) { + // dropped onto email to/cc/bcc field + for(var i in nodes) { + var node = nodes[i].getData(); + var email = ""; + if (node[1].indexOf('contact') > -1) { + email = SE.addressBook.getFormattedAddress(node[0]); + } else if (node[1].indexOf('address-email') > -1){ + email = node[3].replace(/ /gi, ''); + email = email.replace('<', '<').replace('>', '>'); + var tr = source.getTrEl(nodes[i]); + while (tr && !Dom.hasClass(tr, "address-contact")) { + tr = source.getPreviousTrEl(tr); + } + var CID = source.getRecord(tr).getData()[0]; + var o = SE.addressBook._contactCache[CID]; + var name = new String(o.name); + var finalName = name.replace(/(<([^>]+)>)/ig, ""); + email = finalName + email; + } + target.value = SE.addressBook.smartAddEmailAddressToComposeField(target.value, email); + } + } + }, + + + /*///////////////////////////////////////////////////////////////////////////// + /// EMAIL TEMPLATE CODE + */ + applyEmailTemplate : function (idx, id) { + + //bug #20680 + var box_title = mod_strings.LBL_EMAILTEMPLATE_MESSAGE_SHOW_TITLE; + var box_msg = mod_strings.LBL_EMAILTEMPLATE_MESSAGE_SHOW_MSG; + var box_none_msg = mod_strings.LBL_EMAILTEMPLATE_MESSAGE_CLEAR_MSG; + + // id is selected index of email template drop-down + if(id == '' || id == "0") { + YAHOO.SUGAR.MessageBox.show({ + title:box_title, + msg: box_none_msg, + type: 'confirm', + fn: function(btn){ + if(btn=='no'){return;}; + SUGAR.email2.composeLayout.processNoneResult(idx, id);}, + modal:true, + scope:this + }); + return; + } + + YAHOO.SUGAR.MessageBox.show({ + title:box_title, + msg: box_msg, + type: 'confirm', + fn: function(btn){ + if(btn=='no'){return;}; + SUGAR.email2.composeLayout.processResult(idx, id);}, + modal:true, + scope:this + }); + }, + + processNoneResult : function(idx, id) { + var tiny = SE.util.getTiny('htmleditor' + idx); + var tinyHTML = tiny.getContent(); + var openTag = '
    '; + var htmllow = tinyHTML.toLowerCase(); + var start = htmllow.indexOf(openTag); + if (start > -1) { + tinyHTML = tinyHTML.substr(start); + tiny.setContent(tinyHTML); + } else { + tiny.setContent(''); + } + }, + + processResult : function(idx , id){ + call_json_method('EmailTemplates','retrieve','record='+id,'email_template_object', this.appendEmailTemplateJSON); + + // get attachments if any + AjaxObject.target = ''; + AjaxObject.startRequest(callbackLoadAttachments, urlStandard + "&emailUIAction=getTemplateAttachments&parent_id=" + id); + }, + + appendEmailTemplateJSON : function() { + var idx = SE.composeLayout.currentInstanceId; // post increment + + // query based on template, contact_id0,related_to + //jchi 09/10/2008 refix #7743 + if(json_objects['email_template_object']['fields']['subject'] != '' ) { // cn: bug 7743, don't stomp populated Subject Line + document.getElementById('emailSubject' + idx).value = decodeURI(encodeURI(json_objects['email_template_object']['fields']['subject'])); + } + + var text = decodeURI(encodeURI(json_objects['email_template_object']['fields']['body_html'])).replace(/
    /ig, '\n').replace(/
    /gi, "\n").replace(/&/gi,'&').replace(/</gi,'<').replace(/>/gi,'>').replace(/'/gi,'\'').replace(/"/gi,'"'); + + // cn: bug 14361 - text-only templates don't fill compose screen + if(text == '') { + text = decodeURI(encodeURI(json_objects['email_template_object']['fields']['body'])).replace(/
    /ig, '\n').replace(/
    /gi, "\n").replace(/&/gi,'&').replace(/</gi,'<').replace(/>/gi,'>').replace(/'/gi,'\'').replace(/"/gi,'"').replace(/\r\n/gi,"
    "); + } + + var tiny = SE.util.getTiny('htmleditor' + idx); + var tinyHTML = tiny.getContent(); + var openTag = '
    '; + var closeTag = '
    '; + var htmllow = tinyHTML.toLowerCase(); + var start = htmllow.indexOf(openTag); + if (start > -1) { + var htmlPart2 = tinyHTML.substr(start); + tinyHTML = text + htmlPart2; + tiny.setContent(tinyHTML); + } else { + tiny.setContent(text); + } + }, + + /** + * Writes out the signature in the email editor + */ + setSignature : function(idx) { + if (!tinyMCE) + return false; + var hide = document.getElementById('setEditor' + idx).checked; + SE.composeLayout.renderTinyMCEToolBar(idx,hide); + //wait for signatures to load before trying to set them + if (!SE.composeLayout.signatures) { + setTimeout("SE.composeLayout.setSignature(" + idx + ");", 1000); + return; + } + + if(idx) { + var sel = document.getElementById('signatures' + idx); + } else { + var sel = document.getElementById('signature_id'); + idx = SE.tinyInstances.currentHtmleditor; + } + + //Ensure that the tinyMCE html has been rendered. + if(typeof(SE.composeLayout.loadedTinyInstances[idx]) != 'undefined' && SE.composeLayout.loadedTinyInstances[idx] == false) { + setTimeout("SE.composeLayout.setSignature(" + idx + ");",1000); + return; + } + + var signature = ''; + + try { + signature = sel.options[sel.selectedIndex].value; + } catch(e) { + + } + + var openTag = '
    '; + var closeTag = '
    '; + var t = SE.util.getTiny('htmleditor' + idx); + //IE 6 Hack + if(typeof(t) != 'undefined') + { + t.contentDocument = t.contentWindow.document; + var html = t.getContent(); + } + else + var html = ''; + + var htmllow = html.toLowerCase(); + var start = htmllow.indexOf(openTag); + var end = htmllow.indexOf(closeTag) + closeTag.length; + + // selected "none" - remove signature from email + if(signature == '') { + if (start > -1) { + var htmlPart1 = html.substr(0, start); + var htmlPart2 = html.substr(end, html.length); + + html = htmlPart1 + htmlPart2; + t.setContent(html); + } + SE.signatures.lastAttemptedLoad = ''; + return false; + } + + if(!SE.signatures.lastAttemptedLoad) // lazy load place holder + SE.signatures.lastAttemptedLoad = ''; + + SE.signatures.lastAttemptedLoad = signature; + + if(typeof(SE.signatures[signature]) == 'undefined') { + //lazy load + SE.signatures.lastAttemptedLoad = ''; // reset this flag for recursion + SE.signatures.targetInstance = (idx) ? idx : ""; + AjaxObject.target = ''; + AjaxObject.startRequest(callbackLoadSignature, urlStandard + "&emailUIAction=getSignature&id="+signature); + } else { + var newSignature = this.prepareSignature(SE.signatures[signature]); + + // clear out old signature + if(SE.signatures.lastAttemptedLoad && start > -1) { + var htmlPart1 = html.substr(0, start); + var htmlPart2 = html.substr(end, html.length); + + html = htmlPart1 + htmlPart2; + } + + // [pre|ap]pend + start = html.indexOf('

    '); + if(SE.userPrefs.signatures.signature_prepend == 'true' && start > -1) { + var htmlPart1 = html.substr(0, start); + var htmlPart2 = html.substr(start, html.length); + var newHtml = htmlPart1 + openTag + newSignature + closeTag + htmlPart2; + } else if(SUGAR.email2.userPrefs.signatures.signature_prepend == 'true') { + var newHtml = '
    ' + openTag + newSignature + closeTag + html; + } else { + var newHtml = html + openTag + newSignature + closeTag; + } + //tinyMCE.setContent(newHtml); + t.setContent(newHtml); + } + }, + + prepareSignature : function(str) { + var signature = new String(str); + + signature = signature.replace(/</gi, '<'); + signature = signature.replace(/>/gi, '>'); + + return signature; + }, + + + showAttachmentPanel : function(idx) { + var east = SE.composeLayout[idx].getUnitByPosition("right"); + var tabs = SE.composeLayout[idx].rightTabs; + east.expand(); + tabs.set("activeTab", tabs.getTab(0)); + }, + + /** + * expands sidebar and displays options panel + */ + showOptionsPanel : function(idx) { + var east = SE.composeLayout[idx].getUnitByPosition("right"); + var tabs = SE.composeLayout[idx].rightTabs; + east.expand(); + tabs.set("activeTab", tabs.getTab(1)); + }, + + /** + * Selects the Contacts tab + */ + showContactsPanel : function() { + SE.complexLayout.regions.west.showPanel("contactsTab"); + }, + + /** + * Generates fields for Select Document + */ + addDocumentField : function(idx) { + var basket = document.getElementById('addedDocuments' + idx); + if(basket) { + var index = (basket.childNodes.length / 7) - 1; + if(index < 0) + index = 0; + } else { + index = 0; + } + + var test = document.getElementById('documentId' + idx + index); + + while(test != null) { + index++; + test = document.getElementById('documentId' + idx + index); + } + + var documentCup = document.createElement("div"); + documentCup.id = 'documentCup' + idx + index; + documentCup.innerHTML = "" + + // document id field + "" + + // document name field + "" + + // select button + "" + + // remove button + "" + + "
    "; + + basket.appendChild(documentCup); + //basket.innerHTML += out; + return index; + }, + + /** + * Makes async call to save a draft of the email + * @param int Instance index + */ + saveDraft : function(tinyInstance) { + this.sendEmail(tinyInstance, true); + }, + + selectDocument : function(target) { + URL="index.php?module=Emails&action=PopupDocuments&to_pdf=true&target=" + target; + windowName = 'selectDocument'; + windowFeatures = 'width=800' + ',height=600' + ',resizable=1,scrollbars=1'; + + win = window.open(URL, windowName, windowFeatures); + if(window.focus) { + // put the focus on the popup if the browser supports the focus() method + win.focus(); + } + }, + + /** + * Modal popup for file attachment dialogue + */ + addFileField : function() { + if(!SE.addFileDialog){ // lazy initialize the dialog and only create it once + SE.addFileDialog = new YAHOO.widget.Dialog("addFileDialog", { + modal:true, + visible:false, + fixedcenter:true, + constraintoviewport: true, + scroll: true, + keylisteners : new YAHOO.util.KeyListener(document, { keys:27 }, { + fn:function(){SE.addFileDialog.hide();} + }) + }); + SE.addFileDialog.setHeader(app_strings.LBL_EMAIL_ATTACHMENTS); + SE.addFileDialog.render(); + // SE.addFileDialog.addKeyListener(27, , SE.addFileDialog); + } + Dom.removeClass("addFileDialog", "yui-hidden"); + + SE.addFileDialog.show(); + }, + + /** + * Async upload of file to temp dir + */ + uploadAttachment : function() { + if(document.getElementById('email_attachment').value != "") { + var formObject = document.getElementById('uploadAttachment'); + YAHOO.util.Connect.setForm(formObject, true, true); + AjaxObject.target = ''; + AjaxObject.startRequest(callbackUploadAttachment, null); + } else { + alert(app_strings.LBL_EMAIL_ERROR_NO_FILE); + } + }, + + /** + * Adds a SugarDocument to an outbound email. Action occurs in a popup window displaying a ListView from the Documents module + * @param string target in focus compose layout + */ + setDocument : function(idx, target, documentId, documentName, docRevId) { + // fields are named/id'd [fieldName][instanceId][index] + var addedDocs = document.getElementById("addedDocuments" + idx); + var docId = document.getElementById('documentId' + idx + target); + var docName = document.getElementById('documentName' + idx + target); + var docRevisionId = document.getElementById('document' + idx + target); + docId.value = documentId; + docName.value = documentName; + docRevisionId.value = docRevId; + }, + + /** + * Removes the bucket div containing the document input fields + */ + deleteDocumentField : function(documentCup) { + var f0 = document.getElementById(documentCup); + f0.parentNode.removeChild(f0); + }, + + /** + * Removes a Template Attachment field + * @param int + * @param int + */ + deleteTemplateAttachmentField : function(idx, index) { + // create not-in-array values for removal filtering + var r = document.getElementById("templateAttachmentsRemove" + idx).value; + + if(r != "") { + r += "::"; + } + + r += document.getElementById('templateAttachmentId' + idx + index).value; + document.getElementById("templateAttachmentsRemove" + idx).value = r; + + var target = 'templateAttachmentCup' + idx + index; + d = document.getElementById(target); + d.parentNode.removeChild(d); + }, + + /** + * Async removal of uploaded temp file + * @param string index Should be a concatenation of idx and index + * @param string + */ + deleteUploadAttachment : function(index, file) { + var d = document.getElementById('email_attachment_bucket' + index); + d.parentNode.removeChild(d); + + // make async call to delete cached file + AjaxObject.target = ''; + AjaxObject.startRequest(null, urlStandard + "&emailUIAction=removeUploadedAttachment&file="+file); + }, + + /** + * Attaches files coming from Email Templates + */ + addTemplateAttachmentField : function(idx) { + // expose title + document.getElementById('templateAttachmentsTitle' + idx).style.display = 'block'; + + var basket = document.getElementById('addedTemplateAttachments' + idx); + + if(basket) { + var index = basket.childNodes.length; + if(index < 0) + index = 0; + } else { + index = 0; + } + + var out = "
    " + + // remove button + "" + + // file icon + "" + + // templateAttachment field + "" + + // docId field + "" + + // file name + " " + + "

    " + + "
    "; + basket.innerHTML = basket.innerHTML + out; + + return index; + }, + + /** + * Sends one email via async call + * @param int idx Editor instance ID + * @param bool isDraft + */ + sendEmail : function(idx, isDraft) { + + //If the outbound account has an error message associate with it, alert the user and refuse to continue. + var obAccountID = document.getElementById('addressFrom' + idx).value; + + if( typeof(SUGAR.email2.composeLayout.outboundAccountErrors[obAccountID]) != 'undefined' ) + { + overlay(app_strings.LBL_EMAIL_ERROR_DESC, SUGAR.email2.composeLayout.outboundAccountErrors[obAccountID], 'alert'); + return false; + } + + + var form = document.getElementById('emailCompose' + idx); + var composeOptionsFormName = "composeOptionsForm" + idx; + var t = SE.util.getTiny(SE.tinyInstances.currentHtmleditor); + var html = t.getContent(); + var subj = document.getElementById('emailSubject' + idx).value; + var to = trim(document.getElementById('addressTO' + idx).value); + var cc = trim(document.getElementById('addressCC' + idx).value); + var bcc = trim(document.getElementById('addressBCC' + idx).value); + var email_id = document.getElementById('email_id' + idx).value; + var composeType = document.getElementById('composeType').value; + var parent_type = document.getElementById("parent_type").value; + var parent_id = document.getElementById("parent_id").value; + + var el_uid = document.getElementById("uid"); + var uid = (el_uid == null) ? '' : el_uid.value; + + var el_ieId = document.getElementById("ieId"); + var ieId = (el_ieId == null) ? '' : el_ieId.value; + + var el_mbox = document.getElementById("mbox"); + var mbox = (el_mbox == null) ? '' : el_mbox.value; + + if (!isValidEmail(to) || !isValidEmail(cc) || !isValidEmail(bcc)) { + alert(app_strings.LBL_EMAIL_COMPOSE_INVALID_ADDRESS); + return false; + } + + if (!SE.composeLayout.isParentTypeAndNameValid(idx)) { + return; + } // if + var parentTypeValue = document.getElementById('data_parent_type' + idx).value; + var parentIdValue = document.getElementById('data_parent_id' + idx).value; + parent_id = parentIdValue; + parent_type = parentTypeValue; + + var in_draft = (document.getElementById('type' + idx).value == 'draft') ? true : false; + // baseline viability check + + if(to == "" && cc == '' && bcc == '' && !isDraft) { + alert(app_strings.LBL_EMAIL_COMPOSE_ERR_NO_RECIPIENTS); + return false; + } else if(subj == '' && !isDraft) { + if(!confirm(app_strings.LBL_EMAIL_COMPOSE_NO_SUBJECT)) { + return false; + } else { + subj = app_strings.LBL_EMAIL_COMPOSE_NO_SUBJECT_LITERAL; + } + } else if(html == '' && !isDraft) { + if(!confirm(app_strings.LBL_EMAIL_COMPOSE_NO_BODY)) { + return false; + } + } + + SE.util.clearHiddenFieldValues('emailCompose' + idx); + document.getElementById('data_parent_id' + idx).value = parentIdValue; + var title = (isDraft) ? app_strings.LBL_EMAIL_SAVE_DRAFT : app_strings.LBL_EMAIL_SENDING_EMAIL; + overlay(title, app_strings.LBL_EMAIL_ONE_MOMENT); + html = html.replace(/</ig, "sugarLessThan"); + html = html.replace(/>/ig, "sugarGreaterThan"); + + form.sendDescription.value = html; + form.sendSubject.value = subj; + form.sendTo.value = to; + form.sendCc.value = cc; + form.sendBcc.value = bcc; + form.email_id.value = email_id; + form.composeType.value = composeType; + form.composeLayoutId.value = 'composeLayout' + idx; + form.setEditor.value = (document.getElementById('setEditor' + idx).checked == false) ? 1 : 0; + form.saveToSugar.value = 1; + form.fromAccount.value = document.getElementById('addressFrom' + idx).value; + form.parent_type.value = parent_type; + form.parent_id.value = parent_id; + form.uid.value = uid; + form.ieId.value = ieId; + form.mbox.value = mbox; + + // email attachments + var addedFiles = document.getElementById('addedFiles' + idx); + if(addedFiles) { + for(i=0; i 0) { + document.getElementById("emailSubject" + SE.composeLayout.currentInstanceId).value = composePackage.subject; + } + + //If no parent fields are set in the composePackage, ensure they are cleared. + var parentFields = ['parent_type','parent_name','parent_id']; + for(var i=0;i 0) { + document.getElementById("email_id" + SE.composeLayout.currentInstanceId).value = composePackage.email_id; + } // if + if (composePackage.body != null && composePackage.body.length > 0) { + var tiny = SE.util.getTiny('htmleditor' + SE.composeLayout.currentInstanceId); + SE.composeLayout.loadedTinyInstances[SE.composeLayout.currentInstanceId] = false; + setTimeout("SE.composeLayout.setContentOnThisTiny();", 3000); + } // if + if (composePackage.attachments != null) { + SE.composeLayout.loadAttachments(composePackage.attachments); + } // if + + if (composePackage.fromAccounts != null && composePackage.fromAccounts.status) { + var addressFrom = document.getElementById('addressFrom' + SE.composeLayout.currentInstanceId); + SE.util.emptySelectOptions(addressFrom); + var fromAccountOpts = composePackage.fromAccounts.data; + for(i=0; i/ig, '\n').replace(/
    /gi, "\n").replace(/&/gi,'&').replace(/</gi,'<').replace(/>/gi,'>').replace(/'/gi,'\'').replace(/"/gi,'"'); + } // if + //Flag determines if we should clear the tiny contents or just append + if (typeof(composePackage.clearBody) != 'undefined' && composePackage.clearBody) + SE.composeLayout.tinyHTML = ''; + else + SE.composeLayout.tinyHTML = tinyHTML + composePackage.body; + + tiny.setContent(SE.composeLayout.tinyHTML); + //Indicate that the contents has been loaded successfully. + SE.composeLayout.loadedTinyInstances[SE.composeLayout.currentInstanceId] = true; + }, + /** + * Confirms closure of a compose screen if "x" is clicked + */ + confirmClose : function(panel) { + if(confirm(app_strings.LBL_EMAIL_CONFIRM_CLOSE)) { + SE.composeLayout.closeCompose(panel.id); + return true; + } else { + return false; + } + }, + + /** + * forces close of a compose screen + */ + forceCloseCompose : function(id) { + SE.composeLayout.closeCompose(id); + + // handle flow back to originating view + if(composePackage) { + // check if it's a module we need to return to + if(composePackage.return_module && composePackage.return_action && composePackage.return_id) { + if(confirm(app_strings.LBL_EMAIL_RETURN_TO_VIEW)) { + var url = "index.php?module=" + composePackage.return_module + "&action=" + composePackage.return_action + "&record=" + composePackage.return_id; + window.location = url; + } + } + } + }, + + /** + * closes the editor that just sent email + * @param string id ID of composeLayout tab + */ + closeCompose : function(id) { + // destroy tinyMCE instance + var idx = id.substr(13, id.length); + var instanceId = "htmleditor" + idx; + tinyMCE.execCommand('mceRemoveControl', false, instanceId); + + // nullify DOM and namespace values. + inCompose = false; + SE.composeLayout[idx] = null; + SE.tinyInstances[instanceId] = null; + var tabsArray = SE.innerLayout.get("tabs"); + for (i = 0 ; i < tabsArray.length ; i++) { + if (tabsArray[i].get("id") == ('composeTab' + idx)) { + tabsArray[i].close(); + break; + } + } + //SE.innerLayout.getTab(idx).close(); + }, + + /** + * Enable the quick search for the compose relate field or search tab + */ + enableQuickSearchRelate: function(idx,overides){ + + if(typeof overides != 'undefined') + { + var newModuleID = overides['moduleSelectField']; //data_parent_type_search + var newModule = document.getElementById(newModuleID).value; + var formName = overides['formName']; + var fieldName = overides['fieldName']; + var fieldId = overides['fieldId']; + var fullName = formName + "_" + fieldName; + var postBlurFunction = null; + } + else + { + var newModule = document.getElementById('data_parent_type'+idx).value; + var formName = 'emailCompose'+idx; + var fieldName = 'data_parent_name'+idx; + var fieldId = 'data_parent_id'+idx; + var fullName = formName + "_" + fieldName; + var postBlurFunction = "SE.composeLayout.qsAddAddress"; + } + + if(typeof sqs_objects == 'undefined') + window['sqs_objects'] = new Array; + + window['sqs_objects'][fullName] = { + form:formName, + method:"query", + modules:[newModule], + group:"or", + field_list:["name","id", "email1"],populate_list:[fieldName,fieldId],required_list:[fieldId], + conditions:[{name:"name",op:"like_custom",end:"%",value:""}], + post_onblur_function: postBlurFunction, + order:"name","limit":"30","no_match_text":"No Match"}; + + + if(typeof QSProcessedFieldsArray != 'undefined') + QSProcessedFieldsArray[fullName] = false; + if (typeof(QSFieldsArray) != 'undefined' && typeof(QSFieldsArray[fullName]) != 'undefined') { + QSFieldsArray[fullName].destroy(); + delete QSFieldsArray[fullName]; + } + if (Dom.get(fullName + "_results")) { + Dom.get(fullName + "_results").parentNode.removeChild(Dom.get(fullName + "_results")); + } + + enableQS(false); + }, + + qsAddAddress : function(o) { + if (o.name != "" && o.email1 != "") + { + var target = Dom.get("addressTO" + SE.composeLayout.currentInstanceId); + target.value = SE.addressBook.smartAddEmailAddressToComposeField(target.value, o.name + "<" + o.email1 + ">"); + } + }, + /** + * Returns a new instance ID, 0-index + */ + getNewInstanceId : function() { + this.currentInstanceId = this.currentInstanceId + 1; + return this.currentInstanceId; + }, + + /** + * Takes an array of objects that contain the filename and GUID of a Note (attachment or Sugar Document) and applies the values to the compose screen. Valid use-cases are applying an EmailTemplate or resuming a Draft Email. + */ + loadAttachments : function(result) { + var idx = SE.composeLayout.currentInstanceId; + + if(typeof(result) == 'object') { + //jchi #20680. Clean the former template attachments; + var basket = document.getElementById('addedTemplateAttachments' + idx); + if(basket.innerHTML != ''){ + confirm(mod_strings.LBL_CHECK_ATTACHMENTS, mod_strings.LBL_HAS_ATTACHMENTS, function(btn){ + if (btn != 'yes'){ + basket.innerHTML = ''; + } + }); + } + for(i in result) { + if(typeof result[i] == 'object') { + var index = SE.composeLayout.addTemplateAttachmentField(idx); + var bean = result[i]; + document.getElementById('templateAttachmentId' + idx + index).value = bean['id']; + document.getElementById('templateAttachmentName' + idx + index).innerHTML += bean['filename']; + } + } + } + }, + + /** + * fills drop-down values for email templates and signatures + */ + setComposeOptions : function(idx) { + // send from accounts + var addressFrom = document.getElementById('addressFrom' + idx); + + if (addressFrom.options.length <= 0) { + SE.util.emptySelectOptions(addressFrom); + var fromAccountOpts = SE.composeLayout.fromAccounts; + for (id = 0 ; id < fromAccountOpts.length ; id++) { + var key = fromAccountOpts[id].value; + var display = fromAccountOpts[id].text; + var is_default = false; + if(key == SUGAR.default_inbound_accnt_id) + is_default = true; + var opt = new Option(display, key); + addressFrom.options.add(opt); + addressFrom.options[id].selected = is_default; //Safari bug new Option(x,y,true) does not work. + } + } + + // email templates + var et = document.getElementById('email_template' + idx); + SE.util.emptySelectOptions(et); + + for(var key in this.emailTemplates) { // iterate through assoc array + var display = this.emailTemplates[key]; + var opt = new Option(display, key); + et.options.add(opt); + } + + // signatures + var sigs = document.getElementById('signatures' + idx); + SE.util.emptySelectOptions(sigs); + + for(var key in this.signatures) { // iterate through assoc array + var display = this.signatures[key]; + var opt = new Option(display, key); + + if(key == SE.userPrefs.signatures.signature_default) { + opt.selected = true; + } + + sigs.options.add(opt); + } + + // html/plain email? + var htmlEmail = document.getElementById('setEditor' + idx); + if(SE.userPrefs.emailSettings.sendPlainText == 1) { + htmlEmail.checked = true; + } else { + htmlEmail.checked = false; + } + + SE.tinyInstances[SE.tinyInstances.currentHtmleditor].ready = true; + }, + + /** + * After compose screen is rendered, async call to get email body from Sugar + */ + replyForwardEmailStage2 : function() { + SE.util.clearHiddenFieldValues('emailUIForm'); + overlay(app_strings.LBL_EMAIL_RETRIEVING_MESSAGE, app_strings.LBL_EMAIL_ONE_MOMENT); + + var ieId = SE.composeLayout.replyForwardObj.ieId; + var uid = SE.composeLayout.replyForwardObj.uid; + var mbox = SE.composeLayout.replyForwardObj.mbox; + var type = SE.composeLayout.replyForwardObj.type; + var idx = SE.composeLayout.currentInstanceId; + + var sugarEmail = (SE.composeLayout.replyForwardObj.sugarEmail) ? '&sugarEmail=true' : ""; + + document.getElementById('emailSubject' + idx).value = type; + document.getElementById('emailUIAction').value = 'composeEmail'; + document.getElementById('composeType').value = type; + document.getElementById('ieId').value = ieId; + document.getElementById('uid').value = uid; + document.getElementById('mbox').value = mbox; + document.getElementById('setEditor' + idx).checked = SE.userPrefs.emailSettings.sendPlainText == 1 ? true : false; + var formObject = document.getElementById('emailUIForm'); + YAHOO.util.Connect.setForm(formObject); + + var sendType = type; + AjaxObject.startRequest(callbackReplyForward, urlStandard + "&composeType=" + type + sugarEmail); + }, + + /** + * Show the hidden cc or bcc fields + */ + showHiddenAddress: function(addrType,idx){ + + Dom.removeClass(addrType+"_tr"+idx, "yui-hidden"); + Dom.addClass(addrType+"_span"+idx, "yui-hidden"); + Dom.addClass("bcc_cc_sep"+idx, "yui-hidden"); + this[addrType+'Hidden'+idx] = false; + + //After bcc or cc is added, move options below last addr field + Dom.insertAfter("add_addr_options_tr"+idx, 'bcc_tr'+idx); + + //If both cc and bcc hidden, remove the empty row containing text. + if( ( typeof(this['ccHidden'+idx]) != 'undefined' && typeof(this['bccHidden'+idx]) != 'undefined') + && ( this['ccHidden'+idx] == false && this['bccHidden'+idx] == false) ) + Dom.addClass("add_addr_options_tr"+idx, "yui-hidden"); + + SE.composeLayout.resizeEditor(idx); + }, + /** + * Hide the cc and bcc fields if they were shown. + */ + hideHiddenAddresses: function(idx){ + + var addrTypes = ['cc','bcc']; + for(var i = 0;i
    '; +// End of File modules/Emails/javascript/composeEmailTemplate.js + +/********************************************************************************* + * SugarCRM is a customer relationship management program developed by + * SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc. + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU Affero General Public License version 3 as published by the + * Free Software Foundation with the addition of the following permission added + * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK + * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY + * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS. + * + * 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 Affero General Public License for more + * details. + * + * You should have received a copy of the GNU Affero General Public License along with + * this program; if not, see http://www.gnu.org/licenses or write to the Free + * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301 USA. + * + * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road, + * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com. + * + * The interactive user interfaces in modified source and object code versions + * of this program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU Affero General Public License version 3. + * + * In accordance with Section 7(b) of the GNU Affero General Public License version 3, + * these Appropriate Legal Notices must retain the display of the "Powered by + * SugarCRM" logo. If the display of the logo is not reasonably feasible for + * technical reasons, the Appropriate Legal Notices must display the words + * "Powered by SugarCRM". + ********************************************************************************/ +/** + Complex layout init + */ +function complexLayoutInit() { + var se = SUGAR.email2; + var Dom = YAHOO.util.Dom; + se.e2Layout = { + getInnerLayout : function(rows) { + se.listViewLayout = new YAHOO.widget.Layout('listViewDiv', { + parent: se.complexLayout, + border:true, + hideOnLayout: true, + height: 400, + units: [{ + position: "center", + scroll:false, // grid should autoScroll itself + split:true, + body: "
    " + },{ + position: "bottom", + scroll:true, + collapse: false, + resize: true, + useShim:true, + height:'250', + body: "
    " + },{ + position: "right", + scroll:true, + collapse: false, + resize: true, + useShim:true, + width:'250', + body: "
    ", + titlebar: false //,header: "right" + }] + }); + se.complexLayout.on("render", function(){ + var height = SUGAR.email2.innerLayout.get("element").clientHeight - 30; + SUGAR.email2.innerLayout.get("activeTab").get("contentEl").parentNode.style.height = height + "px"; + SUGAR.email2.listViewLayout.set("height", height); + SUGAR.email2.listViewLayout.render(); + }); + se.listViewLayout.render(); + //CSS hack for now + se.listViewLayout.get("element").parentNode.parentNode.style.padding = "0px" + var rp = se.listViewLayout.resizePreview = function() { + var pre = Dom.get("displayEmailFramePreview"); + if (pre) { + var parent = Dom.getAncestorByClassName(pre, "yui-layout-bd"); + pre.style.height = (parent.clientHeight - pre.offsetTop) + "px"; + } + }; + se.listViewLayout.getUnitByPosition("bottom").on("heightChange", se.autoSetLayout); + se.listViewLayout.getUnitByPosition("right").on("endResize", se.autoSetLayout); + se.e2Layout.setPreviewPanel(rows); + se.previewLayout = se.listViewLayout; + return se.listViewLayout; + }, + + getInnerLayout2Rows : function() { + return this.getInnerLayout(true); + }, + getInnerLayout2Columns : function() { + return this.getInnerLayout(false); + }, + + init : function(){ + // initialize state manager, we will use cookies +// Ext.state.Manager.setProvider(new Ext.state.CookieProvider()); + var viewHeight = document.documentElement ? document.documentElement.clientHeight : self.innerHeight; + se.complexLayout = new YAHOO.widget.Layout("container", { + border:true, + hideOnLayout: true, + height: Dom.getViewportHeight() - (document.getElementById('header').clientHeight ) - 65, + width: Dom.getViewportWidth() - 40, + units: [{ + position: "center", + scroll:false, + body: "
    " + }, + { + position: "left", + scroll: true, + body: "
    ", + collapse: true, + width: 210, + minWidth: 100, + resize:true, + useShim:true, + titlebar: true, + header: " " + }, + { + header: Dom.get('footerLinks').innerHTML, + position: 'bottom', + id: 'mbfooter', + height: 22, + border: false + }] + }); + se.complexLayout.render(); + var tp = se.innerLayout = new YAHOO.widget.TabView("emailtabs"); + tp.addTab(new YAHOO.widget.Tab({ + label: "Inbox", + scroll : true, + content : "
    ", + id : "center", + active : true + })); + var centerEl = se.complexLayout.getUnitByPosition('center').get('wrap'); + tp.appendTo(centerEl); + //CSS hack for now + tp.get("element").style.borderRight = "1px solid #666" + + var listV = this.getInnerLayout2Rows(); + listV.set("height", tp.get("element").clientHeight - 25); + listV.render(); + + se.leftTabs = new YAHOO.widget.TabView("lefttabs"); + var folderTab = new YAHOO.widget.Tab({ + label: app_strings.LBL_EMAIL_FOLDERS_SHORT, + scroll : true, + content : "
    ", + id : "tree", + active : true + }); + folderTab.on("activeChange", function(o){ + if (o.newValue) { + se.complexLayout.getUnitByPosition("left").set("header", app_strings.LBL_EMAIL_FOLDERS); + } + }); + se.leftTabs.addTab(folderTab); + + var tabContent = SUGAR.util.getAndRemove("searchTab"); + var searchTab = new YAHOO.widget.Tab({ + label: app_strings.LBL_EMAIL_SEARCH_SHORT, + scroll : true, + content : tabContent.innerHTML, + id : tabContent.id + }); + searchTab.on("activeChange", function(o){ + if (o.newValue) + { + se.complexLayout.getUnitByPosition("left").set("header", app_strings.LBL_EMAIL_SEARCH); + //Setup the calendars if needed + Calendar.setup ({inputField : "searchDateFrom", ifFormat : calFormat, showsTime : false, button : "jscal_trigger_from", singleClick : true, step : 1, weekNumbers:false}); + Calendar.setup ({inputField : "searchDateTo", ifFormat : calFormat, showsTime : false, button : "jscal_trigger_to", singleClick : true, step : 1, weekNumbers:false}); + + //Initalize sqs object for assigned user name + se.e2Layout.initSQSObject('advancedSearchForm','assigned_user_name'); + + //Attach event handler for when the relate module option is selected for the correct sqs object + var parentSearchArgs = {'formName':'advancedSearchForm','fieldName':'data_parent_name_search', + 'moduleSelectField':'data_parent_type_search','fieldId':'data_parent_id_search'}; + YAHOO.util.Event.addListener('data_parent_type_search', 'change',function(){ + SUGAR.email2.composeLayout.enableQuickSearchRelate(null,parentSearchArgs) }); + + //If enter key is pressed, perform search + var addKeyPressFields = ['searchSubject','searchFrom','searchTo','data_parent_name_search','searchDateTo','searchDateFrom','attachmentsSearch','assigned_user_name']; + for(var i=0; i < addKeyPressFields.length;i++) + { + YAHOO.util.Event.addListener(window.document.forms['advancedSearchForm'].elements[addKeyPressFields[i]],"keydown", function(e){ + if (e.keyCode == 13) { + YAHOO.util.Event.stopEvent(e); + SUGAR.email2.search.searchAdvanced(); + } + }); + } + //Initiate quick search for the search tab. Do this only when the tab is selected rather than onDomLoad for perf. gains. + enableQS(true); + //Clear parent values if selecting another parent type. + YAHOO.util.Event.addListener('data_parent_type_search','change', + function(){ + document.getElementById('data_parent_id_search').value =''; + document.getElementById('data_parent_name_search').value =''; + }); + + } + }); + se.leftTabs.addTab(searchTab); + + var resizeTabBody = function() { + var height = SUGAR.email2.leftTabs.get("element").clientHeight - 30; + SUGAR.email2.leftTabs.get("activeTab").get("contentEl").parentNode.style.height = height + "px"; + } + resizeTabBody(); + se.complexLayout.on("render", resizeTabBody); + se.leftTabs.on("activeTabChange", resizeTabBody); + //hack to allow left pane scroll bar to fully show + var lefttabsDiv = document.getElementById('lefttabs'); + var lefttabsDivParent = Dom.getAncestorBy(lefttabsDiv); + var lefttabsDivGParent = Dom.getAncestorBy(lefttabsDivParent); + lefttabsDivParent.style.width = lefttabsDivGParent.offsetWidth - 10 + "px"; + + }, + initSQSObject: function(formName,fieldName) + { + var fullFieldName = formName + '_' + fieldName; //SQS Convention + var resultName = fullFieldName + '_' + 'results'; + + if (QSFieldsArray[fullFieldName] != null) + { + QSFieldsArray[fullFieldName].destroy(); + delete QSFieldsArray[fullFieldName]; + } + if (QSProcessedFieldsArray[fullFieldName]) + QSProcessedFieldsArray[fullFieldName] = false; + + if( Dom.get(resultName) ) + { + var obj = document.getElementById(resultName); + obj.parentNode.removeChild(obj); + } + }, + setPreviewPanel: function(rows) { + if (rows) { + SUGAR.email2.listViewLayout.getUnitByPosition("right").set("width", 0); + SUGAR.email2.listViewLayout.getUnitByPosition("bottom").set("height", 250); + Dom.get("listRight").innerHTML = ""; + Dom.get("listBottom").innerHTML = "
    "; + } else { + SUGAR.email2.listViewLayout.getUnitByPosition("bottom").set("height", 0); + SUGAR.email2.listViewLayout.getUnitByPosition("right").set("width", 250); + Dom.get("listBottom").innerHTML = ""; + Dom.get("listRight").innerHTML = "
    "; + } + } + }; + se.e2Layout.init(); +} + +var myBufferedListenerObject = new Object(); +myBufferedListenerObject.refit = function() { + if(SUGAR.email2.grid) { + SUGAR.email2.grid.autoSize(); + } +} +// End of File modules/Emails/javascript/complexLayout.js + diff --git a/include/javascript/sugar_grp_yui2.js b/include/javascript/sugar_grp_yui2.js new file mode 100755 index 00000000..966a9eb2 --- /dev/null +++ b/include/javascript/sugar_grp_yui2.js @@ -0,0 +1,31 @@ +/* +Copyright (c) 2009, Yahoo! Inc. All rights reserved. +Code licensed under the BSD License: +http://developer.yahoo.net/yui/license.txt +version: 2.8.0r4 +*/ +if(!YAHOO.util.DragDropMgr){YAHOO.util.DragDropMgr=function(){var A=YAHOO.util.Event,B=YAHOO.util.Dom;return{useShim:false,_shimActive:false,_shimState:false,_debugShim:false,_createShim:function(){var C=document.createElement("div");C.id="yui-ddm-shim";if(document.body.firstChild){document.body.insertBefore(C,document.body.firstChild);}else{document.body.appendChild(C);}C.style.display="none";C.style.backgroundColor="red";C.style.position="absolute";C.style.zIndex="99999";B.setStyle(C,"opacity","0");this._shim=C;A.on(C,"mouseup",this.handleMouseUp,this,true);A.on(C,"mousemove",this.handleMouseMove,this,true);A.on(window,"scroll",this._sizeShim,this,true);},_sizeShim:function(){if(this._shimActive){var C=this._shim;C.style.height=B.getDocumentHeight()+"px";C.style.width=B.getDocumentWidth()+"px";C.style.top="0";C.style.left="0";}},_activateShim:function(){if(this.useShim){if(!this._shim){this._createShim();}this._shimActive=true;var C=this._shim,D="0";if(this._debugShim){D=".5";}B.setStyle(C,"opacity",D);this._sizeShim();C.style.display="block";}},_deactivateShim:function(){this._shim.style.display="none";this._shimActive=false;},_shim:null,ids:{},handleIds:{},dragCurrent:null,dragOvers:{},deltaX:0,deltaY:0,preventDefault:true,stopPropagation:true,initialized:false,locked:false,interactionInfo:null,init:function(){this.initialized=true;},POINT:0,INTERSECT:1,STRICT_INTERSECT:2,mode:0,_execOnAll:function(E,D){for(var F in this.ids){for(var C in this.ids[F]){var G=this.ids[F][C];if(!this.isTypeOfDD(G)){continue;}G[E].apply(G,D);}}},_onLoad:function(){this.init();A.on(document,"mouseup",this.handleMouseUp,this,true);A.on(document,"mousemove",this.handleMouseMove,this,true);A.on(window,"unload",this._onUnload,this,true);A.on(window,"resize",this._onResize,this,true);},_onResize:function(C){this._execOnAll("resetConstraints",[]);},lock:function(){this.locked=true;},unlock:function(){this.locked=false;},isLocked:function(){return this.locked;},locationCache:{},useCache:true,clickPixelThresh:3,clickTimeThresh:1000,dragThreshMet:false,clickTimeout:null,startX:0,startY:0,fromTimeout:false,regDragDrop:function(D,C){if(!this.initialized){this.init();}if(!this.ids[C]){this.ids[C]={};}this.ids[C][D.id]=D;},removeDDFromGroup:function(E,C){if(!this.ids[C]){this.ids[C]={};}var D=this.ids[C];if(D&&D[E.id]){delete D[E.id];}},_remove:function(E){for(var D in E.groups){if(D){var C=this.ids[D];if(C&&C[E.id]){delete C[E.id];}}}delete this.handleIds[E.id];},regHandle:function(D,C){if(!this.handleIds[D]){this.handleIds[D]={};}this.handleIds[D][C]=C;},isDragDrop:function(C){return(this.getDDById(C))?true:false;},getRelated:function(H,D){var G=[];for(var F in H.groups){for(var E in this.ids[F]){var C=this.ids[F][E];if(!this.isTypeOfDD(C)){continue;}if(!D||C.isTarget){G[G.length]=C;}}}return G;},isLegalTarget:function(G,F){var D=this.getRelated(G,true);for(var E=0,C=D.length;Ethis.clickPixelThresh||D>this.clickPixelThresh){this.startDrag(this.startX,this.startY);}}if(this.dragThreshMet){if(C&&C.events.b4Drag){C.b4Drag(F);C.fireEvent("b4DragEvent",{e:F});}if(C&&C.events.drag){C.onDrag(F);C.fireEvent("dragEvent",{e:F});}if(C){this.fireEvents(F,false);}}this.stopEvent(F);}},fireEvents:function(V,L){var a=this.dragCurrent;if(!a||a.isLocked()||a.dragOnly){return;}var N=YAHOO.util.Event.getPageX(V),M=YAHOO.util.Event.getPageY(V),P=new YAHOO.util.Point(N,M),K=a.getTargetCoord(P.x,P.y),F=a.getDragEl(),E=["out","over","drop","enter"],U=new YAHOO.util.Region(K.y,K.x+F.offsetWidth,K.y+F.offsetHeight,K.x),I=[],D={},Q=[],c={outEvts:[],overEvts:[],dropEvts:[],enterEvts:[]};for(var S in this.dragOvers){var d=this.dragOvers[S];if(!this.isTypeOfDD(d)){continue; +}if(!this.isOverTarget(P,d,this.mode,U)){c.outEvts.push(d);}I[S]=true;delete this.dragOvers[S];}for(var R in a.groups){if("string"!=typeof R){continue;}for(S in this.ids[R]){var G=this.ids[R][S];if(!this.isTypeOfDD(G)){continue;}if(G.isTarget&&!G.isLocked()&&G!=a){if(this.isOverTarget(P,G,this.mode,U)){D[R]=true;if(L){c.dropEvts.push(G);}else{if(!I[G.id]){c.enterEvts.push(G);}else{c.overEvts.push(G);}this.dragOvers[G.id]=G;}}}}}this.interactionInfo={out:c.outEvts,enter:c.enterEvts,over:c.overEvts,drop:c.dropEvts,point:P,draggedRegion:U,sourceRegion:this.locationCache[a.id],validDrop:L};for(var C in D){Q.push(C);}if(L&&!c.dropEvts.length){this.interactionInfo.validDrop=false;if(a.events.invalidDrop){a.onInvalidDrop(V);a.fireEvent("invalidDropEvent",{e:V});}}for(S=0;S2000){}else{setTimeout(C._addListeners,10);if(document&&document.body){C._timeoutCount+=1;}}}},handleWasClicked:function(C,E){if(this.isHandle(E,C.id)){return true;}else{var D=C.parentNode;while(D){if(this.isHandle(E,D.id)){return true;}else{D=D.parentNode;}}}return false;}};}();YAHOO.util.DDM=YAHOO.util.DragDropMgr;YAHOO.util.DDM._addListeners();}(function(){var A=YAHOO.util.Event;var B=YAHOO.util.Dom;YAHOO.util.DragDrop=function(E,C,D){if(E){this.init(E,C,D);}};YAHOO.util.DragDrop.prototype={events:null,on:function(){this.subscribe.apply(this,arguments);},id:null,config:null,dragElId:null,handleElId:null,invalidHandleTypes:null,invalidHandleIds:null,invalidHandleClasses:null,startPageX:0,startPageY:0,groups:null,locked:false,lock:function(){this.locked=true;},unlock:function(){this.locked=false;},isTarget:true,padding:null,dragOnly:false,useShim:false,_domRef:null,__ygDragDrop:true,constrainX:false,constrainY:false,minX:0,maxX:0,minY:0,maxY:0,deltaX:0,deltaY:0,maintainOffset:false,xTicks:null,yTicks:null,primaryButtonOnly:true,available:false,hasOuterHandles:false,cursorIsOver:false,overlap:null,b4StartDrag:function(C,D){},startDrag:function(C,D){},b4Drag:function(C){},onDrag:function(C){},onDragEnter:function(C,D){},b4DragOver:function(C){},onDragOver:function(C,D){},b4DragOut:function(C){},onDragOut:function(C,D){},b4DragDrop:function(C){},onDragDrop:function(C,D){},onInvalidDrop:function(C){},b4EndDrag:function(C){},endDrag:function(C){},b4MouseDown:function(C){},onMouseDown:function(C){},onMouseUp:function(C){},onAvailable:function(){},getEl:function(){if(!this._domRef){this._domRef=B.get(this.id); +}return this._domRef;},getDragEl:function(){return B.get(this.dragElId);},init:function(F,C,D){this.initTarget(F,C,D);A.on(this._domRef||this.id,"mousedown",this.handleMouseDown,this,true);for(var E in this.events){this.createEvent(E+"Event");}},initTarget:function(E,C,D){this.config=D||{};this.events={};this.DDM=YAHOO.util.DDM;this.groups={};if(typeof E!=="string"){this._domRef=E;E=B.generateId(E);}this.id=E;this.addToGroup((C)?C:"default");this.handleElId=E;A.onAvailable(E,this.handleOnAvailable,this,true);this.setDragElId(E);this.invalidHandleTypes={A:"A"};this.invalidHandleIds={};this.invalidHandleClasses=[];this.applyConfig();},applyConfig:function(){this.events={mouseDown:true,b4MouseDown:true,mouseUp:true,b4StartDrag:true,startDrag:true,b4EndDrag:true,endDrag:true,drag:true,b4Drag:true,invalidDrop:true,b4DragOut:true,dragOut:true,dragEnter:true,b4DragOver:true,dragOver:true,b4DragDrop:true,dragDrop:true};if(this.config.events){for(var C in this.config.events){if(this.config.events[C]===false){this.events[C]=false;}}}this.padding=this.config.padding||[0,0,0,0];this.isTarget=(this.config.isTarget!==false);this.maintainOffset=(this.config.maintainOffset);this.primaryButtonOnly=(this.config.primaryButtonOnly!==false);this.dragOnly=((this.config.dragOnly===true)?true:false);this.useShim=((this.config.useShim===true)?true:false);},handleOnAvailable:function(){this.available=true;this.resetConstraints();this.onAvailable();},setPadding:function(E,C,F,D){if(!C&&0!==C){this.padding=[E,E,E,E];}else{if(!F&&0!==F){this.padding=[E,C,E,C];}else{this.padding=[E,C,F,D];}}},setInitPosition:function(F,E){var G=this.getEl();if(!this.DDM.verifyEl(G)){if(G&&G.style&&(G.style.display=="none")){}else{}return;}var D=F||0;var C=E||0;var H=B.getXY(G);this.initPageX=H[0]-D;this.initPageY=H[1]-C;this.lastPageX=H[0];this.lastPageY=H[1];this.setStartPosition(H);},setStartPosition:function(D){var C=D||B.getXY(this.getEl());this.deltaSetXY=null;this.startPageX=C[0];this.startPageY=C[1];},addToGroup:function(C){this.groups[C]=true;this.DDM.regDragDrop(this,C);},removeFromGroup:function(C){if(this.groups[C]){delete this.groups[C];}this.DDM.removeDDFromGroup(this,C);},setDragElId:function(C){this.dragElId=C;},setHandleElId:function(C){if(typeof C!=="string"){C=B.generateId(C);}this.handleElId=C;this.DDM.regHandle(this.id,C);},setOuterHandleElId:function(C){if(typeof C!=="string"){C=B.generateId(C);}A.on(C,"mousedown",this.handleMouseDown,this,true);this.setHandleElId(C);this.hasOuterHandles=true;},unreg:function(){A.removeListener(this.id,"mousedown",this.handleMouseDown);this._domRef=null;this.DDM._remove(this);},isLocked:function(){return(this.DDM.isLocked()||this.locked);},handleMouseDown:function(J,I){var D=J.which||J.button;if(this.primaryButtonOnly&&D>1){return;}if(this.isLocked()){return;}var C=this.b4MouseDown(J),F=true;if(this.events.b4MouseDown){F=this.fireEvent("b4MouseDownEvent",J);}var E=this.onMouseDown(J),H=true;if(this.events.mouseDown){H=this.fireEvent("mouseDownEvent",J);}if((C===false)||(E===false)||(F===false)||(H===false)){return;}this.DDM.refreshCache(this.groups);var G=new YAHOO.util.Point(A.getPageX(J),A.getPageY(J));if(!this.hasOuterHandles&&!this.DDM.isOverTarget(G,this)){}else{if(this.clickValidator(J)){this.setStartPosition();this.DDM.handleMouseDown(J,this);this.DDM.stopEvent(J);}else{}}},clickValidator:function(D){var C=YAHOO.util.Event.getTarget(D);return(this.isValidHandleChild(C)&&(this.id==this.handleElId||this.DDM.handleWasClicked(C,this.id)));},getTargetCoord:function(E,D){var C=E-this.deltaX;var F=D-this.deltaY;if(this.constrainX){if(Cthis.maxX){C=this.maxX;}}if(this.constrainY){if(Fthis.maxY){F=this.maxY;}}C=this.getTick(C,this.xTicks);F=this.getTick(F,this.yTicks);return{x:C,y:F};},addInvalidHandleType:function(C){var D=C.toUpperCase();this.invalidHandleTypes[D]=D;},addInvalidHandleId:function(C){if(typeof C!=="string"){C=B.generateId(C);}this.invalidHandleIds[C]=C;},addInvalidHandleClass:function(C){this.invalidHandleClasses.push(C);},removeInvalidHandleType:function(C){var D=C.toUpperCase();delete this.invalidHandleTypes[D];},removeInvalidHandleId:function(C){if(typeof C!=="string"){C=B.generateId(C);}delete this.invalidHandleIds[C];},removeInvalidHandleClass:function(D){for(var E=0,C=this.invalidHandleClasses.length;E=this.minX;D=D-C){if(!E[D]){this.xTicks[this.xTicks.length]=D;E[D]=true;}}for(D=this.initPageX;D<=this.maxX;D=D+C){if(!E[D]){this.xTicks[this.xTicks.length]=D;E[D]=true;}}this.xTicks.sort(this.DDM.numericSort);},setYTicks:function(F,C){this.yTicks=[];this.yTickSize=C;var E={};for(var D=this.initPageY;D>=this.minY;D=D-C){if(!E[D]){this.yTicks[this.yTicks.length]=D;E[D]=true;}}for(D=this.initPageY;D<=this.maxY;D=D+C){if(!E[D]){this.yTicks[this.yTicks.length]=D;E[D]=true;}}this.yTicks.sort(this.DDM.numericSort);},setXConstraint:function(E,D,C){this.leftConstraint=parseInt(E,10);this.rightConstraint=parseInt(D,10);this.minX=this.initPageX-this.leftConstraint;this.maxX=this.initPageX+this.rightConstraint;if(C){this.setXTicks(this.initPageX,C);}this.constrainX=true;},clearConstraints:function(){this.constrainX=false;this.constrainY=false;this.clearTicks();},clearTicks:function(){this.xTicks=null;this.yTicks=null;this.xTickSize=0;this.yTickSize=0;},setYConstraint:function(C,E,D){this.topConstraint=parseInt(C,10);this.bottomConstraint=parseInt(E,10);this.minY=this.initPageY-this.topConstraint;this.maxY=this.initPageY+this.bottomConstraint;if(D){this.setYTicks(this.initPageY,D); +}this.constrainY=true;},resetConstraints:function(){if(this.initPageX||this.initPageX===0){var D=(this.maintainOffset)?this.lastPageX-this.initPageX:0;var C=(this.maintainOffset)?this.lastPageY-this.initPageY:0;this.setInitPosition(D,C);}else{this.setInitPosition();}if(this.constrainX){this.setXConstraint(this.leftConstraint,this.rightConstraint,this.xTickSize);}if(this.constrainY){this.setYConstraint(this.topConstraint,this.bottomConstraint,this.yTickSize);}},getTick:function(I,F){if(!F){return I;}else{if(F[0]>=I){return F[0];}else{for(var D=0,C=F.length;D=I){var H=I-F[D];var G=F[E]-I;return(G>H)?F[D]:F[E];}}return F[F.length-1];}}},toString:function(){return("DragDrop "+this.id);}};YAHOO.augment(YAHOO.util.DragDrop,YAHOO.util.EventProvider);})();YAHOO.util.DD=function(C,A,B){if(C){this.init(C,A,B);}};YAHOO.extend(YAHOO.util.DD,YAHOO.util.DragDrop,{scroll:true,autoOffset:function(C,B){var A=C-this.startPageX;var D=B-this.startPageY;this.setDelta(A,D);},setDelta:function(B,A){this.deltaX=B;this.deltaY=A;},setDragElPos:function(C,B){var A=this.getDragEl();this.alignElWithMouse(A,C,B);},alignElWithMouse:function(C,G,F){var E=this.getTargetCoord(G,F);if(!this.deltaSetXY){var H=[E.x,E.y];YAHOO.util.Dom.setXY(C,H);var D=parseInt(YAHOO.util.Dom.getStyle(C,"left"),10);var B=parseInt(YAHOO.util.Dom.getStyle(C,"top"),10);this.deltaSetXY=[D-E.x,B-E.y];}else{YAHOO.util.Dom.setStyle(C,"left",(E.x+this.deltaSetXY[0])+"px");YAHOO.util.Dom.setStyle(C,"top",(E.y+this.deltaSetXY[1])+"px");}this.cachePosition(E.x,E.y);var A=this;setTimeout(function(){A.autoScroll.call(A,E.x,E.y,C.offsetHeight,C.offsetWidth);},0);},cachePosition:function(B,A){if(B){this.lastPageX=B;this.lastPageY=A;}else{var C=YAHOO.util.Dom.getXY(this.getEl());this.lastPageX=C[0];this.lastPageY=C[1];}},autoScroll:function(J,I,E,K){if(this.scroll){var L=this.DDM.getClientHeight();var B=this.DDM.getClientWidth();var N=this.DDM.getScrollTop();var D=this.DDM.getScrollLeft();var H=E+I;var M=K+J;var G=(L+N-I-this.deltaY);var F=(B+D-J-this.deltaX);var C=40;var A=(document.all)?80:30;if(H>L&&G0&&I-NB&&F0&&J-D0){G=F-1;do{D=E.subscribers[G];if(D&&D.obj==I&&D.fn==H){return true;}}while(G--);}return false;};YAHOO.lang.augmentProto(A,YAHOO.util.EventProvider);}());(function(){YAHOO.widget.Module=function(R,Q){if(R){this.init(R,Q);}else{}};var F=YAHOO.util.Dom,D=YAHOO.util.Config,N=YAHOO.util.Event,M=YAHOO.util.CustomEvent,G=YAHOO.widget.Module,I=YAHOO.env.ua,H,P,O,E,A={"BEFORE_INIT":"beforeInit","INIT":"init","APPEND":"append","BEFORE_RENDER":"beforeRender","RENDER":"render","CHANGE_HEADER":"changeHeader","CHANGE_BODY":"changeBody","CHANGE_FOOTER":"changeFooter","CHANGE_CONTENT":"changeContent","DESTROY":"destroy","BEFORE_SHOW":"beforeShow","SHOW":"show","BEFORE_HIDE":"beforeHide","HIDE":"hide"},J={"VISIBLE":{key:"visible",value:true,validator:YAHOO.lang.isBoolean},"EFFECT":{key:"effect",suppressEvent:true,supercedes:["visible"]},"MONITOR_RESIZE":{key:"monitorresize",value:true},"APPEND_TO_DOCUMENT_BODY":{key:"appendtodocumentbody",value:false}};G.IMG_ROOT=null;G.IMG_ROOT_SSL=null;G.CSS_MODULE="yui-module";G.CSS_HEADER="hd";G.CSS_BODY="bd";G.CSS_FOOTER="ft";G.RESIZE_MONITOR_SECURE_URL="javascript:false;";G.RESIZE_MONITOR_BUFFER=1;G.textResizeEvent=new M("textResize");G.forceDocumentRedraw=function(){var Q=document.documentElement;if(Q){Q.className+=" ";Q.className=YAHOO.lang.trim(Q.className);}};function L(){if(!H){H=document.createElement("div");H.innerHTML=('
    '+'
    ');P=H.firstChild;O=P.nextSibling;E=O.nextSibling;}return H;}function K(){if(!P){L();}return(P.cloneNode(false));}function B(){if(!O){L();}return(O.cloneNode(false));}function C(){if(!E){L();}return(E.cloneNode(false));}G.prototype={constructor:G,element:null,header:null,body:null,footer:null,id:null,imageRoot:G.IMG_ROOT,initEvents:function(){var Q=M.LIST; +this.beforeInitEvent=this.createEvent(A.BEFORE_INIT);this.beforeInitEvent.signature=Q;this.initEvent=this.createEvent(A.INIT);this.initEvent.signature=Q;this.appendEvent=this.createEvent(A.APPEND);this.appendEvent.signature=Q;this.beforeRenderEvent=this.createEvent(A.BEFORE_RENDER);this.beforeRenderEvent.signature=Q;this.renderEvent=this.createEvent(A.RENDER);this.renderEvent.signature=Q;this.changeHeaderEvent=this.createEvent(A.CHANGE_HEADER);this.changeHeaderEvent.signature=Q;this.changeBodyEvent=this.createEvent(A.CHANGE_BODY);this.changeBodyEvent.signature=Q;this.changeFooterEvent=this.createEvent(A.CHANGE_FOOTER);this.changeFooterEvent.signature=Q;this.changeContentEvent=this.createEvent(A.CHANGE_CONTENT);this.changeContentEvent.signature=Q;this.destroyEvent=this.createEvent(A.DESTROY);this.destroyEvent.signature=Q;this.beforeShowEvent=this.createEvent(A.BEFORE_SHOW);this.beforeShowEvent.signature=Q;this.showEvent=this.createEvent(A.SHOW);this.showEvent.signature=Q;this.beforeHideEvent=this.createEvent(A.BEFORE_HIDE);this.beforeHideEvent.signature=Q;this.hideEvent=this.createEvent(A.HIDE);this.hideEvent.signature=Q;},platform:function(){var Q=navigator.userAgent.toLowerCase();if(Q.indexOf("windows")!=-1||Q.indexOf("win32")!=-1){return"windows";}else{if(Q.indexOf("macintosh")!=-1){return"mac";}else{return false;}}}(),browser:function(){var Q=navigator.userAgent.toLowerCase();if(Q.indexOf("opera")!=-1){return"opera";}else{if(Q.indexOf("msie 7")!=-1){return"ie7";}else{if(Q.indexOf("msie")!=-1){return"ie";}else{if(Q.indexOf("safari")!=-1){return"safari";}else{if(Q.indexOf("gecko")!=-1){return"gecko";}else{return false;}}}}}}(),isSecure:function(){if(window.location.href.toLowerCase().indexOf("https")===0){return true;}else{return false;}}(),initDefaultConfig:function(){this.cfg.addProperty(J.VISIBLE.key,{handler:this.configVisible,value:J.VISIBLE.value,validator:J.VISIBLE.validator});this.cfg.addProperty(J.EFFECT.key,{suppressEvent:J.EFFECT.suppressEvent,supercedes:J.EFFECT.supercedes});this.cfg.addProperty(J.MONITOR_RESIZE.key,{handler:this.configMonitorResize,value:J.MONITOR_RESIZE.value});this.cfg.addProperty(J.APPEND_TO_DOCUMENT_BODY.key,{value:J.APPEND_TO_DOCUMENT_BODY.value});},init:function(V,U){var S,W;this.initEvents();this.beforeInitEvent.fire(G);this.cfg=new D(this);if(this.isSecure){this.imageRoot=G.IMG_ROOT_SSL;}if(typeof V=="string"){S=V;V=document.getElementById(V);if(!V){V=(L()).cloneNode(false);V.id=S;}}this.id=F.generateId(V);this.element=V;W=this.element.firstChild;if(W){var R=false,Q=false,T=false;do{if(1==W.nodeType){if(!R&&F.hasClass(W,G.CSS_HEADER)){this.header=W;R=true;}else{if(!Q&&F.hasClass(W,G.CSS_BODY)){this.body=W;Q=true;}else{if(!T&&F.hasClass(W,G.CSS_FOOTER)){this.footer=W;T=true;}}}}}while((W=W.nextSibling));}this.initDefaultConfig();F.addClass(this.element,G.CSS_MODULE);if(U){this.cfg.applyConfig(U,true);}if(!D.alreadySubscribed(this.renderEvent,this.cfg.fireQueue,this.cfg)){this.renderEvent.subscribe(this.cfg.fireQueue,this.cfg,true);}this.initEvent.fire(G);},initResizeMonitor:function(){var R=(I.gecko&&this.platform=="windows");if(R){var Q=this;setTimeout(function(){Q._initResizeMonitor();},0);}else{this._initResizeMonitor();}},_initResizeMonitor:function(){var Q,S,U;function W(){G.textResizeEvent.fire();}if(!I.opera){S=F.get("_yuiResizeMonitor");var V=this._supportsCWResize();if(!S){S=document.createElement("iframe");if(this.isSecure&&G.RESIZE_MONITOR_SECURE_URL&&I.ie){S.src=G.RESIZE_MONITOR_SECURE_URL;}if(!V){U=["'); + }, + + init : function(ed) { + var f = document.forms[0], nl = f.elements, ed = tinyMCEPopup.editor, dom = ed.dom, n = ed.selection.getNode(); + + tinyMCEPopup.resizeToInnerSize(); + this.fillClassList('class_list'); + this.fillFileList('src_list', 'tinyMCEImageList'); + this.fillFileList('over_list', 'tinyMCEImageList'); + this.fillFileList('out_list', 'tinyMCEImageList'); + TinyMCE_EditableSelects.init(); + + if (n.nodeName == 'IMG') { + nl.src.value = dom.getAttrib(n, 'src'); + nl.width.value = dom.getAttrib(n, 'width'); + nl.height.value = dom.getAttrib(n, 'height'); + nl.alt.value = dom.getAttrib(n, 'alt'); + nl.title.value = dom.getAttrib(n, 'title'); + nl.vspace.value = this.getAttrib(n, 'vspace'); + nl.hspace.value = this.getAttrib(n, 'hspace'); + nl.border.value = this.getAttrib(n, 'border'); + selectByValue(f, 'align', this.getAttrib(n, 'align')); + selectByValue(f, 'class_list', dom.getAttrib(n, 'class'), true, true); + nl.style.value = dom.getAttrib(n, 'style'); + nl.id.value = dom.getAttrib(n, 'id'); + nl.dir.value = dom.getAttrib(n, 'dir'); + nl.lang.value = dom.getAttrib(n, 'lang'); + nl.usemap.value = dom.getAttrib(n, 'usemap'); + nl.longdesc.value = dom.getAttrib(n, 'longdesc'); + nl.insert.value = ed.getLang('update'); + + if (/^\s*this.src\s*=\s*\'([^\']+)\';?\s*$/.test(dom.getAttrib(n, 'onmouseover'))) + nl.onmouseoversrc.value = dom.getAttrib(n, 'onmouseover').replace(/^\s*this.src\s*=\s*\'([^\']+)\';?\s*$/, '$1'); + + if (/^\s*this.src\s*=\s*\'([^\']+)\';?\s*$/.test(dom.getAttrib(n, 'onmouseout'))) + nl.onmouseoutsrc.value = dom.getAttrib(n, 'onmouseout').replace(/^\s*this.src\s*=\s*\'([^\']+)\';?\s*$/, '$1'); + + if (ed.settings.inline_styles) { + // Move attribs to styles + if (dom.getAttrib(n, 'align')) + this.updateStyle('align'); + + if (dom.getAttrib(n, 'hspace')) + this.updateStyle('hspace'); + + if (dom.getAttrib(n, 'border')) + this.updateStyle('border'); + + if (dom.getAttrib(n, 'vspace')) + this.updateStyle('vspace'); + } + } + + // Setup browse button + document.getElementById('srcbrowsercontainer').innerHTML = getBrowserHTML('srcbrowser','src','image','theme_advanced_image'); + if (isVisible('srcbrowser')) + document.getElementById('src').style.width = '260px'; + + // Setup browse button + document.getElementById('onmouseoversrccontainer').innerHTML = getBrowserHTML('overbrowser','onmouseoversrc','image','theme_advanced_image'); + if (isVisible('overbrowser')) + document.getElementById('onmouseoversrc').style.width = '260px'; + + // Setup browse button + document.getElementById('onmouseoutsrccontainer').innerHTML = getBrowserHTML('outbrowser','onmouseoutsrc','image','theme_advanced_image'); + if (isVisible('outbrowser')) + document.getElementById('onmouseoutsrc').style.width = '260px'; + + // If option enabled default contrain proportions to checked + if (ed.getParam("advimage_constrain_proportions", true)) + f.constrain.checked = true; + + // Check swap image if valid data + if (nl.onmouseoversrc.value || nl.onmouseoutsrc.value) + this.setSwapImage(true); + else + this.setSwapImage(false); + + this.changeAppearance(); + this.showPreviewImage(nl.src.value, 1); + }, + + insert : function(file, title) { + var ed = tinyMCEPopup.editor, t = this, f = document.forms[0]; + + if (f.src.value === '') { + if (ed.selection.getNode().nodeName == 'IMG') { + ed.dom.remove(ed.selection.getNode()); + ed.execCommand('mceRepaint'); + } + + tinyMCEPopup.close(); + return; + } + + if (tinyMCEPopup.getParam("accessibility_warnings", 1)) { + if (!f.alt.value) { + tinyMCEPopup.confirm(tinyMCEPopup.getLang('advimage_dlg.missing_alt'), function(s) { + if (s) + t.insertAndClose(); + }); + + return; + } + } + + t.insertAndClose(); + }, + + insertAndClose : function() { + var ed = tinyMCEPopup.editor, f = document.forms[0], nl = f.elements, v, args = {}, el; + + tinyMCEPopup.restoreSelection(); + + // Fixes crash in Safari + if (tinymce.isWebKit) + ed.getWin().focus(); + + if (!ed.settings.inline_styles) { + args = { + vspace : nl.vspace.value, + hspace : nl.hspace.value, + border : nl.border.value, + align : getSelectValue(f, 'align') + }; + } else { + // Remove deprecated values + args = { + vspace : '', + hspace : '', + border : '', + align : '' + }; + } + + tinymce.extend(args, { + src : nl.src.value, + width : nl.width.value, + height : nl.height.value, + alt : nl.alt.value, + title : nl.title.value, + 'class' : getSelectValue(f, 'class_list'), + style : nl.style.value, + id : nl.id.value, + dir : nl.dir.value, + lang : nl.lang.value, + usemap : nl.usemap.value, + longdesc : nl.longdesc.value + }); + + args.onmouseover = args.onmouseout = ''; + + if (f.onmousemovecheck.checked) { + if (nl.onmouseoversrc.value) + args.onmouseover = "this.src='" + nl.onmouseoversrc.value + "';"; + + if (nl.onmouseoutsrc.value) + args.onmouseout = "this.src='" + nl.onmouseoutsrc.value + "';"; + } + + el = ed.selection.getNode(); + + if (el && el.nodeName == 'IMG') { + ed.dom.setAttribs(el, args); + } else { + ed.execCommand('mceInsertContent', false, '', {skip_undo : 1}); + ed.dom.setAttribs('__mce_tmp', args); + ed.dom.setAttrib('__mce_tmp', 'id', ''); + ed.undoManager.add(); + } + + tinyMCEPopup.close(); + }, + + getAttrib : function(e, at) { + var ed = tinyMCEPopup.editor, dom = ed.dom, v, v2; + + if (ed.settings.inline_styles) { + switch (at) { + case 'align': + if (v = dom.getStyle(e, 'float')) + return v; + + if (v = dom.getStyle(e, 'vertical-align')) + return v; + + break; + + case 'hspace': + v = dom.getStyle(e, 'margin-left') + v2 = dom.getStyle(e, 'margin-right'); + + if (v && v == v2) + return parseInt(v.replace(/[^0-9]/g, '')); + + break; + + case 'vspace': + v = dom.getStyle(e, 'margin-top') + v2 = dom.getStyle(e, 'margin-bottom'); + if (v && v == v2) + return parseInt(v.replace(/[^0-9]/g, '')); + + break; + + case 'border': + v = 0; + + tinymce.each(['top', 'right', 'bottom', 'left'], function(sv) { + sv = dom.getStyle(e, 'border-' + sv + '-width'); + + // False or not the same as prev + if (!sv || (sv != v && v !== 0)) { + v = 0; + return false; + } + + if (sv) + v = sv; + }); + + if (v) + return parseInt(v.replace(/[^0-9]/g, '')); + + break; + } + } + + if (v = dom.getAttrib(e, at)) + return v; + + return ''; + }, + + setSwapImage : function(st) { + var f = document.forms[0]; + + f.onmousemovecheck.checked = st; + setBrowserDisabled('overbrowser', !st); + setBrowserDisabled('outbrowser', !st); + + if (f.over_list) + f.over_list.disabled = !st; + + if (f.out_list) + f.out_list.disabled = !st; + + f.onmouseoversrc.disabled = !st; + f.onmouseoutsrc.disabled = !st; + }, + + fillClassList : function(id) { + var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl; + + if (v = tinyMCEPopup.getParam('theme_advanced_styles')) { + cl = []; + + tinymce.each(v.split(';'), function(v) { + var p = v.split('='); + + cl.push({'title' : p[0], 'class' : p[1]}); + }); + } else + cl = tinyMCEPopup.editor.dom.getClasses(); + + if (cl.length > 0) { + lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('not_set'), ''); + + tinymce.each(cl, function(o) { + lst.options[lst.options.length] = new Option(o.title || o['class'], o['class']); + }); + } else + dom.remove(dom.getParent(id, 'tr')); + }, + + fillFileList : function(id, l) { + var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl; + + l = window[l]; + + if (l && l.length > 0) { + lst.options[lst.options.length] = new Option('', ''); + + tinymce.each(l, function(o) { + lst.options[lst.options.length] = new Option(o[0], o[1]); + }); + } else + dom.remove(dom.getParent(id, 'tr')); + }, + + resetImageData : function() { + var f = document.forms[0]; + + f.elements.width.value = f.elements.height.value = ''; + }, + + updateImageData : function(img, st) { + var f = document.forms[0]; + + if (!st) { + f.elements.width.value = img.width; + f.elements.height.value = img.height; + } + + this.preloadImg = img; + }, + + changeAppearance : function() { + var ed = tinyMCEPopup.editor, f = document.forms[0], img = document.getElementById('alignSampleImg'); + + if (img) { + if (ed.getParam('inline_styles')) { + ed.dom.setAttrib(img, 'style', f.style.value); + } else { + img.align = f.align.value; + img.border = f.border.value; + img.hspace = f.hspace.value; + img.vspace = f.vspace.value; + } + } + }, + + changeHeight : function() { + var f = document.forms[0], tp, t = this; + + if (!f.constrain.checked || !t.preloadImg) { + return; + } + + if (f.width.value == "" || f.height.value == "") + return; + + tp = (parseInt(f.width.value) / parseInt(t.preloadImg.width)) * t.preloadImg.height; + f.height.value = tp.toFixed(0); + }, + + changeWidth : function() { + var f = document.forms[0], tp, t = this; + + if (!f.constrain.checked || !t.preloadImg) { + return; + } + + if (f.width.value == "" || f.height.value == "") + return; + + tp = (parseInt(f.height.value) / parseInt(t.preloadImg.height)) * t.preloadImg.width; + f.width.value = tp.toFixed(0); + }, + + updateStyle : function(ty) { + var dom = tinyMCEPopup.dom, st, v, f = document.forms[0], img = dom.create('img', {style : dom.get('style').value}); + + if (tinyMCEPopup.editor.settings.inline_styles) { + // Handle align + if (ty == 'align') { + dom.setStyle(img, 'float', ''); + dom.setStyle(img, 'vertical-align', ''); + + v = getSelectValue(f, 'align'); + if (v) { + if (v == 'left' || v == 'right') + dom.setStyle(img, 'float', v); + else + img.style.verticalAlign = v; + } + } + + // Handle border + if (ty == 'border') { + dom.setStyle(img, 'border', ''); + + v = f.border.value; + if (v || v == '0') { + if (v == '0') + img.style.border = '0'; + else + img.style.border = v + 'px solid black'; + } + } + + // Handle hspace + if (ty == 'hspace') { + dom.setStyle(img, 'marginLeft', ''); + dom.setStyle(img, 'marginRight', ''); + + v = f.hspace.value; + if (v) { + img.style.marginLeft = v + 'px'; + img.style.marginRight = v + 'px'; + } + } + + // Handle vspace + if (ty == 'vspace') { + dom.setStyle(img, 'marginTop', ''); + dom.setStyle(img, 'marginBottom', ''); + + v = f.vspace.value; + if (v) { + img.style.marginTop = v + 'px'; + img.style.marginBottom = v + 'px'; + } + } + + // Merge + dom.get('style').value = dom.serializeStyle(dom.parseStyle(img.style.cssText)); + } + }, + + changeMouseMove : function() { + }, + + showPreviewImage : function(u, st) { + if (!u) { + tinyMCEPopup.dom.setHTML('prev', ''); + return; + } + + if (!st && tinyMCEPopup.getParam("advimage_update_dimensions_onchange", true)) + this.resetImageData(); + + u = tinyMCEPopup.editor.documentBaseURI.toAbsolute(u); + + if (!st) + tinyMCEPopup.dom.setHTML('prev', ''); + else + tinyMCEPopup.dom.setHTML('prev', ''); + } +}; + +ImageDialog.preInit(); +tinyMCEPopup.onInit.add(ImageDialog.init, ImageDialog); diff --git a/include/javascript/tiny_mce/plugins/advimage/langs/en_dlg.js b/include/javascript/tiny_mce/plugins/advimage/langs/en_dlg.js new file mode 100755 index 00000000..ef81f78b --- /dev/null +++ b/include/javascript/tiny_mce/plugins/advimage/langs/en_dlg.js @@ -0,0 +1,43 @@ +tinyMCE.addI18n('en.advimage_dlg',{ +tab_general:"General", +tab_appearance:"Appearance", +tab_advanced:"Advanced", +general:"General", +title:"Title", +preview:"Preview", +constrain_proportions:"Constrain proportions", +langdir:"Language direction", +langcode:"Language code", +long_desc:"Long description link", +style:"Style", +classes:"Classes", +ltr:"Left to right", +rtl:"Right to left", +id:"Id", +map:"Image map", +swap_image:"Swap image", +alt_image:"Alternative image", +mouseover:"for mouse over", +mouseout:"for mouse out", +misc:"Miscellaneous", +example_img:"Appearance preview image", +missing_alt:"Are you sure you want to continue without including an Image Description? Without it the image may not be accessible to some users with disabilities, or to those using a text browser, or browsing the Web with images turned off.", +dialog_title:"Insert/edit image", +src:"Image URL", +alt:"Image description", +list:"Image list", +border:"Border", +dimensions:"Dimensions", +vspace:"Vertical space", +hspace:"Horizontal space", +align:"Alignment", +align_baseline:"Baseline", +align_top:"Top", +align_middle:"Middle", +align_bottom:"Bottom", +align_texttop:"Text top", +align_textbottom:"Text bottom", +align_left:"Left", +align_right:"Right", +image_list:"Image list" +}); \ No newline at end of file diff --git a/include/javascript/tiny_mce/plugins/advlink/editor_plugin.js b/include/javascript/tiny_mce/plugins/advlink/editor_plugin.js new file mode 100755 index 00000000..4899f7b8 --- /dev/null +++ b/include/javascript/tiny_mce/plugins/advlink/editor_plugin.js @@ -0,0 +1 @@ +(function(){tinymce.create('tinymce.plugins.AdvancedLinkPlugin',{init:function(ed,url){this.editor=ed;ed.addCommand('mceAdvLink',function(){var se=ed.selection;if(se.isCollapsed()&&!ed.dom.getParent(se.getNode(),'A'))return;ed.windowManager.open({file:url+'/link.htm',width:480+parseInt(ed.getLang('advlink.delta_width',0)),height:400+parseInt(ed.getLang('advlink.delta_height',0)),inline:1},{plugin_url:url});});ed.addButton('link',{title:'advlink.link_desc',cmd:'mceAdvLink'});ed.addShortcut('ctrl+k','advlink.advlink_desc','mceAdvLink');ed.onNodeChange.add(function(ed,cm,n,co){cm.setDisabled('link',co&&n.nodeName!='A');cm.setActive('link',n.nodeName=='A'&&!n.name);});},getInfo:function(){return{longname:'Advanced link',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advlink',version:tinymce.majorVersion+"."+tinymce.minorVersion};}});tinymce.PluginManager.add('advlink',tinymce.plugins.AdvancedLinkPlugin);})(); \ No newline at end of file diff --git a/include/javascript/tiny_mce/plugins/advlink/editor_plugin_src.js b/include/javascript/tiny_mce/plugins/advlink/editor_plugin_src.js new file mode 100755 index 00000000..7c8b55f4 --- /dev/null +++ b/include/javascript/tiny_mce/plugins/advlink/editor_plugin_src.js @@ -0,0 +1,58 @@ +/** + + * + * @author Moxiecode + * @copyright Copyright 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + tinymce.create('tinymce.plugins.AdvancedLinkPlugin', { + init : function(ed, url) { + this.editor = ed; + + // Register commands + ed.addCommand('mceAdvLink', function() { + var se = ed.selection; + + // No selection and not in link + if (se.isCollapsed() && !ed.dom.getParent(se.getNode(), 'A')) + return; + + ed.windowManager.open({ + file : url + '/link.htm', + width : 480 + parseInt(ed.getLang('advlink.delta_width', 0)), + height : 400 + parseInt(ed.getLang('advlink.delta_height', 0)), + inline : 1 + }, { + plugin_url : url + }); + }); + + // Register buttons + ed.addButton('link', { + title : 'advlink.link_desc', + cmd : 'mceAdvLink' + }); + + ed.addShortcut('ctrl+k', 'advlink.advlink_desc', 'mceAdvLink'); + + ed.onNodeChange.add(function(ed, cm, n, co) { + cm.setDisabled('link', co && n.nodeName != 'A'); + cm.setActive('link', n.nodeName == 'A' && !n.name); + }); + }, + + getInfo : function() { + return { + longname : 'Advanced link', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advlink', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; + } + }); + + // Register plugin + tinymce.PluginManager.add('advlink', tinymce.plugins.AdvancedLinkPlugin); +})(); \ No newline at end of file diff --git a/include/javascript/tiny_mce/plugins/advlink/js/advlink.js b/include/javascript/tiny_mce/plugins/advlink/js/advlink.js new file mode 100755 index 00000000..c8d19835 --- /dev/null +++ b/include/javascript/tiny_mce/plugins/advlink/js/advlink.js @@ -0,0 +1,527 @@ +/* Functions for the advlink plugin popup */ + +tinyMCEPopup.requireLangPack(); + +var templates = { + "window.open" : "window.open('${url}','${target}','${options}')" +}; + +function preinit() { + var url; + + if (url = tinyMCEPopup.getParam("external_link_list_url")) + document.write(''); +} + +function changeClass() { + var f = document.forms[0]; + + f.classes.value = getSelectValue(f, 'classlist'); +} + +function init() { + tinyMCEPopup.resizeToInnerSize(); + + var formObj = document.forms[0]; + var inst = tinyMCEPopup.editor; + var elm = inst.selection.getNode(); + var action = "insert"; + var html; + + document.getElementById('hrefbrowsercontainer').innerHTML = getBrowserHTML('hrefbrowser','href','file','advlink'); + document.getElementById('popupurlbrowsercontainer').innerHTML = getBrowserHTML('popupurlbrowser','popupurl','file','advlink'); + document.getElementById('linklisthrefcontainer').innerHTML = getLinkListHTML('linklisthref','href'); + document.getElementById('anchorlistcontainer').innerHTML = getAnchorListHTML('anchorlist','href'); + document.getElementById('targetlistcontainer').innerHTML = getTargetListHTML('targetlist','target'); + + // Link list + html = getLinkListHTML('linklisthref','href'); + if (html == "") + document.getElementById("linklisthrefrow").style.display = 'none'; + else + document.getElementById("linklisthrefcontainer").innerHTML = html; + + // Resize some elements + if (isVisible('hrefbrowser')) + document.getElementById('href').style.width = '260px'; + + if (isVisible('popupurlbrowser')) + document.getElementById('popupurl').style.width = '180px'; + + elm = inst.dom.getParent(elm, "A"); + if (elm != null && elm.nodeName == "A") + action = "update"; + + formObj.insert.value = tinyMCEPopup.getLang(action, 'Insert', true); + + setPopupControlsDisabled(true); + + if (action == "update") { + var href = inst.dom.getAttrib(elm, 'href'); + var onclick = inst.dom.getAttrib(elm, 'onclick'); + + // Setup form data + setFormValue('href', href); + setFormValue('title', inst.dom.getAttrib(elm, 'title')); + setFormValue('id', inst.dom.getAttrib(elm, 'id')); + setFormValue('style', inst.dom.getAttrib(elm, "style")); + setFormValue('rel', inst.dom.getAttrib(elm, 'rel')); + setFormValue('rev', inst.dom.getAttrib(elm, 'rev')); + setFormValue('charset', inst.dom.getAttrib(elm, 'charset')); + setFormValue('hreflang', inst.dom.getAttrib(elm, 'hreflang')); + setFormValue('dir', inst.dom.getAttrib(elm, 'dir')); + setFormValue('lang', inst.dom.getAttrib(elm, 'lang')); + setFormValue('tabindex', inst.dom.getAttrib(elm, 'tabindex', typeof(elm.tabindex) != "undefined" ? elm.tabindex : "")); + setFormValue('accesskey', inst.dom.getAttrib(elm, 'accesskey', typeof(elm.accesskey) != "undefined" ? elm.accesskey : "")); + setFormValue('type', inst.dom.getAttrib(elm, 'type')); + setFormValue('onfocus', inst.dom.getAttrib(elm, 'onfocus')); + setFormValue('onblur', inst.dom.getAttrib(elm, 'onblur')); + setFormValue('onclick', onclick); + setFormValue('ondblclick', inst.dom.getAttrib(elm, 'ondblclick')); + setFormValue('onmousedown', inst.dom.getAttrib(elm, 'onmousedown')); + setFormValue('onmouseup', inst.dom.getAttrib(elm, 'onmouseup')); + setFormValue('onmouseover', inst.dom.getAttrib(elm, 'onmouseover')); + setFormValue('onmousemove', inst.dom.getAttrib(elm, 'onmousemove')); + setFormValue('onmouseout', inst.dom.getAttrib(elm, 'onmouseout')); + setFormValue('onkeypress', inst.dom.getAttrib(elm, 'onkeypress')); + setFormValue('onkeydown', inst.dom.getAttrib(elm, 'onkeydown')); + setFormValue('onkeyup', inst.dom.getAttrib(elm, 'onkeyup')); + setFormValue('target', inst.dom.getAttrib(elm, 'target')); + setFormValue('classes', inst.dom.getAttrib(elm, 'class')); + + // Parse onclick data + if (onclick != null && onclick.indexOf('window.open') != -1) + parseWindowOpen(onclick); + else + parseFunction(onclick); + + // Select by the values + selectByValue(formObj, 'dir', inst.dom.getAttrib(elm, 'dir')); + selectByValue(formObj, 'rel', inst.dom.getAttrib(elm, 'rel')); + selectByValue(formObj, 'rev', inst.dom.getAttrib(elm, 'rev')); + selectByValue(formObj, 'linklisthref', href); + + if (href.charAt(0) == '#') + selectByValue(formObj, 'anchorlist', href); + + addClassesToList('classlist', 'advlink_styles'); + + selectByValue(formObj, 'classlist', inst.dom.getAttrib(elm, 'class'), true); + selectByValue(formObj, 'targetlist', inst.dom.getAttrib(elm, 'target'), true); + } else + addClassesToList('classlist', 'advlink_styles'); +} + +function checkPrefix(n) { + if (n.value && Validator.isEmail(n) && !/^\s*mailto:/i.test(n.value) && confirm(tinyMCEPopup.getLang('advlink_dlg.is_email'))) + n.value = 'mailto:' + n.value; + + if (/^\s*www./i.test(n.value) && confirm(tinyMCEPopup.getLang('advlink_dlg.is_external'))) + n.value = 'http://' + n.value; +} + +function setFormValue(name, value) { + document.forms[0].elements[name].value = value; +} + +function parseWindowOpen(onclick) { + var formObj = document.forms[0]; + + // Preprocess center code + if (onclick.indexOf('return false;') != -1) { + formObj.popupreturn.checked = true; + onclick = onclick.replace('return false;', ''); + } else + formObj.popupreturn.checked = false; + + var onClickData = parseLink(onclick); + + if (onClickData != null) { + formObj.ispopup.checked = true; + setPopupControlsDisabled(false); + + var onClickWindowOptions = parseOptions(onClickData['options']); + var url = onClickData['url']; + + formObj.popupname.value = onClickData['target']; + formObj.popupurl.value = url; + formObj.popupwidth.value = getOption(onClickWindowOptions, 'width'); + formObj.popupheight.value = getOption(onClickWindowOptions, 'height'); + + formObj.popupleft.value = getOption(onClickWindowOptions, 'left'); + formObj.popuptop.value = getOption(onClickWindowOptions, 'top'); + + if (formObj.popupleft.value.indexOf('screen') != -1) + formObj.popupleft.value = "c"; + + if (formObj.popuptop.value.indexOf('screen') != -1) + formObj.popuptop.value = "c"; + + formObj.popuplocation.checked = getOption(onClickWindowOptions, 'location') == "yes"; + formObj.popupscrollbars.checked = getOption(onClickWindowOptions, 'scrollbars') == "yes"; + formObj.popupmenubar.checked = getOption(onClickWindowOptions, 'menubar') == "yes"; + formObj.popupresizable.checked = getOption(onClickWindowOptions, 'resizable') == "yes"; + formObj.popuptoolbar.checked = getOption(onClickWindowOptions, 'toolbar') == "yes"; + formObj.popupstatus.checked = getOption(onClickWindowOptions, 'status') == "yes"; + formObj.popupdependent.checked = getOption(onClickWindowOptions, 'dependent') == "yes"; + + buildOnClick(); + } +} + +function parseFunction(onclick) { + var formObj = document.forms[0]; + var onClickData = parseLink(onclick); + + // TODO: Add stuff here +} + +function getOption(opts, name) { + return typeof(opts[name]) == "undefined" ? "" : opts[name]; +} + +function setPopupControlsDisabled(state) { + var formObj = document.forms[0]; + + formObj.popupname.disabled = state; + formObj.popupurl.disabled = state; + formObj.popupwidth.disabled = state; + formObj.popupheight.disabled = state; + formObj.popupleft.disabled = state; + formObj.popuptop.disabled = state; + formObj.popuplocation.disabled = state; + formObj.popupscrollbars.disabled = state; + formObj.popupmenubar.disabled = state; + formObj.popupresizable.disabled = state; + formObj.popuptoolbar.disabled = state; + formObj.popupstatus.disabled = state; + formObj.popupreturn.disabled = state; + formObj.popupdependent.disabled = state; + + setBrowserDisabled('popupurlbrowser', state); +} + +function parseLink(link) { + link = link.replace(new RegExp(''', 'g'), "'"); + + var fnName = link.replace(new RegExp("\\s*([A-Za-z0-9\.]*)\\s*\\(.*", "gi"), "$1"); + + // Is function name a template function + var template = templates[fnName]; + if (template) { + // Build regexp + var variableNames = template.match(new RegExp("'?\\$\\{[A-Za-z0-9\.]*\\}'?", "gi")); + var regExp = "\\s*[A-Za-z0-9\.]*\\s*\\("; + var replaceStr = ""; + for (var i=0; i'); + for (var i=0; i'; + html += ''; + + for (i=0; i' + name + ''; + } + + html += ''; + + return html; +} + +function insertAction() { + var inst = tinyMCEPopup.editor; + var elm, elementArray, i; + + elm = inst.selection.getNode(); + checkPrefix(document.forms[0].href); + + elm = inst.dom.getParent(elm, "A"); + + // Remove element if there is no href + if (!document.forms[0].href.value) { + tinyMCEPopup.execCommand("mceBeginUndoLevel"); + i = inst.selection.getBookmark(); + inst.dom.remove(elm, 1); + inst.selection.moveToBookmark(i); + tinyMCEPopup.execCommand("mceEndUndoLevel"); + tinyMCEPopup.close(); + return; + } + + tinyMCEPopup.execCommand("mceBeginUndoLevel"); + + // Create new anchor elements + if (elm == null) { + tinyMCEPopup.execCommand("CreateLink", false, "#mce_temp_url#", {skip_undo : 1}); + + elementArray = tinymce.grep(inst.dom.select("a"), function(n) {return inst.dom.getAttrib(n, 'href') == '#mce_temp_url#';}); + for (i=0; i' + tinyMCELinkList[i][0] + ''; + + html += ''; + + return html; + + // tinyMCE.debug('-- image list start --', html, '-- image list end --'); +} + +function getTargetListHTML(elm_id, target_form_element) { + var targets = tinyMCEPopup.getParam('theme_advanced_link_targets', '').split(';'); + var html = ''; + + html += ''; + + return html; +} + +// While loading +preinit(); +tinyMCEPopup.onInit.add(init); diff --git a/include/javascript/tiny_mce/plugins/advlink/langs/en_dlg.js b/include/javascript/tiny_mce/plugins/advlink/langs/en_dlg.js new file mode 100755 index 00000000..8ef9c792 --- /dev/null +++ b/include/javascript/tiny_mce/plugins/advlink/langs/en_dlg.js @@ -0,0 +1,52 @@ +tinyMCE.addI18n('en.advlink_dlg',{ +title:"Insert/edit link", +url:"Link URL", +target:"Target", +titlefield:"Title", +is_email:"The URL you entered seems to be an email address, do you want to add the required mailto: prefix?", +is_external:"The URL you entered seems to external link, do you want to add the required http:// prefix?", +list:"Link list", +general_tab:"General", +popup_tab:"Popup", +events_tab:"Events", +advanced_tab:"Advanced", +general_props:"General properties", +popup_props:"Popup properties", +event_props:"Events", +advanced_props:"Advanced properties", +popup_opts:"Options", +anchor_names:"Anchors", +target_same:"Open in this window / frame", +target_parent:"Open in parent window / frame", +target_top:"Open in top frame (replaces all frames)", +target_blank:"Open in new window", +popup:"Javascript popup", +popup_url:"Popup URL", +popup_name:"Window name", +popup_return:"Insert 'return false'", +popup_scrollbars:"Show scrollbars", +popup_statusbar:"Show status bar", +popup_toolbar:"Show toolbars", +popup_menubar:"Show menu bar", +popup_location:"Show location bar", +popup_resizable:"Make window resizable", +popup_dependent:"Dependent (Mozilla/Firefox only)", +popup_size:"Size", +popup_position:"Position (X/Y)", +id:"Id", +style:"Style", +classes:"Classes", +target_name:"Target name", +langdir:"Language direction", +target_langcode:"Target language", +langcode:"Language code", +encoding:"Target character encoding", +mime:"Target MIME type", +rel:"Relationship page to target", +rev:"Relationship target to page", +tabindex:"Tabindex", +accesskey:"Accesskey", +ltr:"Left to right", +rtl:"Right to left", +link_list:"Link list" +}); \ No newline at end of file diff --git a/include/javascript/tiny_mce/plugins/autosave/editor_plugin.js b/include/javascript/tiny_mce/plugins/autosave/editor_plugin.js new file mode 100755 index 00000000..01a994ee --- /dev/null +++ b/include/javascript/tiny_mce/plugins/autosave/editor_plugin.js @@ -0,0 +1 @@ +(function(){tinymce.create('tinymce.plugins.AutoSavePlugin',{init:function(ed,url){var t=this;t.editor=ed;window.onbeforeunload=tinymce.plugins.AutoSavePlugin._beforeUnloadHandler;},getInfo:function(){return{longname:'Auto save',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autosave',version:tinymce.majorVersion+"."+tinymce.minorVersion};},'static':{_beforeUnloadHandler:function(){var msg;tinymce.each(tinyMCE.editors,function(ed){if(ed.getParam("fullscreen_is_enabled"))return;if(ed.isDirty()){msg=ed.getLang("autosave.unload_msg");return false;}});return msg;}}});tinymce.PluginManager.add('autosave',tinymce.plugins.AutoSavePlugin);})(); \ No newline at end of file diff --git a/include/javascript/tiny_mce/plugins/autosave/editor_plugin_src.js b/include/javascript/tiny_mce/plugins/autosave/editor_plugin_src.js new file mode 100755 index 00000000..959cc4e1 --- /dev/null +++ b/include/javascript/tiny_mce/plugins/autosave/editor_plugin_src.js @@ -0,0 +1,51 @@ +/** + + * + * @author Moxiecode + * @copyright Copyright 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + tinymce.create('tinymce.plugins.AutoSavePlugin', { + init : function(ed, url) { + var t = this; + + t.editor = ed; + + window.onbeforeunload = tinymce.plugins.AutoSavePlugin._beforeUnloadHandler; + }, + + getInfo : function() { + return { + longname : 'Auto save', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autosave', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; + }, + + // Private plugin internal methods + + 'static' : { + _beforeUnloadHandler : function() { + var msg; + + tinymce.each(tinyMCE.editors, function(ed) { + if (ed.getParam("fullscreen_is_enabled")) + return; + + if (ed.isDirty()) { + msg = ed.getLang("autosave.unload_msg"); + return false; + } + }); + + return msg; + } + } + }); + + // Register plugin + tinymce.PluginManager.add('autosave', tinymce.plugins.AutoSavePlugin); +})(); \ No newline at end of file diff --git a/include/javascript/tiny_mce/plugins/bbcode/editor_plugin.js b/include/javascript/tiny_mce/plugins/bbcode/editor_plugin.js new file mode 100755 index 00000000..88f7ea65 --- /dev/null +++ b/include/javascript/tiny_mce/plugins/bbcode/editor_plugin.js @@ -0,0 +1 @@ +(function(){tinymce.create('tinymce.plugins.BBCodePlugin',{init:function(ed,url){var t=this,dialect=ed.getParam('bbcode_dialect','punbb').toLowerCase();ed.onBeforeSetContent.add(function(ed,o){o.content=t['_'+dialect+'_bbcode2html'](o.content);});ed.onPostProcess.add(function(ed,o){if(o.set)o.content=t['_'+dialect+'_bbcode2html'](o.content);if(o.get)o.content=t['_'+dialect+'_html2bbcode'](o.content);});},getInfo:function(){return{longname:'BBCode Plugin',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/bbcode',version:tinymce.majorVersion+"."+tinymce.minorVersion};},_punbb_html2bbcode:function(s){s=tinymce.trim(s);function rep(re,str){s=s.replace(re,str);};rep(/(.*?)<\/a>/gi,"[url=$1]$2[/url]");rep(/(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]");rep(/(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]");rep(/(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]");rep(/(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]");rep(/(.*?)<\/span>/gi,"[color=$1]$2[/color]");rep(/(.*?)<\/font>/gi,"[color=$1]$2[/color]");rep(/(.*?)<\/span>/gi,"[size=$1]$2[/size]");rep(/(.*?)<\/font>/gi,"$1");rep(//gi,"[img]$1[/img]");rep(/(.*?)<\/span>/gi,"[code]$1[/code]");rep(/(.*?)<\/span>/gi,"[quote]$1[/quote]");rep(/(.*?)<\/strong>/gi,"[code][b]$1[/b][/code]");rep(/(.*?)<\/strong>/gi,"[quote][b]$1[/b][/quote]");rep(/(.*?)<\/em>/gi,"[code][i]$1[/i][/code]");rep(/(.*?)<\/em>/gi,"[quote][i]$1[/i][/quote]");rep(/(.*?)<\/u>/gi,"[code][u]$1[/u][/code]");rep(/(.*?)<\/u>/gi,"[quote][u]$1[/u][/quote]");rep(/<\/(strong|b)>/gi,"[/b]");rep(/<(strong|b)>/gi,"[b]");rep(/<\/(em|i)>/gi,"[/i]");rep(/<(em|i)>/gi,"[i]");rep(/<\/u>/gi,"[/u]");rep(/(.*?)<\/span>/gi,"[u]$1[/u]");rep(//gi,"[u]");rep(/]*>/gi,"[quote]");rep(/<\/blockquote>/gi,"[/quote]");rep(/
    /gi,"\n");rep(//gi,"\n");rep(/
    /gi,"\n");rep(/

    /gi,"");rep(/<\/p>/gi,"\n");rep(/ /gi," ");rep(/"/gi,"\"");rep(/</gi,"<");rep(/>/gi,">");rep(/&/gi,"&");return s;},_punbb_bbcode2html:function(s){s=tinymce.trim(s);function rep(re,str){s=s.replace(re,str);};rep(/\n/gi,"
    ");rep(/\[b\]/gi,"");rep(/\[\/b\]/gi,"");rep(/\[i\]/gi,"");rep(/\[\/i\]/gi,"");rep(/\[u\]/gi,"");rep(/\[\/u\]/gi,"");rep(/\[url=([^\]]+)\](.*?)\[\/url\]/gi,"$2");rep(/\[url\](.*?)\[\/url\]/gi,"$1");rep(/\[img\](.*?)\[\/img\]/gi,"");rep(/\[color=(.*?)\](.*?)\[\/color\]/gi,"$2");rep(/\[code\](.*?)\[\/code\]/gi,"$1 ");rep(/\[quote.*?\](.*?)\[\/quote\]/gi,"$1 ");return s;}});tinymce.PluginManager.add('bbcode',tinymce.plugins.BBCodePlugin);})(); \ No newline at end of file diff --git a/include/javascript/tiny_mce/plugins/bbcode/editor_plugin_src.js b/include/javascript/tiny_mce/plugins/bbcode/editor_plugin_src.js new file mode 100755 index 00000000..28f2eebd --- /dev/null +++ b/include/javascript/tiny_mce/plugins/bbcode/editor_plugin_src.js @@ -0,0 +1,117 @@ +/** + + * + * @author Moxiecode + * @copyright Copyright 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + tinymce.create('tinymce.plugins.BBCodePlugin', { + init : function(ed, url) { + var t = this, dialect = ed.getParam('bbcode_dialect', 'punbb').toLowerCase(); + + ed.onBeforeSetContent.add(function(ed, o) { + o.content = t['_' + dialect + '_bbcode2html'](o.content); + }); + + ed.onPostProcess.add(function(ed, o) { + if (o.set) + o.content = t['_' + dialect + '_bbcode2html'](o.content); + + if (o.get) + o.content = t['_' + dialect + '_html2bbcode'](o.content); + }); + }, + + getInfo : function() { + return { + longname : 'BBCode Plugin', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/bbcode', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; + }, + + // Private methods + + // HTML -> BBCode in PunBB dialect + _punbb_html2bbcode : function(s) { + s = tinymce.trim(s); + + function rep(re, str) { + s = s.replace(re, str); + }; + + // example: to [b] + rep(/(.*?)<\/a>/gi,"[url=$1]$2[/url]"); + rep(/(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]"); + rep(/(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]"); + rep(/(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]"); + rep(/(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]"); + rep(/(.*?)<\/span>/gi,"[color=$1]$2[/color]"); + rep(/(.*?)<\/font>/gi,"[color=$1]$2[/color]"); + rep(/(.*?)<\/span>/gi,"[size=$1]$2[/size]"); + rep(/(.*?)<\/font>/gi,"$1"); + rep(//gi,"[img]$1[/img]"); + rep(/(.*?)<\/span>/gi,"[code]$1[/code]"); + rep(/(.*?)<\/span>/gi,"[quote]$1[/quote]"); + rep(/(.*?)<\/strong>/gi,"[code][b]$1[/b][/code]"); + rep(/(.*?)<\/strong>/gi,"[quote][b]$1[/b][/quote]"); + rep(/(.*?)<\/em>/gi,"[code][i]$1[/i][/code]"); + rep(/(.*?)<\/em>/gi,"[quote][i]$1[/i][/quote]"); + rep(/(.*?)<\/u>/gi,"[code][u]$1[/u][/code]"); + rep(/(.*?)<\/u>/gi,"[quote][u]$1[/u][/quote]"); + rep(/<\/(strong|b)>/gi,"[/b]"); + rep(/<(strong|b)>/gi,"[b]"); + rep(/<\/(em|i)>/gi,"[/i]"); + rep(/<(em|i)>/gi,"[i]"); + rep(/<\/u>/gi,"[/u]"); + rep(/(.*?)<\/span>/gi,"[u]$1[/u]"); + rep(//gi,"[u]"); + rep(/]*>/gi,"[quote]"); + rep(/<\/blockquote>/gi,"[/quote]"); + rep(/
    /gi,"\n"); + rep(//gi,"\n"); + rep(/
    /gi,"\n"); + rep(/

    /gi,""); + rep(/<\/p>/gi,"\n"); + rep(/ /gi," "); + rep(/"/gi,"\""); + rep(/</gi,"<"); + rep(/>/gi,">"); + rep(/&/gi,"&"); + + return s; + }, + + // BBCode -> HTML from PunBB dialect + _punbb_bbcode2html : function(s) { + s = tinymce.trim(s); + + function rep(re, str) { + s = s.replace(re, str); + }; + + // example: [b] to + rep(/\n/gi,"
    "); + rep(/\[b\]/gi,""); + rep(/\[\/b\]/gi,""); + rep(/\[i\]/gi,""); + rep(/\[\/i\]/gi,""); + rep(/\[u\]/gi,""); + rep(/\[\/u\]/gi,""); + rep(/\[url=([^\]]+)\](.*?)\[\/url\]/gi,"$2"); + rep(/\[url\](.*?)\[\/url\]/gi,"$1"); + rep(/\[img\](.*?)\[\/img\]/gi,""); + rep(/\[color=(.*?)\](.*?)\[\/color\]/gi,"$2"); + rep(/\[code\](.*?)\[\/code\]/gi,"$1 "); + rep(/\[quote.*?\](.*?)\[\/quote\]/gi,"$1 "); + + return s; + } + }); + + // Register plugin + tinymce.PluginManager.add('bbcode', tinymce.plugins.BBCodePlugin); +})(); \ No newline at end of file diff --git a/include/javascript/tiny_mce/plugins/compat2x/editor_plugin.js b/include/javascript/tiny_mce/plugins/compat2x/editor_plugin.js new file mode 100755 index 00000000..02a1da8b --- /dev/null +++ b/include/javascript/tiny_mce/plugins/compat2x/editor_plugin.js @@ -0,0 +1 @@ +(function(){var DOM=tinymce.DOM,Event=tinymce.dom.Event,each=tinymce.each,is=tinymce.is;tinymce.create('tinymce.plugins.Compat2x',{getInfo:function(){return{longname:'Compat2x',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/compat2x',version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion};}});(function(){tinymce.extend(tinyMCE,{addToLang:function(p,l){each(l,function(v,k){tinyMCE.i18n[(tinyMCE.settings.language||'en')+'.'+(p?p+'_':'')+k]=v;});},getInstanceById:function(n){return this.get(n);}});})();(function(){var EditorManager=tinymce.EditorManager;tinyMCE.instances={};tinyMCE.plugins={};tinymce.PluginManager.onAdd.add(function(pm,n,p){tinyMCE.plugins[n]=p;});tinyMCE.majorVersion=tinymce.majorVersion;tinyMCE.minorVersion=tinymce.minorVersion;tinyMCE.releaseDate=tinymce.releaseDate;tinyMCE.baseURL=tinymce.baseURL;tinyMCE.isIE=tinyMCE.isMSIE=tinymce.isIE||tinymce.isOpera;tinyMCE.isMSIE5=tinymce.isIE;tinyMCE.isMSIE5_0=tinymce.isIE;tinyMCE.isMSIE7=tinymce.isIE;tinyMCE.isGecko=tinymce.isGecko;tinyMCE.isSafari=tinymce.isWebKit;tinyMCE.isOpera=tinymce.isOpera;tinyMCE.isMac=false;tinyMCE.isNS7=false;tinyMCE.isNS71=false;tinyMCE.compat=true;TinyMCE_Engine=tinyMCE;tinymce.extend(tinyMCE,{getParam:function(n,dv){return this.activeEditor.getParam(n,dv);},addEvent:function(e,na,f,sc){tinymce.dom.Event.add(e,na,f,sc||this);},getControlHTML:function(n){return EditorManager.activeEditor.controlManager.createControl(n);},loadCSS:function(u){tinymce.DOM.loadCSS(u);},importCSS:function(doc,u){if(doc==document)this.loadCSS(u);else new tinymce.dom.DOMUtils(doc).loadCSS(u);},log:function(){console.debug.apply(console,arguments);},getLang:function(n,dv){var v=EditorManager.activeEditor.getLang(n.replace(/^lang_/g,''),dv);if(/^[0-9\-.]+$/g.test(v))return parseInt(v);return v;},isInstance:function(o){return o!=null&&typeof(o)=="object"&&o.execCommand;},triggerNodeChange:function(){EditorManager.activeEditor.nodeChanged();},regexpReplace:function(in_str,reg_exp,replace_str,opts){var re;if(in_str==null)return in_str;if(typeof(opts)=="undefined")opts='g';re=new RegExp(reg_exp,opts);return in_str.replace(re,replace_str);},trim:function(s){return tinymce.trim(s);},xmlEncode:function(s){return tinymce.DOM.encode(s);},explode:function(s,d){var o=[];tinymce.each(s.split(d),function(v){if(v!='')o.push(v);});return o;},switchClass:function(id,cls){var b;if(/^mceButton/.test(cls)){b=EditorManager.activeEditor.controlManager.get(id);if(!b)return;switch(cls){case"mceButtonNormal":b.setDisabled(false);b.setActive(false);return;case"mceButtonDisabled":b.setDisabled(true);return;case"mceButtonSelected":b.setActive(true);b.setDisabled(false);return;}}},addCSSClass:function(e,n,b){return tinymce.DOM.addClass(e,n,b);},hasCSSClass:function(e,n){return tinymce.DOM.hasClass(e,n);},removeCSSClass:function(e,n){return tinymce.DOM.removeClass(e,n);},getCSSClasses:function(){var cl=EditorManager.activeEditor.dom.getClasses(),o=[];each(cl,function(c){o.push(c['class']);});return o;},setWindowArg:function(n,v){EditorManager.activeEditor.windowManager.params[n]=v;},getWindowArg:function(n,dv){var wm=EditorManager.activeEditor.windowManager,v;v=wm.getParam(n);if(v==='')return'';return v||wm.getFeature(n)||dv;},getParentNode:function(n,f){return this._getDOM().getParent(n,f);},selectElements:function(n,na,f){var i,a=[],nl,x;for(x=0,na=na.split(',');x/i);if(attr&&attr[1]){bdattr=attr[1].match(/\s*(\w+\s*=\s*".*?"|\w+\s*=\s*'.*?'|\w+\s*=\s*\w+|\w+)\s*/g);if(bdattr){for(i=0,len=bdattr.length;i',sp);t.head=c.substring(0,sp+1);ep=c.indexOf('\n';t.head+=ed.getParam('fullpage_default_doctype','');t.head+='\n\n\n'+ed.getParam('fullpage_default_title','Untitled document')+'\n';if(v=ed.getParam('fullpage_default_encoding'))t.head+='\n';if(v=ed.getParam('fullpage_default_font_family'))st+='font-family: '+v+';';if(v=ed.getParam('fullpage_default_font_size'))st+='font-size: '+v+';';if(v=ed.getParam('fullpage_default_text_color'))st+='color: '+v+';';t.head+='\n\n';t.foot='\n\n';}},_getContent:function(ed,o){var t=this;o.content=tinymce.trim(t.head)+'\n'+tinymce.trim(o.content)+'\n'+tinymce.trim(t.foot);}});tinymce.PluginManager.add('fullpage',tinymce.plugins.FullPagePlugin);})(); \ No newline at end of file diff --git a/include/javascript/tiny_mce/plugins/fullpage/editor_plugin_src.js b/include/javascript/tiny_mce/plugins/fullpage/editor_plugin_src.js new file mode 100755 index 00000000..264d22c9 --- /dev/null +++ b/include/javascript/tiny_mce/plugins/fullpage/editor_plugin_src.js @@ -0,0 +1,142 @@ +/** + + * + * @author Moxiecode + * @copyright Copyright 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + tinymce.create('tinymce.plugins.FullPagePlugin', { + init : function(ed, url) { + var t = this; + + t.editor = ed; + + // Register commands + ed.addCommand('mceFullPageProperties', function() { + ed.windowManager.open({ + file : url + '/fullpage.htm', + width : 430 + parseInt(ed.getLang('fullpage.delta_width', 0)), + height : 495 + parseInt(ed.getLang('fullpage.delta_height', 0)), + inline : 1 + }, { + plugin_url : url, + head_html : t.head + }); + }); + + // Register buttons + ed.addButton('fullpage', {title : 'fullpage.desc', cmd : 'mceFullPageProperties'}); + + ed.onBeforeSetContent.add(t._setContent, t); + ed.onSetContent.add(t._setBodyAttribs, t); + ed.onGetContent.add(t._getContent, t); + }, + + getInfo : function() { + return { + longname : 'Fullpage', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullpage', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; + }, + + // Private plugin internal methods + + _setBodyAttribs : function(ed, o) { + var bdattr, i, len, kv, k, v, t, attr = this.head.match(/body(.*?)>/i); + + if (attr && attr[1]) { + bdattr = attr[1].match(/\s*(\w+\s*=\s*".*?"|\w+\s*=\s*'.*?'|\w+\s*=\s*\w+|\w+)\s*/g); + + if (bdattr) { + for(i = 0, len = bdattr.length; i < len; i++) { + kv = bdattr[i].split('='); + k = kv[0].replace(/\s/,''); + v = kv[1]; + + if (v) { + v = v.replace(/^\s+/,'').replace(/\s+$/,''); + t = v.match(/^["'](.*)["']$/); + + if (t) + v = t[1]; + } else + v = k; + + ed.dom.setAttrib(ed.getBody(), 'style', v); + } + } + } + }, + + _createSerializer : function() { + return new tinymce.dom.Serializer({ + dom : this.editor.dom, + apply_source_formatting : true + }); + }, + + _setContent : function(ed, o) { + var t = this, sp, ep, c = o.content, v, st = ''; + + // Parse out head, body and footer + c = c.replace(/<(\/?)BODY/gi, '<$1body'); + sp = c.indexOf('', sp); + t.head = c.substring(0, sp + 1); + + ep = c.indexOf('\n'; + + t.head += ed.getParam('fullpage_default_doctype', ''); + t.head += '\n\n\n' + ed.getParam('fullpage_default_title', 'Untitled document') + '\n'; + + if (v = ed.getParam('fullpage_default_encoding')) + t.head += '\n'; + + if (v = ed.getParam('fullpage_default_font_family')) + st += 'font-family: ' + v + ';'; + + if (v = ed.getParam('fullpage_default_font_size')) + st += 'font-size: ' + v + ';'; + + if (v = ed.getParam('fullpage_default_text_color')) + st += 'color: ' + v + ';'; + + t.head += '\n\n'; + t.foot = '\n\n'; + } + }, + + _getContent : function(ed, o) { + var t = this; + + o.content = tinymce.trim(t.head) + '\n' + tinymce.trim(o.content) + '\n' + tinymce.trim(t.foot); + } + }); + + // Register plugin + tinymce.PluginManager.add('fullpage', tinymce.plugins.FullPagePlugin); +})(); \ No newline at end of file diff --git a/include/javascript/tiny_mce/plugins/fullpage/js/fullpage.js b/include/javascript/tiny_mce/plugins/fullpage/js/fullpage.js new file mode 100755 index 00000000..6c994e9c --- /dev/null +++ b/include/javascript/tiny_mce/plugins/fullpage/js/fullpage.js @@ -0,0 +1,461 @@ +tinyMCEPopup.requireLangPack(); + +var doc; + +var defaultDocTypes = + 'XHTML 1.0 Transitional=,' + + 'XHTML 1.0 Frameset=,' + + 'XHTML 1.0 Strict=,' + + 'XHTML 1.1=,' + + 'HTML 4.01 Transitional=,' + + 'HTML 4.01 Strict=,' + + 'HTML 4.01 Frameset='; + +var defaultEncodings = + 'Western european (iso-8859-1)=iso-8859-1,' + + 'Central European (iso-8859-2)=iso-8859-2,' + + 'Unicode (UTF-8)=utf-8,' + + 'Chinese traditional (Big5)=big5,' + + 'Cyrillic (iso-8859-5)=iso-8859-5,' + + 'Japanese (iso-2022-jp)=iso-2022-jp,' + + 'Greek (iso-8859-7)=iso-8859-7,' + + 'Korean (iso-2022-kr)=iso-2022-kr,' + + 'ASCII (us-ascii)=us-ascii'; + +var defaultMediaTypes = + 'all=all,' + + 'screen=screen,' + + 'print=print,' + + 'tty=tty,' + + 'tv=tv,' + + 'projection=projection,' + + 'handheld=handheld,' + + 'braille=braille,' + + 'aural=aural'; + +var defaultFontNames = 'Arial=arial,helvetica,sans-serif;Courier New=courier new,courier,monospace;Georgia=georgia,times new roman,times,serif;Tahoma=tahoma,arial,helvetica,sans-serif;Times New Roman=times new roman,times,serif;Verdana=verdana,arial,helvetica,sans-serif;Impact=impact;WingDings=wingdings'; +var defaultFontSizes = '10px,11px,12px,13px,14px,15px,16px'; + +function init() { + var f = document.forms['fullpage'], el = f.elements, e, i, p, doctypes, encodings, mediaTypes, fonts, ed = tinyMCEPopup.editor, dom = tinyMCEPopup.dom, style; + + // Setup doctype select box + doctypes = ed.getParam("fullpage_doctypes", defaultDocTypes).split(','); + for (i=0; i 1) + addSelectValue(f, 'doctypes', p[0], p[1]); + } + + // Setup fonts select box + fonts = ed.getParam("fullpage_fonts", defaultFontNames).split(';'); + for (i=0; i 1) + addSelectValue(f, 'fontface', p[0], p[1]); + } + + // Setup fontsize select box + fonts = ed.getParam("fullpage_fontsizes", defaultFontSizes).split(','); + for (i=0; i 1) { + addSelectValue(f, 'element_style_media', p[0], p[1]); + addSelectValue(f, 'element_link_media', p[0], p[1]); + } + } + + // Setup encodings select box + encodings = ed.getParam("fullpage_encodings", defaultEncodings).split(','); + for (i=0; i 1) { + addSelectValue(f, 'docencoding', p[0], p[1]); + addSelectValue(f, 'element_script_charset', p[0], p[1]); + addSelectValue(f, 'element_link_charset', p[0], p[1]); + } + } + + document.getElementById('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor'); + document.getElementById('link_color_pickcontainer').innerHTML = getColorPickerHTML('link_color_pick','link_color'); + //document.getElementById('hover_color_pickcontainer').innerHTML = getColorPickerHTML('hover_color_pick','hover_color'); + document.getElementById('visited_color_pickcontainer').innerHTML = getColorPickerHTML('visited_color_pick','visited_color'); + document.getElementById('active_color_pickcontainer').innerHTML = getColorPickerHTML('active_color_pick','active_color'); + document.getElementById('textcolor_pickcontainer').innerHTML = getColorPickerHTML('textcolor_pick','textcolor'); + document.getElementById('stylesheet_browsercontainer').innerHTML = getBrowserHTML('stylesheetbrowser','stylesheet','file','fullpage'); + document.getElementById('link_href_pickcontainer').innerHTML = getBrowserHTML('link_href_browser','element_link_href','file','fullpage'); + document.getElementById('script_src_pickcontainer').innerHTML = getBrowserHTML('script_src_browser','element_script_src','file','fullpage'); + document.getElementById('bgimage_pickcontainer').innerHTML = getBrowserHTML('bgimage_browser','bgimage','image','fullpage'); + + // Resize some elements + if (isVisible('stylesheetbrowser')) + document.getElementById('stylesheet').style.width = '220px'; + + if (isVisible('link_href_browser')) + document.getElementById('element_link_href').style.width = '230px'; + + if (isVisible('bgimage_browser')) + document.getElementById('bgimage').style.width = '210px'; + + // Add iframe + dom.add(document.body, 'iframe', {id : 'documentIframe', src : 'javascript:""', style : {display : 'none'}}); + doc = dom.get('documentIframe').contentWindow.document; + h = tinyMCEPopup.getWindowArg('head_html'); + + // Preprocess the HTML disable scripts and urls + h = h.replace(/';}return im;});});}},getInfo:function(){return{longname:'Media',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/media',version:tinymce.majorVersion+"."+tinymce.minorVersion};},_objectsToSpans:function(ed,o){var t=this,h=o.content;h=h.replace(/]*>\s*write(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)\(\{([^\)]*)\}\);\s*<\/script>/gi,function(a,b,c){var o=t._parse(c);return''});h=h.replace(/]*)>/gi,'');h=h.replace(/]*)\/?>/gi,'');h=h.replace(/]*)>/gi,'');h=h.replace(/<\/(object)([^>]*)>/gi,'');h=h.replace(/<\/embed>/gi,'');h=h.replace(/]*)>/gi,function(a,b){return''});h=h.replace(/\/ class=\"mceItemParam\"><\/span>/gi,'class="mceItemParam">');o.content=h;},_buildObj:function(o,n){var ob,ed=this.editor,dom=ed.dom,p=this._parse(n.title),stc;stc=ed.getParam('media_strict',true)&&o.type=='application/x-shockwave-flash';p.width=o.width=dom.getAttrib(n,'width')||100;p.height=o.height=dom.getAttrib(n,'height')||100;if(p.src)p.src=ed.convertURL(p.src,'src',n);if(stc){ob=dom.create('span',{mce_name:'object',type:'application/x-shockwave-flash',data:p.src,width:o.width,height:o.height});}else{ob=dom.create('span',{mce_name:'object',classid:"clsid:"+o.classid,codebase:o.codebase,width:o.width,height:o.height});}each(p,function(v,k){if(!/^(width|height|codebase|classid|_cx|_cy)$/.test(k)){if(o.type=='application/x-mplayer2'&&k=='src')k='url';if(v)dom.add(ob,'span',{mce_name:'param',name:k,'_mce_value':v});}});if(!stc)dom.add(ob,'span',tinymce.extend({mce_name:'embed',type:o.type},p));return ob;},_spansToImgs:function(p){var t=this,dom=t.editor.dom,im,ci;each(dom.select('span',p),function(n){if(dom.getAttrib(n,'class')=='mceItemObject'){ci=dom.getAttrib(n,"classid").toLowerCase().replace(/\s+/g,'');switch(ci){case'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000':dom.replace(t._createImg('mceItemFlash',n),n);break;case'clsid:166b1bca-3f9c-11cf-8075-444553540000':dom.replace(t._createImg('mceItemShockWave',n),n);break;case'clsid:6bf52a52-394a-11d3-b153-00c04f79faa6':case'clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95':case'clsid:05589fa1-c356-11ce-bf01-00aa0055595a':dom.replace(t._createImg('mceItemWindowsMedia',n),n);break;case'clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b':dom.replace(t._createImg('mceItemQuickTime',n),n);break;case'clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa':dom.replace(t._createImg('mceItemRealMedia',n),n);break;default:dom.replace(t._createImg('mceItemFlash',n),n);}return;}if(dom.getAttrib(n,'class')=='mceItemEmbed'){switch(dom.getAttrib(n,'type')){case'application/x-shockwave-flash':dom.replace(t._createImg('mceItemFlash',n),n);break;case'application/x-director':dom.replace(t._createImg('mceItemShockWave',n),n);break;case'application/x-mplayer2':dom.replace(t._createImg('mceItemWindowsMedia',n),n);break;case'video/quicktime':dom.replace(t._createImg('mceItemQuickTime',n),n);break;case'audio/x-pn-realaudio-plugin':dom.replace(t._createImg('mceItemRealMedia',n),n);break;default:dom.replace(t._createImg('mceItemFlash',n),n);}}});},_createImg:function(cl,n){var im,dom=this.editor.dom,pa={},ti='',args;args=['id','name','width','height','bgcolor','align','flashvars','src','wmode','allowfullscreen','quality'];im=dom.create('img',{src:this.url+'/img/trans.gif',width:dom.getAttrib(n,'width')||100,height:dom.getAttrib(n,'height')||100,'class':cl});each(args,function(na){var v=dom.getAttrib(n,na);if(v)pa[na]=v;});each(dom.select('span',n),function(n){if(dom.hasClass(n,'mceItemParam'))pa[dom.getAttrib(n,'name')]=dom.getAttrib(n,'_mce_value');});if(pa.movie){pa.src=pa.movie;delete pa.movie;}n=dom.select('.mceItemEmbed',n)[0];if(n){each(args,function(na){var v=dom.getAttrib(n,na);if(v&&!pa[na])pa[na]=v;});}delete pa.width;delete pa.height;im.title=this._serialize(pa);return im;},_parse:function(s){return tinymce.util.JSON.parse('{'+s+'}');},_serialize:function(o){return tinymce.util.JSON.serialize(o).replace(/[{}]/g,'');}});tinymce.PluginManager.add('media',tinymce.plugins.MediaPlugin);})(); \ No newline at end of file diff --git a/include/javascript/tiny_mce/plugins/media/editor_plugin_src.js b/include/javascript/tiny_mce/plugins/media/editor_plugin_src.js new file mode 100755 index 00000000..9f4abda2 --- /dev/null +++ b/include/javascript/tiny_mce/plugins/media/editor_plugin_src.js @@ -0,0 +1,400 @@ +/** + + * + * @author Moxiecode + * @copyright Copyright 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + var each = tinymce.each; + + tinymce.create('tinymce.plugins.MediaPlugin', { + init : function(ed, url) { + var t = this; + + t.editor = ed; + t.url = url; + + function isMediaElm(n) { + return /^(mceItemFlash|mceItemShockWave|mceItemWindowsMedia|mceItemQuickTime|mceItemRealMedia)$/.test(n.className); + }; + + ed.onPreInit.add(function() { + // Force in _value parameter this extra parameter is required for older Opera versions + ed.serializer.addRules('param[name|value|_mce_value]'); + }); + + // Register commands + ed.addCommand('mceMedia', function() { + ed.windowManager.open({ + file : url + '/media.htm', + width : 430 + parseInt(ed.getLang('media.delta_width', 0)), + height : 470 + parseInt(ed.getLang('media.delta_height', 0)), + inline : 1 + }, { + plugin_url : url + }); + }); + + // Register buttons + ed.addButton('media', {title : 'media.desc', cmd : 'mceMedia'}); + + ed.onNodeChange.add(function(ed, cm, n) { + cm.setActive('media', n.nodeName == 'IMG' && isMediaElm(n)); + }); + + ed.onInit.add(function() { + var lo = { + mceItemFlash : 'flash', + mceItemShockWave : 'shockwave', + mceItemWindowsMedia : 'windowsmedia', + mceItemQuickTime : 'quicktime', + mceItemRealMedia : 'realmedia' + }; + + ed.selection.onSetContent.add(function() { + t._spansToImgs(ed.getBody()); + }); + + ed.selection.onBeforeSetContent.add(t._objectsToSpans, t); + + if (ed.settings.content_css !== false) + ed.dom.loadCSS(url + "/css/content.css"); + + if (ed.theme.onResolveName) { + ed.theme.onResolveName.add(function(th, o) { + if (o.name == 'img') { + each(lo, function(v, k) { + if (ed.dom.hasClass(o.node, k)) { + o.name = v; + o.title = ed.dom.getAttrib(o.node, 'title'); + return false; + } + }); + } + }); + } + + if (ed && ed.plugins.contextmenu) { + ed.plugins.contextmenu.onContextMenu.add(function(th, m, e) { + if (e.nodeName == 'IMG' && /mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(e.className)) { + m.add({title : 'media.edit', icon : 'media', cmd : 'mceMedia'}); + } + }); + } + }); + + ed.onBeforeSetContent.add(t._objectsToSpans, t); + + ed.onSetContent.add(function() { + t._spansToImgs(ed.getBody()); + }); + + ed.onPreProcess.add(function(ed, o) { + var dom = ed.dom; + + if (o.set) { + t._spansToImgs(o.node); + + each(dom.select('IMG', o.node), function(n) { + var p; + + if (isMediaElm(n)) { + p = t._parse(n.title); + dom.setAttrib(n, 'width', dom.getAttrib(n, 'width', p.width || 100)); + dom.setAttrib(n, 'height', dom.getAttrib(n, 'height', p.height || 100)); + } + }); + } + + if (o.get) { + each(dom.select('IMG', o.node), function(n) { + var ci, cb, mt; + + if (ed.getParam('media_use_script')) { + if (isMediaElm(n)) + n.className = n.className.replace(/mceItem/g, 'mceTemp'); + + return; + } + + switch (n.className) { + case 'mceItemFlash': + ci = 'd27cdb6e-ae6d-11cf-96b8-444553540000'; + cb = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0'; + mt = 'application/x-shockwave-flash'; + break; + + case 'mceItemShockWave': + ci = '166b1bca-3f9c-11cf-8075-444553540000'; + cb = 'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0'; + mt = 'application/x-director'; + break; + + case 'mceItemWindowsMedia': + ci = ed.getParam('media_wmp6_compatible') ? '05589fa1-c356-11ce-bf01-00aa0055595a' : '6bf52a52-394a-11d3-b153-00c04f79faa6'; + cb = 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701'; + mt = 'application/x-mplayer2'; + break; + + case 'mceItemQuickTime': + ci = '02bf25d5-8c17-4b23-bc80-d3488abddc6b'; + cb = 'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0'; + mt = 'video/quicktime'; + break; + + case 'mceItemRealMedia': + ci = 'cfcdaa03-8be4-11cf-b84b-0020afbbccfa'; + cb = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0'; + mt = 'audio/x-pn-realaudio-plugin'; + break; + } + + if (ci) { + dom.replace(t._buildObj({ + classid : ci, + codebase : cb, + type : mt + }, n), n); + } + }); + } + }); + + ed.onPostProcess.add(function(ed, o) { + o.content = o.content.replace(/_mce_value=/g, 'value='); + }); + + if (ed.getParam('media_use_script')) { + function getAttr(s, n) { + n = new RegExp(n + '=\"([^\"]+)\"', 'g').exec(s); + + return n ? ed.dom.decode(n[1]) : ''; + }; + + ed.onPostProcess.add(function(ed, o) { + o.content = o.content.replace(/]+>/g, function(im) { + var cl = getAttr(im, 'class'); + + if (/^(mceTempFlash|mceTempShockWave|mceTempWindowsMedia|mceTempQuickTime|mceTempRealMedia)$/.test(cl)) { + at = t._parse(getAttr(im, 'title')); + at.width = getAttr(im, 'width'); + at.height = getAttr(im, 'height'); + im = ''; + } + + return im; + }); + }); + } + }, + + getInfo : function() { + return { + longname : 'Media', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/media', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; + }, + + // Private methods + _objectsToSpans : function(ed, o) { + var t = this, h = o.content; + + h = h.replace(/]*>\s*write(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)\(\{([^\)]*)\}\);\s*<\/script>/gi, function(a, b, c) { + var o = t._parse(c); + + return '' + }); + + h = h.replace(/]*)>/gi, ''); + h = h.replace(/]*)\/?>/gi, ''); + h = h.replace(/]*)>/gi, ''); + h = h.replace(/<\/(object)([^>]*)>/gi, ''); + h = h.replace(/<\/embed>/gi, ''); + h = h.replace(/]*)>/gi, function(a, b) {return ''}); + h = h.replace(/\/ class=\"mceItemParam\"><\/span>/gi, 'class="mceItemParam">'); + + o.content = h; + }, + + _buildObj : function(o, n) { + var ob, ed = this.editor, dom = ed.dom, p = this._parse(n.title), stc; + + stc = ed.getParam('media_strict', true) && o.type == 'application/x-shockwave-flash'; + + p.width = o.width = dom.getAttrib(n, 'width') || 100; + p.height = o.height = dom.getAttrib(n, 'height') || 100; + + if (p.src) + p.src = ed.convertURL(p.src, 'src', n); + + if (stc) { + ob = dom.create('span', { + mce_name : 'object', + type : 'application/x-shockwave-flash', + data : p.src, + width : o.width, + height : o.height + }); + } else { + ob = dom.create('span', { + mce_name : 'object', + classid : "clsid:" + o.classid, + codebase : o.codebase, + width : o.width, + height : o.height + }); + } + + each (p, function(v, k) { + if (!/^(width|height|codebase|classid|_cx|_cy)$/.test(k)) { + // Use url instead of src in IE for Windows media + if (o.type == 'application/x-mplayer2' && k == 'src') + k = 'url'; + + if (v) + dom.add(ob, 'span', {mce_name : 'param', name : k, '_mce_value' : v}); + } + }); + + if (!stc) + dom.add(ob, 'span', tinymce.extend({mce_name : 'embed', type : o.type}, p)); + + return ob; + }, + + _spansToImgs : function(p) { + var t = this, dom = t.editor.dom, im, ci; + + each(dom.select('span', p), function(n) { + // Convert object into image + if (dom.getAttrib(n, 'class') == 'mceItemObject') { + ci = dom.getAttrib(n, "classid").toLowerCase().replace(/\s+/g, ''); + + switch (ci) { + case 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000': + dom.replace(t._createImg('mceItemFlash', n), n); + break; + + case 'clsid:166b1bca-3f9c-11cf-8075-444553540000': + dom.replace(t._createImg('mceItemShockWave', n), n); + break; + + case 'clsid:6bf52a52-394a-11d3-b153-00c04f79faa6': + case 'clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95': + case 'clsid:05589fa1-c356-11ce-bf01-00aa0055595a': + dom.replace(t._createImg('mceItemWindowsMedia', n), n); + break; + + case 'clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b': + dom.replace(t._createImg('mceItemQuickTime', n), n); + break; + + case 'clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa': + dom.replace(t._createImg('mceItemRealMedia', n), n); + break; + + default: + dom.replace(t._createImg('mceItemFlash', n), n); + } + + return; + } + + // Convert embed into image + if (dom.getAttrib(n, 'class') == 'mceItemEmbed') { + switch (dom.getAttrib(n, 'type')) { + case 'application/x-shockwave-flash': + dom.replace(t._createImg('mceItemFlash', n), n); + break; + + case 'application/x-director': + dom.replace(t._createImg('mceItemShockWave', n), n); + break; + + case 'application/x-mplayer2': + dom.replace(t._createImg('mceItemWindowsMedia', n), n); + break; + + case 'video/quicktime': + dom.replace(t._createImg('mceItemQuickTime', n), n); + break; + + case 'audio/x-pn-realaudio-plugin': + dom.replace(t._createImg('mceItemRealMedia', n), n); + break; + + default: + dom.replace(t._createImg('mceItemFlash', n), n); + } + } + }); + }, + + _createImg : function(cl, n) { + var im, dom = this.editor.dom, pa = {}, ti = '', args; + + args = ['id', 'name', 'width', 'height', 'bgcolor', 'align', 'flashvars', 'src', 'wmode', 'allowfullscreen', 'quality']; + + // Create image + im = dom.create('img', { + src : this.url + '/img/trans.gif', + width : dom.getAttrib(n, 'width') || 100, + height : dom.getAttrib(n, 'height') || 100, + 'class' : cl + }); + + // Setup base parameters + each(args, function(na) { + var v = dom.getAttrib(n, na); + + if (v) + pa[na] = v; + }); + + // Add optional parameters + each(dom.select('span', n), function(n) { + if (dom.hasClass(n, 'mceItemParam')) + pa[dom.getAttrib(n, 'name')] = dom.getAttrib(n, '_mce_value'); + }); + + // Use src not movie + if (pa.movie) { + pa.src = pa.movie; + delete pa.movie; + } + + // Merge with embed args + n = dom.select('.mceItemEmbed', n)[0]; + if (n) { + each(args, function(na) { + var v = dom.getAttrib(n, na); + + if (v && !pa[na]) + pa[na] = v; + }); + } + + delete pa.width; + delete pa.height; + + im.title = this._serialize(pa); + + return im; + }, + + _parse : function(s) { + return tinymce.util.JSON.parse('{' + s + '}'); + }, + + _serialize : function(o) { + return tinymce.util.JSON.serialize(o).replace(/[{}]/g, ''); + } + }); + + // Register plugin + tinymce.PluginManager.add('media', tinymce.plugins.MediaPlugin); +})(); \ No newline at end of file diff --git a/include/javascript/tiny_mce/plugins/media/js/embed.js b/include/javascript/tiny_mce/plugins/media/js/embed.js new file mode 100755 index 00000000..6fe25de0 --- /dev/null +++ b/include/javascript/tiny_mce/plugins/media/js/embed.js @@ -0,0 +1,73 @@ +/** + * This script contains embed functions for common plugins. This scripts are complety free to use for any purpose. + */ + +function writeFlash(p) { + writeEmbed( + 'D27CDB6E-AE6D-11cf-96B8-444553540000', + 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0', + 'application/x-shockwave-flash', + p + ); +} + +function writeShockWave(p) { + writeEmbed( + '166B1BCA-3F9C-11CF-8075-444553540000', + 'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0', + 'application/x-director', + p + ); +} + +function writeQuickTime(p) { + writeEmbed( + '02BF25D5-8C17-4B23-BC80-D3488ABDDC6B', + 'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0', + 'video/quicktime', + p + ); +} + +function writeRealMedia(p) { + writeEmbed( + 'CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA', + 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0', + 'audio/x-pn-realaudio-plugin', + p + ); +} + +function writeWindowsMedia(p) { + p.url = p.src; + writeEmbed( + '6BF52A52-394A-11D3-B153-00C04F79FAA6', + 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701', + 'application/x-mplayer2', + p + ); +} + +function writeEmbed(cls, cb, mt, p) { + var h = '', n; + + h += ''; + + h += ''); + +function init() { + var pl = "", f, val; + var type = "flash", fe, i; + + ed = tinyMCEPopup.editor; + + tinyMCEPopup.resizeToInnerSize(); + f = document.forms[0] + + fe = ed.selection.getNode(); + if (/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(ed.dom.getAttrib(fe, 'class'))) { + pl = fe.title; + + switch (ed.dom.getAttrib(fe, 'class')) { + case 'mceItemFlash': + type = 'flash'; + break; + + case 'mceItemFlashVideo': + type = 'flv'; + break; + + case 'mceItemShockWave': + type = 'shockwave'; + break; + + case 'mceItemWindowsMedia': + type = 'wmp'; + break; + + case 'mceItemQuickTime': + type = 'qt'; + break; + + case 'mceItemRealMedia': + type = 'rmp'; + break; + } + + document.forms[0].insert.value = ed.getLang('update', 'Insert', true); + } + + document.getElementById('filebrowsercontainer').innerHTML = getBrowserHTML('filebrowser','src','media','media'); + document.getElementById('qtsrcfilebrowsercontainer').innerHTML = getBrowserHTML('qtsrcfilebrowser','qt_qtsrc','media','media'); + document.getElementById('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor'); + + var html = getMediaListHTML('medialist','src','media','media'); + if (html == "") + document.getElementById("linklistrow").style.display = 'none'; + else + document.getElementById("linklistcontainer").innerHTML = html; + + // Resize some elements + if (isVisible('filebrowser')) + document.getElementById('src').style.width = '230px'; + + // Setup form + if (pl != "") { + pl = tinyMCEPopup.editor.plugins.media._parse(pl); + + switch (type) { + case "flash": + setBool(pl, 'flash', 'play'); + setBool(pl, 'flash', 'loop'); + setBool(pl, 'flash', 'menu'); + setBool(pl, 'flash', 'swliveconnect'); + setStr(pl, 'flash', 'quality'); + setStr(pl, 'flash', 'scale'); + setStr(pl, 'flash', 'salign'); + setStr(pl, 'flash', 'wmode'); + setStr(pl, 'flash', 'base'); + setStr(pl, 'flash', 'flashvars'); + break; + + case "qt": + setBool(pl, 'qt', 'loop'); + setBool(pl, 'qt', 'autoplay'); + setBool(pl, 'qt', 'cache'); + setBool(pl, 'qt', 'controller'); + setBool(pl, 'qt', 'correction'); + setBool(pl, 'qt', 'enablejavascript'); + setBool(pl, 'qt', 'kioskmode'); + setBool(pl, 'qt', 'autohref'); + setBool(pl, 'qt', 'playeveryframe'); + setBool(pl, 'qt', 'tarsetcache'); + setStr(pl, 'qt', 'scale'); + setStr(pl, 'qt', 'starttime'); + setStr(pl, 'qt', 'endtime'); + setStr(pl, 'qt', 'tarset'); + setStr(pl, 'qt', 'qtsrcchokespeed'); + setStr(pl, 'qt', 'volume'); + setStr(pl, 'qt', 'qtsrc'); + break; + + case "shockwave": + setBool(pl, 'shockwave', 'sound'); + setBool(pl, 'shockwave', 'progress'); + setBool(pl, 'shockwave', 'autostart'); + setBool(pl, 'shockwave', 'swliveconnect'); + setStr(pl, 'shockwave', 'swvolume'); + setStr(pl, 'shockwave', 'swstretchstyle'); + setStr(pl, 'shockwave', 'swstretchhalign'); + setStr(pl, 'shockwave', 'swstretchvalign'); + break; + + case "wmp": + setBool(pl, 'wmp', 'autostart'); + setBool(pl, 'wmp', 'enabled'); + setBool(pl, 'wmp', 'enablecontextmenu'); + setBool(pl, 'wmp', 'fullscreen'); + setBool(pl, 'wmp', 'invokeurls'); + setBool(pl, 'wmp', 'mute'); + setBool(pl, 'wmp', 'stretchtofit'); + setBool(pl, 'wmp', 'windowlessvideo'); + setStr(pl, 'wmp', 'balance'); + setStr(pl, 'wmp', 'baseurl'); + setStr(pl, 'wmp', 'captioningid'); + setStr(pl, 'wmp', 'currentmarker'); + setStr(pl, 'wmp', 'currentposition'); + setStr(pl, 'wmp', 'defaultframe'); + setStr(pl, 'wmp', 'playcount'); + setStr(pl, 'wmp', 'rate'); + setStr(pl, 'wmp', 'uimode'); + setStr(pl, 'wmp', 'volume'); + break; + + case "rmp": + setBool(pl, 'rmp', 'autostart'); + setBool(pl, 'rmp', 'loop'); + setBool(pl, 'rmp', 'autogotourl'); + setBool(pl, 'rmp', 'center'); + setBool(pl, 'rmp', 'imagestatus'); + setBool(pl, 'rmp', 'maintainaspect'); + setBool(pl, 'rmp', 'nojava'); + setBool(pl, 'rmp', 'prefetch'); + setBool(pl, 'rmp', 'shuffle'); + setStr(pl, 'rmp', 'console'); + setStr(pl, 'rmp', 'controls'); + setStr(pl, 'rmp', 'numloop'); + setStr(pl, 'rmp', 'scriptcallbacks'); + break; + } + + setStr(pl, null, 'src'); + setStr(pl, null, 'id'); + setStr(pl, null, 'name'); + setStr(pl, null, 'vspace'); + setStr(pl, null, 'hspace'); + setStr(pl, null, 'bgcolor'); + setStr(pl, null, 'align'); + setStr(pl, null, 'width'); + setStr(pl, null, 'height'); + + if ((val = ed.dom.getAttrib(fe, "width")) != "") + pl.width = f.width.value = val; + + if ((val = ed.dom.getAttrib(fe, "height")) != "") + pl.height = f.height.value = val; + + oldWidth = pl.width ? parseInt(pl.width) : 0; + oldHeight = pl.height ? parseInt(pl.height) : 0; + } else + oldWidth = oldHeight = 0; + + selectByValue(f, 'media_type', type); + changedType(type); + updateColor('bgcolor_pick', 'bgcolor'); + + TinyMCE_EditableSelects.init(); + generatePreview(); +} + +function insertMedia() { + var fe, f = document.forms[0], h; + + tinyMCEPopup.restoreSelection(); + + if (!AutoValidator.validate(f)) { + tinyMCEPopup.alert(ed.getLang('invalid_data')); + return false; + } + + f.width.value = f.width.value == "" ? 100 : f.width.value; + f.height.value = f.height.value == "" ? 100 : f.height.value; + + fe = ed.selection.getNode(); + if (fe != null && /mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(ed.dom.getAttrib(fe, 'class'))) { + switch (f.media_type.options[f.media_type.selectedIndex].value) { + case "flash": + fe.className = "mceItemFlash"; + break; + + case "flv": + fe.className = "mceItemFlashVideo"; + break; + + case "shockwave": + fe.className = "mceItemShockWave"; + break; + + case "qt": + fe.className = "mceItemQuickTime"; + break; + + case "wmp": + fe.className = "mceItemWindowsMedia"; + break; + + case "rmp": + fe.className = "mceItemRealMedia"; + break; + } + + if (fe.width != f.width.value || fe.height != f.height.height) + ed.execCommand('mceRepaint'); + + fe.title = serializeParameters(); + fe.width = f.width.value; + fe.height = f.height.value; + fe.style.width = f.width.value + (f.width.value.indexOf('%') == -1 ? 'px' : ''); + fe.style.height = f.height.value + (f.height.value.indexOf('%') == -1 ? 'px' : ''); + fe.align = f.align.options[f.align.selectedIndex].value; + } else { + h = ' 0) { + var html = ""; + + html += ''; + + return html; + } + + return ""; +} + +function getType(v) { + var fo, i, c, el, x, f = document.forms[0]; + + fo = ed.getParam("media_types", "flash=swf;flv=flv;shockwave=dcr;qt=mov,qt,mpg,mp3,mp4,mpeg;shockwave=dcr;wmp=avi,wmv,wm,asf,asx,wmx,wvx;rmp=rm,ra,ram").split(';'); + + // YouTube + if (v.match(/watch\?v=(.+)(.*)/)) { + f.width.value = '425'; + f.height.value = '350'; + f.src.value = 'http://www.youtube.com/v/' + v.match(/v=(.*)(.*)/)[0].split('=')[1]; + return 'flash'; + } + + // Google video + if (v.indexOf('http://video.google.com/videoplay?docid=') == 0) { + f.width.value = '425'; + f.height.value = '326'; + f.src.value = 'http://video.google.com/googleplayer.swf?docId=' + v.substring('http://video.google.com/videoplay?docid='.length) + '&hl=en'; + return 'flash'; + } + + for (i=0; i 0 ? s.substring(0, s.length - 1) : s; + + return s; +} + +function setBool(pl, p, n) { + if (typeof(pl[n]) == "undefined") + return; + + document.forms[0].elements[p + "_" + n].checked = pl[n]; +} + +function setStr(pl, p, n) { + var f = document.forms[0], e = f.elements[(p != null ? p + "_" : '') + n]; + + if (typeof(pl[n]) == "undefined") + return; + + if (e.type == "text") + e.value = pl[n]; + else + selectByValue(f, (p != null ? p + "_" : '') + n, pl[n]); +} + +function getBool(p, n, d, tv, fv) { + var v = document.forms[0].elements[p + "_" + n].checked; + + tv = typeof(tv) == 'undefined' ? 'true' : "'" + jsEncode(tv) + "'"; + fv = typeof(fv) == 'undefined' ? 'false' : "'" + jsEncode(fv) + "'"; + + return (v == d) ? '' : n + (v ? ':' + tv + ',' : ':' + fv + ','); +} + +function getStr(p, n, d) { + var e = document.forms[0].elements[(p != null ? p + "_" : "") + n]; + var v = e.type == "text" ? e.value : e.options[e.selectedIndex].value; + + if (n == 'src') + v = tinyMCEPopup.editor.convertURL(v, 'src', null); + + return ((n == d || v == '') ? '' : n + ":'" + jsEncode(v) + "',"); +} + +function getInt(p, n, d) { + var e = document.forms[0].elements[(p != null ? p + "_" : "") + n]; + var v = e.type == "text" ? e.value : e.options[e.selectedIndex].value; + + return ((n == d || v == '') ? '' : n + ":" + v.replace(/[^0-9]+/g, '') + ","); +} + +function jsEncode(s) { + s = s.replace(new RegExp('\\\\', 'g'), '\\\\'); + s = s.replace(new RegExp('"', 'g'), '\\"'); + s = s.replace(new RegExp("'", 'g'), "\\'"); + + return s; +} + +function generatePreview(c) { + var f = document.forms[0], p = document.getElementById('prev'), h = '', cls, pl, n, type, codebase, wp, hp, nw, nh; + + p.innerHTML = ''; + + nw = parseInt(f.width.value); + nh = parseInt(f.height.value); + + if (f.width.value != "" && f.height.value != "") { + if (f.constrain.checked) { + if (c == 'width' && oldWidth != 0) { + wp = nw / oldWidth; + nh = Math.round(wp * nh); + f.height.value = nh; + } else if (c == 'height' && oldHeight != 0) { + hp = nh / oldHeight; + nw = Math.round(hp * nw); + f.width.value = nw; + } + } + } + + if (f.width.value != "") + oldWidth = nw; + + if (f.height.value != "") + oldHeight = nh; + + // After constrain + pl = serializeParameters(); + + switch (f.media_type.options[f.media_type.selectedIndex].value) { + case "flash": + cls = 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'; + codebase = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0'; + type = 'application/x-shockwave-flash'; + break; + + case "shockwave": + cls = 'clsid:166B1BCA-3F9C-11CF-8075-444553540000'; + codebase = 'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0'; + type = 'application/x-director'; + break; + + case "qt": + cls = 'clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B'; + codebase = 'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0'; + type = 'video/quicktime'; + break; + + case "wmp": + cls = ed.getParam('media_wmp6_compatible') ? 'clsid:05589FA1-C356-11CE-BF01-00AA0055595A' : 'clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6'; + codebase = 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701'; + type = 'application/x-mplayer2'; + break; + + case "rmp": + cls = 'clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA'; + codebase = 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701'; + type = 'audio/x-pn-realaudio-plugin'; + break; + } + + if (pl == '') { + p.innerHTML = ''; + return; + } + + pl = tinyMCEPopup.editor.plugins.media._parse(pl); + + if (!pl.src) { + p.innerHTML = ''; + return; + } + + pl.src = tinyMCEPopup.editor.documentBaseURI.toAbsolute(pl.src); + pl.width = !pl.width ? 100 : pl.width; + pl.height = !pl.height ? 100 : pl.height; + pl.id = !pl.id ? 'obj' : pl.id; + pl.name = !pl.name ? 'eobj' : pl.name; + pl.align = !pl.align ? '' : pl.align; + + // Avoid annoying warning about insecure items + if (!tinymce.isIE || document.location.protocol != 'https:') { + h += ''; + + for (n in pl) { + h += ''; + + // Add extra url parameter if it's an absolute URL + if (n == 'src' && pl[n].indexOf('://') != -1) + h += ''; + } + } + + h += '·':' ');});ed.addButton('nonbreaking',{title:'nonbreaking.nonbreaking_desc',cmd:'mceNonBreaking'});if(ed.getParam('nonbreaking_force_tab')){ed.onKeyDown.add(function(ed,e){if(tinymce.isIE&&e.keyCode==9){ed.execCommand('mceNonBreaking');ed.execCommand('mceNonBreaking');ed.execCommand('mceNonBreaking');tinymce.dom.Event.cancel(e);}});}},getInfo:function(){return{longname:'Nonbreaking space',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/nonbreaking',version:tinymce.majorVersion+"."+tinymce.minorVersion};}});tinymce.PluginManager.add('nonbreaking',tinymce.plugins.Nonbreaking);})(); \ No newline at end of file diff --git a/include/javascript/tiny_mce/plugins/nonbreaking/editor_plugin_src.js b/include/javascript/tiny_mce/plugins/nonbreaking/editor_plugin_src.js new file mode 100755 index 00000000..720971d9 --- /dev/null +++ b/include/javascript/tiny_mce/plugins/nonbreaking/editor_plugin_src.js @@ -0,0 +1,50 @@ +/** + + * + * @author Moxiecode + * @copyright Copyright 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + tinymce.create('tinymce.plugins.Nonbreaking', { + init : function(ed, url) { + var t = this; + + t.editor = ed; + + // Register commands + ed.addCommand('mceNonBreaking', function() { + ed.execCommand('mceInsertContent', false, (ed.plugins.visualchars && ed.plugins.visualchars.state) ? '·' : ' '); + }); + + // Register buttons + ed.addButton('nonbreaking', {title : 'nonbreaking.nonbreaking_desc', cmd : 'mceNonBreaking'}); + + if (ed.getParam('nonbreaking_force_tab')) { + ed.onKeyDown.add(function(ed, e) { + if (tinymce.isIE && e.keyCode == 9) { + ed.execCommand('mceNonBreaking'); + ed.execCommand('mceNonBreaking'); + ed.execCommand('mceNonBreaking'); + tinymce.dom.Event.cancel(e); + } + }); + } + }, + + getInfo : function() { + return { + longname : 'Nonbreaking space', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/nonbreaking', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; + } + + // Private methods + }); + + // Register plugin + tinymce.PluginManager.add('nonbreaking', tinymce.plugins.Nonbreaking); +})(); \ No newline at end of file diff --git a/include/javascript/tiny_mce/plugins/noneditable/editor_plugin.js b/include/javascript/tiny_mce/plugins/noneditable/editor_plugin.js new file mode 100755 index 00000000..8a1b8f07 --- /dev/null +++ b/include/javascript/tiny_mce/plugins/noneditable/editor_plugin.js @@ -0,0 +1 @@ +(function(){var Event=tinymce.dom.Event;tinymce.create('tinymce.plugins.NonEditablePlugin',{init:function(ed,url){var t=this,editClass,nonEditClass;t.editor=ed;editClass=ed.getParam("noneditable_editable_class","mceEditable");nonEditClass=ed.getParam("noneditable_noneditable_class","mceNonEditable");ed.onNodeChange.addToTop(function(ed,cm,n){var sc,ec;sc=ed.dom.getParent(ed.selection.getStart(),function(n){return ed.dom.hasClass(n,nonEditClass);});ec=ed.dom.getParent(ed.selection.getEnd(),function(n){return ed.dom.hasClass(n,nonEditClass);});if(sc||ec){t._setDisabled(1);return false;}else t._setDisabled(0);});},getInfo:function(){return{longname:'Non editable elements',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/noneditable',version:tinymce.majorVersion+"."+tinymce.minorVersion};},_block:function(ed,e){var k=e.keyCode;if((k>32&&k<41)||(k>111&&k<124))return;return Event.cancel(e);},_setDisabled:function(s){var t=this,ed=t.editor;tinymce.each(ed.controlManager.controls,function(c){c.setDisabled(s);});if(s!==t.disabled){if(s){ed.onKeyDown.addToTop(t._block);ed.onKeyPress.addToTop(t._block);ed.onKeyUp.addToTop(t._block);ed.onPaste.addToTop(t._block);}else{ed.onKeyDown.remove(t._block);ed.onKeyPress.remove(t._block);ed.onKeyUp.remove(t._block);ed.onPaste.remove(t._block);}t.disabled=s;}}});tinymce.PluginManager.add('noneditable',tinymce.plugins.NonEditablePlugin);})(); \ No newline at end of file diff --git a/include/javascript/tiny_mce/plugins/noneditable/editor_plugin_src.js b/include/javascript/tiny_mce/plugins/noneditable/editor_plugin_src.js new file mode 100755 index 00000000..9176f47b --- /dev/null +++ b/include/javascript/tiny_mce/plugins/noneditable/editor_plugin_src.js @@ -0,0 +1,87 @@ +/** + + * + * @author Moxiecode + * @copyright Copyright 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + var Event = tinymce.dom.Event; + + tinymce.create('tinymce.plugins.NonEditablePlugin', { + init : function(ed, url) { + var t = this, editClass, nonEditClass; + + t.editor = ed; + editClass = ed.getParam("noneditable_editable_class", "mceEditable"); + nonEditClass = ed.getParam("noneditable_noneditable_class", "mceNonEditable"); + + ed.onNodeChange.addToTop(function(ed, cm, n) { + var sc, ec; + + // Block if start or end is inside a non editable element + sc = ed.dom.getParent(ed.selection.getStart(), function(n) { + return ed.dom.hasClass(n, nonEditClass); + }); + + ec = ed.dom.getParent(ed.selection.getEnd(), function(n) { + return ed.dom.hasClass(n, nonEditClass); + }); + + // Block or unblock + if (sc || ec) { + t._setDisabled(1); + return false; + } else + t._setDisabled(0); + }); + }, + + getInfo : function() { + return { + longname : 'Non editable elements', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/noneditable', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; + }, + + _block : function(ed, e) { + var k = e.keyCode; + + // Don't block arrow keys, pg up/down, and F1-F12 + if ((k > 32 && k < 41) || (k > 111 && k < 124)) + return; + + return Event.cancel(e); + }, + + _setDisabled : function(s) { + var t = this, ed = t.editor; + + tinymce.each(ed.controlManager.controls, function(c) { + c.setDisabled(s); + }); + + if (s !== t.disabled) { + if (s) { + ed.onKeyDown.addToTop(t._block); + ed.onKeyPress.addToTop(t._block); + ed.onKeyUp.addToTop(t._block); + ed.onPaste.addToTop(t._block); + } else { + ed.onKeyDown.remove(t._block); + ed.onKeyPress.remove(t._block); + ed.onKeyUp.remove(t._block); + ed.onPaste.remove(t._block); + } + + t.disabled = s; + } + } + }); + + // Register plugin + tinymce.PluginManager.add('noneditable', tinymce.plugins.NonEditablePlugin); +})(); \ No newline at end of file diff --git a/include/javascript/tiny_mce/plugins/pagebreak/editor_plugin.js b/include/javascript/tiny_mce/plugins/pagebreak/editor_plugin.js new file mode 100755 index 00000000..177ea95b --- /dev/null +++ b/include/javascript/tiny_mce/plugins/pagebreak/editor_plugin.js @@ -0,0 +1 @@ +(function(){tinymce.create('tinymce.plugins.PageBreakPlugin',{init:function(ed,url){var pb='',cls='mcePageBreak',sep=ed.getParam('pagebreak_separator',''),pbRE;pbRE=new RegExp(sep.replace(/[\?\.\*\[\]\(\)\{\}\+\^\$\:]/g,function(a){return'\\'+a;}),'g');ed.addCommand('mcePageBreak',function(){ed.execCommand('mceInsertContent',0,pb);});ed.addButton('pagebreak',{title:'pagebreak.desc',cmd:cls});ed.onInit.add(function(){if(ed.settings.content_css!==false)ed.dom.loadCSS(url+"/css/content.css");if(ed.theme.onResolveName){ed.theme.onResolveName.add(function(th,o){if(o.node.nodeName=='IMG'&&ed.dom.hasClass(o.node,cls))o.name='pagebreak';});}});ed.onClick.add(function(ed,e){e=e.target;if(e.nodeName==='IMG'&&ed.dom.hasClass(e,cls))ed.selection.select(e);});ed.onNodeChange.add(function(ed,cm,n){cm.setActive('pagebreak',n.nodeName==='IMG'&&ed.dom.hasClass(n,cls));});ed.onBeforeSetContent.add(function(ed,o){o.content=o.content.replace(pbRE,pb);});ed.onPostProcess.add(function(ed,o){if(o.get)o.content=o.content.replace(/]+>/g,function(im){if(im.indexOf('class="mcePageBreak')!==-1)im=sep;return im;});});},getInfo:function(){return{longname:'PageBreak',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/pagebreak',version:tinymce.majorVersion+"."+tinymce.minorVersion};}});tinymce.PluginManager.add('pagebreak',tinymce.plugins.PageBreakPlugin);})(); \ No newline at end of file diff --git a/include/javascript/tiny_mce/plugins/pagebreak/editor_plugin_src.js b/include/javascript/tiny_mce/plugins/pagebreak/editor_plugin_src.js new file mode 100755 index 00000000..3d97a5d7 --- /dev/null +++ b/include/javascript/tiny_mce/plugins/pagebreak/editor_plugin_src.js @@ -0,0 +1,74 @@ +/** + + * + * @author Moxiecode + * @copyright Copyright 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + tinymce.create('tinymce.plugins.PageBreakPlugin', { + init : function(ed, url) { + var pb = '', cls = 'mcePageBreak', sep = ed.getParam('pagebreak_separator', ''), pbRE; + + pbRE = new RegExp(sep.replace(/[\?\.\*\[\]\(\)\{\}\+\^\$\:]/g, function(a) {return '\\' + a;}), 'g'); + + // Register commands + ed.addCommand('mcePageBreak', function() { + ed.execCommand('mceInsertContent', 0, pb); + }); + + // Register buttons + ed.addButton('pagebreak', {title : 'pagebreak.desc', cmd : cls}); + + ed.onInit.add(function() { + if (ed.settings.content_css !== false) + ed.dom.loadCSS(url + "/css/content.css"); + + if (ed.theme.onResolveName) { + ed.theme.onResolveName.add(function(th, o) { + if (o.node.nodeName == 'IMG' && ed.dom.hasClass(o.node, cls)) + o.name = 'pagebreak'; + }); + } + }); + + ed.onClick.add(function(ed, e) { + e = e.target; + + if (e.nodeName === 'IMG' && ed.dom.hasClass(e, cls)) + ed.selection.select(e); + }); + + ed.onNodeChange.add(function(ed, cm, n) { + cm.setActive('pagebreak', n.nodeName === 'IMG' && ed.dom.hasClass(n, cls)); + }); + + ed.onBeforeSetContent.add(function(ed, o) { + o.content = o.content.replace(pbRE, pb); + }); + + ed.onPostProcess.add(function(ed, o) { + if (o.get) + o.content = o.content.replace(/]+>/g, function(im) { + if (im.indexOf('class="mcePageBreak') !== -1) + im = sep; + + return im; + }); + }); + }, + + getInfo : function() { + return { + longname : 'PageBreak', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/pagebreak', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; + } + }); + + // Register plugin + tinymce.PluginManager.add('pagebreak', tinymce.plugins.PageBreakPlugin); +})(); \ No newline at end of file diff --git a/include/javascript/tiny_mce/plugins/paste/editor_plugin.js b/include/javascript/tiny_mce/plugins/paste/editor_plugin.js new file mode 100755 index 00000000..eeeebd5b --- /dev/null +++ b/include/javascript/tiny_mce/plugins/paste/editor_plugin.js @@ -0,0 +1 @@ +(function(){var Event=tinymce.dom.Event;tinymce.create('tinymce.plugins.PastePlugin',{init:function(ed,url){var t=this;t.editor=ed;ed.addCommand('mcePasteText',function(ui,v){if(ui){if((ed.getParam('paste_use_dialog',true))||(!tinymce.isIE)){ed.windowManager.open({file:url+'/pastetext.htm',width:450,height:400,inline:1},{plugin_url:url});}else t._insertText(clipboardData.getData("Text"),true);}else t._insertText(v.html,v.linebreaks);});ed.addCommand('mcePasteWord',function(ui,v){if(ui){if((ed.getParam('paste_use_dialog',true))||(!tinymce.isIE)){ed.windowManager.open({file:url+'/pasteword.htm',width:450,height:400,inline:1},{plugin_url:url});}else t._insertText(t._clipboardHTML());}else t._insertWordContent(v);});ed.addCommand('mceSelectAll',function(){ed.execCommand('selectall');});ed.addButton('pastetext',{title:'paste.paste_text_desc',cmd:'mcePasteText',ui:true});ed.addButton('pasteword',{title:'paste.paste_word_desc',cmd:'mcePasteWord',ui:true});ed.addButton('selectall',{title:'paste.selectall_desc',cmd:'mceSelectAll'});if(ed.getParam("paste_auto_cleanup_on_paste",false)){ed.onPaste.add(function(ed,e){return t._handlePasteEvent(e)});}if(!tinymce.isIE&&ed.getParam("paste_auto_cleanup_on_paste",false)){ed.onKeyDown.add(function(ed,e){if(e.ctrlKey&&e.keyCode==86){window.setTimeout(function(){ed.execCommand("mcePasteText",true);},1);Event.cancel(e);}});}},getInfo:function(){return{longname:'Paste text/word',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/paste',version:tinymce.majorVersion+"."+tinymce.minorVersion};},_handlePasteEvent:function(e){var html=this._clipboardHTML(),ed=this.editor,sel=ed.selection,r;if(ed&&(r=sel.getRng())&&r.text.length>0)ed.execCommand('delete');if(html&&html.length>0)ed.execCommand('mcePasteWord',false,html);return Event.cancel(e);},_insertText:function(content,bLinebreaks){content=this.editor.dom.encode(content);if(content&&content.length>0){if(!this.editor.selection.isCollapsed())this.editor.execCommand("Delete");if(bLinebreaks){if(this.editor.getParam("paste_create_paragraphs",true)){var rl=this.editor.getParam("paste_replace_list",'\u2122,TM,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');for(var i=0;i

    ');content=content.replace(/\r\r/g,'

    ');content=content.replace(/\n\n/g,'

    ');if((pos=content.indexOf('

    '))!=-1){this.editor.execCommand("Delete");var node=this.editor.selection.getNode();var breakElms=[];do{if(node.nodeType==1){if(node.nodeName=="TD"||node.nodeName=="BODY")break;breakElms[breakElms.length]=node;}}while(node=node.parentNode);var before="",after="

    ";before+=content.substring(0,pos);for(var i=0;i";after+="<"+breakElms[(breakElms.length-1)-i].nodeName+">";}before+="

    ";content=before+content.substring(pos+7)+after;}}if(this.editor.getParam("paste_create_linebreaks",true)){content=content.replace(/\r\n/g,'
    ');content=content.replace(/\r/g,'
    ');content=content.replace(/\n/g,'
    ');}}this.editor.execCommand("mceInsertRawHTML",false,content);}},_insertWordContent:function(content){var t=this,ed=t.editor;if(content&&content.length>0){var bull=String.fromCharCode(8226);var middot=String.fromCharCode(183);if(ed.getParam('paste_insert_word_content_callback'))content=ed.execCallback('paste_insert_word_content_callback','before',content);var rl=ed.getParam("paste_replace_list",'\u2122,TM,\u2026,...,\x93|\x94|\u201c|\u201d,",\x60|\x91|\x92|\u2018|\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');for(var i=0;i(.*?)<\/p>','gi'),'

    $1

    ');}content=content.replace(new RegExp('tab-stops: list [0-9]+.0pt">','gi'),'">'+"--list--");content=content.replace(new RegExp(bull+"(.*?)
    ","gi"),"

    "+middot+"$1

    ");content=content.replace(new RegExp('','gi'),""+bull);content=content.replace(/<\/o:p>/gi,"");content=content.replace(new RegExp('
    ]+>/g,"");if(this.editor.getParam("paste_remove_spans",true))content=content.replace(/<\/?span[^>]*>/gi,"");if(this.editor.getParam("paste_remove_styles",true))content=content.replace(new RegExp('<(\\w[^>]*) style="([^"]*)"([^>]*)','gi'),"<$1$3");content=content.replace(/<\/?font[^>]*>/gi,"");switch(this.editor.getParam("paste_strip_class_attributes","all")){case"all":content=content.replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/gi,"<$1$3");break;case"mso":content=content.replace(new RegExp('<(\\w[^>]*) class="?mso([^ |>]*)([^>]*)','gi'),"<$1$3");break;}content=content.replace(new RegExp('href="?'+this._reEscape(""+document.location)+'','gi'),'href="'+this.editor.documentBaseURI.getURI());content=content.replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi,"<$1$3");content=content.replace(/<\\?\?xml[^>]*>/gi,"");content=content.replace(/<\/?\w+:[^>]*>/gi,"");content=content.replace(/-- page break --\s*

     <\/p>/gi,"");content=content.replace(/-- page break --/gi,"");if(!this.editor.getParam('force_p_newlines')){content=content.replace('','','gi');content=content.replace('

    ','

    ','gi');}if(!tinymce.isIE&&!this.editor.getParam('force_p_newlines')){content=content.replace(/<\/?p[^>]*>/gi,"");}content=content.replace(/<\/?div[^>]*>/gi,"");if(this.editor.getParam("paste_convert_middot_lists",true)){var div=ed.dom.create("div",null,content);var className=this.editor.getParam("paste_unindented_list_class","unIndentedList");while(this._convertMiddots(div,"--list--"));while(this._convertMiddots(div,middot,className));while(this._convertMiddots(div,bull));content=div.innerHTML;}if(this.editor.getParam("paste_convert_headers_to_strong",false)){content=content.replace(/ <\/h[1-6]>/gi,'

      

    ');content=content.replace(//gi,'

    ');content=content.replace(/<\/h[1-6]>/gi,'

    ');content=content.replace(/ <\/b>/gi,'  ');content=content.replace(/^( )*/gi,'');}content=content.replace(/--list--/gi,"");if(ed.getParam('paste_insert_word_content_callback'))content=ed.execCallback('paste_insert_word_content_callback','after',content);this.editor.execCommand("mceInsertContent",false,content);if(this.editor.getParam('paste_force_cleanup_wordpaste',true)){var ed=this.editor;window.setTimeout(function(){ed.execCommand("mceCleanup");},1);}}},_reEscape:function(s){var l="?.\\*[](){}+^$:";var o="";for(var i=0;i 0) + ed.execCommand('delete'); + + if (html && html.length > 0) + ed.execCommand('mcePasteWord', false, html); + + return Event.cancel(e); + }, + + _insertText : function(content, bLinebreaks) { + content = this.editor.dom.encode(content); + + if (content && content.length > 0) { + // Delete any highlighted text before pasting + if (!this.editor.selection.isCollapsed()) + this.editor.execCommand("Delete"); + + if (bLinebreaks) { + // Special paragraph treatment + if (this.editor.getParam("paste_create_paragraphs", true)) { + var rl = this.editor.getParam("paste_replace_list", '\u2122,TM,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(','); + for (var i=0; i

    '); + content = content.replace(/\r\r/g, '

    '); + content = content.replace(/\n\n/g, '

    '); + + // Has paragraphs + if ((pos = content.indexOf('

    ')) != -1) { + this.editor.execCommand("Delete"); + + var node = this.editor.selection.getNode(); + + // Get list of elements to break + var breakElms = []; + + do { + if (node.nodeType == 1) { + // Don't break tables and break at body + if (node.nodeName == "TD" || node.nodeName == "BODY") + break; + + breakElms[breakElms.length] = node; + } + } while(node = node.parentNode); + + var before = "", after = "

    "; + before += content.substring(0, pos); + + for (var i=0; i"; + after += "<" + breakElms[(breakElms.length-1)-i].nodeName + ">"; + } + + before += "

    "; + content = before + content.substring(pos+7) + after; + } + } + + if (this.editor.getParam("paste_create_linebreaks", true)) { + content = content.replace(/\r\n/g, '
    '); + content = content.replace(/\r/g, '
    '); + content = content.replace(/\n/g, '
    '); + } + } + + this.editor.execCommand("mceInsertRawHTML", false, content); + } + }, + + _insertWordContent : function(content) { + var t = this, ed = t.editor; + + if (content && content.length > 0) { + // Cleanup Word content + var bull = String.fromCharCode(8226); + var middot = String.fromCharCode(183); + + if (ed.getParam('paste_insert_word_content_callback')) + content = ed.execCallback('paste_insert_word_content_callback', 'before', content); + + var rl = ed.getParam("paste_replace_list", '\u2122,TM,\u2026,...,\x93|\x94|\u201c|\u201d,",\x60|\x91|\x92|\u2018|\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(','); + for (var i=0; i(.*?)<\/p>', 'gi'), '

    $1

    '); + } + + content = content.replace(new RegExp('tab-stops: list [0-9]+.0pt">', 'gi'), '">' + "--list--"); + content = content.replace(new RegExp(bull + "(.*?)
    ", "gi"), "

    " + middot + "$1

    "); + content = content.replace(new RegExp('', 'gi'), "" + bull); // Covert to bull list + content = content.replace(/<\/o:p>/gi, ""); + content = content.replace(new RegExp('
    ]+>/g, ""); // Header elements + + if (this.editor.getParam("paste_remove_spans", true)) + content = content.replace(/<\/?span[^>]*>/gi, ""); + + if (this.editor.getParam("paste_remove_styles", true)) + content = content.replace(new RegExp('<(\\w[^>]*) style="([^"]*)"([^>]*)', 'gi'), "<$1$3"); + + content = content.replace(/<\/?font[^>]*>/gi, ""); + + // Strips class attributes. + switch (this.editor.getParam("paste_strip_class_attributes", "all")) { + case "all": + content = content.replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/gi, "<$1$3"); + break; + + case "mso": + content = content.replace(new RegExp('<(\\w[^>]*) class="?mso([^ |>]*)([^>]*)', 'gi'), "<$1$3"); + break; + } + + content = content.replace(new RegExp('href="?' + this._reEscape("" + document.location) + '', 'gi'), 'href="' + this.editor.documentBaseURI.getURI()); + content = content.replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi, "<$1$3"); + content = content.replace(/<\\?\?xml[^>]*>/gi, ""); + content = content.replace(/<\/?\w+:[^>]*>/gi, ""); + content = content.replace(/-- page break --\s*

     <\/p>/gi, ""); // Remove pagebreaks + content = content.replace(/-- page break --/gi, ""); // Remove pagebreaks + + // content = content.replace(/\/? */gi, "");   + // content = content.replace(/

     <\/p>/gi, ''); + + if (!this.editor.getParam('force_p_newlines')) { + content = content.replace('', '' ,'gi'); + content = content.replace('

    ', '

    ' ,'gi'); + } + + if (!tinymce.isIE && !this.editor.getParam('force_p_newlines')) { + content = content.replace(/<\/?p[^>]*>/gi, ""); + } + + content = content.replace(/<\/?div[^>]*>/gi, ""); + + // Convert all middlot lists to UL lists + if (this.editor.getParam("paste_convert_middot_lists", true)) { + var div = ed.dom.create("div", null, content); + + // Convert all middot paragraphs to li elements + var className = this.editor.getParam("paste_unindented_list_class", "unIndentedList"); + + while (this._convertMiddots(div, "--list--")) ; // bull + while (this._convertMiddots(div, middot, className)) ; // Middot + while (this._convertMiddots(div, bull)) ; // bull + + content = div.innerHTML; + } + + // Replace all headers with strong and fix some other issues + if (this.editor.getParam("paste_convert_headers_to_strong", false)) { + content = content.replace(/ <\/h[1-6]>/gi, '

      

    '); + content = content.replace(//gi, '

    '); + content = content.replace(/<\/h[1-6]>/gi, '

    '); + content = content.replace(/ <\/b>/gi, '  '); + content = content.replace(/^( )*/gi, ''); + } + + content = content.replace(/--list--/gi, ""); // Remove --list-- + + if (ed.getParam('paste_insert_word_content_callback')) + content = ed.execCallback('paste_insert_word_content_callback', 'after', content); + + // Insert cleaned content + this.editor.execCommand("mceInsertContent", false, content); + + if (this.editor.getParam('paste_force_cleanup_wordpaste', true)) { + var ed = this.editor; + + window.setTimeout(function() { + ed.execCommand("mceCleanup"); + }, 1); // Do normal cleanup detached from this thread + } + } + }, + + _reEscape : function(s) { + var l = "?.\\*[](){}+^$:"; + var o = ""; + + for (var i=0; i'; + + h += ']+>/g,'')).length==0){ed.setContent('


    ',{format:'raw'});n=b.firstChild;r=s.getRng();r.setStart(n,0);r.setEnd(n,0);s.setRng(r);}}});ed.addCommand('FormatBlock',function(u,v){var dom=ed.dom,e=dom.getParent(ed.selection.getNode(),dom.isBlock);if(e)dom.replace(dom.create(v),e,1);else ed.getDoc().execCommand("FormatBlock",false,v);});ed.addCommand('mceInsertContent',function(u,v){ed.getDoc().execCommand("InsertText",false,'mce_marker');ed.getBody().innerHTML=ed.getBody().innerHTML.replace(/mce_marker/g,ed.dom.processHTML(v)+'XX');ed.selection.select(ed.dom.get('_mce_tmp'));ed.getDoc().execCommand("Delete",false,' ');});ed.onKeyPress.add(function(ed,e){var se,li,lic,r1,r2,n,sel,doc,be,af,pa;if(e.keyCode==13){sel=ed.selection;se=sel.getNode();if(e.shiftKey||ed.settings.force_br_newlines&&se.nodeName!='LI'){t._insertBR(ed);Event.cancel(e);}if(li=dom.getParent(se,'LI')){lic=dom.getParent(li,'OL,UL');doc=ed.getDoc();pa=dom.create('p');dom.add(pa,'br',{mce_bogus:"1"});if(isEmpty(doc,li)){if(n=dom.getParent(lic.parentNode,'LI,OL,UL'))return;n=dom.getParent(lic,'p,h1,h2,h3,h4,h5,h6,div')||lic;r1=doc.createRange();r1.setStartBefore(n);r1.setEndBefore(li);r2=doc.createRange();r2.setStartAfter(li);r2.setEndAfter(n);be=r1.cloneContents();af=r2.cloneContents();if(!isEmpty(doc,af))dom.insertAfter(af,n);dom.insertAfter(pa,n);if(!isEmpty(doc,be))dom.insertAfter(be,n);dom.remove(n);n=pa.firstChild;r1=doc.createRange();r1.setStartBefore(n);r1.setEndBefore(n);sel.setRng(r1);return Event.cancel(e);}}}});ed.onExecCommand.add(function(ed,cmd){var sel,dom,bl,bm;if(cmd=='InsertUnorderedList'||cmd=='InsertOrderedList'){sel=ed.selection;dom=ed.dom;if(bl=dom.getParent(sel.getNode(),function(n){return/^(H[1-6]|P|ADDRESS|PRE)$/.test(n.nodeName);})){bm=sel.getBookmark();dom.remove(bl,1);sel.moveToBookmark(bm);}}});ed.onClick.add(function(ed,e){e=e.target;if(e.nodeName=='IMG'){t.selElm=e;ed.selection.select(e);}else t.selElm=null;});ed.onInit.add(function(){t._fixWebKitSpans();if(isOldWebKit)t._patchSafari2x(ed);});ed.onSetContent.add(function(){dom=ed.dom;each(['strong','b','em','u','strike','sub','sup','a'],function(v){each(grep(dom.select(v)).reverse(),function(n){var nn=n.nodeName.toLowerCase(),st;if(nn=='a'){if(n.name)dom.replace(dom.create('img',{mce_name:'a',name:n.name,'class':'mceItemAnchor'}),n);return;}switch(nn){case'b':case'strong':if(nn=='b')nn='strong';st='font-weight: bold;';break;case'em':st='font-style: italic;';break;case'u':st='text-decoration: underline;';break;case'sub':st='vertical-align: sub;';break;case'sup':st='vertical-align: super;';break;case'strike':st='text-decoration: line-through;';break;}dom.replace(dom.create('span',{mce_name:nn,style:st,'class':'Apple-style-span'}),n,1);});});});ed.onPreProcess.add(function(ed,o){dom=ed.dom;each(grep(o.node.getElementsByTagName('span')).reverse(),function(n){var v,bg;if(o.get){if(dom.hasClass(n,'Apple-style-span')){bg=n.style.backgroundColor;switch(dom.getAttrib(n,'mce_name')){case'font':if(!ed.settings.convert_fonts_to_spans)dom.setAttrib(n,'style','');break;case'strong':case'em':case'sub':case'sup':dom.setAttrib(n,'style','');break;case'strike':case'u':if(!ed.settings.inline_styles)dom.setAttrib(n,'style','');else dom.setAttrib(n,'mce_name','');break;default:if(!ed.settings.inline_styles)dom.setAttrib(n,'style','');}if(bg)n.style.backgroundColor=bg;}}if(dom.hasClass(n,'mceItemRemoved'))dom.remove(n,1);});});ed.onPostProcess.add(function(ed,o){o.content=o.content.replace(/
    <\/(h[1-6]|div|p|address|pre)>/g,'');o.content=o.content.replace(/ id=\"undefined\"/g,'');});},getInfo:function(){return{longname:'Safari compatibility',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/safari',version:tinymce.majorVersion+"."+tinymce.minorVersion};},_fixWebKitSpans:function(){var t=this,ed=t.editor;if(!isOldWebKit){Event.add(ed.getDoc(),'DOMNodeInserted',function(e){e=e.target;if(e&&e.nodeType==1)t._fixAppleSpan(e);});}else{ed.onExecCommand.add(function(){each(ed.dom.select('span'),function(n){t._fixAppleSpan(n);});ed.nodeChanged();});}},_fixAppleSpan:function(e){var ed=this.editor,dom=ed.dom,fz=this.webKitFontSizes,fzn=this.namedFontSizes,s=ed.settings,st,p;if(dom.getAttrib(e,'mce_fixed'))return;if(e.nodeName=='SPAN'&&e.className=='Apple-style-span'){st=e.style;if(!s.convert_fonts_to_spans){if(st.fontSize){dom.setAttrib(e,'mce_name','font');dom.setAttrib(e,'size',inArray(fz,st.fontSize)+1);}if(st.fontFamily){dom.setAttrib(e,'mce_name','font');dom.setAttrib(e,'face',st.fontFamily);}if(st.color){dom.setAttrib(e,'mce_name','font');dom.setAttrib(e,'color',dom.toHex(st.color));}if(st.backgroundColor){dom.setAttrib(e,'mce_name','font');dom.setStyle(e,'background-color',st.backgroundColor);}}else{if(st.fontSize)dom.setStyle(e,'fontSize',fzn[inArray(fz,st.fontSize)]);}if(st.fontWeight=='bold')dom.setAttrib(e,'mce_name','strong');if(st.fontStyle=='italic')dom.setAttrib(e,'mce_name','em');if(st.textDecoration=='underline')dom.setAttrib(e,'mce_name','u');if(st.textDecoration=='line-through')dom.setAttrib(e,'mce_name','strike');if(st.verticalAlign=='super')dom.setAttrib(e,'mce_name','sup');if(st.verticalAlign=='sub')dom.setAttrib(e,'mce_name','sub');dom.setAttrib(e,'mce_fixed','1');}},_patchSafari2x:function(ed){var t=this,setContent,getNode,dom=ed.dom,lr;if(ed.windowManager.onBeforeOpen){ed.windowManager.onBeforeOpen.add(function(){r=ed.selection.getRng();});}ed.selection.select=function(n){this.getSel().setBaseAndExtent(n,0,n,1);};getNode=ed.selection.getNode;ed.selection.getNode=function(){return t.selElm||getNode.call(this);};ed.selection.getRng=function(){var t=this,s=t.getSel(),d=ed.getDoc(),r,rb,ra,di;if(s.anchorNode){r=d.createRange();try{rb=d.createRange();rb.setStart(s.anchorNode,s.anchorOffset);rb.collapse(1);ra=d.createRange();ra.setStart(s.focusNode,s.focusOffset);ra.collapse(1);di=rb.compareBoundaryPoints(rb.START_TO_END,ra)<0;r.setStart(di?s.anchorNode:s.focusNode,di?s.anchorOffset:s.focusOffset);r.setEnd(di?s.focusNode:s.anchorNode,di?s.focusOffset:s.anchorOffset);lr=r;}catch(ex){}}return r||lr;};setContent=ed.selection.setContent;ed.selection.setContent=function(h,s){var r=this.getRng(),b;try{setContent.call(this,h,s);}catch(ex){b=dom.create('body');b.innerHTML=h;each(b.childNodes,function(n){r.insertNode(n.cloneNode(true));});}};},_insertBR:function(ed){var dom=ed.dom,s=ed.selection,r=s.getRng(),br;r.insertNode(br=dom.create('br'));r.setStartAfter(br);r.setEndAfter(br);s.setRng(r);if(s.getSel().focusNode==br.previousSibling){s.select(dom.insertAfter(dom.doc.createTextNode('\u00a0'),br));s.collapse(1);}ed.getWin().scrollTo(0,dom.getPos(s.getRng().startContainer).y);}});tinymce.PluginManager.add('safari',tinymce.plugins.Safari);})(); \ No newline at end of file diff --git a/include/javascript/tiny_mce/plugins/safari/editor_plugin_src.js b/include/javascript/tiny_mce/plugins/safari/editor_plugin_src.js new file mode 100755 index 00000000..b82febda --- /dev/null +++ b/include/javascript/tiny_mce/plugins/safari/editor_plugin_src.js @@ -0,0 +1,514 @@ +/** + + * + * @author Moxiecode + * @copyright Copyright 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + var Event = tinymce.dom.Event, grep = tinymce.grep, each = tinymce.each, inArray = tinymce.inArray, isOldWebKit = tinymce.isOldWebKit; + + function isEmpty(d, e, f) { + var w, n; + + w = d.createTreeWalker(e, NodeFilter.SHOW_ALL, null, false); + while (n = w.nextNode()) { + // Filter func + if (f) { + if (!f(n)) + return false; + } + + // Non whitespace text node + if (n.nodeType == 3 && n.nodeValue && /[^\s\u00a0]+/.test(n.nodeValue)) + return false; + + // Is non text element byt still content + if (n.nodeType == 1 && /^(HR|IMG|TABLE)$/.test(n.nodeName)) + return false; + } + + return true; + }; + + tinymce.create('tinymce.plugins.Safari', { + init : function(ed) { + var t = this, dom; + + // Ignore on non webkit + if (!tinymce.isWebKit) + return; + + t.editor = ed; + t.webKitFontSizes = ['x-small', 'small', 'medium', 'large', 'x-large', 'xx-large', '-webkit-xxx-large']; + t.namedFontSizes = ['xx-small', 'x-small','small','medium','large','x-large', 'xx-large']; + + // Safari CreateLink command will not work correctly on images that is aligned + ed.addCommand('CreateLink', function(u, v) { + var n = ed.selection.getNode(), dom = ed.dom, a; + + if (n && (/^(left|right)$/i.test(dom.getStyle(n, 'float', 1)) || /^(left|right)$/i.test(dom.getAttrib(n, 'align')))) { + a = dom.create('a', {href : v}, n.cloneNode()); + n.parentNode.replaceChild(a, n); + ed.selection.select(a); + } else + ed.getDoc().execCommand("CreateLink", false, v); + }); + + ed.onPaste.add(function(ed, e) { + function removeStyles(e) { + e = e.target; + + if (e.nodeType == 1) { + e.style.cssText = ''; + + each(ed.dom.select('*', e), function(e) { + e.style.cssText = ''; + }); + } + }; + + Event.add(ed.getDoc(), 'DOMNodeInserted', removeStyles); + + window.setTimeout(function() { + Event.remove(ed.getDoc(), 'DOMNodeInserted', removeStyles); + }, 0); + }); + + ed.onKeyUp.add(function(ed, e) { + var h, b, r, n, s; + + // If backspace or delete key + if (e.keyCode == 46 || e.keyCode == 8) { + b = ed.getBody(); + h = b.innerHTML; + s = ed.selection; + + // If there is no text content or images or hr elements then remove everything + if (b.childNodes.length == 1 && !/<(img|hr)/.test(h) && tinymce.trim(h.replace(/<[^>]+>/g, '')).length == 0) { + // Inject paragrah and bogus br + ed.setContent('


    ', {format : 'raw'}); + + // Move caret before bogus br + n = b.firstChild; + r = s.getRng(); + r.setStart(n, 0); + r.setEnd(n, 0); + s.setRng(r); + } + } + }); + + // Workaround for FormatBlock bug, http://bugs.webkit.org/show_bug.cgi?id=16004 + ed.addCommand('FormatBlock', function(u, v) { + var dom = ed.dom, e = dom.getParent(ed.selection.getNode(), dom.isBlock); + + if (e) + dom.replace(dom.create(v), e, 1); + else + ed.getDoc().execCommand("FormatBlock", false, v); + }); + + // Workaround for InsertHTML bug, http://bugs.webkit.org/show_bug.cgi?id=16382 + ed.addCommand('mceInsertContent', function(u, v) { + ed.getDoc().execCommand("InsertText", false, 'mce_marker'); + ed.getBody().innerHTML = ed.getBody().innerHTML.replace(/mce_marker/g, ed.dom.processHTML(v) + 'XX'); + ed.selection.select(ed.dom.get('_mce_tmp')); + ed.getDoc().execCommand("Delete", false, ' '); + }); + + ed.onKeyPress.add(function(ed, e) { + var se, li, lic, r1, r2, n, sel, doc, be, af, pa; + + if (e.keyCode == 13) { + sel = ed.selection; + se = sel.getNode(); + + // Workaround for missing shift+enter support, http://bugs.webkit.org/show_bug.cgi?id=16973 + if (e.shiftKey || ed.settings.force_br_newlines && se.nodeName != 'LI') { + t._insertBR(ed); + Event.cancel(e); + } + + // Workaround for DIV elements produced by Safari + if (li = dom.getParent(se, 'LI')) { + lic = dom.getParent(li, 'OL,UL'); + doc = ed.getDoc(); + + pa = dom.create('p'); + dom.add(pa, 'br', {mce_bogus : "1"}); + + if (isEmpty(doc, li)) { + // If list in list then use browser default behavior + if (n = dom.getParent(lic.parentNode, 'LI,OL,UL')) + return; + + n = dom.getParent(lic, 'p,h1,h2,h3,h4,h5,h6,div') || lic; + + // Create range from the start of block element to the list item + r1 = doc.createRange(); + r1.setStartBefore(n); + r1.setEndBefore(li); + + // Create range after the list to the end of block element + r2 = doc.createRange(); + r2.setStartAfter(li); + r2.setEndAfter(n); + + be = r1.cloneContents(); + af = r2.cloneContents(); + + if (!isEmpty(doc, af)) + dom.insertAfter(af, n); + + dom.insertAfter(pa, n); + + if (!isEmpty(doc, be)) + dom.insertAfter(be, n); + + dom.remove(n); + + n = pa.firstChild; + r1 = doc.createRange(); + r1.setStartBefore(n); + r1.setEndBefore(n); + sel.setRng(r1); + + return Event.cancel(e); + } + } + } + }); + + // Safari doesn't place lists outside block elements + ed.onExecCommand.add(function(ed, cmd) { + var sel, dom, bl, bm; + + if (cmd == 'InsertUnorderedList' || cmd == 'InsertOrderedList') { + sel = ed.selection; + dom = ed.dom; + + if (bl = dom.getParent(sel.getNode(), function(n) {return /^(H[1-6]|P|ADDRESS|PRE)$/.test(n.nodeName);})) { + bm = sel.getBookmark(); + dom.remove(bl, 1); + sel.moveToBookmark(bm); + } + } + }); + + // Workaround for bug, http://bugs.webkit.org/show_bug.cgi?id=12250 + ed.onClick.add(function(ed, e) { + e = e.target; + + if (e.nodeName == 'IMG') { + t.selElm = e; + ed.selection.select(e); + } else + t.selElm = null; + }); + + ed.onInit.add(function() { + t._fixWebKitSpans(); + + if (isOldWebKit) + t._patchSafari2x(ed); + }); + + ed.onSetContent.add(function() { + dom = ed.dom; + + // Convert strong,b,em,u,strike to spans + each(['strong','b','em','u','strike','sub','sup','a'], function(v) { + each(grep(dom.select(v)).reverse(), function(n) { + var nn = n.nodeName.toLowerCase(), st; + + // Convert anchors into images + if (nn == 'a') { + if (n.name) + dom.replace(dom.create('img', {mce_name : 'a', name : n.name, 'class' : 'mceItemAnchor'}), n); + + return; + } + + switch (nn) { + case 'b': + case 'strong': + if (nn == 'b') + nn = 'strong'; + + st = 'font-weight: bold;'; + break; + + case 'em': + st = 'font-style: italic;'; + break; + + case 'u': + st = 'text-decoration: underline;'; + break; + + case 'sub': + st = 'vertical-align: sub;'; + break; + + case 'sup': + st = 'vertical-align: super;'; + break; + + case 'strike': + st = 'text-decoration: line-through;'; + break; + } + + dom.replace(dom.create('span', {mce_name : nn, style : st, 'class' : 'Apple-style-span'}), n, 1); + }); + }); + }); + + ed.onPreProcess.add(function(ed, o) { + dom = ed.dom; + + each(grep(o.node.getElementsByTagName('span')).reverse(), function(n) { + var v, bg; + + if (o.get) { + if (dom.hasClass(n, 'Apple-style-span')) { + bg = n.style.backgroundColor; + + switch (dom.getAttrib(n, 'mce_name')) { + case 'font': + if (!ed.settings.convert_fonts_to_spans) + dom.setAttrib(n, 'style', ''); + break; + + case 'strong': + case 'em': + case 'sub': + case 'sup': + dom.setAttrib(n, 'style', ''); + break; + + case 'strike': + case 'u': + if (!ed.settings.inline_styles) + dom.setAttrib(n, 'style', ''); + else + dom.setAttrib(n, 'mce_name', ''); + + break; + + default: + if (!ed.settings.inline_styles) + dom.setAttrib(n, 'style', ''); + } + + + if (bg) + n.style.backgroundColor = bg; + } + } + + if (dom.hasClass(n, 'mceItemRemoved')) + dom.remove(n, 1); + }); + }); + + ed.onPostProcess.add(function(ed, o) { + // Safari adds BR at end of all block elements + o.content = o.content.replace(/
    <\/(h[1-6]|div|p|address|pre)>/g, ''); + + // Safari adds id="undefined" to HR elements + o.content = o.content.replace(/ id=\"undefined\"/g, ''); + }); + }, + + getInfo : function() { + return { + longname : 'Safari compatibility', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/safari', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; + }, + + // Internal methods + + _fixWebKitSpans : function() { + var t = this, ed = t.editor; + + if (!isOldWebKit) { + // Use mutator events on new WebKit + Event.add(ed.getDoc(), 'DOMNodeInserted', function(e) { + e = e.target; + + if (e && e.nodeType == 1) + t._fixAppleSpan(e); + }); + } else { + // Do post command processing in old WebKit since the browser crashes on Mutator events :( + ed.onExecCommand.add(function() { + each(ed.dom.select('span'), function(n) { + t._fixAppleSpan(n); + }); + + ed.nodeChanged(); + }); + } + }, + + _fixAppleSpan : function(e) { + var ed = this.editor, dom = ed.dom, fz = this.webKitFontSizes, fzn = this.namedFontSizes, s = ed.settings, st, p; + + if (dom.getAttrib(e, 'mce_fixed')) + return; + + // Handle Apple style spans + if (e.nodeName == 'SPAN' && e.className == 'Apple-style-span') { + st = e.style; + + if (!s.convert_fonts_to_spans) { + if (st.fontSize) { + dom.setAttrib(e, 'mce_name', 'font'); + dom.setAttrib(e, 'size', inArray(fz, st.fontSize) + 1); + } + + if (st.fontFamily) { + dom.setAttrib(e, 'mce_name', 'font'); + dom.setAttrib(e, 'face', st.fontFamily); + } + + if (st.color) { + dom.setAttrib(e, 'mce_name', 'font'); + dom.setAttrib(e, 'color', dom.toHex(st.color)); + } + + if (st.backgroundColor) { + dom.setAttrib(e, 'mce_name', 'font'); + dom.setStyle(e, 'background-color', st.backgroundColor); + } + } else { + if (st.fontSize) + dom.setStyle(e, 'fontSize', fzn[inArray(fz, st.fontSize)]); + } + + if (st.fontWeight == 'bold') + dom.setAttrib(e, 'mce_name', 'strong'); + + if (st.fontStyle == 'italic') + dom.setAttrib(e, 'mce_name', 'em'); + + if (st.textDecoration == 'underline') + dom.setAttrib(e, 'mce_name', 'u'); + + if (st.textDecoration == 'line-through') + dom.setAttrib(e, 'mce_name', 'strike'); + + if (st.verticalAlign == 'super') + dom.setAttrib(e, 'mce_name', 'sup'); + + if (st.verticalAlign == 'sub') + dom.setAttrib(e, 'mce_name', 'sub'); + + dom.setAttrib(e, 'mce_fixed', '1'); + } + }, + + _patchSafari2x : function(ed) { + var t = this, setContent, getNode, dom = ed.dom, lr; + + // Inline dialogs + if (ed.windowManager.onBeforeOpen) { + ed.windowManager.onBeforeOpen.add(function() { + r = ed.selection.getRng(); + }); + } + + // Fake select on 2.x + ed.selection.select = function(n) { + this.getSel().setBaseAndExtent(n, 0, n, 1); + }; + + getNode = ed.selection.getNode; + ed.selection.getNode = function() { + return t.selElm || getNode.call(this); + }; + + // Fake range on Safari 2.x + ed.selection.getRng = function() { + var t = this, s = t.getSel(), d = ed.getDoc(), r, rb, ra, di; + + // Fake range on Safari 2.x + if (s.anchorNode) { + r = d.createRange(); + + try { + // Setup before range + rb = d.createRange(); + rb.setStart(s.anchorNode, s.anchorOffset); + rb.collapse(1); + + // Setup after range + ra = d.createRange(); + ra.setStart(s.focusNode, s.focusOffset); + ra.collapse(1); + + // Setup start/end points by comparing locations + di = rb.compareBoundaryPoints(rb.START_TO_END, ra) < 0; + r.setStart(di ? s.anchorNode : s.focusNode, di ? s.anchorOffset : s.focusOffset); + r.setEnd(di ? s.focusNode : s.anchorNode, di ? s.focusOffset : s.anchorOffset); + + lr = r; + } catch (ex) { + // Sometimes fails, at least we tried to do it by the book. I hope Safari 2.x will go disappear soooon!!! + } + } + + return r || lr; + }; + + // Fix setContent so it works + setContent = ed.selection.setContent; + ed.selection.setContent = function(h, s) { + var r = this.getRng(), b; + + try { + setContent.call(this, h, s); + } catch (ex) { + // Workaround for Safari 2.x + b = dom.create('body'); + b.innerHTML = h; + + each(b.childNodes, function(n) { + r.insertNode(n.cloneNode(true)); + }); + } + }; + }, + + _insertBR : function(ed) { + var dom = ed.dom, s = ed.selection, r = s.getRng(), br; + + // Insert BR element + r.insertNode(br = dom.create('br')); + + // Place caret after BR + r.setStartAfter(br); + r.setEndAfter(br); + s.setRng(r); + + // Could not place caret after BR then insert an nbsp entity and move the caret + if (s.getSel().focusNode == br.previousSibling) { + s.select(dom.insertAfter(dom.doc.createTextNode('\u00a0'), br)); + s.collapse(1); + } + + // Scroll to new position, scrollIntoView can't be used due to bug: http://bugs.webkit.org/show_bug.cgi?id=16117 + ed.getWin().scrollTo(0, dom.getPos(s.getRng().startContainer).y); + } + }); + + // Register plugin + tinymce.PluginManager.add('safari', tinymce.plugins.Safari); +})(); + diff --git a/include/javascript/tiny_mce/plugins/save/editor_plugin.js b/include/javascript/tiny_mce/plugins/save/editor_plugin.js new file mode 100755 index 00000000..8a13e7d3 --- /dev/null +++ b/include/javascript/tiny_mce/plugins/save/editor_plugin.js @@ -0,0 +1 @@ +(function(){tinymce.create('tinymce.plugins.Save',{init:function(ed,url){var t=this;t.editor=ed;ed.addCommand('mceSave',t._save,t);ed.addCommand('mceCancel',t._cancel,t);ed.addButton('save',{title:'save.save_desc',cmd:'mceSave'});ed.addButton('cancel',{title:'save.cancel_desc',cmd:'mceCancel'});ed.onNodeChange.add(t._nodeChange,t);ed.addShortcut('ctrl+s',ed.getLang('save.save_desc'),'mceSave');},getInfo:function(){return{longname:'Save',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/save',version:tinymce.majorVersion+"."+tinymce.minorVersion};},_nodeChange:function(ed,cm,n){var ed=this.editor;if(ed.getParam('save_enablewhendirty')){cm.setDisabled('save',!ed.isDirty());cm.setDisabled('cancel',!ed.isDirty());}},_save:function(){var ed=this.editor,formObj,os,i,elementId;formObj=tinymce.DOM.get(ed.id).form||tinymce.DOM.getParent(ed.id,'form');if(ed.getParam("save_enablewhendirty")&&!ed.isDirty())return;tinyMCE.triggerSave();if(os=ed.getParam("save_onsavecallback")){if(ed.execCallback('save_onsavecallback',ed)){ed.startContent=tinymce.trim(ed.getContent({format:'raw'}));ed.nodeChanged();}return;}if(formObj){ed.isNotDirty=true;if(formObj.onsubmit==null||formObj.onsubmit()!=false)formObj.submit();ed.nodeChanged();}else ed.windowManager.alert("Error: No form element found.");},_cancel:function(){var ed=this.editor,os,h=tinymce.trim(ed.startContent);if(os=ed.getParam("save_oncancelcallback")){ed.execCallback('save_oncancelcallback',ed);return;}ed.setContent(h);ed.undoManager.clear();ed.nodeChanged();}});tinymce.PluginManager.add('save',tinymce.plugins.Save);})(); \ No newline at end of file diff --git a/include/javascript/tiny_mce/plugins/save/editor_plugin_src.js b/include/javascript/tiny_mce/plugins/save/editor_plugin_src.js new file mode 100755 index 00000000..236c3545 --- /dev/null +++ b/include/javascript/tiny_mce/plugins/save/editor_plugin_src.js @@ -0,0 +1,98 @@ +/** + + * + * @author Moxiecode + * @copyright Copyright 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + tinymce.create('tinymce.plugins.Save', { + init : function(ed, url) { + var t = this; + + t.editor = ed; + + // Register commands + ed.addCommand('mceSave', t._save, t); + ed.addCommand('mceCancel', t._cancel, t); + + // Register buttons + ed.addButton('save', {title : 'save.save_desc', cmd : 'mceSave'}); + ed.addButton('cancel', {title : 'save.cancel_desc', cmd : 'mceCancel'}); + + ed.onNodeChange.add(t._nodeChange, t); + ed.addShortcut('ctrl+s', ed.getLang('save.save_desc'), 'mceSave'); + }, + + getInfo : function() { + return { + longname : 'Save', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/save', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; + }, + + // Private methods + + _nodeChange : function(ed, cm, n) { + var ed = this.editor; + + if (ed.getParam('save_enablewhendirty')) { + cm.setDisabled('save', !ed.isDirty()); + cm.setDisabled('cancel', !ed.isDirty()); + } + }, + + // Private methods + + _save : function() { + var ed = this.editor, formObj, os, i, elementId; + + formObj = tinymce.DOM.get(ed.id).form || tinymce.DOM.getParent(ed.id, 'form'); + + if (ed.getParam("save_enablewhendirty") && !ed.isDirty()) + return; + + tinyMCE.triggerSave(); + + // Use callback instead + if (os = ed.getParam("save_onsavecallback")) { + if (ed.execCallback('save_onsavecallback', ed)) { + ed.startContent = tinymce.trim(ed.getContent({format : 'raw'})); + ed.nodeChanged(); + } + + return; + } + + if (formObj) { + ed.isNotDirty = true; + + if (formObj.onsubmit == null || formObj.onsubmit() != false) + formObj.submit(); + + ed.nodeChanged(); + } else + ed.windowManager.alert("Error: No form element found."); + }, + + _cancel : function() { + var ed = this.editor, os, h = tinymce.trim(ed.startContent); + + // Use callback instead + if (os = ed.getParam("save_oncancelcallback")) { + ed.execCallback('save_oncancelcallback', ed); + return; + } + + ed.setContent(h); + ed.undoManager.clear(); + ed.nodeChanged(); + } + }); + + // Register plugin + tinymce.PluginManager.add('save', tinymce.plugins.Save); +})(); \ No newline at end of file diff --git a/include/javascript/tiny_mce/plugins/searchreplace/editor_plugin.js b/include/javascript/tiny_mce/plugins/searchreplace/editor_plugin.js new file mode 100755 index 00000000..7fd913b2 --- /dev/null +++ b/include/javascript/tiny_mce/plugins/searchreplace/editor_plugin.js @@ -0,0 +1 @@ +(function(){tinymce.create('tinymce.plugins.SearchReplacePlugin',{init:function(ed,url){function open(m){ed.windowManager.open({file:url+'/searchreplace.htm',width:420+parseInt(ed.getLang('searchreplace.delta_width',0)),height:160+parseInt(ed.getLang('searchreplace.delta_height',0)),inline:1,auto_focus:0},{mode:m,search_string:ed.selection.getContent({format:'text'}),plugin_url:url});};ed.addCommand('mceSearch',function(){open('search');});ed.addCommand('mceReplace',function(){open('replace');});ed.addButton('search',{title:'searchreplace.search_desc',cmd:'mceSearch'});ed.addButton('replace',{title:'searchreplace.replace_desc',cmd:'mceReplace'});ed.addShortcut('ctrl+f','searchreplace.search_desc','mceSearch');},getInfo:function(){return{longname:'Search/Replace',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/searchreplace',version:tinymce.majorVersion+"."+tinymce.minorVersion};}});tinymce.PluginManager.add('searchreplace',tinymce.plugins.SearchReplacePlugin);})(); \ No newline at end of file diff --git a/include/javascript/tiny_mce/plugins/searchreplace/editor_plugin_src.js b/include/javascript/tiny_mce/plugins/searchreplace/editor_plugin_src.js new file mode 100755 index 00000000..30e2610b --- /dev/null +++ b/include/javascript/tiny_mce/plugins/searchreplace/editor_plugin_src.js @@ -0,0 +1,54 @@ +/** + + * + * @author Moxiecode + * @copyright Copyright 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + tinymce.create('tinymce.plugins.SearchReplacePlugin', { + init : function(ed, url) { + function open(m) { + ed.windowManager.open({ + file : url + '/searchreplace.htm', + width : 420 + parseInt(ed.getLang('searchreplace.delta_width', 0)), + height : 160 + parseInt(ed.getLang('searchreplace.delta_height', 0)), + inline : 1, + auto_focus : 0 + }, { + mode : m, + search_string : ed.selection.getContent({format : 'text'}), + plugin_url : url + }); + }; + + // Register commands + ed.addCommand('mceSearch', function() { + open('search'); + }); + + ed.addCommand('mceReplace', function() { + open('replace'); + }); + + // Register buttons + ed.addButton('search', {title : 'searchreplace.search_desc', cmd : 'mceSearch'}); + ed.addButton('replace', {title : 'searchreplace.replace_desc', cmd : 'mceReplace'}); + + ed.addShortcut('ctrl+f', 'searchreplace.search_desc', 'mceSearch'); + }, + + getInfo : function() { + return { + longname : 'Search/Replace', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/searchreplace', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; + } + }); + + // Register plugin + tinymce.PluginManager.add('searchreplace', tinymce.plugins.SearchReplacePlugin); +})(); \ No newline at end of file diff --git a/include/javascript/tiny_mce/plugins/searchreplace/js/searchreplace.js b/include/javascript/tiny_mce/plugins/searchreplace/js/searchreplace.js new file mode 100755 index 00000000..e555a3fc --- /dev/null +++ b/include/javascript/tiny_mce/plugins/searchreplace/js/searchreplace.js @@ -0,0 +1,126 @@ +tinyMCEPopup.requireLangPack(); + +var SearchReplaceDialog = { + init : function(ed) { + var f = document.forms[0], m = tinyMCEPopup.getWindowArg("mode"); + + this.switchMode(m); + + f[m + '_panel_searchstring'].value = tinyMCEPopup.getWindowArg("search_string"); + + // Focus input field + f[m + '_panel_searchstring'].focus(); + }, + + switchMode : function(m) { + var f, lm = this.lastMode; + + if (lm != m) { + f = document.forms[0]; + + if (lm) { + f[m + '_panel_searchstring'].value = f[lm + '_panel_searchstring'].value; + f[m + '_panel_backwardsu'].checked = f[lm + '_panel_backwardsu'].checked; + f[m + '_panel_backwardsd'].checked = f[lm + '_panel_backwardsd'].checked; + f[m + '_panel_casesensitivebox'].checked = f[lm + '_panel_casesensitivebox'].checked; + } + + mcTabs.displayTab(m + '_tab', m + '_panel'); + document.getElementById("replaceBtn").style.display = (m == "replace") ? "inline" : "none"; + document.getElementById("replaceAllBtn").style.display = (m == "replace") ? "inline" : "none"; + this.lastMode = m; + } + }, + + searchNext : function(a) { + var ed = tinyMCEPopup.editor, se = ed.selection, r = se.getRng(), f, m = this.lastMode, s, b, fl = 0, w = ed.getWin(), wm = ed.windowManager, fo = 0; + + // Get input + f = document.forms[0]; + s = f[m + '_panel_searchstring'].value; + b = f[m + '_panel_backwardsu'].checked; + ca = f[m + '_panel_casesensitivebox'].checked; + rs = f['replace_panel_replacestring'].value; + + if (s == '') + return; + + function fix() { + // Correct Firefox graphics glitches + r = se.getRng().cloneRange(); + ed.getDoc().execCommand('SelectAll', false, null); + se.setRng(r); + }; + + function replace() { + if (tinymce.isIE) + ed.selection.getRng().duplicate().pasteHTML(rs); // Needs to be duplicated due to selection bug in IE + else + ed.getDoc().execCommand('InsertHTML', false, rs); + }; + + // IE flags + if (ca) + fl = fl | 4; + + switch (a) { + case 'all': + // Move caret to beginning of text + ed.execCommand('SelectAll'); + ed.selection.collapse(true); + + if (tinymce.isIE) { + while (r.findText(s, b ? -1 : 1, fl)) { + r.scrollIntoView(); + r.select(); + replace(); + fo = 1; + } + + tinyMCEPopup.storeSelection(); + } else { + while (w.find(s, ca, b, false, false, false, false)) { + replace(); + fo = 1; + } + } + + if (fo) + tinyMCEPopup.alert(ed.getLang('searchreplace_dlg.allreplaced')); + else + tinyMCEPopup.alert(ed.getLang('searchreplace_dlg.notfound')); + + return; + + case 'current': + if (!ed.selection.isCollapsed()) + replace(); + + break; + } + + se.collapse(b); + r = se.getRng(); + + // Whats the point + if (!s) + return; + + if (tinymce.isIE) { + if (r.findText(s, b ? -1 : 1, fl)) { + r.scrollIntoView(); + r.select(); + } else + tinyMCEPopup.alert(ed.getLang('searchreplace_dlg.notfound')); + + tinyMCEPopup.storeSelection(); + } else { + if (!w.find(s, ca, b, false, false, false, false)) + tinyMCEPopup.alert(ed.getLang('searchreplace_dlg.notfound')); + else + fix(); + } + } +}; + +tinyMCEPopup.onInit.add(SearchReplaceDialog.init, SearchReplaceDialog); diff --git a/include/javascript/tiny_mce/plugins/searchreplace/langs/en_dlg.js b/include/javascript/tiny_mce/plugins/searchreplace/langs/en_dlg.js new file mode 100755 index 00000000..3dd3453d --- /dev/null +++ b/include/javascript/tiny_mce/plugins/searchreplace/langs/en_dlg.js @@ -0,0 +1,16 @@ +tinyMCE.addI18n('en.searchreplace_dlg',{ +searchnext_desc:"Find again", +notfound:"The search has been completed. The search string could not be found.", +search_title:"Find", +replace_title:"Find/Replace", +allreplaced:"All occurrences of the search string were replaced.", +findwhat:"Find what", +replacewith:"Replace with", +direction:"Direction", +up:"Up", +down:"Down", +mcase:"Match case", +findnext:"Find next", +replace:"Replace", +replaceall:"Replace all" +}); \ No newline at end of file diff --git a/include/javascript/tiny_mce/plugins/spellchecker/editor_plugin.js b/include/javascript/tiny_mce/plugins/spellchecker/editor_plugin.js new file mode 100755 index 00000000..9cb67996 --- /dev/null +++ b/include/javascript/tiny_mce/plugins/spellchecker/editor_plugin.js @@ -0,0 +1 @@ +(function(){var JSONRequest=tinymce.util.JSONRequest,each=tinymce.each,DOM=tinymce.DOM;tinymce.create('tinymce.plugins.SpellcheckerPlugin',{getInfo:function(){return{longname:'Spellchecker',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/spellchecker',version:tinymce.majorVersion+"."+tinymce.minorVersion};},init:function(ed,url){var t=this,cm;t.url=url;t.editor=ed;ed.addCommand('mceSpellCheck',function(){if(!t.active){ed.setProgressState(1);t._sendRPC('checkWords',[t.selectedLang,t._getWords()],function(r){if(r.length>0){t.active=1;t._markWords(r);ed.setProgressState(0);ed.nodeChanged();}else{ed.setProgressState(0);ed.windowManager.alert('spellchecker.no_mpell');}});}else t._done();});ed.onInit.add(function(){if(ed.settings.content_css!==false)ed.dom.loadCSS(url+'/css/content.css');});ed.onClick.add(t._showMenu,t);ed.onContextMenu.add(t._showMenu,t);ed.onBeforeGetContent.add(function(){if(t.active)t._removeWords();});ed.onNodeChange.add(function(ed,cm){cm.setActive('spellchecker',t.active);});ed.onSetContent.add(function(){t._done();});ed.onBeforeGetContent.add(function(){t._done();});ed.onBeforeExecCommand.add(function(ed,cmd){if(cmd=='mceFullScreen')t._done();});t.languages={};each(ed.getParam('spellchecker_languages','+English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Polish=pl,Portuguese=pt,Spanish=es,Swedish=sv','hash'),function(v,k){if(k.indexOf('+')===0){k=k.substring(1);t.selectedLang=v;}t.languages[k]=v;});},createControl:function(n,cm){var t=this,c,ed=t.editor;if(n=='spellchecker'){c=cm.createSplitButton(n,{title:'spellchecker.desc',cmd:'mceSpellCheck',scope:t});c.onRenderMenu.add(function(c,m){m.add({title:'spellchecker.langs','class':'mceMenuItemTitle'}).setDisabled(1);each(t.languages,function(v,k){var o={icon:1},mi;o.onclick=function(){mi.setSelected(1);t.selectedItem.setSelected(0);t.selectedItem=mi;t.selectedLang=v;};o.title=k;mi=m.add(o);mi.setSelected(v==t.selectedLang);if(v==t.selectedLang)t.selectedItem=mi;})});return c;}},_walk:function(n,f){var d=this.editor.getDoc(),w;if(d.createTreeWalker){w=d.createTreeWalker(n,NodeFilter.SHOW_TEXT,null,false);while((n=w.nextNode())!=null)f.call(this,n);}else tinymce.walk(n,f,'childNodes');},_getSeparators:function(){var re='',i,str=this.editor.getParam('spellchecker_word_separator_chars','\\s!"#$%&()*+,-./:;<=>?@[\]^_{|}����������������\u201d\u201c');for(i=0;i$1
    $2');v=v.replace(r3,'$1$2');dom.replace(dom.create('span',{'class':'mceItemHidden'},v),n);}}});se.moveToBookmark(b);},_showMenu:function(ed,e){var t=this,ed=t.editor,m=t._menu,p1,dom=ed.dom,vp=dom.getViewPort(ed.getWin());if(!m){p1=DOM.getPos(ed.getContentAreaContainer());m=ed.controlManager.createDropMenu('spellcheckermenu',{offset_x:p1.x,offset_y:p1.y,'class':'mceNoIcons'});t._menu=m;}if(dom.hasClass(e.target,'mceItemHiddenSpellWord')){m.removeAll();m.add({title:'spellchecker.wait','class':'mceMenuItemTitle'}).setDisabled(1);t._sendRPC('getSuggestions',[t.selectedLang,dom.decode(e.target.innerHTML)],function(r){m.removeAll();if(r.length>0){m.add({title:'spellchecker.sug','class':'mceMenuItemTitle'}).setDisabled(1);each(r,function(v){m.add({title:v,onclick:function(){dom.replace(ed.getDoc().createTextNode(v),e.target);t._checkDone();}});});m.addSeparator();}else m.add({title:'spellchecker.no_sug','class':'mceMenuItemTitle'}).setDisabled(1);m.add({title:'spellchecker.ignore_word',onclick:function(){dom.remove(e.target,1);t._checkDone();}});m.add({title:'spellchecker.ignore_words',onclick:function(){t._removeWords(dom.decode(e.target.innerHTML));t._checkDone();}});m.update();});ed.selection.select(e.target);p1=dom.getPos(e.target);m.showMenu(p1.x,p1.y+e.target.offsetHeight-vp.y);return tinymce.dom.Event.cancel(e);}else m.hideMenu();},_checkDone:function(){var t=this,ed=t.editor,dom=ed.dom,o;each(dom.select('span'),function(n){if(n&&dom.hasClass(n,'mceItemHiddenSpellWord')){o=true;return false;}});if(!o)t._done();},_done:function(){var t=this,la=t.active;if(t.active){t.active=0;t._removeWords();if(t._menu)t._menu.hideMenu();if(la)t.editor.nodeChanged();}},_sendRPC:function(m,p,cb){var t=this,url=t.editor.getParam("spellchecker_rpc_url","{backend}");if(url=='{backend}'){t.editor.setProgressState(0);alert('Please specify: spellchecker_rpc_url');return;}JSONRequest.sendRPC({url:url,method:m,params:p,success:cb,error:function(e,x){t.editor.setProgressState(0);t.editor.windowManager.alert(e.errstr||('Error response: '+x.responseText));}});}});tinymce.PluginManager.add('spellchecker',tinymce.plugins.SpellcheckerPlugin);})(); \ No newline at end of file diff --git a/include/javascript/tiny_mce/plugins/spellchecker/editor_plugin_src.js b/include/javascript/tiny_mce/plugins/spellchecker/editor_plugin_src.js new file mode 100755 index 00000000..65a21a2e --- /dev/null +++ b/include/javascript/tiny_mce/plugins/spellchecker/editor_plugin_src.js @@ -0,0 +1,338 @@ +/** + + * + * @author Moxiecode + * @copyright Copyright 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + var JSONRequest = tinymce.util.JSONRequest, each = tinymce.each, DOM = tinymce.DOM; + + tinymce.create('tinymce.plugins.SpellcheckerPlugin', { + getInfo : function() { + return { + longname : 'Spellchecker', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/spellchecker', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; + }, + + init : function(ed, url) { + var t = this, cm; + + t.url = url; + t.editor = ed; + + // Register commands + ed.addCommand('mceSpellCheck', function() { + if (!t.active) { + ed.setProgressState(1); + t._sendRPC('checkWords', [t.selectedLang, t._getWords()], function(r) { + if (r.length > 0) { + t.active = 1; + t._markWords(r); + ed.setProgressState(0); + ed.nodeChanged(); + } else { + ed.setProgressState(0); + ed.windowManager.alert('spellchecker.no_mpell'); + } + }); + } else + t._done(); + }); + + ed.onInit.add(function() { + if (ed.settings.content_css !== false) + ed.dom.loadCSS(url + '/css/content.css'); + }); + + ed.onClick.add(t._showMenu, t); + ed.onContextMenu.add(t._showMenu, t); + ed.onBeforeGetContent.add(function() { + if (t.active) + t._removeWords(); + }); + + ed.onNodeChange.add(function(ed, cm) { + cm.setActive('spellchecker', t.active); + }); + + ed.onSetContent.add(function() { + t._done(); + }); + + ed.onBeforeGetContent.add(function() { + t._done(); + }); + + ed.onBeforeExecCommand.add(function(ed, cmd) { + if (cmd == 'mceFullScreen') + t._done(); + }); + + // Find selected language + t.languages = {}; + each(ed.getParam('spellchecker_languages', '+English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Polish=pl,Portuguese=pt,Spanish=es,Swedish=sv', 'hash'), function(v, k) { + if (k.indexOf('+') === 0) { + k = k.substring(1); + t.selectedLang = v; + } + + t.languages[k] = v; + }); + }, + + createControl : function(n, cm) { + var t = this, c, ed = t.editor; + + if (n == 'spellchecker') { + c = cm.createSplitButton(n, {title : 'spellchecker.desc', cmd : 'mceSpellCheck', scope : t}); + + c.onRenderMenu.add(function(c, m) { + m.add({title : 'spellchecker.langs', 'class' : 'mceMenuItemTitle'}).setDisabled(1); + each(t.languages, function(v, k) { + var o = {icon : 1}, mi; + + o.onclick = function() { + mi.setSelected(1); + t.selectedItem.setSelected(0); + t.selectedItem = mi; + t.selectedLang = v; + }; + + o.title = k; + mi = m.add(o); + mi.setSelected(v == t.selectedLang); + + if (v == t.selectedLang) + t.selectedItem = mi; + }) + }); + + return c; + } + }, + + // Internal functions + + _walk : function(n, f) { + var d = this.editor.getDoc(), w; + + if (d.createTreeWalker) { + w = d.createTreeWalker(n, NodeFilter.SHOW_TEXT, null, false); + + while ((n = w.nextNode()) != null) + f.call(this, n); + } else + tinymce.walk(n, f, 'childNodes'); + }, + + _getSeparators : function() { + var re = '', i, str = this.editor.getParam('spellchecker_word_separator_chars', '\\s!"#$%&()*+,-./:;<=>?@[\]^_{|}\u201d\u201c'); + + // Build word separator regexp + for (i=0; i$1
    $2'); + v = v.replace(r3, '$1$2'); + + dom.replace(dom.create('span', {'class' : 'mceItemHidden'}, v), n); + } + } + }); + + se.moveToBookmark(b); + }, + + _showMenu : function(ed, e) { + var t = this, ed = t.editor, m = t._menu, p1, dom = ed.dom, vp = dom.getViewPort(ed.getWin()); + + if (!m) { + p1 = DOM.getPos(ed.getContentAreaContainer()); + //p2 = DOM.getPos(ed.getContainer()); + + m = ed.controlManager.createDropMenu('spellcheckermenu', { + offset_x : p1.x, + offset_y : p1.y, + 'class' : 'mceNoIcons' + }); + + t._menu = m; + } + + if (dom.hasClass(e.target, 'mceItemHiddenSpellWord')) { + m.removeAll(); + m.add({title : 'spellchecker.wait', 'class' : 'mceMenuItemTitle'}).setDisabled(1); + + t._sendRPC('getSuggestions', [t.selectedLang, dom.decode(e.target.innerHTML)], function(r) { + m.removeAll(); + + if (r.length > 0) { + m.add({title : 'spellchecker.sug', 'class' : 'mceMenuItemTitle'}).setDisabled(1); + each(r, function(v) { + m.add({title : v, onclick : function() { + dom.replace(ed.getDoc().createTextNode(v), e.target); + t._checkDone(); + }}); + }); + + m.addSeparator(); + } else + m.add({title : 'spellchecker.no_sug', 'class' : 'mceMenuItemTitle'}).setDisabled(1); + + m.add({ + title : 'spellchecker.ignore_word', + onclick : function() { + dom.remove(e.target, 1); + t._checkDone(); + } + }); + + m.add({ + title : 'spellchecker.ignore_words', + onclick : function() { + t._removeWords(dom.decode(e.target.innerHTML)); + t._checkDone(); + } + }); + + m.update(); + }); + + ed.selection.select(e.target); + p1 = dom.getPos(e.target); + m.showMenu(p1.x, p1.y + e.target.offsetHeight - vp.y); + + return tinymce.dom.Event.cancel(e); + } else + m.hideMenu(); + }, + + _checkDone : function() { + var t = this, ed = t.editor, dom = ed.dom, o; + + each(dom.select('span'), function(n) { + if (n && dom.hasClass(n, 'mceItemHiddenSpellWord')) { + o = true; + return false; + } + }); + + if (!o) + t._done(); + }, + + _done : function() { + var t = this, la = t.active; + + if (t.active) { + t.active = 0; + t._removeWords(); + + if (t._menu) + t._menu.hideMenu(); + + if (la) + t.editor.nodeChanged(); + } + }, + + _sendRPC : function(m, p, cb) { + var t = this, url = t.editor.getParam("spellchecker_rpc_url", "{backend}"); + + if (url == '{backend}') { + t.editor.setProgressState(0); + alert('Please specify: spellchecker_rpc_url'); + return; + } + + JSONRequest.sendRPC({ + url : url, + method : m, + params : p, + success : cb, + error : function(e, x) { + t.editor.setProgressState(0); + t.editor.windowManager.alert(e.errstr || ('Error response: ' + x.responseText)); + } + }); + } + }); + + // Register plugin + tinymce.PluginManager.add('spellchecker', tinymce.plugins.SpellcheckerPlugin); +})(); \ No newline at end of file diff --git a/include/javascript/tiny_mce/plugins/style/editor_plugin.js b/include/javascript/tiny_mce/plugins/style/editor_plugin.js new file mode 100755 index 00000000..6ebaa91c --- /dev/null +++ b/include/javascript/tiny_mce/plugins/style/editor_plugin.js @@ -0,0 +1 @@ +(function(){tinymce.create('tinymce.plugins.StylePlugin',{init:function(ed,url){ed.addCommand('mceStyleProps',function(){ed.windowManager.open({file:url+'/props.htm',width:480+parseInt(ed.getLang('style.delta_width',0)),height:320+parseInt(ed.getLang('style.delta_height',0)),inline:1},{plugin_url:url,style_text:ed.selection.getNode().style.cssText});});ed.addCommand('mceSetElementStyle',function(ui,v){if(e=ed.selection.getNode()){ed.dom.setAttrib(e,'style',v);ed.execCommand('mceRepaint');}});ed.onNodeChange.add(function(ed,cm,n){cm.setDisabled('styleprops',n.nodeName==='BODY');});ed.addButton('styleprops',{title:'style.desc',cmd:'mceStyleProps'});},getInfo:function(){return{longname:'Style',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/style',version:tinymce.majorVersion+"."+tinymce.minorVersion};}});tinymce.PluginManager.add('style',tinymce.plugins.StylePlugin);})(); \ No newline at end of file diff --git a/include/javascript/tiny_mce/plugins/style/editor_plugin_src.js b/include/javascript/tiny_mce/plugins/style/editor_plugin_src.js new file mode 100755 index 00000000..7a8ecf0d --- /dev/null +++ b/include/javascript/tiny_mce/plugins/style/editor_plugin_src.js @@ -0,0 +1,52 @@ +/** + + * + * @author Moxiecode + * @copyright Copyright 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + tinymce.create('tinymce.plugins.StylePlugin', { + init : function(ed, url) { + // Register commands + ed.addCommand('mceStyleProps', function() { + ed.windowManager.open({ + file : url + '/props.htm', + width : 480 + parseInt(ed.getLang('style.delta_width', 0)), + height : 320 + parseInt(ed.getLang('style.delta_height', 0)), + inline : 1 + }, { + plugin_url : url, + style_text : ed.selection.getNode().style.cssText + }); + }); + + ed.addCommand('mceSetElementStyle', function(ui, v) { + if (e = ed.selection.getNode()) { + ed.dom.setAttrib(e, 'style', v); + ed.execCommand('mceRepaint'); + } + }); + + ed.onNodeChange.add(function(ed, cm, n) { + cm.setDisabled('styleprops', n.nodeName === 'BODY'); + }); + + // Register buttons + ed.addButton('styleprops', {title : 'style.desc', cmd : 'mceStyleProps'}); + }, + + getInfo : function() { + return { + longname : 'Style', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/style', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; + } + }); + + // Register plugin + tinymce.PluginManager.add('style', tinymce.plugins.StylePlugin); +})(); \ No newline at end of file diff --git a/include/javascript/tiny_mce/plugins/style/js/props.js b/include/javascript/tiny_mce/plugins/style/js/props.js new file mode 100755 index 00000000..4fdfceb8 --- /dev/null +++ b/include/javascript/tiny_mce/plugins/style/js/props.js @@ -0,0 +1,641 @@ +tinyMCEPopup.requireLangPack(); + +var defaultFonts = "" + + "Arial, Helvetica, sans-serif=Arial, Helvetica, sans-serif;" + + "Times New Roman, Times, serif=Times New Roman, Times, serif;" + + "Courier New, Courier, mono=Courier New, Courier, mono;" + + "Times New Roman, Times, serif=Times New Roman, Times, serif;" + + "Georgia, Times New Roman, Times, serif=Georgia, Times New Roman, Times, serif;" + + "Verdana, Arial, Helvetica, sans-serif=Verdana, Arial, Helvetica, sans-serif;" + + "Geneva, Arial, Helvetica, sans-serif=Geneva, Arial, Helvetica, sans-serif"; + +var defaultSizes = "9;10;12;14;16;18;24;xx-small;x-small;small;medium;large;x-large;xx-large;smaller;larger"; +var defaultMeasurement = "+pixels=px;points=pt;em;in;cm;mm;picas;ems;exs;%"; +var defaultSpacingMeasurement = "pixels=px;points=pt;in;cm;mm;picas;+ems;exs;%"; +var defaultIndentMeasurement = "pixels=px;+points=pt;in;cm;mm;picas;ems;exs;%"; +var defaultWeight = "normal;bold;bolder;lighter;100;200;300;400;500;600;700;800;900"; +var defaultTextStyle = "normal;italic;oblique"; +var defaultVariant = "normal;small-caps"; +var defaultLineHeight = "normal"; +var defaultAttachment = "fixed;scroll"; +var defaultRepeat = "no-repeat;repeat;repeat-x;repeat-y"; +var defaultPosH = "left;center;right"; +var defaultPosV = "top;center;bottom"; +var defaultVAlign = "baseline;sub;super;top;text-top;middle;bottom;text-bottom"; +var defaultDisplay = "inline;block;list-item;run-in;compact;marker;table;inline-table;table-row-group;table-header-group;table-footer-group;table-row;table-column-group;table-column;table-cell;table-caption;none"; +var defaultBorderStyle = "none;solid;dashed;dotted;double;groove;ridge;inset;outset"; +var defaultBorderWidth = "thin;medium;thick"; +var defaultListType = "disc;circle;square;decimal;lower-roman;upper-roman;lower-alpha;upper-alpha;none"; + +function init() { + var ce = document.getElementById('container'), h; + + ce.style.cssText = tinyMCEPopup.getWindowArg('style_text'); + + h = getBrowserHTML('background_image_browser','background_image','image','advimage'); + document.getElementById("background_image_browser").innerHTML = h; + + document.getElementById('text_color_pickcontainer').innerHTML = getColorPickerHTML('text_color_pick','text_color'); + document.getElementById('background_color_pickcontainer').innerHTML = getColorPickerHTML('background_color_pick','background_color'); + document.getElementById('border_color_top_pickcontainer').innerHTML = getColorPickerHTML('border_color_top_pick','border_color_top'); + document.getElementById('border_color_right_pickcontainer').innerHTML = getColorPickerHTML('border_color_right_pick','border_color_right'); + document.getElementById('border_color_bottom_pickcontainer').innerHTML = getColorPickerHTML('border_color_bottom_pick','border_color_bottom'); + document.getElementById('border_color_left_pickcontainer').innerHTML = getColorPickerHTML('border_color_left_pick','border_color_left'); + + fillSelect(0, 'text_font', 'style_font', defaultFonts, ';', true); + fillSelect(0, 'text_size', 'style_font_size', defaultSizes, ';', true); + fillSelect(0, 'text_size_measurement', 'style_font_size_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'text_case', 'style_text_case', "capitalize;uppercase;lowercase", ';', true); + fillSelect(0, 'text_weight', 'style_font_weight', defaultWeight, ';', true); + fillSelect(0, 'text_style', 'style_font_style', defaultTextStyle, ';', true); + fillSelect(0, 'text_variant', 'style_font_variant', defaultVariant, ';', true); + fillSelect(0, 'text_lineheight', 'style_font_line_height', defaultLineHeight, ';', true); + fillSelect(0, 'text_lineheight_measurement', 'style_font_line_height_measurement', defaultMeasurement, ';', true); + + fillSelect(0, 'background_attachment', 'style_background_attachment', defaultAttachment, ';', true); + fillSelect(0, 'background_repeat', 'style_background_repeat', defaultRepeat, ';', true); + + fillSelect(0, 'background_hpos_measurement', 'style_background_hpos_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'background_vpos_measurement', 'style_background_vpos_measurement', defaultMeasurement, ';', true); + + fillSelect(0, 'background_hpos', 'style_background_hpos', defaultPosH, ';', true); + fillSelect(0, 'background_vpos', 'style_background_vpos', defaultPosV, ';', true); + + fillSelect(0, 'block_wordspacing', 'style_wordspacing', 'normal', ';', true); + fillSelect(0, 'block_wordspacing_measurement', 'style_wordspacing_measurement', defaultSpacingMeasurement, ';', true); + fillSelect(0, 'block_letterspacing', 'style_letterspacing', 'normal', ';', true); + fillSelect(0, 'block_letterspacing_measurement', 'style_letterspacing_measurement', defaultSpacingMeasurement, ';', true); + fillSelect(0, 'block_vertical_alignment', 'style_vertical_alignment', defaultVAlign, ';', true); + fillSelect(0, 'block_text_align', 'style_text_align', "left;right;center;justify", ';', true); + fillSelect(0, 'block_whitespace', 'style_whitespace', "normal;pre;nowrap", ';', true); + fillSelect(0, 'block_display', 'style_display', defaultDisplay, ';', true); + fillSelect(0, 'block_text_indent_measurement', 'style_text_indent_measurement', defaultIndentMeasurement, ';', true); + + fillSelect(0, 'box_width_measurement', 'style_box_width_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'box_height_measurement', 'style_box_height_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'box_float', 'style_float', 'left;right;none', ';', true); + fillSelect(0, 'box_clear', 'style_clear', 'left;right;both;none', ';', true); + fillSelect(0, 'box_padding_left_measurement', 'style_padding_left_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'box_padding_top_measurement', 'style_padding_top_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'box_padding_bottom_measurement', 'style_padding_bottom_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'box_padding_right_measurement', 'style_padding_right_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'box_margin_left_measurement', 'style_margin_left_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'box_margin_top_measurement', 'style_margin_top_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'box_margin_bottom_measurement', 'style_margin_bottom_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'box_margin_right_measurement', 'style_margin_right_measurement', defaultMeasurement, ';', true); + + fillSelect(0, 'border_style_top', 'style_border_style_top', defaultBorderStyle, ';', true); + fillSelect(0, 'border_style_right', 'style_border_style_right', defaultBorderStyle, ';', true); + fillSelect(0, 'border_style_bottom', 'style_border_style_bottom', defaultBorderStyle, ';', true); + fillSelect(0, 'border_style_left', 'style_border_style_left', defaultBorderStyle, ';', true); + + fillSelect(0, 'border_width_top', 'style_border_width_top', defaultBorderWidth, ';', true); + fillSelect(0, 'border_width_right', 'style_border_width_right', defaultBorderWidth, ';', true); + fillSelect(0, 'border_width_bottom', 'style_border_width_bottom', defaultBorderWidth, ';', true); + fillSelect(0, 'border_width_left', 'style_border_width_left', defaultBorderWidth, ';', true); + + fillSelect(0, 'border_width_top_measurement', 'style_border_width_top_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'border_width_right_measurement', 'style_border_width_right_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'border_width_bottom_measurement', 'style_border_width_bottom_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'border_width_left_measurement', 'style_border_width_left_measurement', defaultMeasurement, ';', true); + + fillSelect(0, 'list_type', 'style_list_type', defaultListType, ';', true); + fillSelect(0, 'list_position', 'style_list_position', "inside;outside", ';', true); + + fillSelect(0, 'positioning_type', 'style_positioning_type', "absolute;relative;static", ';', true); + fillSelect(0, 'positioning_visibility', 'style_positioning_visibility', "inherit;visible;hidden", ';', true); + + fillSelect(0, 'positioning_width_measurement', 'style_positioning_width_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'positioning_height_measurement', 'style_positioning_height_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'positioning_overflow', 'style_positioning_overflow', "visible;hidden;scroll;auto", ';', true); + + fillSelect(0, 'positioning_placement_top_measurement', 'style_positioning_placement_top_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'positioning_placement_right_measurement', 'style_positioning_placement_right_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'positioning_placement_bottom_measurement', 'style_positioning_placement_bottom_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'positioning_placement_left_measurement', 'style_positioning_placement_left_measurement', defaultMeasurement, ';', true); + + fillSelect(0, 'positioning_clip_top_measurement', 'style_positioning_clip_top_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'positioning_clip_right_measurement', 'style_positioning_clip_right_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'positioning_clip_bottom_measurement', 'style_positioning_clip_bottom_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'positioning_clip_left_measurement', 'style_positioning_clip_left_measurement', defaultMeasurement, ';', true); + + TinyMCE_EditableSelects.init(); + setupFormData(); + showDisabledControls(); +} + +function setupFormData() { + var ce = document.getElementById('container'), f = document.forms[0], s, b, i; + + // Setup text fields + + selectByValue(f, 'text_font', ce.style.fontFamily, true, true); + selectByValue(f, 'text_size', getNum(ce.style.fontSize), true, true); + selectByValue(f, 'text_size_measurement', getMeasurement(ce.style.fontSize)); + selectByValue(f, 'text_weight', ce.style.fontWeight, true, true); + selectByValue(f, 'text_style', ce.style.fontStyle, true, true); + selectByValue(f, 'text_lineheight', getNum(ce.style.lineHeight), true, true); + selectByValue(f, 'text_lineheight_measurement', getMeasurement(ce.style.lineHeight)); + selectByValue(f, 'text_case', ce.style.textTransform, true, true); + selectByValue(f, 'text_variant', ce.style.fontVariant, true, true); + f.text_color.value = tinyMCEPopup.editor.dom.toHex(ce.style.color); + updateColor('text_color_pick', 'text_color'); + f.text_underline.checked = inStr(ce.style.textDecoration, 'underline'); + f.text_overline.checked = inStr(ce.style.textDecoration, 'overline'); + f.text_linethrough.checked = inStr(ce.style.textDecoration, 'line-through'); + f.text_blink.checked = inStr(ce.style.textDecoration, 'blink'); + + // Setup background fields + + f.background_color.value = tinyMCEPopup.editor.dom.toHex(ce.style.backgroundColor); + updateColor('background_color_pick', 'background_color'); + f.background_image.value = ce.style.backgroundImage.replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1"); + selectByValue(f, 'background_repeat', ce.style.backgroundRepeat, true, true); + selectByValue(f, 'background_attachment', ce.style.backgroundAttachment, true, true); + selectByValue(f, 'background_hpos', getNum(getVal(ce.style.backgroundPosition, 0)), true, true); + selectByValue(f, 'background_hpos_measurement', getMeasurement(getVal(ce.style.backgroundPosition, 0))); + selectByValue(f, 'background_vpos', getNum(getVal(ce.style.backgroundPosition, 1)), true, true); + selectByValue(f, 'background_vpos_measurement', getMeasurement(getVal(ce.style.backgroundPosition, 1))); + + // Setup block fields + + selectByValue(f, 'block_wordspacing', getNum(ce.style.wordSpacing), true, true); + selectByValue(f, 'block_wordspacing_measurement', getMeasurement(ce.style.wordSpacing)); + selectByValue(f, 'block_letterspacing', getNum(ce.style.letterSpacing), true, true); + selectByValue(f, 'block_letterspacing_measurement', getMeasurement(ce.style.letterSpacing)); + selectByValue(f, 'block_vertical_alignment', ce.style.verticalAlign, true, true); + selectByValue(f, 'block_text_align', ce.style.textAlign, true, true); + f.block_text_indent.value = getNum(ce.style.textIndent); + selectByValue(f, 'block_text_indent_measurement', getMeasurement(ce.style.textIndent)); + selectByValue(f, 'block_whitespace', ce.style.whiteSpace, true, true); + selectByValue(f, 'block_display', ce.style.display, true, true); + + // Setup box fields + + f.box_width.value = getNum(ce.style.width); + selectByValue(f, 'box_width_measurement', getMeasurement(ce.style.width)); + + f.box_height.value = getNum(ce.style.height); + selectByValue(f, 'box_height_measurement', getMeasurement(ce.style.height)); + + if (tinymce.isGecko) + selectByValue(f, 'box_float', ce.style.cssFloat, true, true); + else + selectByValue(f, 'box_float', ce.style.styleFloat, true, true); + + selectByValue(f, 'box_clear', ce.style.clear, true, true); + + setupBox(f, ce, 'box_padding', 'padding', ''); + setupBox(f, ce, 'box_margin', 'margin', ''); + + // Setup border fields + + setupBox(f, ce, 'border_style', 'border', 'Style'); + setupBox(f, ce, 'border_width', 'border', 'Width'); + setupBox(f, ce, 'border_color', 'border', 'Color'); + + updateColor('border_color_top_pick', 'border_color_top'); + updateColor('border_color_right_pick', 'border_color_right'); + updateColor('border_color_bottom_pick', 'border_color_bottom'); + updateColor('border_color_left_pick', 'border_color_left'); + + f.elements.border_color_top.value = tinyMCEPopup.editor.dom.toHex(f.elements.border_color_top.value); + f.elements.border_color_right.value = tinyMCEPopup.editor.dom.toHex(f.elements.border_color_right.value); + f.elements.border_color_bottom.value = tinyMCEPopup.editor.dom.toHex(f.elements.border_color_bottom.value); + f.elements.border_color_left.value = tinyMCEPopup.editor.dom.toHex(f.elements.border_color_left.value); + + // Setup list fields + + selectByValue(f, 'list_type', ce.style.listStyleType, true, true); + selectByValue(f, 'list_position', ce.style.listStylePosition, true, true); + f.list_bullet_image.value = ce.style.listStyleImage.replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1"); + + // Setup box fields + + selectByValue(f, 'positioning_type', ce.style.position, true, true); + selectByValue(f, 'positioning_visibility', ce.style.visibility, true, true); + selectByValue(f, 'positioning_overflow', ce.style.overflow, true, true); + f.positioning_zindex.value = ce.style.zIndex ? ce.style.zIndex : ""; + + f.positioning_width.value = getNum(ce.style.width); + selectByValue(f, 'positioning_width_measurement', getMeasurement(ce.style.width)); + + f.positioning_height.value = getNum(ce.style.height); + selectByValue(f, 'positioning_height_measurement', getMeasurement(ce.style.height)); + + setupBox(f, ce, 'positioning_placement', '', '', ['top', 'right', 'bottom', 'left']); + + s = ce.style.clip.replace(new RegExp("rect\\('?([^']*)'?\\)", 'gi'), "$1"); + s = s.replace(/,/g, ' '); + + if (!hasEqualValues([getVal(s, 0), getVal(s, 1), getVal(s, 2), getVal(s, 3)])) { + f.positioning_clip_top.value = getNum(getVal(s, 0)); + selectByValue(f, 'positioning_clip_top_measurement', getMeasurement(getVal(s, 0))); + f.positioning_clip_right.value = getNum(getVal(s, 1)); + selectByValue(f, 'positioning_clip_right_measurement', getMeasurement(getVal(s, 1))); + f.positioning_clip_bottom.value = getNum(getVal(s, 2)); + selectByValue(f, 'positioning_clip_bottom_measurement', getMeasurement(getVal(s, 2))); + f.positioning_clip_left.value = getNum(getVal(s, 3)); + selectByValue(f, 'positioning_clip_left_measurement', getMeasurement(getVal(s, 3))); + } else { + f.positioning_clip_top.value = getNum(getVal(s, 0)); + selectByValue(f, 'positioning_clip_top_measurement', getMeasurement(getVal(s, 0))); + f.positioning_clip_right.value = f.positioning_clip_bottom.value = f.positioning_clip_left.value; + } + +// setupBox(f, ce, '', 'border', 'Color'); +} + +function getMeasurement(s) { + return s.replace(/^([0-9]+)(.*)$/, "$2"); +} + +function getNum(s) { + if (new RegExp('^[0-9]+[a-z%]+$', 'gi').test(s)) + return s.replace(/[^0-9]/g, ''); + + return s; +} + +function inStr(s, n) { + return new RegExp(n, 'gi').test(s); +} + +function getVal(s, i) { + var a = s.split(' '); + + if (a.length > 1) + return a[i]; + + return ""; +} + +function setValue(f, n, v) { + if (f.elements[n].type == "text") + f.elements[n].value = v; + else + selectByValue(f, n, v, true, true); +} + +function setupBox(f, ce, fp, pr, sf, b) { + if (typeof(b) == "undefined") + b = ['Top', 'Right', 'Bottom', 'Left']; + + if (isSame(ce, pr, sf, b)) { + f.elements[fp + "_same"].checked = true; + + setValue(f, fp + "_top", getNum(ce.style[pr + b[0] + sf])); + f.elements[fp + "_top"].disabled = false; + + f.elements[fp + "_right"].value = ""; + f.elements[fp + "_right"].disabled = true; + f.elements[fp + "_bottom"].value = ""; + f.elements[fp + "_bottom"].disabled = true; + f.elements[fp + "_left"].value = ""; + f.elements[fp + "_left"].disabled = true; + + if (f.elements[fp + "_top_measurement"]) { + selectByValue(f, fp + '_top_measurement', getMeasurement(ce.style[pr + b[0] + sf])); + f.elements[fp + "_left_measurement"].disabled = true; + f.elements[fp + "_bottom_measurement"].disabled = true; + f.elements[fp + "_right_measurement"].disabled = true; + } + } else { + f.elements[fp + "_same"].checked = false; + + setValue(f, fp + "_top", getNum(ce.style[pr + b[0] + sf])); + f.elements[fp + "_top"].disabled = false; + + setValue(f, fp + "_right", getNum(ce.style[pr + b[1] + sf])); + f.elements[fp + "_right"].disabled = false; + + setValue(f, fp + "_bottom", getNum(ce.style[pr + b[2] + sf])); + f.elements[fp + "_bottom"].disabled = false; + + setValue(f, fp + "_left", getNum(ce.style[pr + b[3] + sf])); + f.elements[fp + "_left"].disabled = false; + + if (f.elements[fp + "_top_measurement"]) { + selectByValue(f, fp + '_top_measurement', getMeasurement(ce.style[pr + b[0] + sf])); + selectByValue(f, fp + '_right_measurement', getMeasurement(ce.style[pr + b[1] + sf])); + selectByValue(f, fp + '_bottom_measurement', getMeasurement(ce.style[pr + b[2] + sf])); + selectByValue(f, fp + '_left_measurement', getMeasurement(ce.style[pr + b[3] + sf])); + f.elements[fp + "_left_measurement"].disabled = false; + f.elements[fp + "_bottom_measurement"].disabled = false; + f.elements[fp + "_right_measurement"].disabled = false; + } + } +} + +function isSame(e, pr, sf, b) { + var a = [], i, x; + + if (typeof(b) == "undefined") + b = ['Top', 'Right', 'Bottom', 'Left']; + + if (typeof(sf) == "undefined" || sf == null) + sf = ""; + + a[0] = e.style[pr + b[0] + sf]; + a[1] = e.style[pr + b[1] + sf]; + a[2] = e.style[pr + b[2] + sf]; + a[3] = e.style[pr + b[3] + sf]; + + for (i=0; i 0 ? s.substring(1) : s; + + if (f.text_none.checked) + s = "none"; + + ce.style.textDecoration = s; + + // Build background styles + + ce.style.backgroundColor = f.background_color.value; + ce.style.backgroundImage = f.background_image.value != "" ? "url(" + f.background_image.value + ")" : ""; + ce.style.backgroundRepeat = f.background_repeat.value; + ce.style.backgroundAttachment = f.background_attachment.value; + + if (f.background_hpos.value != "") { + s = ""; + s += f.background_hpos.value + (isNum(f.background_hpos.value) ? f.background_hpos_measurement.value : "") + " "; + s += f.background_vpos.value + (isNum(f.background_vpos.value) ? f.background_vpos_measurement.value : ""); + ce.style.backgroundPosition = s; + } + + // Build block styles + + ce.style.wordSpacing = f.block_wordspacing.value + (isNum(f.block_wordspacing.value) ? f.block_wordspacing_measurement.value : ""); + ce.style.letterSpacing = f.block_letterspacing.value + (isNum(f.block_letterspacing.value) ? f.block_letterspacing_measurement.value : ""); + ce.style.verticalAlign = f.block_vertical_alignment.value; + ce.style.textAlign = f.block_text_align.value; + ce.style.textIndent = f.block_text_indent.value + (isNum(f.block_text_indent.value) ? f.block_text_indent_measurement.value : ""); + ce.style.whiteSpace = f.block_whitespace.value; + ce.style.display = f.block_display.value; + + // Build box styles + + ce.style.width = f.box_width.value + (isNum(f.box_width.value) ? f.box_width_measurement.value : ""); + ce.style.height = f.box_height.value + (isNum(f.box_height.value) ? f.box_height_measurement.value : ""); + ce.style.styleFloat = f.box_float.value; + + if (tinymce.isGecko) + ce.style.cssFloat = f.box_float.value; + + ce.style.clear = f.box_clear.value; + + if (!f.box_padding_same.checked) { + ce.style.paddingTop = f.box_padding_top.value + (isNum(f.box_padding_top.value) ? f.box_padding_top_measurement.value : ""); + ce.style.paddingRight = f.box_padding_right.value + (isNum(f.box_padding_right.value) ? f.box_padding_right_measurement.value : ""); + ce.style.paddingBottom = f.box_padding_bottom.value + (isNum(f.box_padding_bottom.value) ? f.box_padding_bottom_measurement.value : ""); + ce.style.paddingLeft = f.box_padding_left.value + (isNum(f.box_padding_left.value) ? f.box_padding_left_measurement.value : ""); + } else + ce.style.padding = f.box_padding_top.value + (isNum(f.box_padding_top.value) ? f.box_padding_top_measurement.value : ""); + + if (!f.box_margin_same.checked) { + ce.style.marginTop = f.box_margin_top.value + (isNum(f.box_margin_top.value) ? f.box_margin_top_measurement.value : ""); + ce.style.marginRight = f.box_margin_right.value + (isNum(f.box_margin_right.value) ? f.box_margin_right_measurement.value : ""); + ce.style.marginBottom = f.box_margin_bottom.value + (isNum(f.box_margin_bottom.value) ? f.box_margin_bottom_measurement.value : ""); + ce.style.marginLeft = f.box_margin_left.value + (isNum(f.box_margin_left.value) ? f.box_margin_left_measurement.value : ""); + } else + ce.style.margin = f.box_margin_top.value + (isNum(f.box_margin_top.value) ? f.box_margin_top_measurement.value : ""); + + // Build border styles + + if (!f.border_style_same.checked) { + ce.style.borderTopStyle = f.border_style_top.value; + ce.style.borderRightStyle = f.border_style_right.value; + ce.style.borderBottomStyle = f.border_style_bottom.value; + ce.style.borderLeftStyle = f.border_style_left.value; + } else + ce.style.borderStyle = f.border_style_top.value; + + if (!f.border_width_same.checked) { + ce.style.borderTopWidth = f.border_width_top.value + (isNum(f.border_width_top.value) ? f.border_width_top_measurement.value : ""); + ce.style.borderRightWidth = f.border_width_right.value + (isNum(f.border_width_right.value) ? f.border_width_right_measurement.value : ""); + ce.style.borderBottomWidth = f.border_width_bottom.value + (isNum(f.border_width_bottom.value) ? f.border_width_bottom_measurement.value : ""); + ce.style.borderLeftWidth = f.border_width_left.value + (isNum(f.border_width_left.value) ? f.border_width_left_measurement.value : ""); + } else + ce.style.borderWidth = f.border_width_top.value; + + if (!f.border_color_same.checked) { + ce.style.borderTopColor = f.border_color_top.value; + ce.style.borderRightColor = f.border_color_right.value; + ce.style.borderBottomColor = f.border_color_bottom.value; + ce.style.borderLeftColor = f.border_color_left.value; + } else + ce.style.borderColor = f.border_color_top.value; + + // Build list styles + + ce.style.listStyleType = f.list_type.value; + ce.style.listStylePosition = f.list_position.value; + ce.style.listStyleImage = f.list_bullet_image.value != "" ? "url(" + f.list_bullet_image.value + ")" : ""; + + // Build positioning styles + + ce.style.position = f.positioning_type.value; + ce.style.visibility = f.positioning_visibility.value; + + if (ce.style.width == "") + ce.style.width = f.positioning_width.value + (isNum(f.positioning_width.value) ? f.positioning_width_measurement.value : ""); + + if (ce.style.height == "") + ce.style.height = f.positioning_height.value + (isNum(f.positioning_height.value) ? f.positioning_height_measurement.value : ""); + + ce.style.zIndex = f.positioning_zindex.value; + ce.style.overflow = f.positioning_overflow.value; + + if (!f.positioning_placement_same.checked) { + ce.style.top = f.positioning_placement_top.value + (isNum(f.positioning_placement_top.value) ? f.positioning_placement_top_measurement.value : ""); + ce.style.right = f.positioning_placement_right.value + (isNum(f.positioning_placement_right.value) ? f.positioning_placement_right_measurement.value : ""); + ce.style.bottom = f.positioning_placement_bottom.value + (isNum(f.positioning_placement_bottom.value) ? f.positioning_placement_bottom_measurement.value : ""); + ce.style.left = f.positioning_placement_left.value + (isNum(f.positioning_placement_left.value) ? f.positioning_placement_left_measurement.value : ""); + } else { + s = f.positioning_placement_top.value + (isNum(f.positioning_placement_top.value) ? f.positioning_placement_top_measurement.value : ""); + ce.style.top = s; + ce.style.right = s; + ce.style.bottom = s; + ce.style.left = s; + } + + if (!f.positioning_clip_same.checked) { + s = "rect("; + s += (isNum(f.positioning_clip_top.value) ? f.positioning_clip_top.value + f.positioning_clip_top_measurement.value : "auto") + " "; + s += (isNum(f.positioning_clip_right.value) ? f.positioning_clip_right.value + f.positioning_clip_right_measurement.value : "auto") + " "; + s += (isNum(f.positioning_clip_bottom.value) ? f.positioning_clip_bottom.value + f.positioning_clip_bottom_measurement.value : "auto") + " "; + s += (isNum(f.positioning_clip_left.value) ? f.positioning_clip_left.value + f.positioning_clip_left_measurement.value : "auto"); + s += ")"; + + if (s != "rect(auto auto auto auto)") + ce.style.clip = s; + } else { + s = "rect("; + t = isNum(f.positioning_clip_top.value) ? f.positioning_clip_top.value + f.positioning_clip_top_measurement.value : "auto"; + s += t + " "; + s += t + " "; + s += t + " "; + s += t + ")"; + + if (s != "rect(auto auto auto auto)") + ce.style.clip = s; + } + + ce.style.cssText = ce.style.cssText; +} + +function isNum(s) { + return new RegExp('[0-9]+', 'g').test(s); +} + +function showDisabledControls() { + var f = document.forms, i, a; + + for (i=0; i 1) { + addSelectValue(f, s, p[0], p[1]); + + if (se) + selectByValue(f, s, p[1]); + } else { + addSelectValue(f, s, p[0], p[0]); + + if (se) + selectByValue(f, s, p[0]); + } + } +} + +function toggleSame(ce, pre) { + var el = document.forms[0].elements, i; + + if (ce.checked) { + el[pre + "_top"].disabled = false; + el[pre + "_right"].disabled = true; + el[pre + "_bottom"].disabled = true; + el[pre + "_left"].disabled = true; + + if (el[pre + "_top_measurement"]) { + el[pre + "_top_measurement"].disabled = false; + el[pre + "_right_measurement"].disabled = true; + el[pre + "_bottom_measurement"].disabled = true; + el[pre + "_left_measurement"].disabled = true; + } + } else { + el[pre + "_top"].disabled = false; + el[pre + "_right"].disabled = false; + el[pre + "_bottom"].disabled = false; + el[pre + "_left"].disabled = false; + + if (el[pre + "_top_measurement"]) { + el[pre + "_top_measurement"].disabled = false; + el[pre + "_right_measurement"].disabled = false; + el[pre + "_bottom_measurement"].disabled = false; + el[pre + "_left_measurement"].disabled = false; + } + } + + showDisabledControls(); +} + +function synch(fr, to) { + var f = document.forms[0]; + + f.elements[to].value = f.elements[fr].value; + + if (f.elements[fr + "_measurement"]) + selectByValue(f, to + "_measurement", f.elements[fr + "_measurement"].value); +} + +tinyMCEPopup.onInit.add(init); diff --git a/include/javascript/tiny_mce/plugins/style/langs/en_dlg.js b/include/javascript/tiny_mce/plugins/style/langs/en_dlg.js new file mode 100755 index 00000000..d9d77627 --- /dev/null +++ b/include/javascript/tiny_mce/plugins/style/langs/en_dlg.js @@ -0,0 +1,63 @@ +tinyMCE.addI18n('en.style_dlg',{ +title:"Edit CSS Style", +apply:"Apply", +text_tab:"Text", +background_tab:"Background", +block_tab:"Block", +box_tab:"Box", +border_tab:"Border", +list_tab:"List", +positioning_tab:"Positioning", +text_props:"Text", +text_font:"Font", +text_size:"Size", +text_weight:"Weight", +text_style:"Style", +text_variant:"Variant", +text_lineheight:"Line height", +text_case:"Case", +text_color:"Color", +text_decoration:"Decoration", +text_overline:"overline", +text_underline:"underline", +text_striketrough:"strikethrough", +text_blink:"blink", +text_none:"none", +background_color:"Background color", +background_image:"Background image", +background_repeat:"Repeat", +background_attachment:"Attachment", +background_hpos:"Horizontal position", +background_vpos:"Vertical position", +block_wordspacing:"Word spacing", +block_letterspacing:"Letter spacing", +block_vertical_alignment:"Vertical alignment", +block_text_align:"Text align", +block_text_indent:"Text indent", +block_whitespace:"Whitespace", +block_display:"Display", +box_width:"Width", +box_height:"Height", +box_float:"Float", +box_clear:"Clear", +padding:"Padding", +same:"Same for all", +top:"Top", +right:"Right", +bottom:"Bottom", +left:"Left", +margin:"Margin", +style:"Style", +width:"Width", +height:"Height", +color:"Color", +list_type:"Type", +bullet_image:"Bullet image", +position:"Position", +positioning_type:"Type", +visibility:"Visibility", +zindex:"Z-index", +overflow:"Overflow", +placement:"Placement", +clip:"Clip" +}); \ No newline at end of file diff --git a/include/javascript/tiny_mce/plugins/table/editor_plugin.js b/include/javascript/tiny_mce/plugins/table/editor_plugin.js new file mode 100755 index 00000000..97a9d256 --- /dev/null +++ b/include/javascript/tiny_mce/plugins/table/editor_plugin.js @@ -0,0 +1 @@ +(function(){var each=tinymce.each;tinymce.create('tinymce.plugins.TablePlugin',{init:function(ed,url){var t=this;t.editor=ed;t.url=url;each([['table','table.desc','mceInsertTable',true],['delete_table','table.del','mceTableDelete'],['delete_col','table.delete_col_desc','mceTableDeleteCol'],['delete_row','table.delete_row_desc','mceTableDeleteRow'],['col_after','table.col_after_desc','mceTableInsertColAfter'],['col_before','table.col_before_desc','mceTableInsertColBefore'],['row_after','table.row_after_desc','mceTableInsertRowAfter'],['row_before','table.row_before_desc','mceTableInsertRowBefore'],['row_props','table.row_desc','mceTableRowProps',true],['cell_props','table.cell_desc','mceTableCellProps',true],['split_cells','table.split_cells_desc','mceTableSplitCells',true],['merge_cells','table.merge_cells_desc','mceTableMergeCells',true]],function(c){ed.addButton(c[0],{title:c[1],cmd:c[2],ui:c[3]});});if(ed.getParam('inline_styles')){ed.onPreProcess.add(function(ed,o){var dom=ed.dom;each(dom.select('table',o.node),function(n){var v;if(v=dom.getAttrib(n,'width')){dom.setStyle(n,'width',v);dom.setAttrib(n,'width');}if(v=dom.getAttrib(n,'height')){dom.setStyle(n,'height',v);dom.setAttrib(n,'height');}});});}ed.onInit.add(function(){if(ed&&ed.plugins.contextmenu){ed.plugins.contextmenu.onContextMenu.add(function(th,m,e){var sm,se=ed.selection,el=se.getNode()||ed.getBody();if(ed.dom.getParent(e,'td')||ed.dom.getParent(e,'th')){m.removeAll();if(el.nodeName=='A'&&!ed.dom.getAttrib(el,'name')){m.add({title:'advanced.link_desc',icon:'link',cmd:ed.plugins.advlink?'mceAdvLink':'mceLink',ui:true});m.add({title:'advanced.unlink_desc',icon:'unlink',cmd:'UnLink'});m.addSeparator();}if(el.nodeName=='IMG'&&el.className.indexOf('mceItem')==-1){m.add({title:'advanced.image_desc',icon:'image',cmd:ed.plugins.advimage?'mceAdvImage':'mceImage',ui:true});m.addSeparator();}m.add({title:'table.desc',icon:'table',cmd:'mceInsertTable',ui:true,value:{action:'insert'}});m.add({title:'table.props_desc',icon:'table_props',cmd:'mceInsertTable',ui:true});m.add({title:'table.del',icon:'delete_table',cmd:'mceTableDelete',ui:true});m.addSeparator();sm=m.addMenu({title:'table.cell'});sm.add({title:'table.cell_desc',icon:'cell_props',cmd:'mceTableCellProps',ui:true});sm.add({title:'table.split_cells_desc',icon:'split_cells',cmd:'mceTableSplitCells',ui:true});sm.add({title:'table.merge_cells_desc',icon:'merge_cells',cmd:'mceTableMergeCells',ui:true});sm=m.addMenu({title:'table.row'});sm.add({title:'table.row_desc',icon:'row_props',cmd:'mceTableRowProps',ui:true});sm.add({title:'table.row_before_desc',icon:'row_before',cmd:'mceTableInsertRowBefore'});sm.add({title:'table.row_after_desc',icon:'row_after',cmd:'mceTableInsertRowAfter'});sm.add({title:'table.delete_row_desc',icon:'delete_row',cmd:'mceTableDeleteRow'});sm.addSeparator();sm.add({title:'table.cut_row_desc',icon:'cut',cmd:'mceTableCutRow'});sm.add({title:'table.copy_row_desc',icon:'copy',cmd:'mceTableCopyRow'});sm.add({title:'table.paste_row_before_desc',icon:'paste',cmd:'mceTablePasteRowBefore'});sm.add({title:'table.paste_row_after_desc',icon:'paste',cmd:'mceTablePasteRowAfter'});sm=m.addMenu({title:'table.col'});sm.add({title:'table.col_before_desc',icon:'col_before',cmd:'mceTableInsertColBefore'});sm.add({title:'table.col_after_desc',icon:'col_after',cmd:'mceTableInsertColAfter'});sm.add({title:'table.delete_col_desc',icon:'delete_col',cmd:'mceTableDeleteCol'});}else m.add({title:'table.desc',icon:'table',cmd:'mceInsertTable',ui:true});});}});ed.onKeyDown.add(function(ed,e){if(e.keyCode==9&&ed.dom.getParent(ed.selection.getNode(),'TABLE')){if(!tinymce.isGecko&&!tinymce.isOpera){tinyMCE.execInstanceCommand(ed.editorId,"mceTableMoveToNextRow",true);return tinymce.dom.Event.cancel(e);}ed.undoManager.add();}});if(!tinymce.isIE){if(ed.getParam('table_selection',true)){ed.onClick.add(function(ed,e){e=e.target;if(e.nodeName==='TABLE')ed.selection.select(e);});}}ed.onNodeChange.add(function(ed,cm,n){var p=ed.dom.getParent(n,'td,th,caption');cm.setActive('table',n.nodeName==='TABLE'||!!p);if(p&&p.nodeName==='CAPTION')p=null;cm.setDisabled('delete_table',!p);cm.setDisabled('delete_col',!p);cm.setDisabled('delete_table',!p);cm.setDisabled('delete_row',!p);cm.setDisabled('col_after',!p);cm.setDisabled('col_before',!p);cm.setDisabled('row_after',!p);cm.setDisabled('row_before',!p);cm.setDisabled('row_props',!p);cm.setDisabled('cell_props',!p);cm.setDisabled('split_cells',!p||(parseInt(ed.dom.getAttrib(p,'colspan','1'))<2&&parseInt(ed.dom.getAttrib(p,'rowspan','1'))<2));cm.setDisabled('merge_cells',!p);});if(!tinymce.isIE){ed.onBeforeSetContent.add(function(ed,o){if(o.initial)o.content=o.content.replace(/<(td|th)([^>]+|)>\s*<\/(td|th)>/g,tinymce.isOpera?'<$1$2> ':'<$1$2>
    ');});}},execCommand:function(cmd,ui,val){var ed=this.editor,b;switch(cmd){case"mceTableMoveToNextRow":case"mceInsertTable":case"mceTableRowProps":case"mceTableCellProps":case"mceTableSplitCells":case"mceTableMergeCells":case"mceTableInsertRowBefore":case"mceTableInsertRowAfter":case"mceTableDeleteRow":case"mceTableInsertColBefore":case"mceTableInsertColAfter":case"mceTableDeleteCol":case"mceTableCutRow":case"mceTableCopyRow":case"mceTablePasteRowBefore":case"mceTablePasteRowAfter":case"mceTableDelete":ed.execCommand('mceBeginUndoLevel');this._doExecCommand(cmd,ui,val);ed.execCommand('mceEndUndoLevel');return true;}return false;},getInfo:function(){return{longname:'Tables',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/table',version:tinymce.majorVersion+"."+tinymce.minorVersion};},_doExecCommand:function(command,user_interface,value){var inst=this.editor,ed=inst,url=this.url;var focusElm=inst.selection.getNode();var trElm=inst.dom.getParent(focusElm,"tr");var tdElm=inst.dom.getParent(focusElm,"td,th");var tableElm=inst.dom.getParent(focusElm,"table");var doc=inst.contentWindow.document;var tableBorder=tableElm?tableElm.getAttribute("border"):"";if(trElm&&tdElm==null)tdElm=trElm.cells[0];function inArray(ar,v){for(var i=0;i0&&inArray(ar[i],v))return true;if(ar[i]==v)return true;}return false;}function select(dx,dy){var td;grid=getTableGrid(tableElm);dx=dx||0;dy=dy||0;dx=Math.max(cpos.cellindex+dx,0);dy=Math.max(cpos.rowindex+dy,0);inst.execCommand('mceRepaint');td=getCell(grid,dy,dx);if(td){inst.selection.select(td.firstChild||td);inst.selection.collapse(1);}};function makeTD(){var newTD=doc.createElement("td");if(!tinymce.isIE)newTD.innerHTML='
    ';}function getColRowSpan(td){var colspan=inst.dom.getAttrib(td,"colspan");var rowspan=inst.dom.getAttrib(td,"rowspan");colspan=colspan==""?1:parseInt(colspan);rowspan=rowspan==""?1:parseInt(rowspan);return{colspan:colspan,rowspan:rowspan};}function getCellPos(grid,td){var x,y;for(y=0;y1){for(var i=x;i1)td.rowSpan=sd.rowspan+1;lastElm=td;}deleteMarked(tableElm);}}function prevElm(node,name){while((node=node.previousSibling)!=null){if(node.nodeName==name)return node;}return null;}function nextElm(node,names){var namesAr=names.split(',');while((node=node.nextSibling)!=null){for(var i=0;i1){do{var nexttd=nextElm(td,"TD,TH");if(td._delete)td.parentNode.removeChild(td);}while((td=nexttd)!=null);}}while((tr=next)!=null);}function addRows(td_elm,tr_elm,rowspan){td_elm.rowSpan=1;var trNext=nextElm(tr_elm,"TR");for(var i=1;i';if(tinymce.isIE)trNext.insertBefore(newTD,trNext.cells(td_elm.cellIndex));else trNext.insertBefore(newTD,trNext.cells[td_elm.cellIndex]);trNext=nextElm(trNext,"TR");}}function copyRow(doc,table,tr){var grid=getTableGrid(table);var newTR=tr.cloneNode(false);var cpos=getCellPos(grid,tr.cells[0]);var lastCell=null;var tableBorder=inst.dom.getAttrib(table,"border");var tdElm=null;for(var x=0;tdElm=getCell(grid,cpos.rowindex,x);x++){var newTD=null;if(lastCell!=tdElm){for(var i=0;i';}newTD.colSpan=1;newTD.rowSpan=1;newTR.appendChild(newTD);lastCell=tdElm;}return newTR;}switch(command){case"mceTableMoveToNextRow":var nextCell=getNextCell(tableElm,tdElm);if(!nextCell){inst.execCommand("mceTableInsertRowAfter",tdElm);nextCell=getNextCell(tableElm,tdElm);}inst.selection.select(nextCell);inst.selection.collapse(true);return true;case"mceTableRowProps":if(trElm==null)return true;if(user_interface){inst.windowManager.open({url:url+'/row.htm',width:400+parseInt(inst.getLang('table.rowprops_delta_width',0)),height:295+parseInt(inst.getLang('table.rowprops_delta_height',0)),inline:1},{plugin_url:url});}return true;case"mceTableCellProps":if(tdElm==null)return true;if(user_interface){inst.windowManager.open({url:url+'/cell.htm',width:400+parseInt(inst.getLang('table.cellprops_delta_width',0)),height:295+parseInt(inst.getLang('table.cellprops_delta_height',0)),inline:1},{plugin_url:url});}return true;case"mceInsertTable":if(user_interface){inst.windowManager.open({url:url+'/table.htm',width:400+parseInt(inst.getLang('table.table_delta_width',0)),height:320+parseInt(inst.getLang('table.table_delta_height',0)),inline:1},{plugin_url:url,action:value?value.action:0});}return true;case"mceTableDelete":var table=inst.dom.getParent(inst.selection.getNode(),"table");if(table){table.parentNode.removeChild(table);inst.execCommand('mceRepaint');}return true;case"mceTableSplitCells":case"mceTableMergeCells":case"mceTableInsertRowBefore":case"mceTableInsertRowAfter":case"mceTableDeleteRow":case"mceTableInsertColBefore":case"mceTableInsertColAfter":case"mceTableDeleteCol":case"mceTableCutRow":case"mceTableCopyRow":case"mceTablePasteRowBefore":case"mceTablePasteRowAfter":if(!tableElm)return true;if(trElm&&tableElm!=trElm.parentNode)tableElm=trElm.parentNode;if(tableElm&&trElm){switch(command){case"mceTableCutRow":if(!trElm||!tdElm)return true;inst.tableRowClipboard=copyRow(doc,tableElm,trElm);inst.execCommand("mceTableDeleteRow");break;case"mceTableCopyRow":if(!trElm||!tdElm)return true;inst.tableRowClipboard=copyRow(doc,tableElm,trElm);break;case"mceTablePasteRowBefore":if(!trElm||!tdElm)return true;var newTR=inst.tableRowClipboard.cloneNode(true);var prevTR=prevElm(trElm,"TR");if(prevTR!=null)trimRow(tableElm,prevTR,prevTR.cells[0],newTR);trElm.parentNode.insertBefore(newTR,trElm);break;case"mceTablePasteRowAfter":if(!trElm||!tdElm)return true;var nextTR=nextElm(trElm,"TR");var newTR=inst.tableRowClipboard.cloneNode(true);trimRow(tableElm,trElm,tdElm,newTR);if(nextTR==null)trElm.parentNode.appendChild(newTR);else nextTR.parentNode.insertBefore(newTR,nextTR);break;case"mceTableInsertRowBefore":if(!trElm||!tdElm)return true;var grid=getTableGrid(tableElm);var cpos=getCellPos(grid,tdElm);var newTR=doc.createElement("tr");var lastTDElm=null;cpos.rowindex--;if(cpos.rowindex<0)cpos.rowindex=0;for(var x=0;tdElm=getCell(grid,cpos.rowindex,x);x++){if(tdElm!=lastTDElm){var sd=getColRowSpan(tdElm);if(sd['rowspan']==1){var newTD=doc.createElement("td");if(!tinymce.isIE)newTD.innerHTML='
    ';newTD.colSpan=tdElm.colSpan;newTR.appendChild(newTD);}else tdElm.rowSpan=sd['rowspan']+1;lastTDElm=tdElm;}}trElm.parentNode.insertBefore(newTR,trElm);select(0,1);break;case"mceTableInsertRowAfter":if(!trElm||!tdElm)return true;var grid=getTableGrid(tableElm);var cpos=getCellPos(grid,tdElm);var newTR=doc.createElement("tr");var lastTDElm=null;for(var x=0;tdElm=getCell(grid,cpos.rowindex,x);x++){if(tdElm!=lastTDElm){var sd=getColRowSpan(tdElm);if(sd['rowspan']==1){var newTD=doc.createElement("td");if(!tinymce.isIE)newTD.innerHTML='
    ';newTD.colSpan=tdElm.colSpan;newTR.appendChild(newTD);}else tdElm.rowSpan=sd['rowspan']+1;lastTDElm=tdElm;}}if(newTR.hasChildNodes()){var nextTR=nextElm(trElm,"TR");if(nextTR)nextTR.parentNode.insertBefore(newTR,nextTR);else tableElm.appendChild(newTR);}select(0,1);break;case"mceTableDeleteRow":if(!trElm||!tdElm)return true;var grid=getTableGrid(tableElm);var cpos=getCellPos(grid,tdElm);if(grid.length==1&&tableElm.nodeName=='TBODY'){inst.dom.remove(inst.dom.getParent(tableElm,"table"));return true;}var cells=trElm.cells;var nextTR=nextElm(trElm,"TR");for(var x=0;x1){var newTD=cells[x].cloneNode(true);var sd=getColRowSpan(cells[x]);newTD.rowSpan=sd.rowspan-1;var nextTD=nextTR.cells[x];if(nextTD==null)nextTR.appendChild(newTD);else nextTR.insertBefore(newTD,nextTD);}}var lastTDElm=null;for(var x=0;tdElm=getCell(grid,cpos.rowindex,x);x++){if(tdElm!=lastTDElm){var sd=getColRowSpan(tdElm);if(sd.rowspan>1){tdElm.rowSpan=sd.rowspan-1;}else{trElm=tdElm.parentNode;if(trElm.parentNode)trElm._delete=true;}lastTDElm=tdElm;}}deleteMarked(tableElm);select(0,-1);break;case"mceTableInsertColBefore":if(!trElm||!tdElm)return true;var grid=getTableGrid(inst.dom.getParent(tableElm,"table"));var cpos=getCellPos(grid,tdElm);var lastTDElm=null;for(var y=0;tdElm=getCell(grid,y,cpos.cellindex);y++){if(tdElm!=lastTDElm){var sd=getColRowSpan(tdElm);if(sd['colspan']==1){var newTD=doc.createElement(tdElm.nodeName);if(!tinymce.isIE)newTD.innerHTML='
    ';newTD.rowSpan=tdElm.rowSpan;tdElm.parentNode.insertBefore(newTD,tdElm);}else tdElm.colSpan++;lastTDElm=tdElm;}}select();break;case"mceTableInsertColAfter":if(!trElm||!tdElm)return true;var grid=getTableGrid(inst.dom.getParent(tableElm,"table"));var cpos=getCellPos(grid,tdElm);var lastTDElm=null;for(var y=0;tdElm=getCell(grid,y,cpos.cellindex);y++){if(tdElm!=lastTDElm){var sd=getColRowSpan(tdElm);if(sd['colspan']==1){var newTD=doc.createElement(tdElm.nodeName);if(!tinymce.isIE)newTD.innerHTML='
    ';newTD.rowSpan=tdElm.rowSpan;var nextTD=nextElm(tdElm,"TD,TH");if(nextTD==null)tdElm.parentNode.appendChild(newTD);else nextTD.parentNode.insertBefore(newTD,nextTD);}else tdElm.colSpan++;lastTDElm=tdElm;}}select(1);break;case"mceTableDeleteCol":if(!trElm||!tdElm)return true;var grid=getTableGrid(tableElm);var cpos=getCellPos(grid,tdElm);var lastTDElm=null;if((grid.length>1&&grid[0].length<=1)&&tableElm.nodeName=='TBODY'){inst.dom.remove(inst.dom.getParent(tableElm,"table"));return true;}for(var y=0;tdElm=getCell(grid,y,cpos.cellindex);y++){if(tdElm!=lastTDElm){var sd=getColRowSpan(tdElm);if(sd['colspan']>1)tdElm.colSpan=sd['colspan']-1;else{if(tdElm.parentNode)tdElm.parentNode.removeChild(tdElm);}lastTDElm=tdElm;}}select(-1);break;case"mceTableSplitCells":if(!trElm||!tdElm)return true;var spandata=getColRowSpan(tdElm);var colspan=spandata["colspan"];var rowspan=spandata["rowspan"];if(colspan>1||rowspan>1){tdElm.colSpan=1;for(var i=1;i';trElm.insertBefore(newTD,nextElm(tdElm,"TD,TH"));if(rowspan>1)addRows(newTD,trElm,rowspan);}addRows(tdElm,trElm,rowspan);}tableElm=inst.dom.getParent(inst.selection.getNode(),"table");break;case"mceTableMergeCells":var rows=[];var sel=inst.selection.getSel();var grid=getTableGrid(tableElm);if(tinymce.isIE||sel.rangeCount==1){if(user_interface){var sp=getColRowSpan(tdElm);inst.windowManager.open({url:url+'/merge_cells.htm',width:240+parseInt(inst.getLang('table.merge_cells_delta_width',0)),height:110+parseInt(inst.getLang('table.merge_cells_delta_height',0)),inline:1},{action:"update",numcols:sp.colspan,numrows:sp.rowspan,plugin_url:url});return true;}else{var numRows=parseInt(value['numrows']);var numCols=parseInt(value['numcols']);var cpos=getCellPos(grid,tdElm);if((""+numRows)=="NaN")numRows=1;if((""+numCols)=="NaN")numCols=1;var tRows=tableElm.rows;for(var y=cpos.rowindex;y0)rows[rows.length]=rowCells;var td=getCell(grid,cpos.rowindex,cpos.cellindex);each(ed.dom.select('br',td),function(e,i){if(i>0&&ed.dom.getAttrib('mce_bogus'))ed.dom.remove(e);});}}}else{var cells=[];var sel=inst.selection.getSel();var lastTR=null;var curRow=null;var x1=-1,y1=-1,x2,y2;if(sel.rangeCount<2)return true;for(var i=0;i0)rows[rows.length]=rowCells;}var curRow=[];var lastTR=null;for(var y=0;ycolSpan)colSpan=rowColSpan;lastRowSpan=-1;}var lastColSpan=-1;for(var x=0;xrowSpan)rowSpan=colRowSpan;lastColSpan=-1;}tdElm=rows[0][0];tdElm.rowSpan=rowSpan;tdElm.colSpan=colSpan;for(var y=0;y0))tdElm.innerHTML+=html;if(rows[y][x]!=tdElm&&!rows[y][x]._deleted){var cpos=getCellPos(grid,rows[y][x]);var tr=rows[y][x].parentNode;tr.removeChild(rows[y][x]);rows[y][x]._deleted=true;if(!tr.hasChildNodes()){tr.parentNode.removeChild(tr);var lastCell=null;for(var x=0;cellElm=getCell(grid,cpos.rowindex,x);x++){if(cellElm!=lastCell&&cellElm.rowSpan>1)cellElm.rowSpan--;lastCell=cellElm;}if(tdElm.rowSpan>1)tdElm.rowSpan--;}}}}each(ed.dom.select('br',tdElm),function(e,i){if(i>0&&ed.dom.getAttrib(e,'mce_bogus'))ed.dom.remove(e);});break;}tableElm=inst.dom.getParent(inst.selection.getNode(),"table");inst.addVisual(tableElm);inst.nodeChanged();}return true;}return false;}});tinymce.PluginManager.add('table',tinymce.plugins.TablePlugin);})(); \ No newline at end of file diff --git a/include/javascript/tiny_mce/plugins/table/editor_plugin_src.js b/include/javascript/tiny_mce/plugins/table/editor_plugin_src.js new file mode 100755 index 00000000..985af1a8 --- /dev/null +++ b/include/javascript/tiny_mce/plugins/table/editor_plugin_src.js @@ -0,0 +1,1136 @@ +/** + + * + * @author Moxiecode + * @copyright Copyright 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + var each = tinymce.each; + + tinymce.create('tinymce.plugins.TablePlugin', { + init : function(ed, url) { + var t = this; + + t.editor = ed; + t.url = url; + + // Register buttons + each([ + ['table', 'table.desc', 'mceInsertTable', true], + ['delete_table', 'table.del', 'mceTableDelete'], + ['delete_col', 'table.delete_col_desc', 'mceTableDeleteCol'], + ['delete_row', 'table.delete_row_desc', 'mceTableDeleteRow'], + ['col_after', 'table.col_after_desc', 'mceTableInsertColAfter'], + ['col_before', 'table.col_before_desc', 'mceTableInsertColBefore'], + ['row_after', 'table.row_after_desc', 'mceTableInsertRowAfter'], + ['row_before', 'table.row_before_desc', 'mceTableInsertRowBefore'], + ['row_props', 'table.row_desc', 'mceTableRowProps', true], + ['cell_props', 'table.cell_desc', 'mceTableCellProps', true], + ['split_cells', 'table.split_cells_desc', 'mceTableSplitCells', true], + ['merge_cells', 'table.merge_cells_desc', 'mceTableMergeCells', true] + ], function(c) { + ed.addButton(c[0], {title : c[1], cmd : c[2], ui : c[3]}); + }); + + if (ed.getParam('inline_styles')) { + // Force move of attribs to styles in strict mode + ed.onPreProcess.add(function(ed, o) { + var dom = ed.dom; + + each(dom.select('table', o.node), function(n) { + var v; + + if (v = dom.getAttrib(n, 'width')) { + dom.setStyle(n, 'width', v); + dom.setAttrib(n, 'width'); + } + + if (v = dom.getAttrib(n, 'height')) { + dom.setStyle(n, 'height', v); + dom.setAttrib(n, 'height'); + } + }); + }); + } + + ed.onInit.add(function() { + if (ed && ed.plugins.contextmenu) { + ed.plugins.contextmenu.onContextMenu.add(function(th, m, e) { + var sm, se = ed.selection, el = se.getNode() || ed.getBody(); + + if (ed.dom.getParent(e, 'td') || ed.dom.getParent(e, 'th')) { + m.removeAll(); + + if (el.nodeName == 'A' && !ed.dom.getAttrib(el, 'name')) { + m.add({title : 'advanced.link_desc', icon : 'link', cmd : ed.plugins.advlink ? 'mceAdvLink' : 'mceLink', ui : true}); + m.add({title : 'advanced.unlink_desc', icon : 'unlink', cmd : 'UnLink'}); + m.addSeparator(); + } + + if (el.nodeName == 'IMG' && el.className.indexOf('mceItem') == -1) { + m.add({title : 'advanced.image_desc', icon : 'image', cmd : ed.plugins.advimage ? 'mceAdvImage' : 'mceImage', ui : true}); + m.addSeparator(); + } + + m.add({title : 'table.desc', icon : 'table', cmd : 'mceInsertTable', ui : true, value : {action : 'insert'}}); + m.add({title : 'table.props_desc', icon : 'table_props', cmd : 'mceInsertTable', ui : true}); + m.add({title : 'table.del', icon : 'delete_table', cmd : 'mceTableDelete', ui : true}); + m.addSeparator(); + + // Cell menu + sm = m.addMenu({title : 'table.cell'}); + sm.add({title : 'table.cell_desc', icon : 'cell_props', cmd : 'mceTableCellProps', ui : true}); + sm.add({title : 'table.split_cells_desc', icon : 'split_cells', cmd : 'mceTableSplitCells', ui : true}); + sm.add({title : 'table.merge_cells_desc', icon : 'merge_cells', cmd : 'mceTableMergeCells', ui : true}); + + // Row menu + sm = m.addMenu({title : 'table.row'}); + sm.add({title : 'table.row_desc', icon : 'row_props', cmd : 'mceTableRowProps', ui : true}); + sm.add({title : 'table.row_before_desc', icon : 'row_before', cmd : 'mceTableInsertRowBefore'}); + sm.add({title : 'table.row_after_desc', icon : 'row_after', cmd : 'mceTableInsertRowAfter'}); + sm.add({title : 'table.delete_row_desc', icon : 'delete_row', cmd : 'mceTableDeleteRow'}); + sm.addSeparator(); + sm.add({title : 'table.cut_row_desc', icon : 'cut', cmd : 'mceTableCutRow'}); + sm.add({title : 'table.copy_row_desc', icon : 'copy', cmd : 'mceTableCopyRow'}); + sm.add({title : 'table.paste_row_before_desc', icon : 'paste', cmd : 'mceTablePasteRowBefore'}); + sm.add({title : 'table.paste_row_after_desc', icon : 'paste', cmd : 'mceTablePasteRowAfter'}); + + // Column menu + sm = m.addMenu({title : 'table.col'}); + sm.add({title : 'table.col_before_desc', icon : 'col_before', cmd : 'mceTableInsertColBefore'}); + sm.add({title : 'table.col_after_desc', icon : 'col_after', cmd : 'mceTableInsertColAfter'}); + sm.add({title : 'table.delete_col_desc', icon : 'delete_col', cmd : 'mceTableDeleteCol'}); + } else + m.add({title : 'table.desc', icon : 'table', cmd : 'mceInsertTable', ui : true}); + }); + } + }); + + // Add undo level when new rows are created using the tab key + ed.onKeyDown.add(function(ed, e) { + if (e.keyCode == 9 && ed.dom.getParent(ed.selection.getNode(), 'TABLE')) { + if (!tinymce.isGecko && !tinymce.isOpera) { + tinyMCE.execInstanceCommand(ed.editorId, "mceTableMoveToNextRow", true); + return tinymce.dom.Event.cancel(e); + } + + ed.undoManager.add(); + } + }); + + // Select whole table is a table border is clicked + if (!tinymce.isIE) { + if (ed.getParam('table_selection', true)) { + ed.onClick.add(function(ed, e) { + e = e.target; + + if (e.nodeName === 'TABLE') + ed.selection.select(e); + }); + } + } + + ed.onNodeChange.add(function(ed, cm, n) { + var p = ed.dom.getParent(n, 'td,th,caption'); + + cm.setActive('table', n.nodeName === 'TABLE' || !!p); + if (p && p.nodeName === 'CAPTION') + p = null; + + cm.setDisabled('delete_table', !p); + cm.setDisabled('delete_col', !p); + cm.setDisabled('delete_table', !p); + cm.setDisabled('delete_row', !p); + cm.setDisabled('col_after', !p); + cm.setDisabled('col_before', !p); + cm.setDisabled('row_after', !p); + cm.setDisabled('row_before', !p); + cm.setDisabled('row_props', !p); + cm.setDisabled('cell_props', !p); + cm.setDisabled('split_cells', !p || (parseInt(ed.dom.getAttrib(p, 'colspan', '1')) < 2 && parseInt(ed.dom.getAttrib(p, 'rowspan', '1')) < 2)); + cm.setDisabled('merge_cells', !p); + }); + + // Padd empty table cells + if (!tinymce.isIE) { + ed.onBeforeSetContent.add(function(ed, o) { + if (o.initial) + o.content = o.content.replace(/<(td|th)([^>]+|)>\s*<\/(td|th)>/g, tinymce.isOpera ? '<$1$2> ' : '<$1$2>
    '); + }); + } + }, + + execCommand : function(cmd, ui, val) { + var ed = this.editor, b; + + // Is table command + switch (cmd) { + case "mceTableMoveToNextRow": + case "mceInsertTable": + case "mceTableRowProps": + case "mceTableCellProps": + case "mceTableSplitCells": + case "mceTableMergeCells": + case "mceTableInsertRowBefore": + case "mceTableInsertRowAfter": + case "mceTableDeleteRow": + case "mceTableInsertColBefore": + case "mceTableInsertColAfter": + case "mceTableDeleteCol": + case "mceTableCutRow": + case "mceTableCopyRow": + case "mceTablePasteRowBefore": + case "mceTablePasteRowAfter": + case "mceTableDelete": + ed.execCommand('mceBeginUndoLevel'); + this._doExecCommand(cmd, ui, val); + ed.execCommand('mceEndUndoLevel'); + + return true; + } + + // Pass to next handler in chain + return false; + }, + + getInfo : function() { + return { + longname : 'Tables', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/table', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; + }, + + // Private plugin internal methods + + /** + * Executes the table commands. + */ + _doExecCommand : function(command, user_interface, value) { + var inst = this.editor, ed = inst, url = this.url; + var focusElm = inst.selection.getNode(); + var trElm = inst.dom.getParent(focusElm, "tr"); + var tdElm = inst.dom.getParent(focusElm, "td,th"); + var tableElm = inst.dom.getParent(focusElm, "table"); + var doc = inst.contentWindow.document; + var tableBorder = tableElm ? tableElm.getAttribute("border") : ""; + + // Get first TD if no TD found + if (trElm && tdElm == null) + tdElm = trElm.cells[0]; + + function inArray(ar, v) { + for (var i=0; i 0 && inArray(ar[i], v)) + return true; + + // Found value + if (ar[i] == v) + return true; + } + + return false; + } + + function select(dx, dy) { + var td; + + grid = getTableGrid(tableElm); + dx = dx || 0; + dy = dy || 0; + dx = Math.max(cpos.cellindex + dx, 0); + dy = Math.max(cpos.rowindex + dy, 0); + + // Recalculate grid and select + inst.execCommand('mceRepaint'); + td = getCell(grid, dy, dx); + + if (td) { + inst.selection.select(td.firstChild || td); + inst.selection.collapse(1); + } + }; + + function makeTD() { + var newTD = doc.createElement("td"); + + if (!tinymce.isIE) + newTD.innerHTML = '
    '; + } + + function getColRowSpan(td) { + var colspan = inst.dom.getAttrib(td, "colspan"); + var rowspan = inst.dom.getAttrib(td, "rowspan"); + + colspan = colspan == "" ? 1 : parseInt(colspan); + rowspan = rowspan == "" ? 1 : parseInt(rowspan); + + return {colspan : colspan, rowspan : rowspan}; + } + + function getCellPos(grid, td) { + var x, y; + + for (y=0; y 1) { // Remove due to colspan + for (var i=x; i 1) + td.rowSpan = sd.rowspan + 1; + + lastElm = td; + } + + deleteMarked(tableElm); + } + } + + function prevElm(node, name) { + while ((node = node.previousSibling) != null) { + if (node.nodeName == name) + return node; + } + + return null; + } + + function nextElm(node, names) { + var namesAr = names.split(','); + + while ((node = node.nextSibling) != null) { + for (var i=0; i 1) { + do { + var nexttd = nextElm(td, "TD,TH"); + + if (td._delete) + td.parentNode.removeChild(td); + } while ((td = nexttd) != null); + } + } while ((tr = next) != null); + } + + function addRows(td_elm, tr_elm, rowspan) { + // Add rows + td_elm.rowSpan = 1; + var trNext = nextElm(tr_elm, "TR"); + for (var i=1; i 1) { + var newTD = cells[x].cloneNode(true); + var sd = getColRowSpan(cells[x]); + + newTD.rowSpan = sd.rowspan - 1; + + var nextTD = nextTR.cells[x]; + + if (nextTD == null) + nextTR.appendChild(newTD); + else + nextTR.insertBefore(newTD, nextTD); + } + } + + // Delete cells + var lastTDElm = null; + for (var x=0; tdElm = getCell(grid, cpos.rowindex, x); x++) { + if (tdElm != lastTDElm) { + var sd = getColRowSpan(tdElm); + + if (sd.rowspan > 1) { + tdElm.rowSpan = sd.rowspan - 1; + } else { + trElm = tdElm.parentNode; + + if (trElm.parentNode) + trElm._delete = true; + } + + lastTDElm = tdElm; + } + } + + deleteMarked(tableElm); + + select(0, -1); + break; + + case "mceTableInsertColBefore": + if (!trElm || !tdElm) + return true; + + var grid = getTableGrid(inst.dom.getParent(tableElm, "table")); + var cpos = getCellPos(grid, tdElm); + var lastTDElm = null; + + for (var y=0; tdElm = getCell(grid, y, cpos.cellindex); y++) { + if (tdElm != lastTDElm) { + var sd = getColRowSpan(tdElm); + + if (sd['colspan'] == 1) { + var newTD = doc.createElement(tdElm.nodeName); + + if (!tinymce.isIE) + newTD.innerHTML = '
    '; + + newTD.rowSpan = tdElm.rowSpan; + + tdElm.parentNode.insertBefore(newTD, tdElm); + } else + tdElm.colSpan++; + + lastTDElm = tdElm; + } + } + + select(); + break; + + case "mceTableInsertColAfter": + if (!trElm || !tdElm) + return true; + + var grid = getTableGrid(inst.dom.getParent(tableElm, "table")); + var cpos = getCellPos(grid, tdElm); + var lastTDElm = null; + + for (var y=0; tdElm = getCell(grid, y, cpos.cellindex); y++) { + if (tdElm != lastTDElm) { + var sd = getColRowSpan(tdElm); + + if (sd['colspan'] == 1) { + var newTD = doc.createElement(tdElm.nodeName); + + if (!tinymce.isIE) + newTD.innerHTML = '
    '; + + newTD.rowSpan = tdElm.rowSpan; + + var nextTD = nextElm(tdElm, "TD,TH"); + if (nextTD == null) + tdElm.parentNode.appendChild(newTD); + else + nextTD.parentNode.insertBefore(newTD, nextTD); + } else + tdElm.colSpan++; + + lastTDElm = tdElm; + } + } + + select(1); + break; + + case "mceTableDeleteCol": + if (!trElm || !tdElm) + return true; + + var grid = getTableGrid(tableElm); + var cpos = getCellPos(grid, tdElm); + var lastTDElm = null; + + // Only one col, remove whole table + if ((grid.length > 1 && grid[0].length <= 1) && tableElm.nodeName == 'TBODY') { + inst.dom.remove(inst.dom.getParent(tableElm, "table")); + return true; + } + + // Delete cells + for (var y=0; tdElm = getCell(grid, y, cpos.cellindex); y++) { + if (tdElm != lastTDElm) { + var sd = getColRowSpan(tdElm); + + if (sd['colspan'] > 1) + tdElm.colSpan = sd['colspan'] - 1; + else { + if (tdElm.parentNode) + tdElm.parentNode.removeChild(tdElm); + } + + lastTDElm = tdElm; + } + } + + select(-1); + break; + + case "mceTableSplitCells": + if (!trElm || !tdElm) + return true; + + var spandata = getColRowSpan(tdElm); + + var colspan = spandata["colspan"]; + var rowspan = spandata["rowspan"]; + + // Needs splitting + if (colspan > 1 || rowspan > 1) { + // Generate cols + tdElm.colSpan = 1; + for (var i=1; i 1) + addRows(newTD, trElm, rowspan); + } + + addRows(tdElm, trElm, rowspan); + } + + // Apply visual aids + tableElm = inst.dom.getParent(inst.selection.getNode(), "table"); + break; + + case "mceTableMergeCells": + var rows = []; + var sel = inst.selection.getSel(); + var grid = getTableGrid(tableElm); + + if (tinymce.isIE || sel.rangeCount == 1) { + if (user_interface) { + // Setup template + var sp = getColRowSpan(tdElm); + + inst.windowManager.open({ + url : url + '/merge_cells.htm', + width : 240 + parseInt(inst.getLang('table.merge_cells_delta_width', 0)), + height : 110 + parseInt(inst.getLang('table.merge_cells_delta_height', 0)), + inline : 1 + }, { + action : "update", + numcols : sp.colspan, + numrows : sp.rowspan, + plugin_url : url + }); + + return true; + } else { + var numRows = parseInt(value['numrows']); + var numCols = parseInt(value['numcols']); + var cpos = getCellPos(grid, tdElm); + + if (("" + numRows) == "NaN") + numRows = 1; + + if (("" + numCols) == "NaN") + numCols = 1; + + // Get rows and cells + var tRows = tableElm.rows; + for (var y=cpos.rowindex; y 0) + rows[rows.length] = rowCells; + + var td = getCell(grid, cpos.rowindex, cpos.cellindex); + each(ed.dom.select('br', td), function(e, i) { + if (i > 0 && ed.dom.getAttrib('mce_bogus')) + ed.dom.remove(e); + }); + } + + //return true; + } + } else { + var cells = []; + var sel = inst.selection.getSel(); + var lastTR = null; + var curRow = null; + var x1 = -1, y1 = -1, x2, y2; + + // Only one cell selected, whats the point? + if (sel.rangeCount < 2) + return true; + + // Get all selected cells + for (var i=0; i 0) + rows[rows.length] = rowCells; + } + + // Find selected cells in grid and box + var curRow = []; + var lastTR = null; + for (var y=0; y colSpan) + colSpan = rowColSpan; + + lastRowSpan = -1; + } + + // Validate vertical and get total rowspan + var lastColSpan = -1; + for (var x=0; x rowSpan) + rowSpan = colRowSpan; + + lastColSpan = -1; + } + + // Setup td + tdElm = rows[0][0]; + tdElm.rowSpan = rowSpan; + tdElm.colSpan = colSpan; + + // Merge cells + for (var y=0; y 0)) + tdElm.innerHTML += html; + + // Not current cell + if (rows[y][x] != tdElm && !rows[y][x]._deleted) { + var cpos = getCellPos(grid, rows[y][x]); + var tr = rows[y][x].parentNode; + + tr.removeChild(rows[y][x]); + rows[y][x]._deleted = true; + + // Empty TR, remove it + if (!tr.hasChildNodes()) { + tr.parentNode.removeChild(tr); + + var lastCell = null; + for (var x=0; cellElm = getCell(grid, cpos.rowindex, x); x++) { + if (cellElm != lastCell && cellElm.rowSpan > 1) + cellElm.rowSpan--; + + lastCell = cellElm; + } + + if (tdElm.rowSpan > 1) + tdElm.rowSpan--; + } + } + } + } + + // Remove all but one bogus br + each(ed.dom.select('br', tdElm), function(e, i) { + if (i > 0 && ed.dom.getAttrib(e, 'mce_bogus')) + ed.dom.remove(e); + }); + + break; + } + + tableElm = inst.dom.getParent(inst.selection.getNode(), "table"); + inst.addVisual(tableElm); + inst.nodeChanged(); + } + + return true; + } + + // Pass to next handler in chain + return false; + } + }); + + // Register plugin + tinymce.PluginManager.add('table', tinymce.plugins.TablePlugin); +})(); \ No newline at end of file diff --git a/include/javascript/tiny_mce/plugins/table/js/cell.js b/include/javascript/tiny_mce/plugins/table/js/cell.js new file mode 100755 index 00000000..07320ac2 --- /dev/null +++ b/include/javascript/tiny_mce/plugins/table/js/cell.js @@ -0,0 +1,269 @@ +tinyMCEPopup.requireLangPack(); + +var ed; + +function init() { + ed = tinyMCEPopup.editor; + tinyMCEPopup.resizeToInnerSize(); + + document.getElementById('backgroundimagebrowsercontainer').innerHTML = getBrowserHTML('backgroundimagebrowser','backgroundimage','image','table'); + document.getElementById('bordercolor_pickcontainer').innerHTML = getColorPickerHTML('bordercolor_pick','bordercolor'); + document.getElementById('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor') + + var inst = ed; + var tdElm = ed.dom.getParent(ed.selection.getNode(), "td,th"); + var formObj = document.forms[0]; + var st = ed.dom.parseStyle(ed.dom.getAttrib(tdElm, "style")); + + // Get table cell data + var celltype = tdElm.nodeName.toLowerCase(); + var align = ed.dom.getAttrib(tdElm, 'align'); + var valign = ed.dom.getAttrib(tdElm, 'valign'); + var width = trimSize(getStyle(tdElm, 'width', 'width')); + var height = trimSize(getStyle(tdElm, 'height', 'height')); + var bordercolor = convertRGBToHex(getStyle(tdElm, 'bordercolor', 'borderLeftColor')); + var bgcolor = convertRGBToHex(getStyle(tdElm, 'bgcolor', 'backgroundColor')); + var className = ed.dom.getAttrib(tdElm, 'class'); + var backgroundimage = getStyle(tdElm, 'background', 'backgroundImage').replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1");; + var id = ed.dom.getAttrib(tdElm, 'id'); + var lang = ed.dom.getAttrib(tdElm, 'lang'); + var dir = ed.dom.getAttrib(tdElm, 'dir'); + var scope = ed.dom.getAttrib(tdElm, 'scope'); + + // Setup form + addClassesToList('class', 'table_cell_styles'); + TinyMCE_EditableSelects.init(); + + formObj.bordercolor.value = bordercolor; + formObj.bgcolor.value = bgcolor; + formObj.backgroundimage.value = backgroundimage; + formObj.width.value = width; + formObj.height.value = height; + formObj.id.value = id; + formObj.lang.value = lang; + formObj.style.value = ed.dom.serializeStyle(st); + selectByValue(formObj, 'align', align); + selectByValue(formObj, 'valign', valign); + selectByValue(formObj, 'class', className, true, true); + selectByValue(formObj, 'celltype', celltype); + selectByValue(formObj, 'dir', dir); + selectByValue(formObj, 'scope', scope); + + // Resize some elements + if (isVisible('backgroundimagebrowser')) + document.getElementById('backgroundimage').style.width = '180px'; + + updateColor('bordercolor_pick', 'bordercolor'); + updateColor('bgcolor_pick', 'bgcolor'); +} + +function updateAction() { + var el, inst = ed, tdElm, trElm, tableElm, formObj = document.forms[0]; + + tinyMCEPopup.restoreSelection(); + el = ed.selection.getNode(); + tdElm = ed.dom.getParent(el, "td,th"); + trElm = ed.dom.getParent(el, "tr"); + tableElm = ed.dom.getParent(el, "table"); + + ed.execCommand('mceBeginUndoLevel'); + + switch (getSelectValue(formObj, 'action')) { + case "cell": + var celltype = getSelectValue(formObj, 'celltype'); + var scope = getSelectValue(formObj, 'scope'); + + function doUpdate(s) { + if (s) { + updateCell(tdElm); + + ed.addVisual(); + ed.nodeChanged(); + inst.execCommand('mceEndUndoLevel'); + tinyMCEPopup.close(); + } + }; + + if (ed.getParam("accessibility_warnings", 1)) { + if (celltype == "th" && scope == "") + tinyMCEPopup.confirm(ed.getLang('table_dlg.missing_scope', '', true), doUpdate); + else + doUpdate(1); + + return; + } + + updateCell(tdElm); + break; + + case "row": + var cell = trElm.firstChild; + + if (cell.nodeName != "TD" && cell.nodeName != "TH") + cell = nextCell(cell); + + do { + cell = updateCell(cell, true); + } while ((cell = nextCell(cell)) != null); + + break; + + case "all": + var rows = tableElm.getElementsByTagName("tr"); + + for (var i=0; i colLimit) { + tinyMCEPopup.alert(inst.getLang('table_dlg.col_limit').replace(/\{\$cols\}/g, colLimit)); + return false; + } else if (rowLimit && rows > rowLimit) { + tinyMCEPopup.alert(inst.getLang('table_dlg.row_limit').replace(/\{\$rows\}/g, rowLimit)); + return false; + } else if (cellLimit && cols * rows > cellLimit) { + tinyMCEPopup.alert(inst.getLang('table_dlg.cell_limit').replace(/\{\$cells\}/g, cellLimit)); + return false; + } + + // Update table + if (action == "update") { + inst.execCommand('mceBeginUndoLevel'); + + dom.setAttrib(elm, 'cellPadding', cellpadding, true); + dom.setAttrib(elm, 'cellSpacing', cellspacing, true); + dom.setAttrib(elm, 'border', border); + dom.setAttrib(elm, 'align', align); + dom.setAttrib(elm, 'frame', frame); + dom.setAttrib(elm, 'rules', rules); + dom.setAttrib(elm, 'class', className); + dom.setAttrib(elm, 'style', style); + dom.setAttrib(elm, 'id', id); + dom.setAttrib(elm, 'summary', summary); + dom.setAttrib(elm, 'dir', dir); + dom.setAttrib(elm, 'lang', lang); + + capEl = inst.dom.select('caption', elm)[0]; + + if (capEl && !caption) + capEl.parentNode.removeChild(capEl); + + if (!capEl && caption) { + capEl = elm.ownerDocument.createElement('caption'); + + if (!tinymce.isIE) + capEl.innerHTML = '
    '; + + elm.insertBefore(capEl, elm.firstChild); + } + + if (width && inst.settings.inline_styles) { + dom.setStyle(elm, 'width', width); + dom.setAttrib(elm, 'width', ''); + } else { + dom.setAttrib(elm, 'width', width, true); + dom.setStyle(elm, 'width', ''); + } + + // Remove these since they are not valid XHTML + dom.setAttrib(elm, 'borderColor', ''); + dom.setAttrib(elm, 'bgColor', ''); + dom.setAttrib(elm, 'background', ''); + + if (height && inst.settings.inline_styles) { + dom.setStyle(elm, 'height', height); + dom.setAttrib(elm, 'height', ''); + } else { + dom.setAttrib(elm, 'height', height, true); + dom.setStyle(elm, 'height', ''); + } + + if (background != '') + elm.style.backgroundImage = "url('" + background + "')"; + else + elm.style.backgroundImage = ''; + +/* if (tinyMCEPopup.getParam("inline_styles")) { + if (width != '') + elm.style.width = getCSSSize(width); + }*/ + + if (bordercolor != "") { + elm.style.borderColor = bordercolor; + elm.style.borderStyle = elm.style.borderStyle == "" ? "solid" : elm.style.borderStyle; + elm.style.borderWidth = border == "" ? "1px" : border; + } else + elm.style.borderColor = ''; + + elm.style.backgroundColor = bgcolor; + elm.style.height = getCSSSize(height); + + inst.addVisual(); + + // Fix for stange MSIE align bug + //elm.outerHTML = elm.outerHTML; + + inst.nodeChanged(); + inst.execCommand('mceEndUndoLevel'); + + // Repaint if dimensions changed + if (formObj.width.value != orgTableWidth || formObj.height.value != orgTableHeight) + inst.execCommand('mceRepaint'); + + tinyMCEPopup.close(); + return true; + } + + // Create new table + html += '/g, '>'); + + return ' ' + attrib + '="' + value + '"'; +} + +function init() { + tinyMCEPopup.resizeToInnerSize(); + + document.getElementById('backgroundimagebrowsercontainer').innerHTML = getBrowserHTML('backgroundimagebrowser','backgroundimage','image','table'); + document.getElementById('backgroundimagebrowsercontainer').innerHTML = getBrowserHTML('backgroundimagebrowser','backgroundimage','image','table'); + document.getElementById('bordercolor_pickcontainer').innerHTML = getColorPickerHTML('bordercolor_pick','bordercolor'); + document.getElementById('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor'); + + var cols = 2, rows = 2, border = tinyMCEPopup.getParam('table_default_border', '0'), cellpadding = tinyMCEPopup.getParam('table_default_cellpadding', ''), cellspacing = tinyMCEPopup.getParam('table_default_cellspacing', ''); + var align = "", width = "", height = "", bordercolor = "", bgcolor = "", className = ""; + var id = "", summary = "", style = "", dir = "", lang = "", background = "", bgcolor = "", bordercolor = "", rules, frame; + var inst = tinyMCEPopup.editor, dom = inst.dom; + var formObj = document.forms[0]; + var elm = dom.getParent(inst.selection.getNode(), "table"); + + action = tinyMCEPopup.getWindowArg('action'); + + if (!action) + action = elm ? "update" : "insert"; + + if (elm && action != "insert") { + var rowsAr = elm.rows; + var cols = 0; + for (var i=0; i cols) + cols = rowsAr[i].cells.length; + + cols = cols; + rows = rowsAr.length; + + st = dom.parseStyle(dom.getAttrib(elm, "style")); + border = trimSize(getStyle(elm, 'border', 'borderWidth')); + cellpadding = dom.getAttrib(elm, 'cellpadding', ""); + cellspacing = dom.getAttrib(elm, 'cellspacing', ""); + width = trimSize(getStyle(elm, 'width', 'width')); + height = trimSize(getStyle(elm, 'height', 'height')); + bordercolor = convertRGBToHex(getStyle(elm, 'bordercolor', 'borderLeftColor')); + bgcolor = convertRGBToHex(getStyle(elm, 'bgcolor', 'backgroundColor')); + align = dom.getAttrib(elm, 'align', align); + frame = dom.getAttrib(elm, 'frame'); + rules = dom.getAttrib(elm, 'rules'); + className = tinymce.trim(dom.getAttrib(elm, 'class').replace(/mceItem.+/g, '')); + id = dom.getAttrib(elm, 'id'); + summary = dom.getAttrib(elm, 'summary'); + style = dom.serializeStyle(st); + dir = dom.getAttrib(elm, 'dir'); + lang = dom.getAttrib(elm, 'lang'); + background = getStyle(elm, 'background', 'backgroundImage').replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1"); + formObj.caption.checked = elm.getElementsByTagName('caption').length > 0; + + orgTableWidth = width; + orgTableHeight = height; + + action = "update"; + formObj.insert.value = inst.getLang('update'); + } + + addClassesToList('class', "table_styles"); + TinyMCE_EditableSelects.init(); + + // Update form + selectByValue(formObj, 'align', align); + selectByValue(formObj, 'frame', frame); + selectByValue(formObj, 'rules', rules); + selectByValue(formObj, 'class', className, true, true); + formObj.cols.value = cols; + formObj.rows.value = rows; + formObj.border.value = border; + formObj.cellpadding.value = cellpadding; + formObj.cellspacing.value = cellspacing; + formObj.width.value = width; + formObj.height.value = height; + formObj.bordercolor.value = bordercolor; + formObj.bgcolor.value = bgcolor; + formObj.id.value = id; + formObj.summary.value = summary; + formObj.style.value = style; + formObj.dir.value = dir; + formObj.lang.value = lang; + formObj.backgroundimage.value = background; + + updateColor('bordercolor_pick', 'bordercolor'); + updateColor('bgcolor_pick', 'bgcolor'); + + // Resize some elements + if (isVisible('backgroundimagebrowser')) + document.getElementById('backgroundimage').style.width = '180px'; + + // Disable some fields in update mode + if (action == "update") { + formObj.cols.disabled = true; + formObj.rows.disabled = true; + } +} + +function changedSize() { + var formObj = document.forms[0]; + var st = dom.parseStyle(formObj.style.value); + +/* var width = formObj.width.value; + if (width != "") + st['width'] = tinyMCEPopup.getParam("inline_styles") ? getCSSSize(width) : ""; + else + st['width'] = "";*/ + + var height = formObj.height.value; + if (height != "") + st['height'] = getCSSSize(height); + else + st['height'] = ""; + + formObj.style.value = dom.serializeStyle(st); +} + +function changedBackgroundImage() { + var formObj = document.forms[0]; + var st = dom.parseStyle(formObj.style.value); + + st['background-image'] = "url('" + formObj.backgroundimage.value + "')"; + + formObj.style.value = dom.serializeStyle(st); +} + +function changedBorder() { + var formObj = document.forms[0]; + var st = dom.parseStyle(formObj.style.value); + + // Update border width if the element has a color + if (formObj.border.value != "" && formObj.bordercolor.value != "") + st['border-width'] = formObj.border.value + "px"; + + formObj.style.value = dom.serializeStyle(st); +} + +function changedColor() { + var formObj = document.forms[0]; + var st = dom.parseStyle(formObj.style.value); + + st['background-color'] = formObj.bgcolor.value; + + if (formObj.bordercolor.value != "") { + st['border-color'] = formObj.bordercolor.value; + + // Add border-width if it's missing + if (!st['border-width']) + st['border-width'] = formObj.border.value == "" ? "1px" : formObj.border.value + "px"; + } + + formObj.style.value = dom.serializeStyle(st); +} + +function changedStyle() { + var formObj = document.forms[0]; + var st = dom.parseStyle(formObj.style.value); + + if (st['background-image']) + formObj.backgroundimage.value = st['background-image'].replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1"); + else + formObj.backgroundimage.value = ''; + + if (st['width']) + formObj.width.value = trimSize(st['width']); + + if (st['height']) + formObj.height.value = trimSize(st['height']); + + if (st['background-color']) { + formObj.bgcolor.value = st['background-color']; + updateColor('bgcolor_pick','bgcolor'); + } + + if (st['border-color']) { + formObj.bordercolor.value = st['border-color']; + updateColor('bordercolor_pick','bordercolor'); + } +} + +tinyMCEPopup.onInit.add(init); diff --git a/include/javascript/tiny_mce/plugins/table/langs/en_dlg.js b/include/javascript/tiny_mce/plugins/table/langs/en_dlg.js new file mode 100755 index 00000000..a33c987c --- /dev/null +++ b/include/javascript/tiny_mce/plugins/table/langs/en_dlg.js @@ -0,0 +1,74 @@ +tinyMCE.addI18n('en.table_dlg',{ +general_tab:"General", +advanced_tab:"Advanced", +general_props:"General properties", +advanced_props:"Advanced properties", +rowtype:"Row in table part", +title:"Insert/Modify table", +width:"Width", +height:"Height", +cols:"Cols", +rows:"Rows", +cellspacing:"Cellspacing", +cellpadding:"Cellpadding", +border:"Border", +align:"Alignment", +align_default:"Default", +align_left:"Left", +align_right:"Right", +align_middle:"Center", +row_title:"Table row properties", +cell_title:"Table cell properties", +cell_type:"Cell type", +valign:"Vertical alignment", +align_top:"Top", +align_bottom:"Bottom", +bordercolor:"Border color", +bgcolor:"Background color", +merge_cells_title:"Merge table cells", +id:"Id", +style:"Style", +langdir:"Language direction", +langcode:"Language code", +mime:"Target MIME type", +ltr:"Left to right", +rtl:"Right to left", +bgimage:"Background image", +summary:"Summary", +td:"Data", +th:"Header", +cell_cell:"Update current cell", +cell_row:"Update all cells in row", +cell_all:"Update all cells in table", +row_row:"Update current row", +row_odd:"Update odd rows in table", +row_even:"Update even rows in table", +row_all:"Update all rows in table", +thead:"Table Head", +tbody:"Table Body", +tfoot:"Table Foot", +scope:"Scope", +rowgroup:"Row Group", +colgroup:"Col Group", +col_limit:"You've exceeded the maximum number of columns of {$cols}.", +row_limit:"You've exceeded the maximum number of rows of {$rows}.", +cell_limit:"You've exceeded the maximum number of cells of {$cells}.", +missing_scope:"Are you sure you want to continue without specifying a scope for this table header cell. Without it, it may be difficult for some users with disabilities to understand the content or data displayed of the table.", +caption:"Table caption", +frame:"Frame", +frame_none:"none", +frame_groups:"groups", +frame_rows:"rows", +frame_cols:"cols", +frame_all:"all", +rules:"Rules", +rules_void:"void", +rules_above:"above", +rules_below:"below", +rules_hsides:"hsides", +rules_lhs:"lhs", +rules_rhs:"rhs", +rules_vsides:"vsides", +rules_box:"box", +rules_border:"border" +}); \ No newline at end of file diff --git a/include/javascript/tiny_mce/plugins/template/editor_plugin.js b/include/javascript/tiny_mce/plugins/template/editor_plugin.js new file mode 100755 index 00000000..0f7fb015 --- /dev/null +++ b/include/javascript/tiny_mce/plugins/template/editor_plugin.js @@ -0,0 +1 @@ +(function(){var each=tinymce.each;tinymce.create('tinymce.plugins.TemplatePlugin',{init:function(ed,url){var t=this;t.editor=ed;ed.addCommand('mceTemplate',function(ui){ed.windowManager.open({file:url+'/template.htm',width:ed.getParam('template_popup_width',750),height:ed.getParam('template_popup_height',600),inline:1},{plugin_url:url});});ed.addCommand('mceInsertTemplate',t._insertTemplate,t);ed.addButton('template',{title:'template.desc',cmd:'mceTemplate'});ed.onPreProcess.add(function(ed,o){var dom=ed.dom;each(dom.select('div',o.node),function(e){if(dom.hasClass(e,'mceTmpl')){each(dom.select('*',e),function(e){if(dom.hasClass(e,ed.getParam('template_mdate_classes','mdate').replace(/\s+/g,'|')))e.innerHTML=t._getDateTime(new Date(),ed.getParam("template_mdate_format",ed.getLang("template.mdate_format")));});t._replaceVals(e);}});});},getInfo:function(){return{longname:'Template plugin',author:'Moxiecode Systems AB',authorurl:'http://www.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/template',version:tinymce.majorVersion+"."+tinymce.minorVersion};},_insertTemplate:function(ui,v){var t=this,ed=t.editor,h,el,dom=ed.dom,sel=ed.selection.getContent();h=v.content;each(t.editor.getParam('template_replace_values'),function(v,k){if(typeof(v)!='function')h=h.replace(new RegExp('\\{\\$'+k+'\\}','g'),v);});el=dom.create('div',null,h);n=dom.select('.mceTmpl',el);if(n&&n.length>0){el=dom.create('div',null);el.appendChild(n[0].cloneNode(true));}function hasClass(n,c){return new RegExp('\\b'+c+'\\b','g').test(n.className);};each(dom.select('*',el),function(n){if(hasClass(n,ed.getParam('template_cdate_classes','cdate').replace(/\s+/g,'|')))n.innerHTML=t._getDateTime(new Date(),ed.getParam("template_cdate_format",ed.getLang("template.cdate_format")));if(hasClass(n,ed.getParam('template_mdate_classes','mdate').replace(/\s+/g,'|')))n.innerHTML=t._getDateTime(new Date(),ed.getParam("template_mdate_format",ed.getLang("template.mdate_format")));if(hasClass(n,ed.getParam('template_selected_content_classes','selcontent').replace(/\s+/g,'|')))n.innerHTML=sel;});t._replaceVals(el);ed.execCommand('mceInsertContent',false,el.innerHTML);ed.addVisual();},_replaceVals:function(e){var dom=this.editor.dom,vl=this.editor.getParam('template_replace_values');each(dom.select('*',e),function(e){each(vl,function(v,k){if(dom.hasClass(e,k)){if(typeof(vl[k])=='function')vl[k](e);}});});},_getDateTime:function(d,fmt){if(!fmt)return"";function addZeros(value,len){var i;value=""+value;if(value.length 0) { + el = dom.create('div', null); + el.appendChild(n[0].cloneNode(true)); + } + + function hasClass(n, c) { + return new RegExp('\\b' + c + '\\b', 'g').test(n.className); + }; + + each(dom.select('*', el), function(n) { + // Replace cdate + if (hasClass(n, ed.getParam('template_cdate_classes', 'cdate').replace(/\s+/g, '|'))) + n.innerHTML = t._getDateTime(new Date(), ed.getParam("template_cdate_format", ed.getLang("template.cdate_format"))); + + // Replace mdate + if (hasClass(n, ed.getParam('template_mdate_classes', 'mdate').replace(/\s+/g, '|'))) + n.innerHTML = t._getDateTime(new Date(), ed.getParam("template_mdate_format", ed.getLang("template.mdate_format"))); + + // Replace selection + if (hasClass(n, ed.getParam('template_selected_content_classes', 'selcontent').replace(/\s+/g, '|'))) + n.innerHTML = sel; + }); + + t._replaceVals(el); + + ed.execCommand('mceInsertContent', false, el.innerHTML); + ed.addVisual(); + }, + + _replaceVals : function(e) { + var dom = this.editor.dom, vl = this.editor.getParam('template_replace_values'); + + each(dom.select('*', e), function(e) { + each(vl, function(v, k) { + if (dom.hasClass(e, k)) { + if (typeof(vl[k]) == 'function') + vl[k](e); + } + }); + }); + }, + + _getDateTime : function(d, fmt) { + if (!fmt) + return ""; + + function addZeros(value, len) { + var i; + + value = "" + value; + + if (value.length < len) { + for (i=0; i<(len-value.length); i++) + value = "0" + value; + } + + return value; + } + + fmt = fmt.replace("%D", "%m/%d/%y"); + fmt = fmt.replace("%r", "%I:%M:%S %p"); + fmt = fmt.replace("%Y", "" + d.getFullYear()); + fmt = fmt.replace("%y", "" + d.getYear()); + fmt = fmt.replace("%m", addZeros(d.getMonth()+1, 2)); + fmt = fmt.replace("%d", addZeros(d.getDate(), 2)); + fmt = fmt.replace("%H", "" + addZeros(d.getHours(), 2)); + fmt = fmt.replace("%M", "" + addZeros(d.getMinutes(), 2)); + fmt = fmt.replace("%S", "" + addZeros(d.getSeconds(), 2)); + fmt = fmt.replace("%I", "" + ((d.getHours() + 11) % 12 + 1)); + fmt = fmt.replace("%p", "" + (d.getHours() < 12 ? "AM" : "PM")); + fmt = fmt.replace("%B", "" + tinyMCE.getLang("template_months_long").split(',')[d.getMonth()]); + fmt = fmt.replace("%b", "" + tinyMCE.getLang("template_months_short").split(',')[d.getMonth()]); + fmt = fmt.replace("%A", "" + tinyMCE.getLang("template_day_long").split(',')[d.getDay()]); + fmt = fmt.replace("%a", "" + tinyMCE.getLang("template_day_short").split(',')[d.getDay()]); + fmt = fmt.replace("%%", "%"); + + return fmt; + } + }); + + // Register plugin + tinymce.PluginManager.add('template', tinymce.plugins.TemplatePlugin); +})(); \ No newline at end of file diff --git a/include/javascript/tiny_mce/plugins/template/js/template.js b/include/javascript/tiny_mce/plugins/template/js/template.js new file mode 100755 index 00000000..7eab2ebb --- /dev/null +++ b/include/javascript/tiny_mce/plugins/template/js/template.js @@ -0,0 +1,106 @@ +tinyMCEPopup.requireLangPack(); + +var TemplateDialog = { + preInit : function() { + var url = tinyMCEPopup.getParam("template_external_list_url"); + + if (url != null) + document.write(''); + }, + + init : function() { + var ed = tinyMCEPopup.editor, tsrc, sel, x, u; + + tsrc = ed.getParam("template_templates", false); + sel = document.getElementById('tpath'); + + // Setup external template list + if (!tsrc && typeof(tinyMCETemplateList) != 'undefined') { + for (x=0, tsrc = []; x'); + }); + }, + + selectTemplate : function(u, ti) { + var d = window.frames['templatesrc'].document, x, tsrc = this.tsrc; + + if (!u) + return; + + d.body.innerHTML = this.templateHTML = this.getFileContents(u); + + for (x=0; x$1
    ');nv=nv.replace(/\u00a0/g,'\u00b7');ed.dom.setOuterHTML(nl[i],nv,d);}}else{nl=tinymce.grep(ed.dom.select('span',b),function(n){return ed.dom.hasClass(n,'mceVisualNbsp');});for(i=0;i$1
    '); + nv = nv.replace(/\u00a0/g, '\u00b7'); + ed.dom.setOuterHTML(nl[i], nv, d); + } + } else { + nl = tinymce.grep(ed.dom.select('span', b), function(n) { + return ed.dom.hasClass(n, 'mceVisualNbsp'); + }); + + for (i=0; i]+)>/gi,'');o.content=o.content.replace(/<\/abbr>/gi,'');}};ed.onBeforeSetContent.add(fix);ed.onPostProcess.add(fix);}ed.onNodeChange.add(function(ed,cm,n,co){n=ed.dom.getParent(n,'CITE,ACRONYM,ABBR,DEL,INS');cm.setDisabled('cite',co);cm.setDisabled('acronym',co);cm.setDisabled('abbr',co);cm.setDisabled('del',co);cm.setDisabled('ins',co);cm.setDisabled('attribs',n&&n.nodeName=='BODY');cm.setActive('cite',0);cm.setActive('acronym',0);cm.setActive('abbr',0);cm.setActive('del',0);cm.setActive('ins',0);if(n){do{cm.setDisabled(n.nodeName.toLowerCase(),0);cm.setActive(n.nodeName.toLowerCase(),1);}while(n=n.parentNode);}});},getInfo:function(){return{longname:'XHTML Xtras Plugin',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/xhtmlxtras',version:tinymce.majorVersion+"."+tinymce.minorVersion};}});tinymce.PluginManager.add('xhtmlxtras',tinymce.plugins.XHTMLXtrasPlugin);})(); \ No newline at end of file diff --git a/include/javascript/tiny_mce/plugins/xhtmlxtras/editor_plugin_src.js b/include/javascript/tiny_mce/plugins/xhtmlxtras/editor_plugin_src.js new file mode 100755 index 00000000..75a26ff1 --- /dev/null +++ b/include/javascript/tiny_mce/plugins/xhtmlxtras/editor_plugin_src.js @@ -0,0 +1,136 @@ +/** + + * + * @author Moxiecode + * @copyright Copyright 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + tinymce.create('tinymce.plugins.XHTMLXtrasPlugin', { + init : function(ed, url) { + // Register commands + ed.addCommand('mceCite', function() { + ed.windowManager.open({ + file : url + '/cite.htm', + width : 350 + parseInt(ed.getLang('xhtmlxtras.cite_delta_width', 0)), + height : 250 + parseInt(ed.getLang('xhtmlxtras.cite_delta_height', 0)), + inline : 1 + }, { + plugin_url : url + }); + }); + + ed.addCommand('mceAcronym', function() { + ed.windowManager.open({ + file : url + '/acronym.htm', + width : 350 + parseInt(ed.getLang('xhtmlxtras.acronym_delta_width', 0)), + height : 250 + parseInt(ed.getLang('xhtmlxtras.acronym_delta_width', 0)), + inline : 1 + }, { + plugin_url : url + }); + }); + + ed.addCommand('mceAbbr', function() { + ed.windowManager.open({ + file : url + '/abbr.htm', + width : 350 + parseInt(ed.getLang('xhtmlxtras.abbr_delta_width', 0)), + height : 250 + parseInt(ed.getLang('xhtmlxtras.abbr_delta_width', 0)), + inline : 1 + }, { + plugin_url : url + }); + }); + + ed.addCommand('mceDel', function() { + ed.windowManager.open({ + file : url + '/del.htm', + width : 340 + parseInt(ed.getLang('xhtmlxtras.del_delta_width', 0)), + height : 310 + parseInt(ed.getLang('xhtmlxtras.del_delta_width', 0)), + inline : 1 + }, { + plugin_url : url + }); + }); + + ed.addCommand('mceIns', function() { + ed.windowManager.open({ + file : url + '/ins.htm', + width : 340 + parseInt(ed.getLang('xhtmlxtras.ins_delta_width', 0)), + height : 310 + parseInt(ed.getLang('xhtmlxtras.ins_delta_width', 0)), + inline : 1 + }, { + plugin_url : url + }); + }); + + ed.addCommand('mceAttributes', function() { + ed.windowManager.open({ + file : url + '/attributes.htm', + width : 380, + height : 370, + inline : 1 + }, { + plugin_url : url + }); + }); + + // Register buttons + ed.addButton('cite', {title : 'xhtmlxtras.cite_desc', cmd : 'mceCite'}); + ed.addButton('acronym', {title : 'xhtmlxtras.acronym_desc', cmd : 'mceAcronym'}); + ed.addButton('abbr', {title : 'xhtmlxtras.abbr_desc', cmd : 'mceAbbr'}); + ed.addButton('del', {title : 'xhtmlxtras.del_desc', cmd : 'mceDel'}); + ed.addButton('ins', {title : 'xhtmlxtras.ins_desc', cmd : 'mceIns'}); + ed.addButton('attribs', {title : 'xhtmlxtras.attribs_desc', cmd : 'mceAttributes'}); + + if (tinymce.isIE) { + function fix(ed, o) { + if (o.set) { + o.content = o.content.replace(/]+)>/gi, ''); + o.content = o.content.replace(/<\/abbr>/gi, ''); + } + }; + + ed.onBeforeSetContent.add(fix); + ed.onPostProcess.add(fix); + } + + ed.onNodeChange.add(function(ed, cm, n, co) { + n = ed.dom.getParent(n, 'CITE,ACRONYM,ABBR,DEL,INS'); + + cm.setDisabled('cite', co); + cm.setDisabled('acronym', co); + cm.setDisabled('abbr', co); + cm.setDisabled('del', co); + cm.setDisabled('ins', co); + cm.setDisabled('attribs', n && n.nodeName == 'BODY'); + cm.setActive('cite', 0); + cm.setActive('acronym', 0); + cm.setActive('abbr', 0); + cm.setActive('del', 0); + cm.setActive('ins', 0); + + // Activate all + if (n) { + do { + cm.setDisabled(n.nodeName.toLowerCase(), 0); + cm.setActive(n.nodeName.toLowerCase(), 1); + } while (n = n.parentNode); + } + }); + }, + + getInfo : function() { + return { + longname : 'XHTML Xtras Plugin', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/xhtmlxtras', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; + } + }); + + // Register plugin + tinymce.PluginManager.add('xhtmlxtras', tinymce.plugins.XHTMLXtrasPlugin); +})(); \ No newline at end of file diff --git a/include/javascript/tiny_mce/plugins/xhtmlxtras/js/abbr.js b/include/javascript/tiny_mce/plugins/xhtmlxtras/js/abbr.js new file mode 100755 index 00000000..9630a365 --- /dev/null +++ b/include/javascript/tiny_mce/plugins/xhtmlxtras/js/abbr.js @@ -0,0 +1,25 @@ + /** + + * + * @author Moxiecode - based on work by Andrew Tetlaw + * @copyright Copyright 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +function init() { + SXE.initElementDialog('abbr'); + if (SXE.currentAction == "update") { + SXE.showRemoveButton(); + } +} + +function insertAbbr() { + SXE.insertElement(tinymce.isIE ? 'html:abbr' : 'abbr'); + tinyMCEPopup.close(); +} + +function removeAbbr() { + SXE.removeElement('abbr'); + tinyMCEPopup.close(); +} + +tinyMCEPopup.onInit.add(init); diff --git a/include/javascript/tiny_mce/plugins/xhtmlxtras/js/acronym.js b/include/javascript/tiny_mce/plugins/xhtmlxtras/js/acronym.js new file mode 100755 index 00000000..d4ffbe1b --- /dev/null +++ b/include/javascript/tiny_mce/plugins/xhtmlxtras/js/acronym.js @@ -0,0 +1,25 @@ + /** + + * + * @author Moxiecode - based on work by Andrew Tetlaw + * @copyright Copyright 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +function init() { + SXE.initElementDialog('acronym'); + if (SXE.currentAction == "update") { + SXE.showRemoveButton(); + } +} + +function insertAcronym() { + SXE.insertElement('acronym'); + tinyMCEPopup.close(); +} + +function removeAcronym() { + SXE.removeElement('acronym'); + tinyMCEPopup.close(); +} + +tinyMCEPopup.onInit.add(init); diff --git a/include/javascript/tiny_mce/plugins/xhtmlxtras/js/attributes.js b/include/javascript/tiny_mce/plugins/xhtmlxtras/js/attributes.js new file mode 100755 index 00000000..9971b6a3 --- /dev/null +++ b/include/javascript/tiny_mce/plugins/xhtmlxtras/js/attributes.js @@ -0,0 +1,123 @@ + /** + + * + * @author Moxiecode - based on work by Andrew Tetlaw + * @copyright Copyright 2004-2006, Moxiecode Systems AB, All rights reserved. + */ + +function init() { + tinyMCEPopup.resizeToInnerSize(); + var inst = tinyMCEPopup.editor; + var dom = inst.dom; + var elm = inst.selection.getNode(); + var f = document.forms[0]; + var onclick = dom.getAttrib(elm, 'onclick'); + + setFormValue('title', dom.getAttrib(elm, 'title')); + setFormValue('id', dom.getAttrib(elm, 'id')); + setFormValue('style', dom.getAttrib(elm, "style")); + setFormValue('dir', dom.getAttrib(elm, 'dir')); + setFormValue('lang', dom.getAttrib(elm, 'lang')); + setFormValue('tabindex', dom.getAttrib(elm, 'tabindex', typeof(elm.tabindex) != "undefined" ? elm.tabindex : "")); + setFormValue('accesskey', dom.getAttrib(elm, 'accesskey', typeof(elm.accesskey) != "undefined" ? elm.accesskey : "")); + setFormValue('onfocus', dom.getAttrib(elm, 'onfocus')); + setFormValue('onblur', dom.getAttrib(elm, 'onblur')); + setFormValue('onclick', onclick); + setFormValue('ondblclick', dom.getAttrib(elm, 'ondblclick')); + setFormValue('onmousedown', dom.getAttrib(elm, 'onmousedown')); + setFormValue('onmouseup', dom.getAttrib(elm, 'onmouseup')); + setFormValue('onmouseover', dom.getAttrib(elm, 'onmouseover')); + setFormValue('onmousemove', dom.getAttrib(elm, 'onmousemove')); + setFormValue('onmouseout', dom.getAttrib(elm, 'onmouseout')); + setFormValue('onkeypress', dom.getAttrib(elm, 'onkeypress')); + setFormValue('onkeydown', dom.getAttrib(elm, 'onkeydown')); + setFormValue('onkeyup', dom.getAttrib(elm, 'onkeyup')); + className = dom.getAttrib(elm, 'class'); + + addClassesToList('classlist', 'advlink_styles'); + selectByValue(f, 'classlist', className, true); + + TinyMCE_EditableSelects.init(); +} + +function setFormValue(name, value) { + if(value && document.forms[0].elements[name]){ + document.forms[0].elements[name].value = value; + } +} + +function insertAction() { + var inst = tinyMCEPopup.editor; + var elm = inst.selection.getNode(); + + tinyMCEPopup.execCommand("mceBeginUndoLevel"); + setAllAttribs(elm); + tinyMCEPopup.execCommand("mceEndUndoLevel"); + tinyMCEPopup.close(); +} + +function setAttrib(elm, attrib, value) { + var formObj = document.forms[0]; + var valueElm = formObj.elements[attrib.toLowerCase()]; + var inst = tinyMCEPopup.editor; + var dom = inst.dom; + + if (typeof(value) == "undefined" || value == null) { + value = ""; + + if (valueElm) + value = valueElm.value; + } + + if (value != "") { + dom.setAttrib(elm, attrib.toLowerCase(), value); + + if (attrib == "style") + attrib = "style.cssText"; + + if (attrib.substring(0, 2) == 'on') + value = 'return true;' + value; + + if (attrib == "class") + attrib = "className"; + + elm[attrib]=value; + } else + elm.removeAttribute(attrib); +} + +function setAllAttribs(elm) { + var f = document.forms[0]; + + setAttrib(elm, 'title'); + setAttrib(elm, 'id'); + setAttrib(elm, 'style'); + setAttrib(elm, 'class', getSelectValue(f, 'classlist')); + setAttrib(elm, 'dir'); + setAttrib(elm, 'lang'); + setAttrib(elm, 'tabindex'); + setAttrib(elm, 'accesskey'); + setAttrib(elm, 'onfocus'); + setAttrib(elm, 'onblur'); + setAttrib(elm, 'onclick'); + setAttrib(elm, 'ondblclick'); + setAttrib(elm, 'onmousedown'); + setAttrib(elm, 'onmouseup'); + setAttrib(elm, 'onmouseover'); + setAttrib(elm, 'onmousemove'); + setAttrib(elm, 'onmouseout'); + setAttrib(elm, 'onkeypress'); + setAttrib(elm, 'onkeydown'); + setAttrib(elm, 'onkeyup'); + + // Refresh in old MSIE +// if (tinyMCE.isMSIE5) +// elm.outerHTML = elm.outerHTML; +} + +function insertAttribute() { + tinyMCEPopup.close(); +} + +tinyMCEPopup.onInit.add(init); +tinyMCEPopup.requireLangPack(); diff --git a/include/javascript/tiny_mce/plugins/xhtmlxtras/js/cite.js b/include/javascript/tiny_mce/plugins/xhtmlxtras/js/cite.js new file mode 100755 index 00000000..f764d9b6 --- /dev/null +++ b/include/javascript/tiny_mce/plugins/xhtmlxtras/js/cite.js @@ -0,0 +1,25 @@ + /** + + * + * @author Moxiecode - based on work by Andrew Tetlaw + * @copyright Copyright 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +function init() { + SXE.initElementDialog('cite'); + if (SXE.currentAction == "update") { + SXE.showRemoveButton(); + } +} + +function insertCite() { + SXE.insertElement('cite'); + tinyMCEPopup.close(); +} + +function removeCite() { + SXE.removeElement('cite'); + tinyMCEPopup.close(); +} + +tinyMCEPopup.onInit.add(init); diff --git a/include/javascript/tiny_mce/plugins/xhtmlxtras/js/del.js b/include/javascript/tiny_mce/plugins/xhtmlxtras/js/del.js new file mode 100755 index 00000000..e607a009 --- /dev/null +++ b/include/javascript/tiny_mce/plugins/xhtmlxtras/js/del.js @@ -0,0 +1,60 @@ + /** + + * + * @author Moxiecode - based on work by Andrew Tetlaw + * @copyright Copyright 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +function init() { + SXE.initElementDialog('del'); + if (SXE.currentAction == "update") { + setFormValue('datetime', tinyMCEPopup.editor.dom.getAttrib(SXE.updateElement, 'datetime')); + setFormValue('cite', tinyMCEPopup.editor.dom.getAttrib(SXE.updateElement, 'cite')); + SXE.showRemoveButton(); + } +} + +function setElementAttribs(elm) { + setAllCommonAttribs(elm); + setAttrib(elm, 'datetime'); + setAttrib(elm, 'cite'); +} + +function insertDel() { + var elm = tinyMCEPopup.editor.dom.getParent(SXE.focusElement, 'DEL'); + + tinyMCEPopup.execCommand('mceBeginUndoLevel'); + if (elm == null) { + var s = SXE.inst.selection.getContent(); + if(s.length > 0) { + insertInlineElement('del'); + var elementArray = tinymce.grep(SXE.inst.dom.select('del'), function(n) {return n.id == '#sxe_temp_del#';}); + for (var i=0; i 0) { + tagName = element_name; + + if (tinymce.isIE && element_name.indexOf('html:') == 0) + element_name = element_name.substring(5).toLowerCase(); + + insertInlineElement(element_name); + var elementArray = tinymce.grep(SXE.inst.dom.select(element_name)); + for (var i=0; i -1) ? true : false; +} + +SXE.removeClass = function(elm,cl) { + if(elm.className == null || elm.className == "" || !SXE.containsClass(elm,cl)) { + return true; + } + var classNames = elm.className.split(" "); + var newClassNames = ""; + for (var x = 0, cnl = classNames.length; x < cnl; x++) { + if (classNames[x] != cl) { + newClassNames += (classNames[x] + " "); + } + } + elm.className = newClassNames.substring(0,newClassNames.length-1); //removes extra space at the end +} + +SXE.addClass = function(elm,cl) { + if(!SXE.containsClass(elm,cl)) elm.className ? elm.className += " " + cl : elm.className = cl; + return true; +} + +function insertInlineElement(en) { + var ed = tinyMCEPopup.editor, dom = ed.dom; + + ed.getDoc().execCommand('FontName', false, 'mceinline'); + tinymce.each(dom.select(tinymce.isWebKit ? 'span' : 'font'), function(n) { + if (n.style.fontFamily == 'mceinline' || n.face == 'mceinline') + dom.replace(dom.create(en, {_mce_new : 1}), n, 1); + }); +} diff --git a/include/javascript/tiny_mce/plugins/xhtmlxtras/js/ins.js b/include/javascript/tiny_mce/plugins/xhtmlxtras/js/ins.js new file mode 100755 index 00000000..d518739f --- /dev/null +++ b/include/javascript/tiny_mce/plugins/xhtmlxtras/js/ins.js @@ -0,0 +1,59 @@ + /** + + * + * @author Moxiecode - based on work by Andrew Tetlaw + * @copyright Copyright 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +function init() { + SXE.initElementDialog('ins'); + if (SXE.currentAction == "update") { + setFormValue('datetime', tinyMCEPopup.editor.dom.getAttrib(SXE.updateElement, 'datetime')); + setFormValue('cite', tinyMCEPopup.editor.dom.getAttrib(SXE.updateElement, 'cite')); + SXE.showRemoveButton(); + } +} + +function setElementAttribs(elm) { + setAllCommonAttribs(elm); + setAttrib(elm, 'datetime'); + setAttrib(elm, 'cite'); +} + +function insertIns() { + var elm = tinyMCEPopup.editor.dom.getParent(SXE.focusElement, 'INS'); + tinyMCEPopup.execCommand('mceBeginUndoLevel'); + if (elm == null) { + var s = SXE.inst.selection.getContent(); + if(s.length > 0) { + insertInlineElement('INS'); + var elementArray = tinymce.grep(SXE.inst.dom.select('ins'), function(n) {return n.id == '#sxe_temp_ins#';}); + for (var i=0; i=1&&v<=7){k=v+' ('+t.sizes[v-1]+'pt)';if(ed.settings.convert_fonts_to_spans){cl=s.font_size_classes[v-1];v=s.font_size_style_values[v-1]||(t.sizes[v-1]+'pt');}}if(/\s*\./.test(v))cl=v.replace(/\./g,'');o[k]=cl?{'class':cl}:{fontSize:v};});s.theme_advanced_font_sizes=o;}if((v=s.theme_advanced_path_location)&&v!='none')s.theme_advanced_statusbar_location=s.theme_advanced_path_location;if(s.theme_advanced_statusbar_location=='none')s.theme_advanced_statusbar_location=0;ed.onInit.add(function(){ed.onNodeChange.add(t._nodeChanged,t);if(ed.settings.content_css!==false)ed.dom.loadCSS(ed.baseURI.toAbsolute("themes/advanced/skins/"+ed.settings.skin+"/content.css"));});ed.onSetProgressState.add(function(ed,b,ti){var co,id=ed.id,tb;if(b){t.progressTimer=setTimeout(function(){co=ed.getContainer();co=co.insertBefore(DOM.create('DIV',{style:'position:relative'}),co.firstChild);tb=DOM.get(ed.id+'_tbl');DOM.add(co,'div',{id:id+'_blocker','class':'mceBlocker',style:{width:tb.clientWidth+2,height:tb.clientHeight+2}});DOM.add(co,'div',{id:id+'_progress','class':'mceProgress',style:{left:tb.clientWidth/ 2, top : tb.clientHeight /2}});},ti||0);}else{DOM.remove(id+'_blocker');DOM.remove(id+'_progress');clearTimeout(t.progressTimer);}});DOM.loadCSS(s.editor_css?ed.documentBaseURI.toAbsolute(s.editor_css):url+"/skins/"+ed.settings.skin+"/ui.css");if(s.skin_variant)DOM.loadCSS(url+"/skins/"+ed.settings.skin+"/ui_"+s.skin_variant+".css");},createControl:function(n,cf){var cd,c;if(c=cf.createControl(n))return c;switch(n){case"styleselect":return this._createStyleSelect();case"formatselect":return this._createBlockFormats();case"fontselect":return this._createFontSelect();case"fontsizeselect":return this._createFontSizeSelect();case"forecolor":return this._createForeColorMenu();case"backcolor":return this._createBackColorMenu();}if((cd=this.controls[n]))return cf.createButton(n,{title:"advanced."+cd[0],cmd:cd[1],ui:cd[2],value:cd[3]});},execCommand:function(cmd,ui,val){var f=this['_'+cmd];if(f){f.call(this,ui,val);return true;}return false;},_importClasses:function(e){var ed=this.editor,c=ed.controlManager.get('styleselect');if(c.getLength()==0){each(ed.dom.getClasses(),function(o){c.add(o['class'],o['class']);});}},_createStyleSelect:function(n){var t=this,ed=t.editor,cf=ed.controlManager,c=cf.createListBox('styleselect',{title:'advanced.style_select',onselect:function(v){if(c.selectedValue===v){ed.execCommand('mceSetStyleInfo',0,{command:'removeformat'});c.select();return false;}else ed.execCommand('mceSetCSSClass',0,v);}});if(c){each(ed.getParam('theme_advanced_styles','','hash'),function(v,k){if(v)c.add(t.editor.translate(k),v);});c.onPostRender.add(function(ed,n){if(!c.NativeListBox){Event.add(n.id+'_text','focus',t._importClasses,t);Event.add(n.id+'_text','mousedown',t._importClasses,t);Event.add(n.id+'_open','focus',t._importClasses,t);Event.add(n.id+'_open','mousedown',t._importClasses,t);}else Event.add(n.id,'focus',t._importClasses,t);});}return c;},_createFontSelect:function(){var c,t=this,ed=t.editor;c=ed.controlManager.createListBox('fontselect',{title:'advanced.fontdefault',cmd:'FontName'});if(c){each(ed.getParam('theme_advanced_fonts',t.settings.theme_advanced_fonts,'hash'),function(v,k){c.add(ed.translate(k),v,{style:v.indexOf('dings')==-1?'font-family:'+v:''});});}return c;},_createFontSizeSelect:function(){var t=this,ed=t.editor,c,i=0,cl=[];c=ed.controlManager.createListBox('fontsizeselect',{title:'advanced.font_size',onselect:function(v){if(v.fontSize)ed.execCommand('FontSize',false,v.fontSize);else{each(t.settings.theme_advanced_font_sizes,function(v,k){if(v['class'])cl.push(v['class']);});ed.editorCommands._applyInlineStyle('span',{'class':v['class']},{check_classes:cl});}}});if(c){each(t.settings.theme_advanced_font_sizes,function(v,k){var fz=v.fontSize;if(fz>=1&&fz<=7)fz=t.sizes[parseInt(fz)-1]+'pt';c.add(k,v,{'style':'font-size:'+fz,'class':'mceFontSize'+(i++)+(' '+(v['class']||''))});});}return c;},_createBlockFormats:function(){var c,fmts={p:'advanced.paragraph',address:'advanced.address',pre:'advanced.pre',h1:'advanced.h1',h2:'advanced.h2',h3:'advanced.h3',h4:'advanced.h4',h5:'advanced.h5',h6:'advanced.h6',div:'advanced.div',blockquote:'advanced.blockquote',code:'advanced.code',dt:'advanced.dt',dd:'advanced.dd',samp:'advanced.samp'},t=this;c=t.editor.controlManager.createListBox('formatselect',{title:'advanced.block',cmd:'FormatBlock'});if(c){each(t.editor.getParam('theme_advanced_blockformats',t.settings.theme_advanced_blockformats,'hash'),function(v,k){c.add(t.editor.translate(k!=v?k:fmts[v]),v,{'class':'mce_formatPreview mce_'+v});});}return c;},_createForeColorMenu:function(){var c,t=this,s=t.settings,o={},v;if(s.theme_advanced_more_colors){o.more_colors_func=function(){t._mceColorPicker(0,{color:c.value,func:function(co){c.setColor(co);}});};}if(v=s.theme_advanced_text_colors)o.colors=v;if(s.theme_advanced_default_foreground_color)o.default_color=s.theme_advanced_default_foreground_color;o.title='advanced.forecolor_desc';o.cmd='ForeColor';o.scope=this;c=t.editor.controlManager.createColorSplitButton('forecolor',o);return c;},_createBackColorMenu:function(){var c,t=this,s=t.settings,o={},v;if(s.theme_advanced_more_colors){o.more_colors_func=function(){t._mceColorPicker(0,{color:c.value,func:function(co){c.setColor(co);}});};}if(v=s.theme_advanced_background_colors)o.colors=v;if(s.theme_advanced_default_background_color)o.default_color=s.theme_advanced_default_background_color;o.title='advanced.backcolor_desc';o.cmd='HiliteColor';o.scope=this;c=t.editor.controlManager.createColorSplitButton('backcolor',o);return c;},renderUI:function(o){var n,ic,tb,t=this,ed=t.editor,s=t.settings,sc,p,nl;n=p=DOM.create('span',{id:ed.id+'_parent','class':'mceEditor '+ed.settings.skin+'Skin'+(s.skin_variant?' '+ed.settings.skin+'Skin'+t._ufirst(s.skin_variant):'')});if(!DOM.boxModel)n=DOM.add(n,'div',{'class':'mceOldBoxModel'});n=sc=DOM.add(n,'table',{id:ed.id+'_tbl','class':'mceLayout',cellSpacing:0,cellPadding:0});n=tb=DOM.add(n,'tbody');switch((s.theme_advanced_layout_manager||'').toLowerCase()){case"rowlayout":ic=t._rowLayout(s,tb,o);break;case"customlayout":ic=ed.execCallback("theme_advanced_custom_layout",s,tb,o,p);break;default:ic=t._simpleLayout(s,tb,o,p);}n=o.targetNode;nl=DOM.stdMode?sc.getElementsByTagName('tr'):sc.rows;DOM.addClass(nl[0],'mceFirst');DOM.addClass(nl[nl.length-1],'mceLast');each(DOM.select('tr',tb),function(n){DOM.addClass(n.firstChild,'mceFirst');DOM.addClass(n.childNodes[n.childNodes.length-1],'mceLast');});if(DOM.get(s.theme_advanced_toolbar_container))DOM.get(s.theme_advanced_toolbar_container).appendChild(p);else DOM.insertAfter(p,n);Event.add(ed.id+'_path_row','click',function(e){e=e.target;if(e.nodeName=='A'){t._sel(e.className.replace(/^.*mcePath_([0-9]+).*$/,'$1'));return Event.cancel(e);}});if(!ed.getParam('accessibility_focus')||ed.getParam('tab_focus'))Event.add(DOM.add(p,'a',{href:'#'},''),'focus',function(){tinyMCE.get(ed.id).focus();});if(s.theme_advanced_toolbar_location=='external')o.deltaHeight=0;t.deltaHeight=o.deltaHeight;o.targetNode=null;return{iframeContainer:ic,editorContainer:ed.id+'_parent',sizeContainer:sc,deltaHeight:o.deltaHeight};},getInfo:function(){return{longname:'Advanced theme',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',version:tinymce.majorVersion+"."+tinymce.minorVersion}},resizeBy:function(dw,dh){var e=DOM.get(this.editor.id+'_tbl');this.resizeTo(e.clientWidth+dw,e.clientHeight+dh);},resizeTo:function(w,h){var ed=this.editor,s=ed.settings,e=DOM.get(ed.id+'_tbl'),ifr=DOM.get(ed.id+'_ifr'),dh;w=Math.max(s.theme_advanced_resizing_min_width||100,w);h=Math.max(s.theme_advanced_resizing_min_height||100,h);w=Math.min(s.theme_advanced_resizing_max_width||0xFFFF,w);h=Math.min(s.theme_advanced_resizing_max_height||0xFFFF,h);dh=e.clientHeight-ifr.clientHeight;DOM.setStyle(ifr,'height',h-dh);DOM.setStyles(e,{width:w,height:h});},destroy:function(){var id=this.editor.id;Event.clear(id+'_resize');Event.clear(id+'_path_row');Event.clear(id+'_external_close');},_simpleLayout:function(s,tb,o,p){var t=this,ed=t.editor,lo=s.theme_advanced_toolbar_location,sl=s.theme_advanced_statusbar_location,n,ic,etb,c;if(s.readonly){n=DOM.add(tb,'tr');n=ic=DOM.add(n,'td',{'class':'mceIframeContainer'});return ic;}if(lo=='top')t._addToolbars(tb,o);if(lo=='external'){n=c=DOM.create('div',{style:'position:relative'});n=DOM.add(n,'div',{id:ed.id+'_external','class':'mceExternalToolbar'});DOM.add(n,'a',{id:ed.id+'_external_close',href:'javascript:;','class':'mceExternalClose'});n=DOM.add(n,'table',{id:ed.id+'_tblext',cellSpacing:0,cellPadding:0});etb=DOM.add(n,'tbody');if(p.firstChild.className=='mceOldBoxModel')p.firstChild.appendChild(c);else p.insertBefore(c,p.firstChild);t._addToolbars(etb,o);ed.onMouseUp.add(function(){var e=DOM.get(ed.id+'_external');DOM.show(e);DOM.hide(lastExtID);var f=Event.add(ed.id+'_external_close','click',function(){DOM.hide(ed.id+'_external');Event.remove(ed.id+'_external_close','click',f);});DOM.show(e);DOM.setStyle(e,'top',0-DOM.getRect(ed.id+'_tblext').h-1);DOM.hide(e);DOM.show(e);e.style.filter='';lastExtID=ed.id+'_external';e=null;});}if(sl=='top')t._addStatusBar(tb,o);if(!s.theme_advanced_toolbar_container){n=DOM.add(tb,'tr');n=ic=DOM.add(n,'td',{'class':'mceIframeContainer'});}if(lo=='bottom')t._addToolbars(tb,o);if(sl=='bottom')t._addStatusBar(tb,o);return ic;},_rowLayout:function(s,tb,o){var t=this,ed=t.editor,dc,da,cf=ed.controlManager,n,ic,to,a;dc=s.theme_advanced_containers_default_class||'';da=s.theme_advanced_containers_default_align||'center';each(explode(s.theme_advanced_containers||''),function(c,i){var v=s['theme_advanced_container_'+c]||'';switch(v.toLowerCase()){case'mceeditor':n=DOM.add(tb,'tr');n=ic=DOM.add(n,'td',{'class':'mceIframeContainer'});break;case'mceelementpath':t._addStatusBar(tb,o);break;default:a=(s['theme_advanced_container_'+c+'_align']||da).toLowerCase();a='mce'+t._ufirst(a);n=DOM.add(DOM.add(tb,'tr'),'td',{'class':'mceToolbar '+(s['theme_advanced_container_'+c+'_class']||dc)+' '+a||da});to=cf.createToolbar("toolbar"+i);t._addControls(v,to);DOM.setHTML(n,to.renderHTML());o.deltaHeight-=s.theme_advanced_row_height;}});return ic;},_addControls:function(v,tb){var t=this,s=t.settings,di,cf=t.editor.controlManager;if(s.theme_advanced_disable&&!t._disabled){di={};each(explode(s.theme_advanced_disable),function(v){di[v]=1;});t._disabled=di;}else di=t._disabled;each(explode(v),function(n){var c;if(di&&di[n])return;if(n=='tablecontrols'){each(["table","|","row_props","cell_props","|","row_before","row_after","delete_row","|","col_before","col_after","delete_col","|","split_cells","merge_cells"],function(n){n=t.createControl(n,cf);if(n)tb.add(n);});return;}c=t.createControl(n,cf);if(c)tb.add(c);});},_addToolbars:function(c,o){var t=this,i,tb,ed=t.editor,s=t.settings,v,cf=ed.controlManager,di,n,h=[],a;a=s.theme_advanced_toolbar_align.toLowerCase();a='mce'+t._ufirst(a);n=DOM.add(DOM.add(c,'tr'),'td',{'class':'mceToolbar '+a});if(!ed.getParam('accessibility_focus')||ed.getParam('tab_focus'))h.push(DOM.createHTML('a',{href:'#',onfocus:'tinyMCE.get(\''+ed.id+'\').focus();'},''));h.push(DOM.createHTML('a',{href:'#',accesskey:'q',title:ed.getLang("advanced.toolbar_focus"), tabindex : "-1"},''));for(i=1;(v=s['theme_advanced_buttons'+i]);i++){tb=cf.createToolbar("toolbar"+i,{'class':'mceToolbarRow'+i});if(s['theme_advanced_buttons'+i+'_add'])v+=','+s['theme_advanced_buttons'+i+'_add'];if(s['theme_advanced_buttons'+i+'_add_before'])v=s['theme_advanced_buttons'+i+'_add_before']+','+v;t._addControls(v,tb);h.push(tb.renderHTML());o.deltaHeight-=s.theme_advanced_row_height;}h.push(DOM.createHTML('a',{href:'#',accesskey:'z',title:ed.getLang("advanced.toolbar_focus"),onfocus:'tinyMCE.getInstanceById(\''+ed.id+'\').focus();', tabindex : "-1"},''));DOM.setHTML(n,h.join(''));},_addStatusBar:function(tb,o){var n,t=this,ed=t.editor,s=t.settings,r,mf,me,td;n=DOM.add(tb,'tr');n=td=DOM.add(n,'td',{'class':'mceStatusbar'});n=DOM.add(n,'div',{id:ed.id+'_path_row'},s.theme_advanced_path?ed.translate('advanced.path')+': ':' ');DOM.add(n,'a',{href:'#',accesskey:'x'});if(s.theme_advanced_resizing&&!tinymce.isOldWebKit){DOM.add(td,'a',{id:ed.id+'_resize',href:'javascript:;',onclick:"return false;",'class':'mceResize'});if(s.theme_advanced_resizing_use_cookie){ed.onPostRender.add(function(){var o=Cookie.getHash("TinyMCE_"+ed.id+"_size"),c=DOM.get(ed.id+'_tbl');if(!o)return;if(s.theme_advanced_resize_horizontal)c.style.width=Math.max(10,o.cw)+'px';c.style.height=Math.max(10,o.ch)+'px';DOM.get(ed.id+'_ifr').style.height=Math.max(10,parseInt(o.ch)+t.deltaHeight)+'px';});}ed.onPostRender.add(function(){Event.add(ed.id+'_resize','mousedown',function(e){var c,p,w,h,n,pa;c=DOM.get(ed.id+'_tbl');w=c.clientWidth;h=c.clientHeight;miw=s.theme_advanced_resizing_min_width||100;mih=s.theme_advanced_resizing_min_height||100;maw=s.theme_advanced_resizing_max_width||0xFFFF;mah=s.theme_advanced_resizing_max_height||0xFFFF;p=DOM.add(DOM.get(ed.id+'_parent'),'div',{'class':'mcePlaceHolder'});DOM.setStyles(p,{width:w,height:h});DOM.hide(c);DOM.show(p);r={x:e.screenX,y:e.screenY,w:w,h:h,dx:null,dy:null};mf=Event.add(DOM.doc,'mousemove',function(e){var w,h;r.dx=e.screenX-r.x;r.dy=e.screenY-r.y;w=Math.max(miw,r.w+r.dx);h=Math.max(mih,r.h+r.dy);w=Math.min(maw,w);h=Math.min(mah,h);if(s.theme_advanced_resize_horizontal)p.style.width=w+'px';p.style.height=h+'px';return Event.cancel(e);});me=Event.add(DOM.doc,'mouseup',function(e){var ifr;Event.remove(DOM.doc,'mousemove',mf);Event.remove(DOM.doc,'mouseup',me);c.style.display='';DOM.remove(p);if(r.dx===null)return;ifr=DOM.get(ed.id+'_ifr');if(s.theme_advanced_resize_horizontal)c.style.width=Math.max(10,r.w+r.dx)+'px';c.style.height=Math.max(10,r.h+r.dy)+'px';ifr.style.height=Math.max(10,ifr.clientHeight+r.dy)+'px';if(s.theme_advanced_resizing_use_cookie){Cookie.setHash("TinyMCE_"+ed.id+"_size",{cw:r.w+r.dx,ch:r.h+r.dy});}});return Event.cancel(e);});});}o.deltaHeight-=21;n=tb=null;},_nodeChanged:function(ed,cm,n,co){var t=this,p,de=0,v,c,s=t.settings,cl,fz,fn;if(s.readonly)return;tinymce.each(t.stateControls,function(c){cm.setActive(c,ed.queryCommandState(t.controls[c][1]));});cm.setActive('visualaid',ed.hasVisual);cm.setDisabled('undo',!ed.undoManager.hasUndo()&&!ed.typing);cm.setDisabled('redo',!ed.undoManager.hasRedo());cm.setDisabled('outdent',!ed.queryCommandState('Outdent'));p=DOM.getParent(n,'A');if(c=cm.get('link')){if(!p||!p.name){c.setDisabled(!p&&co);c.setActive(!!p);}}if(c=cm.get('unlink')){c.setDisabled(!p&&co);c.setActive(!!p&&!p.name);}if(c=cm.get('anchor')){c.setActive(!!p&&p.name);if(tinymce.isWebKit){p=DOM.getParent(n,'IMG');c.setActive(!!p&&DOM.getAttrib(p,'mce_name')=='a');}}p=DOM.getParent(n,'IMG');if(c=cm.get('image'))c.setActive(!!p&&n.className.indexOf('mceItem')==-1);if(c=cm.get('styleselect')){if(n.className){t._importClasses();c.select(n.className);}else c.select();}if(c=cm.get('formatselect')){p=DOM.getParent(n,DOM.isBlock);if(p)c.select(p.nodeName.toLowerCase());}if(ed.settings.convert_fonts_to_spans){ed.dom.getParent(n,function(n){if(n.nodeName==='SPAN'){if(!cl&&n.className)cl=n.className;if(!fz&&n.style.fontSize)fz=n.style.fontSize;if(!fn&&n.style.fontFamily)fn=n.style.fontFamily.replace(/[\"\']+/g,'').replace(/^([^,]+).*/,'$1').toLowerCase();}return false;});if(c=cm.get('fontselect')){c.select(function(v){return v.replace(/^([^,]+).*/,'$1').toLowerCase()==fn;});}if(c=cm.get('fontsizeselect')){c.select(function(v){if(v.fontSize&&v.fontSize===fz)return true;if(v['class']&&v['class']===cl)return true;});}}else{if(c=cm.get('fontselect'))c.select(ed.queryCommandValue('FontName'));if(c=cm.get('fontsizeselect')){v=ed.queryCommandValue('FontSize');c.select(function(iv){return iv.fontSize==v;});}}if(s.theme_advanced_path&&s.theme_advanced_statusbar_location){p=DOM.get(ed.id+'_path')||DOM.add(ed.id+'_path_row','span',{id:ed.id+'_path'});DOM.setHTML(p,'');ed.dom.getParent(n,function(n){var na=n.nodeName.toLowerCase(),u,pi,ti='';if(n.nodeType!=1||n.nodeName==='BR'||(DOM.hasClass(n,'mceItemHidden')||DOM.hasClass(n,'mceItemRemoved')))return;if(v=DOM.getAttrib(n,'mce_name'))na=v;if(tinymce.isIE&&n.scopeName!=='HTML')na=n.scopeName+':'+na;na=na.replace(/mce\:/g,'');switch(na){case'b':na='strong';break;case'i':na='em';break;case'img':if(v=DOM.getAttrib(n,'src'))ti+='src: '+v+' ';break;case'a':if(v=DOM.getAttrib(n,'name')){ti+='name: '+v+' ';na+='#'+v;}if(v=DOM.getAttrib(n,'href'))ti+='href: '+v+' ';break;case'font':if(s.convert_fonts_to_spans)na='span';if(v=DOM.getAttrib(n,'face'))ti+='font: '+v+' ';if(v=DOM.getAttrib(n,'size'))ti+='size: '+v+' ';if(v=DOM.getAttrib(n,'color'))ti+='color: '+v+' ';break;case'span':if(v=DOM.getAttrib(n,'style'))ti+='style: '+v+' ';break;}if(v=DOM.getAttrib(n,'id'))ti+='id: '+v+' ';if(v=n.className){v=v.replace(/(webkit-[\w\-]+|Apple-[\w\-]+|mceItem\w+|mceVisualAid)/g,'');if(v&&v.indexOf('mceItem')==-1){ti+='class: '+v+' ';if(DOM.isBlock(n)||na=='img'||na=='span')na+='.'+v;}}na=na.replace(/(html:)/g,'');na={name:na,node:n,title:ti};t.onResolveName.dispatch(t,na);ti=na.title;na=na.name;pi=DOM.create('a',{'href':"javascript:;",onmousedown:"return false;",title:ti,'class':'mcePath_'+(de++)},na);if(p.hasChildNodes()){p.insertBefore(DOM.doc.createTextNode(' \u00bb '),p.firstChild);p.insertBefore(pi,p.firstChild);}else p.appendChild(pi);},ed.getBody());}},_sel:function(v){this.editor.execCommand('mceSelectNodeDepth',false,v);},_mceInsertAnchor:function(ui,v){var ed=this.editor;ed.windowManager.open({url:tinymce.baseURL+'/themes/advanced/anchor.htm',width:320+parseInt(ed.getLang('advanced.anchor_delta_width',0)),height:90+parseInt(ed.getLang('advanced.anchor_delta_height',0)),inline:true},{theme_url:this.url});},_mceCharMap:function(){var ed=this.editor;ed.windowManager.open({url:tinymce.baseURL+'/themes/advanced/charmap.htm',width:550+parseInt(ed.getLang('advanced.charmap_delta_width',0)),height:250+parseInt(ed.getLang('advanced.charmap_delta_height',0)),inline:true},{theme_url:this.url});},_mceHelp:function(){var ed=this.editor;ed.windowManager.open({url:tinymce.baseURL+'/themes/advanced/about.htm',width:480,height:380,inline:true},{theme_url:this.url});},_mceColorPicker:function(u,v){var ed=this.editor;v=v||{};ed.windowManager.open({url:tinymce.baseURL+'/themes/advanced/color_picker.htm',width:375+parseInt(ed.getLang('advanced.colorpicker_delta_width',0)),height:250+parseInt(ed.getLang('advanced.colorpicker_delta_height',0)),close_previous:false,inline:true},{input_color:v.color,func:v.func,theme_url:this.url});},_mceCodeEditor:function(ui,val){var ed=this.editor;ed.windowManager.open({url:tinymce.baseURL+'/themes/advanced/source_editor.htm',width:parseInt(ed.getParam("theme_advanced_source_editor_width",720)),height:parseInt(ed.getParam("theme_advanced_source_editor_height",580)),inline:true,resizable:true,maximizable:true},{theme_url:this.url});},_mceImage:function(ui,val){var ed=this.editor;if(ed.dom.getAttrib(ed.selection.getNode(),'class').indexOf('mceItem')!=-1)return;ed.windowManager.open({url:tinymce.baseURL+'/themes/advanced/image.htm',width:355+parseInt(ed.getLang('advanced.image_delta_width',0)),height:275+parseInt(ed.getLang('advanced.image_delta_height',0)),inline:true},{theme_url:this.url});},_mceLink:function(ui,val){var ed=this.editor;ed.windowManager.open({url:tinymce.baseURL+'/themes/advanced/link.htm',width:310+parseInt(ed.getLang('advanced.link_delta_width',0)),height:200+parseInt(ed.getLang('advanced.link_delta_height',0)),inline:true},{theme_url:this.url});},_mceNewDocument:function(){var ed=this.editor;ed.windowManager.confirm('advanced.newdocument',function(s){if(s)ed.execCommand('mceSetContent',false,'');});},_mceForeColor:function(){var t=this;this._mceColorPicker(0,{color:t.fgColor,func:function(co){t.fgColor=co;t.editor.execCommand('ForeColor',false,co);}});},_mceBackColor:function(){var t=this;this._mceColorPicker(0,{color:t.bgColor,func:function(co){t.bgColor=co;t.editor.execCommand('HiliteColor',false,co);}});},_ufirst:function(s){return s.substring(0,1).toUpperCase()+s.substring(1);}});tinymce.ThemeManager.add('advanced',tinymce.themes.AdvancedTheme);}()); \ No newline at end of file diff --git a/include/javascript/tiny_mce/themes/advanced/editor_template_src.js b/include/javascript/tiny_mce/themes/advanced/editor_template_src.js new file mode 100755 index 00000000..304cabb2 --- /dev/null +++ b/include/javascript/tiny_mce/themes/advanced/editor_template_src.js @@ -0,0 +1,1153 @@ +/** + + * + * @author Moxiecode + * @copyright Copyright 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + var DOM = tinymce.DOM, Event = tinymce.dom.Event, extend = tinymce.extend, each = tinymce.each, Cookie = tinymce.util.Cookie, lastExtID, explode = tinymce.explode; + + // Tell it to load theme specific language pack(s) + tinymce.ThemeManager.requireLangPack('advanced'); + + tinymce.create('tinymce.themes.AdvancedTheme', { + sizes : [8, 10, 12, 14, 18, 24, 36], + + // Control name lookup, format: title, command + controls : { + bold : ['bold_desc', 'Bold'], + italic : ['italic_desc', 'Italic'], + underline : ['underline_desc', 'Underline'], + strikethrough : ['striketrough_desc', 'Strikethrough'], + justifyleft : ['justifyleft_desc', 'JustifyLeft'], + justifycenter : ['justifycenter_desc', 'JustifyCenter'], + justifyright : ['justifyright_desc', 'JustifyRight'], + justifyfull : ['justifyfull_desc', 'JustifyFull'], + bullist : ['bullist_desc', 'InsertUnorderedList'], + numlist : ['numlist_desc', 'InsertOrderedList'], + outdent : ['outdent_desc', 'Outdent'], + indent : ['indent_desc', 'Indent'], + cut : ['cut_desc', 'Cut'], + copy : ['copy_desc', 'Copy'], + paste : ['paste_desc', 'Paste'], + undo : ['undo_desc', 'Undo'], + redo : ['redo_desc', 'Redo'], + link : ['link_desc', 'mceLink'], + unlink : ['unlink_desc', 'unlink'], + image : ['image_desc', 'mceImage'], + cleanup : ['cleanup_desc', 'mceCleanup'], + help : ['help_desc', 'mceHelp'], + code : ['code_desc', 'mceCodeEditor'], + hr : ['hr_desc', 'InsertHorizontalRule'], + removeformat : ['removeformat_desc', 'RemoveFormat'], + sub : ['sub_desc', 'subscript'], + sup : ['sup_desc', 'superscript'], + forecolor : ['forecolor_desc', 'ForeColor'], + forecolorpicker : ['forecolor_desc', 'mceForeColor'], + backcolor : ['backcolor_desc', 'HiliteColor'], + backcolorpicker : ['backcolor_desc', 'mceBackColor'], + charmap : ['charmap_desc', 'mceCharMap'], + visualaid : ['visualaid_desc', 'mceToggleVisualAid'], + anchor : ['anchor_desc', 'mceInsertAnchor'], + newdocument : ['newdocument_desc', 'mceNewDocument'], + blockquote : ['blockquote_desc', 'mceBlockQuote'] + }, + + stateControls : ['bold', 'italic', 'underline', 'strikethrough', 'bullist', 'numlist', 'justifyleft', 'justifycenter', 'justifyright', 'justifyfull', 'sub', 'sup', 'blockquote'], + + init : function(ed, url) { + var t = this, s, v, o; + + t.editor = ed; + t.url = url; + t.onResolveName = new tinymce.util.Dispatcher(this); + + // Default settings + t.settings = s = extend({ + theme_advanced_path : true, + theme_advanced_toolbar_location : 'bottom', + theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect", + theme_advanced_buttons2 : "bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code", + theme_advanced_buttons3 : "hr,removeformat,visualaid,|,sub,sup,|,charmap", + theme_advanced_blockformats : "p,address,pre,h1,h2,h3,h4,h5,h6", + theme_advanced_toolbar_align : "center", + theme_advanced_fonts : "Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats", + theme_advanced_more_colors : 1, + theme_advanced_row_height : 23, + theme_advanced_resize_horizontal : 1, + theme_advanced_resizing_use_cookie : 1, + theme_advanced_font_sizes : "1,2,3,4,5,6,7", + readonly : ed.settings.readonly + }, ed.settings); + + // Setup default font_size_style_values + if (!s.font_size_style_values) + s.font_size_style_values = "8pt,10pt,12pt,14pt,18pt,24pt,36pt"; + + if (tinymce.is(s.theme_advanced_font_sizes, 'string')) { + s.font_size_style_values = tinymce.explode(s.font_size_style_values); + s.font_size_classes = tinymce.explode(s.font_size_classes || ''); + + // Parse string value + o = {}; + ed.settings.theme_advanced_font_sizes = s.theme_advanced_font_sizes; + each(ed.getParam('theme_advanced_font_sizes', '', 'hash'), function(v, k) { + var cl; + + if (k == v && v >= 1 && v <= 7) { + k = v + ' (' + t.sizes[v - 1] + 'pt)'; + + if (ed.settings.convert_fonts_to_spans) { + cl = s.font_size_classes[v - 1]; + v = s.font_size_style_values[v - 1] || (t.sizes[v - 1] + 'pt'); + } + } + + if (/\s*\./.test(v)) + cl = v.replace(/\./g, ''); + + o[k] = cl ? {'class' : cl} : {fontSize : v}; + }); + + s.theme_advanced_font_sizes = o; + } + + if ((v = s.theme_advanced_path_location) && v != 'none') + s.theme_advanced_statusbar_location = s.theme_advanced_path_location; + + if (s.theme_advanced_statusbar_location == 'none') + s.theme_advanced_statusbar_location = 0; + + // Init editor + ed.onInit.add(function() { + ed.onNodeChange.add(t._nodeChanged, t); + + if (ed.settings.content_css !== false) + ed.dom.loadCSS(ed.baseURI.toAbsolute("themes/advanced/skins/" + ed.settings.skin + "/content.css")); + }); + + ed.onSetProgressState.add(function(ed, b, ti) { + var co, id = ed.id, tb; + + if (b) { + t.progressTimer = setTimeout(function() { + co = ed.getContainer(); + co = co.insertBefore(DOM.create('DIV', {style : 'position:relative'}), co.firstChild); + tb = DOM.get(ed.id + '_tbl'); + + DOM.add(co, 'div', {id : id + '_blocker', 'class' : 'mceBlocker', style : {width : tb.clientWidth + 2, height : tb.clientHeight + 2}}); + DOM.add(co, 'div', {id : id + '_progress', 'class' : 'mceProgress', style : {left : tb.clientWidth / 2, top : tb.clientHeight / 2}}); + }, ti || 0); + } else { + DOM.remove(id + '_blocker'); + DOM.remove(id + '_progress'); + clearTimeout(t.progressTimer); + } + }); + + DOM.loadCSS(s.editor_css ? ed.documentBaseURI.toAbsolute(s.editor_css) : url + "/skins/" + ed.settings.skin + "/ui.css"); + + if (s.skin_variant) + DOM.loadCSS(url + "/skins/" + ed.settings.skin + "/ui_" + s.skin_variant + ".css"); + }, + + createControl : function(n, cf) { + var cd, c; + + if (c = cf.createControl(n)) + return c; + + switch (n) { + case "styleselect": + return this._createStyleSelect(); + + case "formatselect": + return this._createBlockFormats(); + + case "fontselect": + return this._createFontSelect(); + + case "fontsizeselect": + return this._createFontSizeSelect(); + + case "forecolor": + return this._createForeColorMenu(); + + case "backcolor": + return this._createBackColorMenu(); + } + + if ((cd = this.controls[n])) + return cf.createButton(n, {title : "advanced." + cd[0], cmd : cd[1], ui : cd[2], value : cd[3]}); + }, + + execCommand : function(cmd, ui, val) { + var f = this['_' + cmd]; + + if (f) { + f.call(this, ui, val); + return true; + } + + return false; + }, + + _importClasses : function(e) { + var ed = this.editor, c = ed.controlManager.get('styleselect'); + + if (c.getLength() == 0) { + each(ed.dom.getClasses(), function(o) { + c.add(o['class'], o['class']); + }); + } + }, + + _createStyleSelect : function(n) { + var t = this, ed = t.editor, cf = ed.controlManager, c = cf.createListBox('styleselect', { + title : 'advanced.style_select', + onselect : function(v) { + if (c.selectedValue === v) { + ed.execCommand('mceSetStyleInfo', 0, {command : 'removeformat'}); + c.select(); + return false; + } else + ed.execCommand('mceSetCSSClass', 0, v); + } + }); + + if (c) { + each(ed.getParam('theme_advanced_styles', '', 'hash'), function(v, k) { + if (v) + c.add(t.editor.translate(k), v); + }); + + c.onPostRender.add(function(ed, n) { + if (!c.NativeListBox) { + Event.add(n.id + '_text', 'focus', t._importClasses, t); + Event.add(n.id + '_text', 'mousedown', t._importClasses, t); + Event.add(n.id + '_open', 'focus', t._importClasses, t); + Event.add(n.id + '_open', 'mousedown', t._importClasses, t); + } else + Event.add(n.id, 'focus', t._importClasses, t); + }); + } + + return c; + }, + + _createFontSelect : function() { + var c, t = this, ed = t.editor; + + c = ed.controlManager.createListBox('fontselect', {title : 'advanced.fontdefault', cmd : 'FontName'}); + if (c) { + each(ed.getParam('theme_advanced_fonts', t.settings.theme_advanced_fonts, 'hash'), function(v, k) { + c.add(ed.translate(k), v, {style : v.indexOf('dings') == -1 ? 'font-family:' + v : ''}); + }); + } + + return c; + }, + + _createFontSizeSelect : function() { + var t = this, ed = t.editor, c, i = 0, cl = []; + + c = ed.controlManager.createListBox('fontsizeselect', {title : 'advanced.font_size', onselect : function(v) { + if (v.fontSize) + ed.execCommand('FontSize', false, v.fontSize); + else { + each(t.settings.theme_advanced_font_sizes, function(v, k) { + if (v['class']) + cl.push(v['class']); + }); + + ed.editorCommands._applyInlineStyle('span', {'class' : v['class']}, {check_classes : cl}); + } + }}); + + if (c) { + each(t.settings.theme_advanced_font_sizes, function(v, k) { + var fz = v.fontSize; + + if (fz >= 1 && fz <= 7) + fz = t.sizes[parseInt(fz) - 1] + 'pt'; + + c.add(k, v, {'style' : 'font-size:' + fz, 'class' : 'mceFontSize' + (i++) + (' ' + (v['class'] || ''))}); + }); + } + + return c; + }, + + _createBlockFormats : function() { + var c, fmts = { + p : 'advanced.paragraph', + address : 'advanced.address', + pre : 'advanced.pre', + h1 : 'advanced.h1', + h2 : 'advanced.h2', + h3 : 'advanced.h3', + h4 : 'advanced.h4', + h5 : 'advanced.h5', + h6 : 'advanced.h6', + div : 'advanced.div', + blockquote : 'advanced.blockquote', + code : 'advanced.code', + dt : 'advanced.dt', + dd : 'advanced.dd', + samp : 'advanced.samp' + }, t = this; + + c = t.editor.controlManager.createListBox('formatselect', {title : 'advanced.block', cmd : 'FormatBlock'}); + if (c) { + each(t.editor.getParam('theme_advanced_blockformats', t.settings.theme_advanced_blockformats, 'hash'), function(v, k) { + c.add(t.editor.translate(k != v ? k : fmts[v]), v, {'class' : 'mce_formatPreview mce_' + v}); + }); + } + + return c; + }, + + _createForeColorMenu : function() { + var c, t = this, s = t.settings, o = {}, v; + + if (s.theme_advanced_more_colors) { + o.more_colors_func = function() { + t._mceColorPicker(0, { + color : c.value, + func : function(co) { + c.setColor(co); + } + }); + }; + } + + if (v = s.theme_advanced_text_colors) + o.colors = v; + + if (s.theme_advanced_default_foreground_color) + o.default_color = s.theme_advanced_default_foreground_color; + + o.title = 'advanced.forecolor_desc'; + o.cmd = 'ForeColor'; + o.scope = this; + + c = t.editor.controlManager.createColorSplitButton('forecolor', o); + + return c; + }, + + _createBackColorMenu : function() { + var c, t = this, s = t.settings, o = {}, v; + + if (s.theme_advanced_more_colors) { + o.more_colors_func = function() { + t._mceColorPicker(0, { + color : c.value, + func : function(co) { + c.setColor(co); + } + }); + }; + } + + if (v = s.theme_advanced_background_colors) + o.colors = v; + + if (s.theme_advanced_default_background_color) + o.default_color = s.theme_advanced_default_background_color; + + o.title = 'advanced.backcolor_desc'; + o.cmd = 'HiliteColor'; + o.scope = this; + + c = t.editor.controlManager.createColorSplitButton('backcolor', o); + + return c; + }, + + renderUI : function(o) { + var n, ic, tb, t = this, ed = t.editor, s = t.settings, sc, p, nl; + + n = p = DOM.create('span', {id : ed.id + '_parent', 'class' : 'mceEditor ' + ed.settings.skin + 'Skin' + (s.skin_variant ? ' ' + ed.settings.skin + 'Skin' + t._ufirst(s.skin_variant) : '')}); + + if (!DOM.boxModel) + n = DOM.add(n, 'div', {'class' : 'mceOldBoxModel'}); + + n = sc = DOM.add(n, 'table', {id : ed.id + '_tbl', 'class' : 'mceLayout', cellSpacing : 0, cellPadding : 0}); + n = tb = DOM.add(n, 'tbody'); + + switch ((s.theme_advanced_layout_manager || '').toLowerCase()) { + case "rowlayout": + ic = t._rowLayout(s, tb, o); + break; + + case "customlayout": + ic = ed.execCallback("theme_advanced_custom_layout", s, tb, o, p); + break; + + default: + ic = t._simpleLayout(s, tb, o, p); + } + + n = o.targetNode; + + // Add classes to first and last TRs + nl = DOM.stdMode ? sc.getElementsByTagName('tr') : sc.rows; // Quick fix for IE 8 + DOM.addClass(nl[0], 'mceFirst'); + DOM.addClass(nl[nl.length - 1], 'mceLast'); + + // Add classes to first and last TDs + each(DOM.select('tr', tb), function(n) { + DOM.addClass(n.firstChild, 'mceFirst'); + DOM.addClass(n.childNodes[n.childNodes.length - 1], 'mceLast'); + }); + + if (DOM.get(s.theme_advanced_toolbar_container)) + DOM.get(s.theme_advanced_toolbar_container).appendChild(p); + else + DOM.insertAfter(p, n); + + Event.add(ed.id + '_path_row', 'click', function(e) { + e = e.target; + + if (e.nodeName == 'A') { + t._sel(e.className.replace(/^.*mcePath_([0-9]+).*$/, '$1')); + + return Event.cancel(e); + } + }); +/* + if (DOM.get(ed.id + '_path_row')) { + Event.add(ed.id + '_tbl', 'mouseover', function(e) { + var re; + + e = e.target; + + if (e.nodeName == 'SPAN' && DOM.hasClass(e.parentNode, 'mceButton')) { + re = DOM.get(ed.id + '_path_row'); + t.lastPath = re.innerHTML; + DOM.setHTML(re, e.parentNode.title); + } + }); + + Event.add(ed.id + '_tbl', 'mouseout', function(e) { + if (t.lastPath) { + DOM.setHTML(ed.id + '_path_row', t.lastPath); + t.lastPath = 0; + } + }); + } +*/ + + if (!ed.getParam('accessibility_focus') || ed.getParam('tab_focus')) + Event.add(DOM.add(p, 'a', {href : '#'}, ''), 'focus', function() {tinyMCE.get(ed.id).focus();}); + + if (s.theme_advanced_toolbar_location == 'external') + o.deltaHeight = 0; + + t.deltaHeight = o.deltaHeight; + o.targetNode = null; + + return { + iframeContainer : ic, + editorContainer : ed.id + '_parent', + sizeContainer : sc, + deltaHeight : o.deltaHeight + }; + }, + + getInfo : function() { + return { + longname : 'Advanced theme', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + version : tinymce.majorVersion + "." + tinymce.minorVersion + } + }, + + resizeBy : function(dw, dh) { + var e = DOM.get(this.editor.id + '_tbl'); + + this.resizeTo(e.clientWidth + dw, e.clientHeight + dh); + }, + + resizeTo : function(w, h) { + var ed = this.editor, s = ed.settings, e = DOM.get(ed.id + '_tbl'), ifr = DOM.get(ed.id + '_ifr'), dh; + + // Boundery fix box + w = Math.max(s.theme_advanced_resizing_min_width || 100, w); + h = Math.max(s.theme_advanced_resizing_min_height || 100, h); + w = Math.min(s.theme_advanced_resizing_max_width || 0xFFFF, w); + h = Math.min(s.theme_advanced_resizing_max_height || 0xFFFF, h); + + // Calc difference between iframe and container + dh = e.clientHeight - ifr.clientHeight; + + // Resize iframe and container + DOM.setStyle(ifr, 'height', h - dh); + DOM.setStyles(e, {width : w, height : h}); + }, + + destroy : function() { + var id = this.editor.id; + + Event.clear(id + '_resize'); + Event.clear(id + '_path_row'); + Event.clear(id + '_external_close'); + }, + + // Internal functions + + _simpleLayout : function(s, tb, o, p) { + var t = this, ed = t.editor, lo = s.theme_advanced_toolbar_location, sl = s.theme_advanced_statusbar_location, n, ic, etb, c; + + if (s.readonly) { + n = DOM.add(tb, 'tr'); + n = ic = DOM.add(n, 'td', {'class' : 'mceIframeContainer'}); + return ic; + } + + // Create toolbar container at top + if (lo == 'top') + t._addToolbars(tb, o); + + // Create external toolbar + if (lo == 'external') { + n = c = DOM.create('div', {style : 'position:relative'}); + n = DOM.add(n, 'div', {id : ed.id + '_external', 'class' : 'mceExternalToolbar'}); + DOM.add(n, 'a', {id : ed.id + '_external_close', href : 'javascript:;', 'class' : 'mceExternalClose'}); + n = DOM.add(n, 'table', {id : ed.id + '_tblext', cellSpacing : 0, cellPadding : 0}); + etb = DOM.add(n, 'tbody'); + + if (p.firstChild.className == 'mceOldBoxModel') + p.firstChild.appendChild(c); + else + p.insertBefore(c, p.firstChild); + + t._addToolbars(etb, o); + + ed.onMouseUp.add(function() { + var e = DOM.get(ed.id + '_external'); + DOM.show(e); + + DOM.hide(lastExtID); + + var f = Event.add(ed.id + '_external_close', 'click', function() { + DOM.hide(ed.id + '_external'); + Event.remove(ed.id + '_external_close', 'click', f); + }); + + DOM.show(e); + DOM.setStyle(e, 'top', 0 - DOM.getRect(ed.id + '_tblext').h - 1); + + // Fixes IE rendering bug + DOM.hide(e); + DOM.show(e); + e.style.filter = ''; + + lastExtID = ed.id + '_external'; + + e = null; + }); + } + + if (sl == 'top') + t._addStatusBar(tb, o); + + // Create iframe container + if (!s.theme_advanced_toolbar_container) { + n = DOM.add(tb, 'tr'); + n = ic = DOM.add(n, 'td', {'class' : 'mceIframeContainer'}); + } + + // Create toolbar container at bottom + if (lo == 'bottom') + t._addToolbars(tb, o); + + if (sl == 'bottom') + t._addStatusBar(tb, o); + + return ic; + }, + + _rowLayout : function(s, tb, o) { + var t = this, ed = t.editor, dc, da, cf = ed.controlManager, n, ic, to, a; + + dc = s.theme_advanced_containers_default_class || ''; + da = s.theme_advanced_containers_default_align || 'center'; + + each(explode(s.theme_advanced_containers || ''), function(c, i) { + var v = s['theme_advanced_container_' + c] || ''; + + switch (v.toLowerCase()) { + case 'mceeditor': + n = DOM.add(tb, 'tr'); + n = ic = DOM.add(n, 'td', {'class' : 'mceIframeContainer'}); + break; + + case 'mceelementpath': + t._addStatusBar(tb, o); + break; + + default: + a = (s['theme_advanced_container_' + c + '_align'] || da).toLowerCase(); + a = 'mce' + t._ufirst(a); + + n = DOM.add(DOM.add(tb, 'tr'), 'td', { + 'class' : 'mceToolbar ' + (s['theme_advanced_container_' + c + '_class'] || dc) + ' ' + a || da + }); + + to = cf.createToolbar("toolbar" + i); + t._addControls(v, to); + DOM.setHTML(n, to.renderHTML()); + o.deltaHeight -= s.theme_advanced_row_height; + } + }); + + return ic; + }, + + _addControls : function(v, tb) { + var t = this, s = t.settings, di, cf = t.editor.controlManager; + + if (s.theme_advanced_disable && !t._disabled) { + di = {}; + + each(explode(s.theme_advanced_disable), function(v) { + di[v] = 1; + }); + + t._disabled = di; + } else + di = t._disabled; + + each(explode(v), function(n) { + var c; + + if (di && di[n]) + return; + + // Compatiblity with 2.x + if (n == 'tablecontrols') { + each(["table","|","row_props","cell_props","|","row_before","row_after","delete_row","|","col_before","col_after","delete_col","|","split_cells","merge_cells"], function(n) { + n = t.createControl(n, cf); + + if (n) + tb.add(n); + }); + + return; + } + + c = t.createControl(n, cf); + + if (c) + tb.add(c); + }); + }, + + _addToolbars : function(c, o) { + var t = this, i, tb, ed = t.editor, s = t.settings, v, cf = ed.controlManager, di, n, h = [], a; + + a = s.theme_advanced_toolbar_align.toLowerCase(); + a = 'mce' + t._ufirst(a); + + n = DOM.add(DOM.add(c, 'tr'), 'td', {'class' : 'mceToolbar ' + a}); + + if (!ed.getParam('accessibility_focus') || ed.getParam('tab_focus')) + h.push(DOM.createHTML('a', {href : '#', onfocus : 'tinyMCE.get(\'' + ed.id + '\').focus();'}, '')); + + h.push(DOM.createHTML('a', {href : '#', accesskey : 'q', title : ed.getLang("advanced.toolbar_focus"), tabindex : "-1"}, '')); + + // Create toolbar and add the controls + for (i=1; (v = s['theme_advanced_buttons' + i]); i++) { + tb = cf.createToolbar("toolbar" + i, {'class' : 'mceToolbarRow' + i}); + + if (s['theme_advanced_buttons' + i + '_add']) + v += ',' + s['theme_advanced_buttons' + i + '_add']; + + if (s['theme_advanced_buttons' + i + '_add_before']) + v = s['theme_advanced_buttons' + i + '_add_before'] + ',' + v; + + t._addControls(v, tb); + + //n.appendChild(n = tb.render()); + h.push(tb.renderHTML()); + + o.deltaHeight -= s.theme_advanced_row_height; + } + + h.push(DOM.createHTML('a', {href : '#', accesskey : 'z', title : ed.getLang("advanced.toolbar_focus"), onfocus : 'tinyMCE.getInstanceById(\'' + ed.id + '\').focus();', tabindex : "-1"}, '')); + DOM.setHTML(n, h.join('')); + }, + + _addStatusBar : function(tb, o) { + var n, t = this, ed = t.editor, s = t.settings, r, mf, me, td; + + n = DOM.add(tb, 'tr'); + n = td = DOM.add(n, 'td', {'class' : 'mceStatusbar'}); + n = DOM.add(n, 'div', {id : ed.id + '_path_row'}, s.theme_advanced_path ? ed.translate('advanced.path') + ': ' : ' '); + DOM.add(n, 'a', {href : '#', accesskey : 'x'}); + + if (s.theme_advanced_resizing && !tinymce.isOldWebKit) { + DOM.add(td, 'a', {id : ed.id + '_resize', href : 'javascript:;', onclick : "return false;", 'class' : 'mceResize'}); + + if (s.theme_advanced_resizing_use_cookie) { + ed.onPostRender.add(function() { + var o = Cookie.getHash("TinyMCE_" + ed.id + "_size"), c = DOM.get(ed.id + '_tbl'); + + if (!o) + return; + + if (s.theme_advanced_resize_horizontal) + c.style.width = Math.max(10, o.cw) + 'px'; + + c.style.height = Math.max(10, o.ch) + 'px'; + DOM.get(ed.id + '_ifr').style.height = Math.max(10, parseInt(o.ch) + t.deltaHeight) + 'px'; + }); + } + + ed.onPostRender.add(function() { + Event.add(ed.id + '_resize', 'mousedown', function(e) { + var c, p, w, h, n, pa; + + // Measure container + c = DOM.get(ed.id + '_tbl'); + w = c.clientWidth; + h = c.clientHeight; + + miw = s.theme_advanced_resizing_min_width || 100; + mih = s.theme_advanced_resizing_min_height || 100; + maw = s.theme_advanced_resizing_max_width || 0xFFFF; + mah = s.theme_advanced_resizing_max_height || 0xFFFF; + + // Setup placeholder + p = DOM.add(DOM.get(ed.id + '_parent'), 'div', {'class' : 'mcePlaceHolder'}); + DOM.setStyles(p, {width : w, height : h}); + + // Replace with placeholder + DOM.hide(c); + DOM.show(p); + + // Create internal resize obj + r = { + x : e.screenX, + y : e.screenY, + w : w, + h : h, + dx : null, + dy : null + }; + + // Start listening + mf = Event.add(DOM.doc, 'mousemove', function(e) { + var w, h; + + // Calc delta values + r.dx = e.screenX - r.x; + r.dy = e.screenY - r.y; + + // Boundery fix box + w = Math.max(miw, r.w + r.dx); + h = Math.max(mih, r.h + r.dy); + w = Math.min(maw, w); + h = Math.min(mah, h); + + // Resize placeholder + if (s.theme_advanced_resize_horizontal) + p.style.width = w + 'px'; + + p.style.height = h + 'px'; + + return Event.cancel(e); + }); + + me = Event.add(DOM.doc, 'mouseup', function(e) { + var ifr; + + // Stop listening + Event.remove(DOM.doc, 'mousemove', mf); + Event.remove(DOM.doc, 'mouseup', me); + + c.style.display = ''; + DOM.remove(p); + + if (r.dx === null) + return; + + ifr = DOM.get(ed.id + '_ifr'); + + if (s.theme_advanced_resize_horizontal) + c.style.width = Math.max(10, r.w + r.dx) + 'px'; + + c.style.height = Math.max(10, r.h + r.dy) + 'px'; + ifr.style.height = Math.max(10, ifr.clientHeight + r.dy) + 'px'; + + if (s.theme_advanced_resizing_use_cookie) { + Cookie.setHash("TinyMCE_" + ed.id + "_size", { + cw : r.w + r.dx, + ch : r.h + r.dy + }); + } + }); + + return Event.cancel(e); + }); + }); + } + + o.deltaHeight -= 21; + n = tb = null; + }, + + _nodeChanged : function(ed, cm, n, co) { + var t = this, p, de = 0, v, c, s = t.settings, cl, fz, fn; + + if (s.readonly) + return; + + tinymce.each(t.stateControls, function(c) { + cm.setActive(c, ed.queryCommandState(t.controls[c][1])); + }); + + cm.setActive('visualaid', ed.hasVisual); + cm.setDisabled('undo', !ed.undoManager.hasUndo() && !ed.typing); + cm.setDisabled('redo', !ed.undoManager.hasRedo()); + cm.setDisabled('outdent', !ed.queryCommandState('Outdent')); + + p = DOM.getParent(n, 'A'); + if (c = cm.get('link')) { + if (!p || !p.name) { + c.setDisabled(!p && co); + c.setActive(!!p); + } + } + + if (c = cm.get('unlink')) { + c.setDisabled(!p && co); + c.setActive(!!p && !p.name); + } + + if (c = cm.get('anchor')) { + c.setActive(!!p && p.name); + + if (tinymce.isWebKit) { + p = DOM.getParent(n, 'IMG'); + c.setActive(!!p && DOM.getAttrib(p, 'mce_name') == 'a'); + } + } + + p = DOM.getParent(n, 'IMG'); + if (c = cm.get('image')) + c.setActive(!!p && n.className.indexOf('mceItem') == -1); + + if (c = cm.get('styleselect')) { + if (n.className) { + t._importClasses(); + c.select(n.className); + } else + c.select(); + } + + if (c = cm.get('formatselect')) { + p = DOM.getParent(n, DOM.isBlock); + + if (p) + c.select(p.nodeName.toLowerCase()); + } + + if (ed.settings.convert_fonts_to_spans) { + ed.dom.getParent(n, function(n) { + if (n.nodeName === 'SPAN') { + if (!cl && n.className) + cl = n.className; + + if (!fz && n.style.fontSize) + fz = n.style.fontSize; + + if (!fn && n.style.fontFamily) + fn = n.style.fontFamily.replace(/[\"\']+/g, '').replace(/^([^,]+).*/, '$1').toLowerCase(); + } + + return false; + }); + + if (c = cm.get('fontselect')) { + c.select(function(v) { + return v.replace(/^([^,]+).*/, '$1').toLowerCase() == fn; + }); + } + + if (c = cm.get('fontsizeselect')) { + c.select(function(v) { + if (v.fontSize && v.fontSize === fz) + return true; + + if (v['class'] && v['class'] === cl) + return true; + }); + } + } else { + if (c = cm.get('fontselect')) + c.select(ed.queryCommandValue('FontName')); + + if (c = cm.get('fontsizeselect')) { + v = ed.queryCommandValue('FontSize'); + c.select(function(iv) { + return iv.fontSize == v; + }); + } + } + + if (s.theme_advanced_path && s.theme_advanced_statusbar_location) { + p = DOM.get(ed.id + '_path') || DOM.add(ed.id + '_path_row', 'span', {id : ed.id + '_path'}); + DOM.setHTML(p, ''); + + ed.dom.getParent(n, function(n) { + var na = n.nodeName.toLowerCase(), u, pi, ti = ''; + + // Ignore non element and hidden elements + if (n.nodeType != 1 || n.nodeName === 'BR' || (DOM.hasClass(n, 'mceItemHidden') || DOM.hasClass(n, 'mceItemRemoved'))) + return; + + // Fake name + if (v = DOM.getAttrib(n, 'mce_name')) + na = v; + + // Handle prefix + if (tinymce.isIE && n.scopeName !== 'HTML') + na = n.scopeName + ':' + na; + + // Remove internal prefix + na = na.replace(/mce\:/g, ''); + + // Handle node name + switch (na) { + case 'b': + na = 'strong'; + break; + + case 'i': + na = 'em'; + break; + + case 'img': + if (v = DOM.getAttrib(n, 'src')) + ti += 'src: ' + v + ' '; + + break; + + case 'a': + if (v = DOM.getAttrib(n, 'name')) { + ti += 'name: ' + v + ' '; + na += '#' + v; + } + + if (v = DOM.getAttrib(n, 'href')) + ti += 'href: ' + v + ' '; + + break; + + case 'font': + if (s.convert_fonts_to_spans) + na = 'span'; + + if (v = DOM.getAttrib(n, 'face')) + ti += 'font: ' + v + ' '; + + if (v = DOM.getAttrib(n, 'size')) + ti += 'size: ' + v + ' '; + + if (v = DOM.getAttrib(n, 'color')) + ti += 'color: ' + v + ' '; + + break; + + case 'span': + if (v = DOM.getAttrib(n, 'style')) + ti += 'style: ' + v + ' '; + + break; + } + + if (v = DOM.getAttrib(n, 'id')) + ti += 'id: ' + v + ' '; + + if (v = n.className) { + v = v.replace(/(webkit-[\w\-]+|Apple-[\w\-]+|mceItem\w+|mceVisualAid)/g, ''); + + if (v && v.indexOf('mceItem') == -1) { + ti += 'class: ' + v + ' '; + + if (DOM.isBlock(n) || na == 'img' || na == 'span') + na += '.' + v; + } + } + + na = na.replace(/(html:)/g, ''); + na = {name : na, node : n, title : ti}; + t.onResolveName.dispatch(t, na); + ti = na.title; + na = na.name; + + //u = "javascript:tinymce.EditorManager.get('" + ed.id + "').theme._sel('" + (de++) + "');"; + pi = DOM.create('a', {'href' : "javascript:;", onmousedown : "return false;", title : ti, 'class' : 'mcePath_' + (de++)}, na); + + if (p.hasChildNodes()) { + p.insertBefore(DOM.doc.createTextNode(' \u00bb '), p.firstChild); + p.insertBefore(pi, p.firstChild); + } else + p.appendChild(pi); + }, ed.getBody()); + } + }, + + // Commands gets called by execCommand + + _sel : function(v) { + this.editor.execCommand('mceSelectNodeDepth', false, v); + }, + + _mceInsertAnchor : function(ui, v) { + var ed = this.editor; + + ed.windowManager.open({ + url : tinymce.baseURL + '/themes/advanced/anchor.htm', + width : 320 + parseInt(ed.getLang('advanced.anchor_delta_width', 0)), + height : 90 + parseInt(ed.getLang('advanced.anchor_delta_height', 0)), + inline : true + }, { + theme_url : this.url + }); + }, + + _mceCharMap : function() { + var ed = this.editor; + + ed.windowManager.open({ + url : tinymce.baseURL + '/themes/advanced/charmap.htm', + width : 550 + parseInt(ed.getLang('advanced.charmap_delta_width', 0)), + height : 250 + parseInt(ed.getLang('advanced.charmap_delta_height', 0)), + inline : true + }, { + theme_url : this.url + }); + }, + + _mceHelp : function() { + var ed = this.editor; + + ed.windowManager.open({ + url : tinymce.baseURL + '/themes/advanced/about.htm', + width : 480, + height : 380, + inline : true + }, { + theme_url : this.url + }); + }, + + _mceColorPicker : function(u, v) { + var ed = this.editor; + + v = v || {}; + + ed.windowManager.open({ + url : tinymce.baseURL + '/themes/advanced/color_picker.htm', + width : 375 + parseInt(ed.getLang('advanced.colorpicker_delta_width', 0)), + height : 250 + parseInt(ed.getLang('advanced.colorpicker_delta_height', 0)), + close_previous : false, + inline : true + }, { + input_color : v.color, + func : v.func, + theme_url : this.url + }); + }, + + _mceCodeEditor : function(ui, val) { + var ed = this.editor; + + ed.windowManager.open({ + url : tinymce.baseURL + '/themes/advanced/source_editor.htm', + width : parseInt(ed.getParam("theme_advanced_source_editor_width", 720)), + height : parseInt(ed.getParam("theme_advanced_source_editor_height", 580)), + inline : true, + resizable : true, + maximizable : true + }, { + theme_url : this.url + }); + }, + + _mceImage : function(ui, val) { + var ed = this.editor; + + // Internal image object like a flash placeholder + if (ed.dom.getAttrib(ed.selection.getNode(), 'class').indexOf('mceItem') != -1) + return; + + ed.windowManager.open({ + url : tinymce.baseURL + '/themes/advanced/image.htm', + width : 355 + parseInt(ed.getLang('advanced.image_delta_width', 0)), + height : 275 + parseInt(ed.getLang('advanced.image_delta_height', 0)), + inline : true + }, { + theme_url : this.url + }); + }, + + _mceLink : function(ui, val) { + var ed = this.editor; + + ed.windowManager.open({ + url : tinymce.baseURL + '/themes/advanced/link.htm', + width : 310 + parseInt(ed.getLang('advanced.link_delta_width', 0)), + height : 200 + parseInt(ed.getLang('advanced.link_delta_height', 0)), + inline : true + }, { + theme_url : this.url + }); + }, + + _mceNewDocument : function() { + var ed = this.editor; + + ed.windowManager.confirm('advanced.newdocument', function(s) { + if (s) + ed.execCommand('mceSetContent', false, ''); + }); + }, + + _mceForeColor : function() { + var t = this; + + this._mceColorPicker(0, { + color: t.fgColor, + func : function(co) { + t.fgColor = co; + t.editor.execCommand('ForeColor', false, co); + } + }); + }, + + _mceBackColor : function() { + var t = this; + + this._mceColorPicker(0, { + color: t.bgColor, + func : function(co) { + t.bgColor = co; + t.editor.execCommand('HiliteColor', false, co); + } + }); + }, + + _ufirst : function(s) { + return s.substring(0, 1).toUpperCase() + s.substring(1); + } + }); + + tinymce.ThemeManager.add('advanced', tinymce.themes.AdvancedTheme); +}()); \ No newline at end of file diff --git a/include/javascript/tiny_mce/themes/advanced/js/about.js b/include/javascript/tiny_mce/themes/advanced/js/about.js new file mode 100755 index 00000000..7fc8ba2a --- /dev/null +++ b/include/javascript/tiny_mce/themes/advanced/js/about.js @@ -0,0 +1,72 @@ +tinyMCEPopup.requireLangPack(); + +function init() { + var ed, tcont; + + tinyMCEPopup.resizeToInnerSize(); + ed = tinyMCEPopup.editor; + + // Give FF some time + window.setTimeout(insertHelpIFrame, 10); + + tcont = document.getElementById('plugintablecontainer'); + document.getElementById('plugins_tab').style.display = 'none'; + + var html = ""; + html += ''; + html += ''; + html += ''; + html += ''; + html += ''; + html += ''; + html += ''; + html += ''; + html += ''; + + tinymce.each(ed.plugins, function(p, n) { + var info; + + if (!p.getInfo) + return; + + html += ''; + + info = p.getInfo(); + + if (info.infourl != null && info.infourl != '') + html += ''; + else + html += ''; + + if (info.authorurl != null && info.authorurl != '') + html += ''; + else + html += ''; + + html += ''; + html += ''; + + document.getElementById('plugins_tab').style.display = ''; + + }); + + html += ''; + html += '
    ' + ed.getLang('advanced_dlg.about_plugin') + '' + ed.getLang('advanced_dlg.about_author') + '' + ed.getLang('advanced_dlg.about_version') + '
    ' + info.longname + '' + info.longname + '' + info.author + '' + info.author + '' + info.version + '
    '; + + tcont.innerHTML = html; + + tinyMCEPopup.dom.get('version').innerHTML = tinymce.majorVersion + "." + tinymce.minorVersion; + tinyMCEPopup.dom.get('date').innerHTML = tinymce.releaseDate; +} + +function insertHelpIFrame() { + var html; + + if (tinyMCEPopup.getParam('docs_url')) { + html = ''; + document.getElementById('iframecontainer').innerHTML = html; + document.getElementById('help_tab').style.display = 'block'; + } +} + +tinyMCEPopup.onInit.add(init); diff --git a/include/javascript/tiny_mce/themes/advanced/js/anchor.js b/include/javascript/tiny_mce/themes/advanced/js/anchor.js new file mode 100755 index 00000000..76f4f7dd --- /dev/null +++ b/include/javascript/tiny_mce/themes/advanced/js/anchor.js @@ -0,0 +1,37 @@ +tinyMCEPopup.requireLangPack(); + +var AnchorDialog = { + init : function(ed) { + var action, elm, f = document.forms[0]; + + this.editor = ed; + elm = ed.dom.getParent(ed.selection.getNode(), 'A,IMG'); + v = ed.dom.getAttrib(elm, 'name'); + + if (v) { + this.action = 'update'; + f.anchorName.value = v; + } + + f.insert.value = ed.getLang(elm ? 'update' : 'insert'); + }, + + update : function() { + var ed = this.editor; + + tinyMCEPopup.restoreSelection(); + + if (this.action != 'update') + ed.selection.collapse(1); + + // Webkit acts weird if empty inline element is inserted so we need to use a image instead + if (tinymce.isWebKit) + ed.execCommand('mceInsertContent', 0, ed.dom.createHTML('img', {mce_name : 'a', name : document.forms[0].anchorName.value, 'class' : 'mceItemAnchor'})); + else + ed.execCommand('mceInsertContent', 0, ed.dom.createHTML('a', {name : document.forms[0].anchorName.value, 'class' : 'mceItemAnchor'}, '')); + + tinyMCEPopup.close(); + } +}; + +tinyMCEPopup.onInit.add(AnchorDialog.init, AnchorDialog); diff --git a/include/javascript/tiny_mce/themes/advanced/js/charmap.js b/include/javascript/tiny_mce/themes/advanced/js/charmap.js new file mode 100755 index 00000000..d9fd8d32 --- /dev/null +++ b/include/javascript/tiny_mce/themes/advanced/js/charmap.js @@ -0,0 +1,325 @@ +tinyMCEPopup.requireLangPack(); + +var charmap = [ + [' ', ' ', true, 'no-break space'], + ['&', '&', true, 'ampersand'], + ['"', '"', true, 'quotation mark'], +// finance + ['¢', '¢', true, 'cent sign'], + ['€', '€', true, 'euro sign'], + ['£', '£', true, 'pound sign'], + ['¥', '¥', true, 'yen sign'], +// signs + ['©', '©', true, 'copyright sign'], + ['®', '®', true, 'registered sign'], + ['™', '™', true, 'trade mark sign'], + ['‰', '‰', true, 'per mille sign'], + ['µ', 'µ', true, 'micro sign'], + ['·', '·', true, 'middle dot'], + ['•', '•', true, 'bullet'], + ['…', '…', true, 'three dot leader'], + ['′', '′', true, 'minutes / feet'], + ['″', '″', true, 'seconds / inches'], + ['§', '§', true, 'section sign'], + ['¶', '¶', true, 'paragraph sign'], + ['ß', 'ß', true, 'sharp s / ess-zed'], +// quotations + ['‹', '‹', true, 'single left-pointing angle quotation mark'], + ['›', '›', true, 'single right-pointing angle quotation mark'], + ['«', '«', true, 'left pointing guillemet'], + ['»', '»', true, 'right pointing guillemet'], + ['‘', '‘', true, 'left single quotation mark'], + ['’', '’', true, 'right single quotation mark'], + ['“', '“', true, 'left double quotation mark'], + ['”', '”', true, 'right double quotation mark'], + ['‚', '‚', true, 'single low-9 quotation mark'], + ['„', '„', true, 'double low-9 quotation mark'], + ['<', '<', true, 'less-than sign'], + ['>', '>', true, 'greater-than sign'], + ['≤', '≤', true, 'less-than or equal to'], + ['≥', '≥', true, 'greater-than or equal to'], + ['–', '–', true, 'en dash'], + ['—', '—', true, 'em dash'], + ['¯', '¯', true, 'macron'], + ['‾', '‾', true, 'overline'], + ['¤', '¤', true, 'currency sign'], + ['¦', '¦', true, 'broken bar'], + ['¨', '¨', true, 'diaeresis'], + ['¡', '¡', true, 'inverted exclamation mark'], + ['¿', '¿', true, 'turned question mark'], + ['ˆ', 'ˆ', true, 'circumflex accent'], + ['˜', '˜', true, 'small tilde'], + ['°', '°', true, 'degree sign'], + ['−', '−', true, 'minus sign'], + ['±', '±', true, 'plus-minus sign'], + ['÷', '÷', true, 'division sign'], + ['⁄', '⁄', true, 'fraction slash'], + ['×', '×', true, 'multiplication sign'], + ['¹', '¹', true, 'superscript one'], + ['²', '²', true, 'superscript two'], + ['³', '³', true, 'superscript three'], + ['¼', '¼', true, 'fraction one quarter'], + ['½', '½', true, 'fraction one half'], + ['¾', '¾', true, 'fraction three quarters'], +// math / logical + ['ƒ', 'ƒ', true, 'function / florin'], + ['∫', '∫', true, 'integral'], + ['∑', '∑', true, 'n-ary sumation'], + ['∞', '∞', true, 'infinity'], + ['√', '√', true, 'square root'], + ['∼', '∼', false,'similar to'], + ['≅', '≅', false,'approximately equal to'], + ['≈', '≈', true, 'almost equal to'], + ['≠', '≠', true, 'not equal to'], + ['≡', '≡', true, 'identical to'], + ['∈', '∈', false,'element of'], + ['∉', '∉', false,'not an element of'], + ['∋', '∋', false,'contains as member'], + ['∏', '∏', true, 'n-ary product'], + ['∧', '∧', false,'logical and'], + ['∨', '∨', false,'logical or'], + ['¬', '¬', true, 'not sign'], + ['∩', '∩', true, 'intersection'], + ['∪', '∪', false,'union'], + ['∂', '∂', true, 'partial differential'], + ['∀', '∀', false,'for all'], + ['∃', '∃', false,'there exists'], + ['∅', '∅', false,'diameter'], + ['∇', '∇', false,'backward difference'], + ['∗', '∗', false,'asterisk operator'], + ['∝', '∝', false,'proportional to'], + ['∠', '∠', false,'angle'], +// undefined + ['´', '´', true, 'acute accent'], + ['¸', '¸', true, 'cedilla'], + ['ª', 'ª', true, 'feminine ordinal indicator'], + ['º', 'º', true, 'masculine ordinal indicator'], + ['†', '†', true, 'dagger'], + ['‡', '‡', true, 'double dagger'], +// alphabetical special chars + ['À', 'À', true, 'A - grave'], + ['Á', 'Á', true, 'A - acute'], + ['Â', 'Â', true, 'A - circumflex'], + ['Ã', 'Ã', true, 'A - tilde'], + ['Ä', 'Ä', true, 'A - diaeresis'], + ['Å', 'Å', true, 'A - ring above'], + ['Æ', 'Æ', true, 'ligature AE'], + ['Ç', 'Ç', true, 'C - cedilla'], + ['È', 'È', true, 'E - grave'], + ['É', 'É', true, 'E - acute'], + ['Ê', 'Ê', true, 'E - circumflex'], + ['Ë', 'Ë', true, 'E - diaeresis'], + ['Ì', 'Ì', true, 'I - grave'], + ['Í', 'Í', true, 'I - acute'], + ['Î', 'Î', true, 'I - circumflex'], + ['Ï', 'Ï', true, 'I - diaeresis'], + ['Ð', 'Ð', true, 'ETH'], + ['Ñ', 'Ñ', true, 'N - tilde'], + ['Ò', 'Ò', true, 'O - grave'], + ['Ó', 'Ó', true, 'O - acute'], + ['Ô', 'Ô', true, 'O - circumflex'], + ['Õ', 'Õ', true, 'O - tilde'], + ['Ö', 'Ö', true, 'O - diaeresis'], + ['Ø', 'Ø', true, 'O - slash'], + ['Œ', 'Œ', true, 'ligature OE'], + ['Š', 'Š', true, 'S - caron'], + ['Ù', 'Ù', true, 'U - grave'], + ['Ú', 'Ú', true, 'U - acute'], + ['Û', 'Û', true, 'U - circumflex'], + ['Ü', 'Ü', true, 'U - diaeresis'], + ['Ý', 'Ý', true, 'Y - acute'], + ['Ÿ', 'Ÿ', true, 'Y - diaeresis'], + ['Þ', 'Þ', true, 'THORN'], + ['à', 'à', true, 'a - grave'], + ['á', 'á', true, 'a - acute'], + ['â', 'â', true, 'a - circumflex'], + ['ã', 'ã', true, 'a - tilde'], + ['ä', 'ä', true, 'a - diaeresis'], + ['å', 'å', true, 'a - ring above'], + ['æ', 'æ', true, 'ligature ae'], + ['ç', 'ç', true, 'c - cedilla'], + ['è', 'è', true, 'e - grave'], + ['é', 'é', true, 'e - acute'], + ['ê', 'ê', true, 'e - circumflex'], + ['ë', 'ë', true, 'e - diaeresis'], + ['ì', 'ì', true, 'i - grave'], + ['í', 'í', true, 'i - acute'], + ['î', 'î', true, 'i - circumflex'], + ['ï', 'ï', true, 'i - diaeresis'], + ['ð', 'ð', true, 'eth'], + ['ñ', 'ñ', true, 'n - tilde'], + ['ò', 'ò', true, 'o - grave'], + ['ó', 'ó', true, 'o - acute'], + ['ô', 'ô', true, 'o - circumflex'], + ['õ', 'õ', true, 'o - tilde'], + ['ö', 'ö', true, 'o - diaeresis'], + ['ø', 'ø', true, 'o slash'], + ['œ', 'œ', true, 'ligature oe'], + ['š', 'š', true, 's - caron'], + ['ù', 'ù', true, 'u - grave'], + ['ú', 'ú', true, 'u - acute'], + ['û', 'û', true, 'u - circumflex'], + ['ü', 'ü', true, 'u - diaeresis'], + ['ý', 'ý', true, 'y - acute'], + ['þ', 'þ', true, 'thorn'], + ['ÿ', 'ÿ', true, 'y - diaeresis'], + ['Α', 'Α', true, 'Alpha'], + ['Β', 'Β', true, 'Beta'], + ['Γ', 'Γ', true, 'Gamma'], + ['Δ', 'Δ', true, 'Delta'], + ['Ε', 'Ε', true, 'Epsilon'], + ['Ζ', 'Ζ', true, 'Zeta'], + ['Η', 'Η', true, 'Eta'], + ['Θ', 'Θ', true, 'Theta'], + ['Ι', 'Ι', true, 'Iota'], + ['Κ', 'Κ', true, 'Kappa'], + ['Λ', 'Λ', true, 'Lambda'], + ['Μ', 'Μ', true, 'Mu'], + ['Ν', 'Ν', true, 'Nu'], + ['Ξ', 'Ξ', true, 'Xi'], + ['Ο', 'Ο', true, 'Omicron'], + ['Π', 'Π', true, 'Pi'], + ['Ρ', 'Ρ', true, 'Rho'], + ['Σ', 'Σ', true, 'Sigma'], + ['Τ', 'Τ', true, 'Tau'], + ['Υ', 'Υ', true, 'Upsilon'], + ['Φ', 'Φ', true, 'Phi'], + ['Χ', 'Χ', true, 'Chi'], + ['Ψ', 'Ψ', true, 'Psi'], + ['Ω', 'Ω', true, 'Omega'], + ['α', 'α', true, 'alpha'], + ['β', 'β', true, 'beta'], + ['γ', 'γ', true, 'gamma'], + ['δ', 'δ', true, 'delta'], + ['ε', 'ε', true, 'epsilon'], + ['ζ', 'ζ', true, 'zeta'], + ['η', 'η', true, 'eta'], + ['θ', 'θ', true, 'theta'], + ['ι', 'ι', true, 'iota'], + ['κ', 'κ', true, 'kappa'], + ['λ', 'λ', true, 'lambda'], + ['μ', 'μ', true, 'mu'], + ['ν', 'ν', true, 'nu'], + ['ξ', 'ξ', true, 'xi'], + ['ο', 'ο', true, 'omicron'], + ['π', 'π', true, 'pi'], + ['ρ', 'ρ', true, 'rho'], + ['ς', 'ς', true, 'final sigma'], + ['σ', 'σ', true, 'sigma'], + ['τ', 'τ', true, 'tau'], + ['υ', 'υ', true, 'upsilon'], + ['φ', 'φ', true, 'phi'], + ['χ', 'χ', true, 'chi'], + ['ψ', 'ψ', true, 'psi'], + ['ω', 'ω', true, 'omega'], +// symbols + ['ℵ', 'ℵ', false,'alef symbol'], + ['ϖ', 'ϖ', false,'pi symbol'], + ['ℜ', 'ℜ', false,'real part symbol'], + ['ϑ','ϑ', false,'theta symbol'], + ['ϒ', 'ϒ', false,'upsilon - hook symbol'], + ['℘', '℘', false,'Weierstrass p'], + ['ℑ', 'ℑ', false,'imaginary part'], +// arrows + ['←', '←', true, 'leftwards arrow'], + ['↑', '↑', true, 'upwards arrow'], + ['→', '→', true, 'rightwards arrow'], + ['↓', '↓', true, 'downwards arrow'], + ['↔', '↔', true, 'left right arrow'], + ['↵', '↵', false,'carriage return'], + ['⇐', '⇐', false,'leftwards double arrow'], + ['⇑', '⇑', false,'upwards double arrow'], + ['⇒', '⇒', false,'rightwards double arrow'], + ['⇓', '⇓', false,'downwards double arrow'], + ['⇔', '⇔', false,'left right double arrow'], + ['∴', '∴', false,'therefore'], + ['⊂', '⊂', false,'subset of'], + ['⊃', '⊃', false,'superset of'], + ['⊄', '⊄', false,'not a subset of'], + ['⊆', '⊆', false,'subset of or equal to'], + ['⊇', '⊇', false,'superset of or equal to'], + ['⊕', '⊕', false,'circled plus'], + ['⊗', '⊗', false,'circled times'], + ['⊥', '⊥', false,'perpendicular'], + ['⋅', '⋅', false,'dot operator'], + ['⌈', '⌈', false,'left ceiling'], + ['⌉', '⌉', false,'right ceiling'], + ['⌊', '⌊', false,'left floor'], + ['⌋', '⌋', false,'right floor'], + ['⟨', '〈', false,'left-pointing angle bracket'], + ['⟩', '〉', false,'right-pointing angle bracket'], + ['◊', '◊', true,'lozenge'], + ['♠', '♠', false,'black spade suit'], + ['♣', '♣', true, 'black club suit'], + ['♥', '♥', true, 'black heart suit'], + ['♦', '♦', true, 'black diamond suit'], + [' ', ' ', false,'en space'], + [' ', ' ', false,'em space'], + [' ', ' ', false,'thin space'], + ['‌', '‌', false,'zero width non-joiner'], + ['‍', '‍', false,'zero width joiner'], + ['‎', '‎', false,'left-to-right mark'], + ['‏', '‏', false,'right-to-left mark'], + ['­', '­', false,'soft hyphen'] +]; + +tinyMCEPopup.onInit.add(function() { + tinyMCEPopup.dom.setHTML('charmapView', renderCharMapHTML()); +}); + +function renderCharMapHTML() { + var charsPerRow = 20, tdWidth=20, tdHeight=20, i; + var html = ''; + var cols=-1; + + for (i=0; i' + + '' + + charmap[i][1] + + ''; + if ((cols+1) % charsPerRow == 0) + html += ''; + } + } + + if (cols % charsPerRow > 0) { + var padd = charsPerRow - (cols % charsPerRow); + for (var i=0; i '; + } + + html += '
    '; + + return html; +} + +function insertChar(chr) { + tinyMCEPopup.execCommand('mceInsertContent', false, '&#' + chr + ';'); + + // Refocus in window + if (tinyMCEPopup.isWindow) + window.focus(); + + tinyMCEPopup.editor.focus(); + tinyMCEPopup.close(); +} + +function previewChar(codeA, codeB, codeN) { + var elmA = document.getElementById('codeA'); + var elmB = document.getElementById('codeB'); + var elmV = document.getElementById('codeV'); + var elmN = document.getElementById('codeN'); + + if (codeA=='#160;') { + elmV.innerHTML = '__'; + } else { + elmV.innerHTML = '&' + codeA; + } + + elmB.innerHTML = '&' + codeA; + elmA.innerHTML = '&' + codeB; + elmN.innerHTML = codeN; +} diff --git a/include/javascript/tiny_mce/themes/advanced/js/color_picker.js b/include/javascript/tiny_mce/themes/advanced/js/color_picker.js new file mode 100755 index 00000000..c1a65db2 --- /dev/null +++ b/include/javascript/tiny_mce/themes/advanced/js/color_picker.js @@ -0,0 +1,253 @@ +tinyMCEPopup.requireLangPack(); + +var detail = 50, strhex = "0123456789abcdef", i, isMouseDown = false, isMouseOver = false; + +var colors = [ + "#000000","#000033","#000066","#000099","#0000cc","#0000ff","#330000","#330033", + "#330066","#330099","#3300cc","#3300ff","#660000","#660033","#660066","#660099", + "#6600cc","#6600ff","#990000","#990033","#990066","#990099","#9900cc","#9900ff", + "#cc0000","#cc0033","#cc0066","#cc0099","#cc00cc","#cc00ff","#ff0000","#ff0033", + "#ff0066","#ff0099","#ff00cc","#ff00ff","#003300","#003333","#003366","#003399", + "#0033cc","#0033ff","#333300","#333333","#333366","#333399","#3333cc","#3333ff", + "#663300","#663333","#663366","#663399","#6633cc","#6633ff","#993300","#993333", + "#993366","#993399","#9933cc","#9933ff","#cc3300","#cc3333","#cc3366","#cc3399", + "#cc33cc","#cc33ff","#ff3300","#ff3333","#ff3366","#ff3399","#ff33cc","#ff33ff", + "#006600","#006633","#006666","#006699","#0066cc","#0066ff","#336600","#336633", + "#336666","#336699","#3366cc","#3366ff","#666600","#666633","#666666","#666699", + "#6666cc","#6666ff","#996600","#996633","#996666","#996699","#9966cc","#9966ff", + "#cc6600","#cc6633","#cc6666","#cc6699","#cc66cc","#cc66ff","#ff6600","#ff6633", + "#ff6666","#ff6699","#ff66cc","#ff66ff","#009900","#009933","#009966","#009999", + "#0099cc","#0099ff","#339900","#339933","#339966","#339999","#3399cc","#3399ff", + "#669900","#669933","#669966","#669999","#6699cc","#6699ff","#999900","#999933", + "#999966","#999999","#9999cc","#9999ff","#cc9900","#cc9933","#cc9966","#cc9999", + "#cc99cc","#cc99ff","#ff9900","#ff9933","#ff9966","#ff9999","#ff99cc","#ff99ff", + "#00cc00","#00cc33","#00cc66","#00cc99","#00cccc","#00ccff","#33cc00","#33cc33", + "#33cc66","#33cc99","#33cccc","#33ccff","#66cc00","#66cc33","#66cc66","#66cc99", + "#66cccc","#66ccff","#99cc00","#99cc33","#99cc66","#99cc99","#99cccc","#99ccff", + "#cccc00","#cccc33","#cccc66","#cccc99","#cccccc","#ccccff","#ffcc00","#ffcc33", + "#ffcc66","#ffcc99","#ffcccc","#ffccff","#00ff00","#00ff33","#00ff66","#00ff99", + "#00ffcc","#00ffff","#33ff00","#33ff33","#33ff66","#33ff99","#33ffcc","#33ffff", + "#66ff00","#66ff33","#66ff66","#66ff99","#66ffcc","#66ffff","#99ff00","#99ff33", + "#99ff66","#99ff99","#99ffcc","#99ffff","#ccff00","#ccff33","#ccff66","#ccff99", + "#ccffcc","#ccffff","#ffff00","#ffff33","#ffff66","#ffff99","#ffffcc","#ffffff" +]; + +var named = { + '#F0F8FF':'AliceBlue','#FAEBD7':'AntiqueWhite','#00FFFF':'Aqua','#7FFFD4':'Aquamarine','#F0FFFF':'Azure','#F5F5DC':'Beige', + '#FFE4C4':'Bisque','#000000':'Black','#FFEBCD':'BlanchedAlmond','#0000FF':'Blue','#8A2BE2':'BlueViolet','#A52A2A':'Brown', + '#DEB887':'BurlyWood','#5F9EA0':'CadetBlue','#7FFF00':'Chartreuse','#D2691E':'Chocolate','#FF7F50':'Coral','#6495ED':'CornflowerBlue', + '#FFF8DC':'Cornsilk','#DC143C':'Crimson','#00FFFF':'Cyan','#00008B':'DarkBlue','#008B8B':'DarkCyan','#B8860B':'DarkGoldenRod', + '#A9A9A9':'DarkGray','#A9A9A9':'DarkGrey','#006400':'DarkGreen','#BDB76B':'DarkKhaki','#8B008B':'DarkMagenta','#556B2F':'DarkOliveGreen', + '#FF8C00':'Darkorange','#9932CC':'DarkOrchid','#8B0000':'DarkRed','#E9967A':'DarkSalmon','#8FBC8F':'DarkSeaGreen','#483D8B':'DarkSlateBlue', + '#2F4F4F':'DarkSlateGray','#2F4F4F':'DarkSlateGrey','#00CED1':'DarkTurquoise','#9400D3':'DarkViolet','#FF1493':'DeepPink','#00BFFF':'DeepSkyBlue', + '#696969':'DimGray','#696969':'DimGrey','#1E90FF':'DodgerBlue','#B22222':'FireBrick','#FFFAF0':'FloralWhite','#228B22':'ForestGreen', + '#FF00FF':'Fuchsia','#DCDCDC':'Gainsboro','#F8F8FF':'GhostWhite','#FFD700':'Gold','#DAA520':'GoldenRod','#808080':'Gray','#808080':'Grey', + '#008000':'Green','#ADFF2F':'GreenYellow','#F0FFF0':'HoneyDew','#FF69B4':'HotPink','#CD5C5C':'IndianRed','#4B0082':'Indigo','#FFFFF0':'Ivory', + '#F0E68C':'Khaki','#E6E6FA':'Lavender','#FFF0F5':'LavenderBlush','#7CFC00':'LawnGreen','#FFFACD':'LemonChiffon','#ADD8E6':'LightBlue', + '#F08080':'LightCoral','#E0FFFF':'LightCyan','#FAFAD2':'LightGoldenRodYellow','#D3D3D3':'LightGray','#D3D3D3':'LightGrey','#90EE90':'LightGreen', + '#FFB6C1':'LightPink','#FFA07A':'LightSalmon','#20B2AA':'LightSeaGreen','#87CEFA':'LightSkyBlue','#778899':'LightSlateGray','#778899':'LightSlateGrey', + '#B0C4DE':'LightSteelBlue','#FFFFE0':'LightYellow','#00FF00':'Lime','#32CD32':'LimeGreen','#FAF0E6':'Linen','#FF00FF':'Magenta','#800000':'Maroon', + '#66CDAA':'MediumAquaMarine','#0000CD':'MediumBlue','#BA55D3':'MediumOrchid','#9370D8':'MediumPurple','#3CB371':'MediumSeaGreen','#7B68EE':'MediumSlateBlue', + '#00FA9A':'MediumSpringGreen','#48D1CC':'MediumTurquoise','#C71585':'MediumVioletRed','#191970':'MidnightBlue','#F5FFFA':'MintCream','#FFE4E1':'MistyRose','#FFE4B5':'Moccasin', + '#FFDEAD':'NavajoWhite','#000080':'Navy','#FDF5E6':'OldLace','#808000':'Olive','#6B8E23':'OliveDrab','#FFA500':'Orange','#FF4500':'OrangeRed','#DA70D6':'Orchid', + '#EEE8AA':'PaleGoldenRod','#98FB98':'PaleGreen','#AFEEEE':'PaleTurquoise','#D87093':'PaleVioletRed','#FFEFD5':'PapayaWhip','#FFDAB9':'PeachPuff', + '#CD853F':'Peru','#FFC0CB':'Pink','#DDA0DD':'Plum','#B0E0E6':'PowderBlue','#800080':'Purple','#FF0000':'Red','#BC8F8F':'RosyBrown','#4169E1':'RoyalBlue', + '#8B4513':'SaddleBrown','#FA8072':'Salmon','#F4A460':'SandyBrown','#2E8B57':'SeaGreen','#FFF5EE':'SeaShell','#A0522D':'Sienna','#C0C0C0':'Silver', + '#87CEEB':'SkyBlue','#6A5ACD':'SlateBlue','#708090':'SlateGray','#708090':'SlateGrey','#FFFAFA':'Snow','#00FF7F':'SpringGreen', + '#4682B4':'SteelBlue','#D2B48C':'Tan','#008080':'Teal','#D8BFD8':'Thistle','#FF6347':'Tomato','#40E0D0':'Turquoise','#EE82EE':'Violet', + '#F5DEB3':'Wheat','#FFFFFF':'White','#F5F5F5':'WhiteSmoke','#FFFF00':'Yellow','#9ACD32':'YellowGreen' +}; + +function init() { + var inputColor = convertRGBToHex(tinyMCEPopup.getWindowArg('input_color')); + + tinyMCEPopup.resizeToInnerSize(); + + generatePicker(); + + if (inputColor) { + changeFinalColor(inputColor); + + col = convertHexToRGB(inputColor); + + if (col) + updateLight(col.r, col.g, col.b); + } +} + +function insertAction() { + var color = document.getElementById("color").value, f = tinyMCEPopup.getWindowArg('func'); + + tinyMCEPopup.restoreSelection(); + + if (f) + f(color); + + tinyMCEPopup.close(); +} + +function showColor(color, name) { + if (name) + document.getElementById("colorname").innerHTML = name; + + document.getElementById("preview").style.backgroundColor = color; + document.getElementById("color").value = color.toLowerCase(); +} + +function convertRGBToHex(col) { + var re = new RegExp("rgb\\s*\\(\\s*([0-9]+).*,\\s*([0-9]+).*,\\s*([0-9]+).*\\)", "gi"); + + if (!col) + return col; + + var rgb = col.replace(re, "$1,$2,$3").split(','); + if (rgb.length == 3) { + r = parseInt(rgb[0]).toString(16); + g = parseInt(rgb[1]).toString(16); + b = parseInt(rgb[2]).toString(16); + + r = r.length == 1 ? '0' + r : r; + g = g.length == 1 ? '0' + g : g; + b = b.length == 1 ? '0' + b : b; + + return "#" + r + g + b; + } + + return col; +} + +function convertHexToRGB(col) { + if (col.indexOf('#') != -1) { + col = col.replace(new RegExp('[^0-9A-F]', 'gi'), ''); + + r = parseInt(col.substring(0, 2), 16); + g = parseInt(col.substring(2, 4), 16); + b = parseInt(col.substring(4, 6), 16); + + return {r : r, g : g, b : b}; + } + + return null; +} + +function generatePicker() { + var el = document.getElementById('light'), h = '', i; + + for (i = 0; i < detail; i++){ + h += '
    '; + } + + el.innerHTML = h; +} + +function generateWebColors() { + var el = document.getElementById('webcolors'), h = '', i; + + if (el.className == 'generated') + return; + + h += '' + + ''; + + for (i=0; i' + + '' + + ''; + if ((i+1) % 18 == 0) + h += ''; + } + + h += '
    '; + + el.innerHTML = h; + el.className = 'generated'; +} + +function generateNamedColors() { + var el = document.getElementById('namedcolors'), h = '', n, v, i = 0; + + if (el.className == 'generated') + return; + + for (n in named) { + v = named[n]; + h += '' + } + + el.innerHTML = h; + el.className = 'generated'; +} + +function dechex(n) { + return strhex.charAt(Math.floor(n / 16)) + strhex.charAt(n % 16); +} + +function computeColor(e) { + var x, y, partWidth, partDetail, imHeight, r, g, b, coef, i, finalCoef, finalR, finalG, finalB; + + x = e.offsetX ? e.offsetX : (e.target ? e.clientX - e.target.x : 0); + y = e.offsetY ? e.offsetY : (e.target ? e.clientY - e.target.y : 0); + + partWidth = document.getElementById('colors').width / 6; + partDetail = detail / 2; + imHeight = document.getElementById('colors').height; + + r = (x >= 0)*(x < partWidth)*255 + (x >= partWidth)*(x < 2*partWidth)*(2*255 - x * 255 / partWidth) + (x >= 4*partWidth)*(x < 5*partWidth)*(-4*255 + x * 255 / partWidth) + (x >= 5*partWidth)*(x < 6*partWidth)*255; + g = (x >= 0)*(x < partWidth)*(x * 255 / partWidth) + (x >= partWidth)*(x < 3*partWidth)*255 + (x >= 3*partWidth)*(x < 4*partWidth)*(4*255 - x * 255 / partWidth); + b = (x >= 2*partWidth)*(x < 3*partWidth)*(-2*255 + x * 255 / partWidth) + (x >= 3*partWidth)*(x < 5*partWidth)*255 + (x >= 5*partWidth)*(x < 6*partWidth)*(6*255 - x * 255 / partWidth); + + coef = (imHeight - y) / imHeight; + r = 128 + (r - 128) * coef; + g = 128 + (g - 128) * coef; + b = 128 + (b - 128) * coef; + + changeFinalColor('#' + dechex(r) + dechex(g) + dechex(b)); + updateLight(r, g, b); +} + +function updateLight(r, g, b) { + var i, partDetail = detail / 2, finalCoef, finalR, finalG, finalB, color; + + for (i=0; i=0) && (i'); + }, + + init : function() { + var f = document.forms[0], ed = tinyMCEPopup.editor; + + // Setup browse button + document.getElementById('srcbrowsercontainer').innerHTML = getBrowserHTML('srcbrowser','src','image','theme_advanced_image'); + if (isVisible('srcbrowser')) + document.getElementById('src').style.width = '180px'; + + e = ed.selection.getNode(); + + this.fillFileList('image_list', 'tinyMCEImageList'); + + if (e.nodeName == 'IMG') { + f.src.value = ed.dom.getAttrib(e, 'src'); + f.alt.value = ed.dom.getAttrib(e, 'alt'); + f.border.value = this.getAttrib(e, 'border'); + f.vspace.value = this.getAttrib(e, 'vspace'); + f.hspace.value = this.getAttrib(e, 'hspace'); + f.width.value = ed.dom.getAttrib(e, 'width'); + f.height.value = ed.dom.getAttrib(e, 'height'); + f.insert.value = ed.getLang('update'); + this.styleVal = ed.dom.getAttrib(e, 'style'); + selectByValue(f, 'image_list', f.src.value); + selectByValue(f, 'align', this.getAttrib(e, 'align')); + this.updateStyle(); + } + }, + + fillFileList : function(id, l) { + var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl; + + l = window[l]; + + if (l && l.length > 0) { + lst.options[lst.options.length] = new Option('', ''); + + tinymce.each(l, function(o) { + lst.options[lst.options.length] = new Option(o[0], o[1]); + }); + } else + dom.remove(dom.getParent(id, 'tr')); + }, + + update : function() { + var f = document.forms[0], nl = f.elements, ed = tinyMCEPopup.editor, args = {}, el; + + tinyMCEPopup.restoreSelection(); + + if (f.src.value === '') { + if (ed.selection.getNode().nodeName == 'IMG') { + ed.dom.remove(ed.selection.getNode()); + ed.execCommand('mceRepaint'); + } + + tinyMCEPopup.close(); + return; + } + + if (!ed.settings.inline_styles) { + args = tinymce.extend(args, { + vspace : nl.vspace.value, + hspace : nl.hspace.value, + border : nl.border.value, + align : getSelectValue(f, 'align') + }); + } else + args.style = this.styleVal; + + tinymce.extend(args, { + src : f.src.value, + alt : f.alt.value, + width : f.width.value, + height : f.height.value + }); + + el = ed.selection.getNode(); + + if (el && el.nodeName == 'IMG') { + ed.dom.setAttribs(el, args); + } else { + ed.execCommand('mceInsertContent', false, '', {skip_undo : 1}); + ed.dom.setAttribs('__mce_tmp', args); + ed.dom.setAttrib('__mce_tmp', 'id', ''); + ed.undoManager.add(); + } + + tinyMCEPopup.close(); + }, + + updateStyle : function() { + var dom = tinyMCEPopup.dom, st, v, f = document.forms[0]; + + if (tinyMCEPopup.editor.settings.inline_styles) { + st = tinyMCEPopup.dom.parseStyle(this.styleVal); + + // Handle align + v = getSelectValue(f, 'align'); + if (v) { + if (v == 'left' || v == 'right') { + st['float'] = v; + delete st['vertical-align']; + } else { + st['vertical-align'] = v; + delete st['float']; + } + } else { + delete st['float']; + delete st['vertical-align']; + } + + // Handle border + v = f.border.value; + if (v || v == '0') { + if (v == '0') + st['border'] = '0'; + else + st['border'] = v + 'px solid black'; + } else + delete st['border']; + + // Handle hspace + v = f.hspace.value; + if (v) { + delete st['margin']; + st['margin-left'] = v + 'px'; + st['margin-right'] = v + 'px'; + } else { + delete st['margin-left']; + delete st['margin-right']; + } + + // Handle vspace + v = f.vspace.value; + if (v) { + delete st['margin']; + st['margin-top'] = v + 'px'; + st['margin-bottom'] = v + 'px'; + } else { + delete st['margin-top']; + delete st['margin-bottom']; + } + + // Merge + st = tinyMCEPopup.dom.parseStyle(dom.serializeStyle(st)); + this.styleVal = dom.serializeStyle(st); + } + }, + + getAttrib : function(e, at) { + var ed = tinyMCEPopup.editor, dom = ed.dom, v, v2; + + if (ed.settings.inline_styles) { + switch (at) { + case 'align': + if (v = dom.getStyle(e, 'float')) + return v; + + if (v = dom.getStyle(e, 'vertical-align')) + return v; + + break; + + case 'hspace': + v = dom.getStyle(e, 'margin-left') + v2 = dom.getStyle(e, 'margin-right'); + if (v && v == v2) + return parseInt(v.replace(/[^0-9]/g, '')); + + break; + + case 'vspace': + v = dom.getStyle(e, 'margin-top') + v2 = dom.getStyle(e, 'margin-bottom'); + if (v && v == v2) + return parseInt(v.replace(/[^0-9]/g, '')); + + break; + + case 'border': + v = 0; + + tinymce.each(['top', 'right', 'bottom', 'left'], function(sv) { + sv = dom.getStyle(e, 'border-' + sv + '-width'); + + // False or not the same as prev + if (!sv || (sv != v && v !== 0)) { + v = 0; + return false; + } + + if (sv) + v = sv; + }); + + if (v) + return parseInt(v.replace(/[^0-9]/g, '')); + + break; + } + } + + if (v = dom.getAttrib(e, at)) + return v; + + return ''; + }, + + resetImageData : function() { + var f = document.forms[0]; + + f.width.value = f.height.value = ""; + }, + + updateImageData : function() { + var f = document.forms[0], t = ImageDialog; + + if (f.width.value == "") + f.width.value = t.preloadImg.width; + + if (f.height.value == "") + f.height.value = t.preloadImg.height; + }, + + getImageData : function() { + var f = document.forms[0]; + + this.preloadImg = new Image(); + this.preloadImg.onload = this.updateImageData; + this.preloadImg.onerror = this.resetImageData; + this.preloadImg.src = tinyMCEPopup.editor.documentBaseURI.toAbsolute(f.src.value); + } +}; + +ImageDialog.preInit(); +tinyMCEPopup.onInit.add(ImageDialog.init, ImageDialog); diff --git a/include/javascript/tiny_mce/themes/advanced/js/link.js b/include/javascript/tiny_mce/themes/advanced/js/link.js new file mode 100755 index 00000000..c8cb642a --- /dev/null +++ b/include/javascript/tiny_mce/themes/advanced/js/link.js @@ -0,0 +1,155 @@ +tinyMCEPopup.requireLangPack(); + +var LinkDialog = { + preInit : function() { + var url; + + if (url = tinyMCEPopup.getParam("external_link_list_url")) + document.write(''); + }, + + init : function() { + var f = document.forms[0], ed = tinyMCEPopup.editor; + + // Setup browse button + document.getElementById('hrefbrowsercontainer').innerHTML = getBrowserHTML('hrefbrowser', 'href', 'file', 'theme_advanced_link'); + if (isVisible('hrefbrowser')) + document.getElementById('href').style.width = '180px'; + + this.fillClassList('class_list'); + this.fillFileList('link_list', 'tinyMCELinkList'); + this.fillTargetList('target_list'); + + if (e = ed.dom.getParent(ed.selection.getNode(), 'A')) { + f.href.value = ed.dom.getAttrib(e, 'href'); + f.linktitle.value = ed.dom.getAttrib(e, 'title'); + f.insert.value = ed.getLang('update'); + selectByValue(f, 'link_list', f.href.value); + selectByValue(f, 'target_list', ed.dom.getAttrib(e, 'target')); + selectByValue(f, 'class_list', ed.dom.getAttrib(e, 'class')); + } + }, + + update : function() { + var f = document.forms[0], ed = tinyMCEPopup.editor, e, b; + + tinyMCEPopup.restoreSelection(); + e = ed.dom.getParent(ed.selection.getNode(), 'A'); + + // Remove element if there is no href + if (!f.href.value) { + if (e) { + tinyMCEPopup.execCommand("mceBeginUndoLevel"); + b = ed.selection.getBookmark(); + ed.dom.remove(e, 1); + ed.selection.moveToBookmark(b); + tinyMCEPopup.execCommand("mceEndUndoLevel"); + tinyMCEPopup.close(); + return; + } + } + + tinyMCEPopup.execCommand("mceBeginUndoLevel"); + + // Create new anchor elements + if (e == null) { + tinyMCEPopup.execCommand("CreateLink", false, "#mce_temp_url#", {skip_undo : 1}); + + tinymce.each(ed.dom.select("a"), function(n) { + if (ed.dom.getAttrib(n, 'href') == '#mce_temp_url#') { + e = n; + + ed.dom.setAttribs(e, { + href : f.href.value, + title : f.linktitle.value, + target : f.target_list ? f.target_list.options[f.target_list.selectedIndex].value : null, + 'class' : f.class_list ? f.class_list.options[f.class_list.selectedIndex].value : null + }); + } + }); + } else { + ed.dom.setAttribs(e, { + href : f.href.value, + title : f.linktitle.value, + target : f.target_list ? f.target_list.options[f.target_list.selectedIndex].value : null, + 'class' : f.class_list ? f.class_list.options[f.class_list.selectedIndex].value : null + }); + } + + // Don't move caret if selection was image + if (e.childNodes.length != 1 || e.firstChild.nodeName != 'IMG') { + ed.focus(); + ed.selection.select(e); + ed.selection.collapse(0); + tinyMCEPopup.storeSelection(); + } + + tinyMCEPopup.execCommand("mceEndUndoLevel"); + tinyMCEPopup.close(); + }, + + checkPrefix : function(n) { + if (n.value && Validator.isEmail(n) && !/^\s*mailto:/i.test(n.value) && confirm(tinyMCEPopup.getLang('advanced_dlg.link_is_email'))) + n.value = 'mailto:' + n.value; + + if (/^\s*www./i.test(n.value) && confirm(tinyMCEPopup.getLang('advanced_dlg.link_is_external'))) + n.value = 'http://' + n.value; + }, + + fillFileList : function(id, l) { + var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl; + + l = window[l]; + + if (l && l.length > 0) { + lst.options[lst.options.length] = new Option('', ''); + + tinymce.each(l, function(o) { + lst.options[lst.options.length] = new Option(o[0], o[1]); + }); + } else + dom.remove(dom.getParent(id, 'tr')); + }, + + fillClassList : function(id) { + var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl; + + if (v = tinyMCEPopup.getParam('theme_advanced_styles')) { + cl = []; + + tinymce.each(v.split(';'), function(v) { + var p = v.split('='); + + cl.push({'title' : p[0], 'class' : p[1]}); + }); + } else + cl = tinyMCEPopup.editor.dom.getClasses(); + + if (cl.length > 0) { + lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('not_set'), ''); + + tinymce.each(cl, function(o) { + lst.options[lst.options.length] = new Option(o.title || o['class'], o['class']); + }); + } else + dom.remove(dom.getParent(id, 'tr')); + }, + + fillTargetList : function(id) { + var dom = tinyMCEPopup.dom, lst = dom.get(id), v; + + lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('not_set'), ''); + lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('advanced_dlg.link_target_same'), '_self'); + lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('advanced_dlg.link_target_blank'), '_blank'); + + if (v = tinyMCEPopup.getParam('theme_advanced_link_targets')) { + tinymce.each(v.split(','), function(v) { + v = v.split('='); + lst.options[lst.options.length] = new Option(v[0], v[1]); + }); + } + } +}; + +LinkDialog.preInit(); +tinyMCEPopup.onInit.add(LinkDialog.init, LinkDialog); diff --git a/include/javascript/tiny_mce/themes/advanced/js/source_editor.js b/include/javascript/tiny_mce/themes/advanced/js/source_editor.js new file mode 100755 index 00000000..a6235a38 --- /dev/null +++ b/include/javascript/tiny_mce/themes/advanced/js/source_editor.js @@ -0,0 +1,62 @@ +tinyMCEPopup.requireLangPack(); +tinyMCEPopup.onInit.add(onLoadInit); + +function saveContent() { + tinyMCEPopup.editor.setContent(document.getElementById('htmlSource').value); + tinyMCEPopup.close(); +} + +function onLoadInit() { + tinyMCEPopup.resizeToInnerSize(); + + // Remove Gecko spellchecking + if (tinymce.isGecko) + document.body.spellcheck = tinyMCEPopup.editor.getParam("gecko_spellcheck"); + + document.getElementById('htmlSource').value = tinyMCEPopup.editor.getContent(); + + if (tinyMCEPopup.editor.getParam("theme_advanced_source_editor_wrap", true)) { + setWrap('soft'); + document.getElementById('wraped').checked = true; + } + + resizeInputs(); +} + +function setWrap(val) { + var v, n, s = document.getElementById('htmlSource'); + + s.wrap = val; + + if (!tinymce.isIE) { + v = s.value; + n = s.cloneNode(false); + n.setAttribute("wrap", val); + s.parentNode.replaceChild(n, s); + n.value = v; + } +} + +function toggleWordWrap(elm) { + if (elm.checked) + setWrap('soft'); + else + setWrap('off'); +} + +var wHeight=0, wWidth=0, owHeight=0, owWidth=0; + +function resizeInputs() { + var el = document.getElementById('htmlSource'); + + if (!tinymce.isIE) { + wHeight = self.innerHeight - 65; + wWidth = self.innerWidth - 16; + } else { + wHeight = document.body.clientHeight - 70; + wWidth = document.body.clientWidth - 16; + } + + el.style.height = Math.abs(wHeight) + 'px'; + el.style.width = Math.abs(wWidth) + 'px'; +} diff --git a/include/javascript/tiny_mce/themes/advanced/langs/en.js b/include/javascript/tiny_mce/themes/advanced/langs/en.js new file mode 100755 index 00000000..52989e39 --- /dev/null +++ b/include/javascript/tiny_mce/themes/advanced/langs/en.js @@ -0,0 +1,62 @@ +tinyMCE.addI18n('en.advanced',{ +style_select:"Styles", +font_size:"Font size", +fontdefault:"Font family", +block:"Format", +paragraph:"Paragraph", +div:"Div", +address:"Address", +pre:"Preformatted", +h1:"Heading 1", +h2:"Heading 2", +h3:"Heading 3", +h4:"Heading 4", +h5:"Heading 5", +h6:"Heading 6", +blockquote:"Blockquote", +code:"Code", +samp:"Code sample", +dt:"Definition term ", +dd:"Definition description", +bold_desc:"Bold (Ctrl+B)", +italic_desc:"Italic (Ctrl+I)", +underline_desc:"Underline (Ctrl+U)", +striketrough_desc:"Strikethrough", +justifyleft_desc:"Align left", +justifycenter_desc:"Align center", +justifyright_desc:"Align right", +justifyfull_desc:"Align full", +bullist_desc:"Unordered list", +numlist_desc:"Ordered list", +outdent_desc:"Outdent", +indent_desc:"Indent", +undo_desc:"Undo (Ctrl+Z)", +redo_desc:"Redo (Ctrl+Y)", +link_desc:"Insert/edit link", +unlink_desc:"Unlink", +image_desc:"Insert/edit image", +cleanup_desc:"Cleanup messy code", +code_desc:"Edit HTML Source", +sub_desc:"Subscript", +sup_desc:"Superscript", +hr_desc:"Insert horizontal ruler", +removeformat_desc:"Remove formatting", +custom1_desc:"Your custom description here", +forecolor_desc:"Select text color", +backcolor_desc:"Select background color", +charmap_desc:"Insert custom character", +visualaid_desc:"Toggle guidelines/invisible elements", +anchor_desc:"Insert/edit anchor", +cut_desc:"Cut", +copy_desc:"Copy", +paste_desc:"Paste", +image_props_desc:"Image properties", +newdocument_desc:"New document", +help_desc:"Help", +blockquote_desc:"Blockquote", +clipboard_msg:"Copy/Cut/Paste is not available in Mozilla and Firefox.\r\nDo you want more information about this issue?", +path:"Path", +newdocument:"Are you sure you want clear all contents?", +toolbar_focus:"Jump to tool buttons - Alt+Q, Jump to editor - Alt-Z, Jump to element path - Alt-X", +more_colors:"More colors" +}); \ No newline at end of file diff --git a/include/javascript/tiny_mce/themes/advanced/langs/en_dlg.js b/include/javascript/tiny_mce/themes/advanced/langs/en_dlg.js new file mode 100755 index 00000000..80e49419 --- /dev/null +++ b/include/javascript/tiny_mce/themes/advanced/langs/en_dlg.js @@ -0,0 +1,51 @@ +tinyMCE.addI18n('en.advanced_dlg',{ +about_title:"About TinyMCE", +about_general:"About", +about_help:"Help", +about_license:"License", +about_plugins:"Plugins", +about_plugin:"Plugin", +about_author:"Author", +about_version:"Version", +about_loaded:"Loaded plugins", +anchor_title:"Insert/edit anchor", +anchor_name:"Anchor name", +code_title:"HTML Source Editor", +code_wordwrap:"Word wrap", +colorpicker_title:"Select a color", +colorpicker_picker_tab:"Picker", +colorpicker_picker_title:"Color picker", +colorpicker_palette_tab:"Palette", +colorpicker_palette_title:"Palette colors", +colorpicker_named_tab:"Named", +colorpicker_named_title:"Named colors", +colorpicker_color:"Color:", +colorpicker_name:"Name:", +charmap_title:"Select custom character", +image_title:"Insert/edit image", +image_src:"Image URL", +image_alt:"Image description", +image_list:"Image list", +image_border:"Border", +image_dimensions:"Dimensions", +image_vspace:"Vertical space", +image_hspace:"Horizontal space", +image_align:"Alignment", +image_align_baseline:"Baseline", +image_align_top:"Top", +image_align_middle:"Middle", +image_align_bottom:"Bottom", +image_align_texttop:"Text top", +image_align_textbottom:"Text bottom", +image_align_left:"Left", +image_align_right:"Right", +link_title:"Insert/edit link", +link_url:"Link URL", +link_target:"Target", +link_target_same:"Open link in the same window", +link_target_blank:"Open link in a new window", +link_titlefield:"Title", +link_is_email:"The URL you entered seems to be an email address, do you want to add the required mailto: prefix?", +link_is_external:"The URL you entered seems to external link, do you want to add the required http:// prefix?", +link_list:"Link list" +}); \ No newline at end of file diff --git a/include/javascript/tiny_mce/themes/simple/editor_template.js b/include/javascript/tiny_mce/themes/simple/editor_template.js new file mode 100755 index 00000000..d19fb53f --- /dev/null +++ b/include/javascript/tiny_mce/themes/simple/editor_template.js @@ -0,0 +1 @@ +(function(){var DOM=tinymce.DOM;tinymce.ThemeManager.requireLangPack('simple');tinymce.create('tinymce.themes.SimpleTheme',{init:function(ed,url){var t=this,states=['Bold','Italic','Underline','Strikethrough','InsertUnorderedList','InsertOrderedList'],s=ed.settings;t.editor=ed;ed.onInit.add(function(){ed.onNodeChange.add(function(ed,cm){tinymce.each(states,function(c){cm.get(c.toLowerCase()).setActive(ed.queryCommandState(c));});});ed.dom.loadCSS(url+"/skins/"+s.skin+"/content.css");});DOM.loadCSS((s.editor_css?ed.documentBaseURI.toAbsolute(s.editor_css):'')||url+"/skins/"+s.skin+"/ui.css");},renderUI:function(o){var t=this,n=o.targetNode,ic,tb,ed=t.editor,cf=ed.controlManager,sc;n=DOM.insertAfter(DOM.create('span',{id:ed.id+'_container','class':'mceEditor '+ed.settings.skin+'SimpleSkin'}),n);n=sc=DOM.add(n,'table',{cellPadding:0,cellSpacing:0,'class':'mceLayout'});n=tb=DOM.add(n,'tbody');n=DOM.add(tb,'tr');n=ic=DOM.add(DOM.add(n,'td'),'div',{'class':'mceIframeContainer'});n=DOM.add(DOM.add(tb,'tr',{'class':'last'}),'td',{'class':'mceToolbar mceLast',align:'center'});tb=t.toolbar=cf.createToolbar("tools1");tb.add(cf.createButton('bold',{title:'simple.bold_desc',cmd:'Bold'}));tb.add(cf.createButton('italic',{title:'simple.italic_desc',cmd:'Italic'}));tb.add(cf.createButton('underline',{title:'simple.underline_desc',cmd:'Underline'}));tb.add(cf.createButton('strikethrough',{title:'simple.striketrough_desc',cmd:'Strikethrough'}));tb.add(cf.createSeparator());tb.add(cf.createButton('undo',{title:'simple.undo_desc',cmd:'Undo'}));tb.add(cf.createButton('redo',{title:'simple.redo_desc',cmd:'Redo'}));tb.add(cf.createSeparator());tb.add(cf.createButton('cleanup',{title:'simple.cleanup_desc',cmd:'mceCleanup'}));tb.add(cf.createSeparator());tb.add(cf.createButton('insertunorderedlist',{title:'simple.bullist_desc',cmd:'InsertUnorderedList'}));tb.add(cf.createButton('insertorderedlist',{title:'simple.numlist_desc',cmd:'InsertOrderedList'}));tb.renderTo(n);return{iframeContainer:ic,editorContainer:ed.id+'_container',sizeContainer:sc,deltaHeight:-20};},getInfo:function(){return{longname:'Simple theme',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.ThemeManager.add('simple',tinymce.themes.SimpleTheme);})(); \ No newline at end of file diff --git a/include/javascript/tiny_mce/themes/simple/editor_template_src.js b/include/javascript/tiny_mce/themes/simple/editor_template_src.js new file mode 100755 index 00000000..fac4d895 --- /dev/null +++ b/include/javascript/tiny_mce/themes/simple/editor_template_src.js @@ -0,0 +1,85 @@ +/** + + * + * This file is meant to showcase how to create a simple theme. The advanced + * theme is more suitable for production use. + * + * @author Moxiecode + * @copyright Copyright 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + var DOM = tinymce.DOM; + + // Tell it to load theme specific language pack(s) + tinymce.ThemeManager.requireLangPack('simple'); + + tinymce.create('tinymce.themes.SimpleTheme', { + init : function(ed, url) { + var t = this, states = ['Bold', 'Italic', 'Underline', 'Strikethrough', 'InsertUnorderedList', 'InsertOrderedList'], s = ed.settings; + + t.editor = ed; + + ed.onInit.add(function() { + ed.onNodeChange.add(function(ed, cm) { + tinymce.each(states, function(c) { + cm.get(c.toLowerCase()).setActive(ed.queryCommandState(c)); + }); + }); + + ed.dom.loadCSS(url + "/skins/" + s.skin + "/content.css"); + }); + + DOM.loadCSS((s.editor_css ? ed.documentBaseURI.toAbsolute(s.editor_css) : '') || url + "/skins/" + s.skin + "/ui.css"); + }, + + renderUI : function(o) { + var t = this, n = o.targetNode, ic, tb, ed = t.editor, cf = ed.controlManager, sc; + + n = DOM.insertAfter(DOM.create('span', {id : ed.id + '_container', 'class' : 'mceEditor ' + ed.settings.skin + 'SimpleSkin'}), n); + n = sc = DOM.add(n, 'table', {cellPadding : 0, cellSpacing : 0, 'class' : 'mceLayout'}); + n = tb = DOM.add(n, 'tbody'); + + // Create iframe container + n = DOM.add(tb, 'tr'); + n = ic = DOM.add(DOM.add(n, 'td'), 'div', {'class' : 'mceIframeContainer'}); + + // Create toolbar container + n = DOM.add(DOM.add(tb, 'tr', {'class' : 'last'}), 'td', {'class' : 'mceToolbar mceLast', align : 'center'}); + + // Create toolbar + tb = t.toolbar = cf.createToolbar("tools1"); + tb.add(cf.createButton('bold', {title : 'simple.bold_desc', cmd : 'Bold'})); + tb.add(cf.createButton('italic', {title : 'simple.italic_desc', cmd : 'Italic'})); + tb.add(cf.createButton('underline', {title : 'simple.underline_desc', cmd : 'Underline'})); + tb.add(cf.createButton('strikethrough', {title : 'simple.striketrough_desc', cmd : 'Strikethrough'})); + tb.add(cf.createSeparator()); + tb.add(cf.createButton('undo', {title : 'simple.undo_desc', cmd : 'Undo'})); + tb.add(cf.createButton('redo', {title : 'simple.redo_desc', cmd : 'Redo'})); + tb.add(cf.createSeparator()); + tb.add(cf.createButton('cleanup', {title : 'simple.cleanup_desc', cmd : 'mceCleanup'})); + tb.add(cf.createSeparator()); + tb.add(cf.createButton('insertunorderedlist', {title : 'simple.bullist_desc', cmd : 'InsertUnorderedList'})); + tb.add(cf.createButton('insertorderedlist', {title : 'simple.numlist_desc', cmd : 'InsertOrderedList'})); + tb.renderTo(n); + + return { + iframeContainer : ic, + editorContainer : ed.id + '_container', + sizeContainer : sc, + deltaHeight : -20 + }; + }, + + getInfo : function() { + return { + longname : 'Simple theme', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + version : tinymce.majorVersion + "." + tinymce.minorVersion + } + } + }); + + tinymce.ThemeManager.add('simple', tinymce.themes.SimpleTheme); +})(); \ No newline at end of file diff --git a/include/javascript/tiny_mce/themes/simple/langs/en.js b/include/javascript/tiny_mce/themes/simple/langs/en.js new file mode 100755 index 00000000..6f095311 --- /dev/null +++ b/include/javascript/tiny_mce/themes/simple/langs/en.js @@ -0,0 +1,11 @@ +tinyMCE.addI18n('en.simple',{ +bold_desc:"Bold (Ctrl+B)", +italic_desc:"Italic (Ctrl+I)", +underline_desc:"Underline (Ctrl+U)", +striketrough_desc:"Strikethrough", +bullist_desc:"Unordered list", +numlist_desc:"Ordered list", +undo_desc:"Undo (Ctrl+Z)", +redo_desc:"Redo (Ctrl+Y)", +cleanup_desc:"Cleanup messy code" +}); \ No newline at end of file diff --git a/include/javascript/tiny_mce/tiny_mce.js b/include/javascript/tiny_mce/tiny_mce.js new file mode 100755 index 00000000..d230fc9c --- /dev/null +++ b/include/javascript/tiny_mce/tiny_mce.js @@ -0,0 +1 @@ +var tinymce={majorVersion:'3',minorVersion:'2.1.1',releaseDate:'2008-11-27',_init:function(){var t=this,d=document,w=window,na=navigator,ua=na.userAgent,i,nl,n,base,p,v;t.isOpera=w.opera&&opera.buildNumber;t.isWebKit=/WebKit/.test(ua);t.isOldWebKit=t.isWebKit&&!w.getSelection().getRangeAt;t.isIE=!t.isWebKit&&!t.isOpera&&(/MSIE/gi).test(ua)&&(/Explorer/gi).test(na.appName);t.isIE6=t.isIE&&/MSIE [56]/.test(ua);t.isGecko=!t.isWebKit&&/Gecko/.test(ua);t.isMac=ua.indexOf('Mac')!=-1;t.isAir=/adobeair/i.test(ua);if(w.tinyMCEPreInit){t.suffix=tinyMCEPreInit.suffix;t.baseURL=tinyMCEPreInit.base;t.query=tinyMCEPreInit.query;return;}t.suffix='';nl=d.getElementsByTagName('base');for(i=0;i=items.length){for(i=0,l=base.length;i=items.length||base[i]!=items[i]){bp=i+1;break;}}}if(base.length=base.length||base[i]!=items[i]){bp=i+1;break;}}}if(bp==1)return path;for(i=0,l=base.length-(bp-1);i=0;i--){if(path[i].length==0||path[i]==".")continue;if(path[i]=='..'){nb++;continue;}if(nb>0){nb--;continue;}o.push(path[i]);}i=base.length-nb;if(i<=0)return'/'+o.reverse().join('/');return'/'+base.slice(0,i).join('/')+'/'+o.reverse().join('/');},getURI:function(nh){var s,t=this;if(!t.source||nh){s='';if(!nh){if(t.protocol)s+=t.protocol+'://';if(t.userInfo)s+=t.userInfo+'@';if(t.host)s+=t.host;if(t.port)s+=':'+t.port;}if(t.path)s+=t.path;if(t.query)s+='?'+t.query;if(t.anchor)s+='#'+t.anchor;t.source=s;}return t.source;}});})();(function(){var each=tinymce.each;tinymce.create('static tinymce.util.Cookie',{getHash:function(n){var v=this.get(n),h;if(v){each(v.split('&'),function(v){v=v.split('=');h=h||{};h[unescape(v[0])]=unescape(v[1]);});}return h;},setHash:function(n,v,e,p,d,s){var o='';each(v,function(v,k){o+=(!o?'':'&')+escape(k)+'='+escape(v);});this.set(n,o,e,p,d,s);},get:function(n){var c=document.cookie,e,p=n+"=",b;if(!c)return;b=c.indexOf("; "+p);if(b==-1){b=c.indexOf(p);if(b!=0)return null;}else b+=2;e=c.indexOf(";",b);if(e==-1)e=c.length;return unescape(c.substring(b+p.length,e));},set:function(n,v,e,p,d,s){document.cookie=n+"="+escape(v)+((e)?"; expires="+e.toGMTString():"")+((p)?"; path="+escape(p):"")+((d)?"; domain="+d:"")+((s)?"; secure":"");},remove:function(n,p){var d=new Date();d.setTime(d.getTime()-1000);this.set(n,'',d,p,d);}});})();tinymce.create('static tinymce.util.JSON',{serialize:function(o){var i,v,s=tinymce.util.JSON.serialize,t;if(o==null)return'null';t=typeof o;if(t=='string'){v='\bb\tt\nn\ff\rr\""\'\'\\\\';return'"'+o.replace(/([\u0080-\uFFFF\x00-\x1f\"])/g,function(a,b){i=v.indexOf(b);if(i+1)return'\\'+v.charAt(i+1);a=b.charCodeAt().toString(16);return'\\u'+'0000'.substring(a.length)+a;})+'"';}if(t=='object'){if(o instanceof Array){for(i=0,v='[';i0?',':'')+s(o[i]);return v+']';}v='{';for(i in o)v+=typeof o[i]!='function'?(v.length>1?',"':'"')+i+'":'+s(o[i]):'';return v+'}';}return''+o;},parse:function(s){try{return eval('('+s+')');}catch(ex){}}});tinymce.create('static tinymce.util.XHR',{send:function(o){var x,t,w=window,c=0;o.scope=o.scope||this;o.success_scope=o.success_scope||o.scope;o.error_scope=o.error_scope||o.scope;o.async=o.async===false?false:true;o.data=o.data||'';function get(s){x=0;try{x=new ActiveXObject(s);}catch(ex){}return x;};x=w.XMLHttpRequest?new XMLHttpRequest():get('Microsoft.XMLHTTP')||get('Msxml2.XMLHTTP');if(x){if(x.overrideMimeType)x.overrideMimeType(o.content_type);x.open(o.type||(o.data?'POST':'GET'),o.url,o.async);if(o.content_type)x.setRequestHeader('Content-Type',o.content_type);x.send(o.data);function ready(){if(!o.async||x.readyState==4||c++>10000){if(o.success&&c<10000&&x.status==200)o.success.call(o.success_scope,''+x.responseText,x,o);else if(o.error)o.error.call(o.error_scope,c>10000?'TIMED_OUT':'GENERAL',x,o);x=null;}else w.setTimeout(ready,10);};if(!o.async)return ready();t=w.setTimeout(ready,10);}}});(function(){var extend=tinymce.extend,JSON=tinymce.util.JSON,XHR=tinymce.util.XHR;tinymce.create('tinymce.util.JSONRequest',{JSONRequest:function(s){this.settings=extend({},s);this.count=0;},send:function(o){var ecb=o.error,scb=o.success;o=extend(this.settings,o);o.success=function(c,x){c=JSON.parse(c);if(typeof(c)=='undefined'){c={error:'JSON Parse error.'};}if(c.error)ecb.call(o.error_scope||o.scope,c.error,x);else scb.call(o.success_scope||o.scope,c.result);};o.error=function(ty,x){ecb.call(o.error_scope||o.scope,ty,x);};o.data=JSON.serialize({id:o.id||'c'+(this.count++),method:o.method,params:o.params});o.content_type='application/json';XHR.send(o);},'static':{sendRPC:function(o){return new tinymce.util.JSONRequest().send(o);}}});}());(function(){var each=tinymce.each,is=tinymce.is;var isWebKit=tinymce.isWebKit,isIE=tinymce.isIE;tinymce.create('tinymce.dom.DOMUtils',{doc:null,root:null,files:null,listeners:{},pixelStyles:/^(top|left|bottom|right|width|height|borderWidth)$/,cache:{},idPattern:/^#[\w]+$/,elmPattern:/^[\w_*]+$/,elmClassPattern:/^([\w_]*)\.([\w_]+)$/,props:{"for":"htmlFor","class":"className",className:"className",checked:"checked",disabled:"disabled",maxlength:"maxLength",readonly:"readOnly",selected:"selected",value:"value",id:"id",name:"name",type:"type"},DOMUtils:function(d,s){var t=this;t.doc=d;t.win=window;t.files={};t.cssFlicker=false;t.counter=0;t.boxModel=!tinymce.isIE||d.compatMode=="CSS1Compat";t.stdMode=d.documentMode===8;this.settings=s=tinymce.extend({keep_values:false,hex_colors:1,process_html:1},s);if(tinymce.isIE6){try{d.execCommand('BackgroundImageCache',false,true);}catch(e){t.cssFlicker=true;}}tinymce.addUnload(t.destroy,t);},getRoot:function(){var t=this,s=t.settings;return(s&&t.get(s.root_element))||t.doc.body;},getViewPort:function(w){var d,b;w=!w?this.win:w;d=w.document;b=this.boxModel?d.documentElement:d.body;return{x:w.pageXOffset||b.scrollLeft,y:w.pageYOffset||b.scrollTop,w:w.innerWidth||b.clientWidth,h:w.innerHeight||b.clientHeight};},getRect:function(e){var p,t=this,sr;e=t.get(e);p=t.getPos(e);sr=t.getSize(e);return{x:p.x,y:p.y,w:sr.w,h:sr.h};},getSize:function(e){var t=this,w,h;e=t.get(e);w=t.getStyle(e,'width');h=t.getStyle(e,'height');if(w.indexOf('px')===-1)w=0;if(h.indexOf('px')===-1)h=0;return{w:parseInt(w)||e.offsetWidth||e.clientWidth,h:parseInt(h)||e.offsetHeight||e.clientHeight};},getParent:function(n,f,r){var na,se=this.settings;n=this.get(n);if(se.strict_root)r=r||this.getRoot();if(is(f,'string')){na=f.toUpperCase();f=function(n){var s=false;if(n.nodeType==1&&na==='*'){s=true;return false;}each(na.split(','),function(v){if(n.nodeType==1&&((se.strict&&n.nodeName.toUpperCase()==v)||n.nodeName.toUpperCase()==v)){s=true;return false;}});return s;};}while(n){if(n==r)return null;if(f(n))return n;n=n.parentNode;}return null;},get:function(e){var n;if(e&&this.doc&&typeof(e)=='string'){n=e;e=this.doc.getElementById(e);if(e&&e.id!==n)return this.doc.getElementsByName(n)[1];}return e;},select:function(pa,s){var t=this,cs,c,pl,o=[],x,i,l,n,xp;s=t.get(s)||t.doc;if(s.querySelectorAll){if(s!=t.doc){i=s.id;s.id='_mc_tmp';pa='#_mc_tmp '+pa;}l=tinymce.grep(s.querySelectorAll(pa));s.id=i;return l;}if(!t.selectorRe)t.selectorRe=/^([\w\\*]+)?(?:#([\w\\]+))?(?:\.([\w\\\.]+))?(?:\[\@([\w\\]+)([\^\$\*!]?=)([\w\\]+)\])?(?:\:([\w\\]+))?/i;;if(tinymce.isAir){each(tinymce.explode(pa),function(v){if(!(xp=t.cache[v])){xp='';each(v.split(' '),function(v){v=t.selectorRe.exec(v);xp+=v[1]?'//'+v[1]:'//*';if(v[2])xp+="[@id='"+v[2]+"']";if(v[3]){each(v[3].split('.'),function(n){xp+="[@class = '"+n+"' or contains(concat(' ', @class, ' '), ' "+n+" ')]";});}});t.cache[v]=xp;}xp=t.doc.evaluate(xp,s,null,4,null);while(n=xp.iterateNext())o.push(n);});return o;}if(t.settings.strict){function get(s,n){return s.getElementsByTagName(n.toLowerCase());};}else{function get(s,n){return s.getElementsByTagName(n);};}if(t.elmPattern.test(pa)){x=get(s,pa);for(i=0,l=x.length;i=0;i--)cs+='}, '+(i?'n':'s')+');';cs+='})';t.cache[pa]=cs=eval(cs);}cs(isIE?collectIE:collect,s);});each(o,function(n){if(isIE)n.removeAttribute('mce_save');else delete n.mce_save;});return o;},add:function(p,n,a,h,c){var t=this;return this.run(p,function(p){var e,k;e=is(n,'string')?t.doc.createElement(n):n;t.setAttribs(e,a);if(h){if(h.nodeType)e.appendChild(h);else t.setHTML(e,h);}return!c?p.appendChild(e):e;});},create:function(n,a,h){return this.add(this.doc.createElement(n),n,a,h,1);},createHTML:function(n,a,h){var o='',t=this,k;o+='<'+n;for(k in a){if(a.hasOwnProperty(k))o+=' '+k+'="'+t.encode(a[k])+'"';}if(tinymce.is(h))return o+'>'+h+'';return o+' />';},remove:function(n,k){return this.run(n,function(n){var p,g;p=n.parentNode;if(!p)return null;if(k){each(n.childNodes,function(c){p.insertBefore(c.cloneNode(true),n);});}return p.removeChild(n);});},setStyle:function(n,na,v){var t=this;return t.run(n,function(e){var s,i;s=e.style;na=na.replace(/-(\D)/g,function(a,b){return b.toUpperCase();});if(t.pixelStyles.test(na)&&(tinymce.is(v,'number')||/^[\-0-9\.]+$/.test(v)))v+='px';switch(na){case'opacity':if(isIE){s.filter=v===''?'':"alpha(opacity="+(v*100)+")";if(!n.currentStyle||!n.currentStyle.hasLayout)s.display='inline-block';}s[na]=s['-moz-opacity']=s['-khtml-opacity']=v||'';break;case'float':isIE?s.styleFloat=v:s.cssFloat=v;break;default:s[na]=v||'';}if(t.settings.update_styles)t.setAttrib(e,'mce_style');});},getStyle:function(n,na,c){n=this.get(n);if(!n)return false;if(this.doc.defaultView&&c){na=na.replace(/[A-Z]/g,function(a){return'-'+a;});try{return this.doc.defaultView.getComputedStyle(n,null).getPropertyValue(na);}catch(ex){return null;}}na=na.replace(/-(\D)/g,function(a,b){return b.toUpperCase();});if(na=='float')na=isIE?'styleFloat':'cssFloat';if(n.currentStyle&&c)return n.currentStyle[na];return n.style[na];},setStyles:function(e,o){var t=this,s=t.settings,ol;ol=s.update_styles;s.update_styles=0;each(o,function(v,n){t.setStyle(e,n,v);});s.update_styles=ol;if(s.update_styles)t.setAttrib(e,s.cssText);},setAttrib:function(e,n,v){var t=this;if(!e||!n)return;if(t.settings.strict)n=n.toLowerCase();return this.run(e,function(e){var s=t.settings;switch(n){case"style":if(!is(v,'string')){each(v,function(v,n){t.setStyle(e,n,v);});return;}if(s.keep_values){if(v&&!t._isRes(v))e.setAttribute('mce_style',v,2);else e.removeAttribute('mce_style',2);}e.style.cssText=v;break;case"class":e.className=v||'';break;case"src":case"href":if(s.keep_values){if(s.url_converter)v=s.url_converter.call(s.url_converter_scope||t,v,n,e);t.setAttrib(e,'mce_'+n,v,2);}break;case"shape":e.setAttribute('mce_style',v);break;}if(is(v)&&v!==null&&v.length!==0)e.setAttribute(n,''+v,2);else e.removeAttribute(n,2);});},setAttribs:function(e,o){var t=this;return this.run(e,function(e){each(o,function(v,n){t.setAttrib(e,n,v);});});},getAttrib:function(e,n,dv){var v,t=this;e=t.get(e);if(!e||e.nodeType!==1)return false;if(!is(dv))dv='';if(/^(src|href|style|coords|shape)$/.test(n)){v=e.getAttribute("mce_"+n);if(v)return v;}if(isIE&&t.props[n]){v=e[t.props[n]];v=v&&v.nodeValue?v.nodeValue:v;}if(!v)v=e.getAttribute(n,2);if(n==='style'){v=v||e.style.cssText;if(v){v=t.serializeStyle(t.parseStyle(v));if(t.settings.keep_values&&!t._isRes(v))e.setAttribute('mce_style',v);}}if(isWebKit&&n==="class"&&v)v=v.replace(/(apple|webkit)\-[a-z\-]+/gi,'');if(isIE){switch(n){case'rowspan':case'colspan':if(v===1)v='';break;case'size':if(v==='+0'||v===20)v='';break;case'width':case'height':case'vspace':case'checked':case'disabled':case'readonly':if(v===0)v='';break;case'hspace':if(v===-1)v='';break;case'maxlength':case'tabindex':if(v===32768||v===2147483647||v==='32768')v='';break;case'compact':case'noshade':case'nowrap':if(v===65535)return n;return dv;case'shape':v=v.toLowerCase();break;default:if(n.indexOf('on')===0&&v)v=(''+v).replace(/^function\s+anonymous\(\)\s+\{\s+(.*)\s+\}$/,'$1');}}return(v!==undefined&&v!==null&&v!=='')?''+v:dv;},getPos:function(n){var t=this,x=0,y=0,e,d=t.doc,r;n=t.get(n);if(n&&isIE){n=n.getBoundingClientRect();e=t.boxModel?d.documentElement:d.body;x=t.getStyle(t.select('html')[0],'borderWidth');x=(x=='medium'||t.boxModel&&!t.isIE6)&&2||x;n.top+=t.win.self!=t.win.top?2:0;return{x:n.left+e.scrollLeft-x,y:n.top+e.scrollTop-x};}r=n;while(r){x+=r.offsetLeft||0;y+=r.offsetTop||0;r=r.offsetParent;}r=n;while(r){if(!/^table-row|inline.*/i.test(t.getStyle(r,"display",1))){x-=r.scrollLeft||0;y-=r.scrollTop||0;}r=r.parentNode;if(r==d.body)break;}return{x:x,y:y};},parseStyle:function(st){var t=this,s=t.settings,o={};if(!st)return o;function compress(p,s,ot){var t,r,b,l;t=o[p+'-top'+s];if(!t)return;r=o[p+'-right'+s];if(t!=r)return;b=o[p+'-bottom'+s];if(r!=b)return;l=o[p+'-left'+s];if(b!=l)return;o[ot]=l;delete o[p+'-top'+s];delete o[p+'-right'+s];delete o[p+'-bottom'+s];delete o[p+'-left'+s];};function compress2(ta,a,b,c){var t;t=o[a];if(!t)return;t=o[b];if(!t)return;t=o[c];if(!t)return;o[ta]=o[a]+' '+o[b]+' '+o[c];delete o[a];delete o[b];delete o[c];};st=st.replace(/&(#?[a-z0-9]+);/g,'&$1_MCE_SEMI_');each(st.split(';'),function(v){var sv,ur=[];if(v){v=v.replace(/_MCE_SEMI_/g,';');v=v.replace(/url\([^\)]+\)/g,function(v){ur.push(v);return'url('+ur.length+')';});v=v.split(':');sv=tinymce.trim(v[1]);sv=sv.replace(/url\(([^\)]+)\)/g,function(a,b){return ur[parseInt(b)-1];});sv=sv.replace(/rgb\([^\)]+\)/g,function(v){return t.toHex(v);});if(s.url_converter){sv=sv.replace(/url\([\'\"]?([^\)\'\"]+)[\'\"]?\)/g,function(x,c){return'url('+s.url_converter.call(s.url_converter_scope||t,t.decode(c),'style',null)+')';});}o[tinymce.trim(v[0]).toLowerCase()]=sv;}});compress("border","","border");compress("border","-width","border-width");compress("border","-color","border-color");compress("border","-style","border-style");compress("padding","","padding");compress("margin","","margin");compress2('border','border-width','border-style','border-color');if(isIE){if(o.border=='medium none')o.border='';}return o;},serializeStyle:function(o){var s='';each(o,function(v,k){if(k&&v){if(tinymce.isGecko&&k.indexOf('-moz-')===0)return;switch(k){case'color':case'background-color':v=v.toLowerCase();break;}s+=(s?' ':'')+k+': '+v+';';}});return s;},loadCSS:function(u){var t=this,d=t.doc;if(!u)u='';each(u.split(','),function(u){if(t.files[u])return;t.files[u]=true;t.add(t.select('head')[0],'link',{rel:'stylesheet',href:tinymce._addVer(u)});});},addClass:function(e,c){return this.run(e,function(e){var o;if(!c)return 0;if(this.hasClass(e,c))return e.className;o=this.removeClass(e,c);return e.className=(o!=''?(o+' '):'')+c;});},removeClass:function(e,c){var t=this,re;return t.run(e,function(e){var v;if(t.hasClass(e,c)){if(!re)re=new RegExp("(^|\\s+)"+c+"(\\s+|$)","g");v=e.className.replace(re,' ');return e.className=tinymce.trim(v!=' '?v:'');}return e.className;});},hasClass:function(n,c){n=this.get(n);if(!n||!c)return false;return(' '+n.className+' ').indexOf(' '+c+' ')!==-1;},show:function(e){return this.setStyle(e,'display','block');},hide:function(e){return this.setStyle(e,'display','none');},isHidden:function(e){e=this.get(e);return!e||e.style.display=='none'||this.getStyle(e,'display')=='none';},uniqueId:function(p){return(!p?'mce_':p)+(this.counter++);},setHTML:function(e,h){var t=this;return this.run(e,function(e){var x,i,nl,n,p,x;h=t.processHTML(h);if(isIE){function set(){try{e.innerHTML='
    '+h;e.removeChild(e.firstChild);}catch(ex){while(e.firstChild)e.firstChild.removeNode();x=t.create('div');x.innerHTML='
    '+h;each(x.childNodes,function(n,i){if(i)e.appendChild(n);});}};if(t.settings.fix_ie_paragraphs)h=h.replace(/

    <\/p>|]+)><\/p>|/gi,' 

    ');set();if(t.settings.fix_ie_paragraphs){nl=e.getElementsByTagName("p");for(i=nl.length-1,x=0;i>=0;i--){n=nl[i];if(!n.hasChildNodes()){if(!n.mce_keep){x=1;break;}n.removeAttribute('mce_keep');}}}if(x){h=h.replace(/

    ]+)>|

    /g,'

    ');h=h.replace(/<\/p>/g,'
    ');set();if(t.settings.fix_ie_paragraphs){nl=e.getElementsByTagName("DIV");for(i=nl.length-1;i>=0;i--){n=nl[i];if(n.mce_tmp){p=t.doc.createElement('p');n.cloneNode(false).outerHTML.replace(/([a-z0-9\-_]+)=/gi,function(a,b){var v;if(b!=='mce_tmp'){v=n.getAttribute(b);if(!v&&b==='class')v=n.className;p.setAttribute(b,v);}});for(x=0;x|]+)>/gi,'<$1b$2>');h=h.replace(/<(\/?)em>|]+)>/gi,'<$1i$2>');}else if(isIE){h=h.replace(/'/g,''');h=h.replace(/\s+(disabled|checked|readonly|selected)\s*=\s*[\"\']?(false|0)[\"\']?/gi,'');}h=h.replace(/]+)\/>|/gi,'');if(s.keep_values){if(/)/g,'\n');s=s.replace(/^[\r\n]*|[\r\n]*$/g,'');s=s.replace(/^\s*(\/\/\s*|\]\]>|-->|\]\]-->)\s*$/g,'');return s;};h=h.replace(/]+|)>([\s\S]*?)<\/script>/g,function(v,a,b){b=trim(b);if(!a)a=' type="text/javascript"';if(b)b='';return''+b+'';});h=h.replace(/]+|)>([\s\S]*?)<\/style>/g,function(v,a,b){b=trim(b);return''+b+'';});}h=h.replace(//g,'');h=h.replace(/<([\w:]+) [^>]*(src|href|style|shape|coords)[^>]*>/gi,function(a,n){function handle(m,b,c){var u=c;if(a.indexOf('mce_'+b)!=-1)return m;if(b=='style'){if(t._isRes(c))return m;if(s.hex_colors){u=u.replace(/rgb\([^\)]+\)/g,function(v){return t.toHex(v);});}if(s.url_converter){u=u.replace(/url\([\'\"]?([^\)\'\"]+)\)/g,function(x,c){return'url('+t.encode(s.url_converter.call(s.url_converter_scope||t,t.decode(c),b,n))+')';});}}else if(b!='coords'&&b!='shape'){if(s.url_converter)u=t.encode(s.url_converter.call(s.url_converter_scope||t,t.decode(c),b,n));}return' '+b+'="'+c+'" mce_'+b+'="'+u+'"';};a=a.replace(/ (src|href|style|coords|shape)=[\"]([^\"]+)[\"]/gi,handle);a=a.replace(/ (src|href|style|coords|shape)=[\']([^\']+)[\']/gi,handle);return a.replace(/ (src|href|style|coords|shape)=([^\s\"\'>]+)/gi,handle);});}return h;},getOuterHTML:function(e){var d;e=this.get(e);if(!e)return null;if(isIE)return e.outerHTML;d=(e.ownerDocument||this.doc).createElement("body");d.appendChild(e.cloneNode(true));return d.innerHTML;},setOuterHTML:function(e,h,d){var t=this;return this.run(e,function(e){var n,tp;e=t.get(e);d=d||e.ownerDocument||t.doc;if(isIE&&e.nodeType==1)e.outerHTML=h;else{tp=d.createElement("body");tp.innerHTML=h;n=tp.lastChild;while(n){t.insertAfter(n.cloneNode(true),e);n=n.previousSibling;}t.remove(e);}});},decode:function(s){var e,n,v;if(/&[^;]+;/.test(s)){e=this.doc.createElement("div");e.innerHTML=s;n=e.firstChild;v='';if(n){do{v+=n.nodeValue;}while(n.nextSibling);}return v||s;}return s;},encode:function(s){return s?(''+s).replace(/[<>&\"]/g,function(c,b){switch(c){case'&':return'&';case'"':return'"';case'<':return'<';case'>':return'>';}return c;}):s;},insertAfter:function(n,r){var t=this;r=t.get(r);return this.run(n,function(n){var p,ns;p=r.parentNode;ns=r.nextSibling;if(ns)p.insertBefore(n,ns);else p.appendChild(n);return n;});},isBlock:function(n){if(n.nodeType&&n.nodeType!==1)return false;n=n.nodeName||n;return/^(H[1-6]|HR|P|DIV|ADDRESS|PRE|FORM|TABLE|LI|OL|UL|TD|CAPTION|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP)$/.test(n);},replace:function(n,o,k){if(is(o,'array'))n=n.cloneNode(true);return this.run(o,function(o){if(k){each(o.childNodes,function(c){n.appendChild(c.cloneNode(true));});}return o.parentNode.replaceChild(n,o);});},toHex:function(s){var c=/^\s*rgb\s*?\(\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?\)\s*$/i.exec(s);function hex(s){s=parseInt(s).toString(16);return s.length>1?s:'0'+s;};if(c){s='#'+hex(c[1])+hex(c[2])+hex(c[3]);return s;}return s;},getClasses:function(){var t=this,cl=[],i,lo={},f=t.settings.class_filter,ov;if(t.classes)return t.classes;function addClasses(s){each(s.imports,function(r){addClasses(r);});each(s.cssRules||s.rules,function(r){switch(r.type||1){case 1:if(r.selectorText){each(r.selectorText.split(','),function(v){v=v.replace(/^\s*|\s*$|^\s\./g,"");if(/\.mce/.test(v)||!/\.[\w\-]+$/.test(v))return;ov=v;v=v.replace(/.*\.([a-z0-9_\-]+).*/i,'$1');if(f&&!(v=f(v,ov)))return;if(!lo[v]){cl.push({'class':v});lo[v]=1;}});}break;case 3:addClasses(r.styleSheet);break;}});};try{each(t.doc.styleSheets,addClasses);}catch(ex){}if(cl.length>0)t.classes=cl;return cl;},run:function(e,f,s){var t=this,o;if(t.doc&&typeof(e)==='string')e=t.get(e);if(!e)return false;s=s||this;if(!e.nodeType&&(e.length||e.length===0)){o=[];each(e,function(e,i){if(e){if(typeof(e)=='string')e=t.doc.getElementById(e);o.push(f.call(s,e,i));}});return o;}return f.call(s,e);},getAttribs:function(n){var o;n=this.get(n);if(!n)return[];if(isIE){o=[];if(n.nodeName=='OBJECT')return n.attributes;n.cloneNode(false).outerHTML.replace(/([a-z0-9\:\-_]+)=/gi,function(a,b){o.push({specified:1,nodeName:b});});return o;}return n.attributes;},destroy:function(s){var t=this;t.win=t.doc=t.root=null;if(!s)tinymce.removeUnload(t.destroy);},_isRes:function(c){return/^(top|left|bottom|right|width|height)/i.test(c)||/;\s*(top|left|bottom|right|width|height)/i.test(c);}});tinymce.DOM=new tinymce.dom.DOMUtils(document,{process_html:0});})();(function(){var each=tinymce.each,DOM=tinymce.DOM,isIE=tinymce.isIE,isWebKit=tinymce.isWebKit,Event;tinymce.create('static tinymce.dom.Event',{inits:[],events:[],add:function(o,n,f,s){var cb,t=this,el=t.events,r;if(o&&o instanceof Array){r=[];each(o,function(o){o=DOM.get(o);r.push(t.add(o,n,f,s));});return r;}o=DOM.get(o);if(!o)return;cb=function(e){e=e||window.event;if(e&&!e.target&&isIE)e.target=e.srcElement;if(!s)return f(e);return f.call(s,e);};if(n=='unload'){tinymce.unloads.unshift({func:cb});return cb;}if(n=='init'){if(t.domLoaded)cb();else t.inits.push(cb);return cb;}el.push({obj:o,name:n,func:f,cfunc:cb,scope:s});t._add(o,n,cb);return f;},remove:function(o,n,f){var t=this,a=t.events,s=false,r;if(o&&o instanceof Array){r=[];each(o,function(o){o=DOM.get(o);r.push(t.remove(o,n,f));});return r;}o=DOM.get(o);each(a,function(e,i){if(e.obj==o&&e.name==n&&(!f||(e.func==f||e.cfunc==f))){a.splice(i,1);t._remove(o,n,e.cfunc);s=true;return false;}});return s;},clear:function(o){var t=this,a=t.events,i,e;if(o){o=DOM.get(o);for(i=a.length-1;i>=0;i--){e=a[i];if(e.obj===o){t._remove(e.obj,e.name,e.cfunc);e.obj=e.cfunc=null;a.splice(i,1);}}}},cancel:function(e){if(!e)return false;this.stop(e);return this.prevent(e);},stop:function(e){if(e.stopPropagation)e.stopPropagation();else e.cancelBubble=true;return false;},prevent:function(e){if(e.preventDefault)e.preventDefault();else e.returnValue=false;return false;},_unload:function(){var t=Event;each(t.events,function(e,i){t._remove(e.obj,e.name,e.cfunc);e.obj=e.cfunc=null;});t.events=[];t=null;},_add:function(o,n,f){if(o.attachEvent)o.attachEvent('on'+n,f);else if(o.addEventListener)o.addEventListener(n,f,false);else o['on'+n]=f;},_remove:function(o,n,f){if(o){try{if(o.detachEvent)o.detachEvent('on'+n,f);else if(o.removeEventListener)o.removeEventListener(n,f,false);else o['on'+n]=null;}catch(ex){}}},_pageInit:function(){var e=Event;if(e.domLoaded)return;e._remove(window,'DOMContentLoaded',e._pageInit);e.domLoaded=true;each(e.inits,function(c){c();});e.inits=[];},_wait:function(){var t;if(window.tinyMCE_GZ&&tinyMCE_GZ.loaded){Event.domLoaded=1;return;}var skipInitPhase = (typeof (skipTinyMCEInitPhase) != 'undefined') ? true : false;if(isIE&&document.location.protocol!='https:'&& !skipInitPhase){document.write('';bi=s.body_id||'tinymce';if(bi.indexOf('=')!=-1){bi=t.getParam('body_id','','hash');bi=bi[t.id]||bi;}bc=s.body_class||'';if(bc.indexOf('=')!=-1){bc=t.getParam('body_class','','hash');bc=bc[t.id]||'';}t.iframeHTML+='';if(tinymce.relaxedDomain){if(isIE||(tinymce.isOpera&&parseFloat(opera.version())>=9.5))u='javascript:(function(){document.open();document.domain="'+document.domain+'";var ed = window.parent.tinyMCE.get("'+t.id+'");document.write(ed.iframeHTML);document.close();ed.setupIframe();})()';else if(tinymce.isOpera)u='javascript:(function(){document.open();document.domain="'+document.domain+'";document.close();ed.setupIframe();})()';}n=DOM.add(o.iframeContainer,'iframe',{id:t.id+"_ifr",src:u||'javascript:""',frameBorder:'0',style:{width:'100%',height:h}});t.contentAreaContainer=o.iframeContainer;DOM.get(o.editorContainer).style.display=t.orgDisplay;DOM.get(t.id).style.display='none';if(tinymce.isOldWebKit){Event.add(n,'load',t.setupIframe,t);n.src=tinymce.baseURL+'/plugins/safari/blank.htm';}else{if(!isIE||!tinymce.relaxedDomain)t.setupIframe();e=n=o=null;}},setupIframe:function(){var t=this,s=t.settings,e=DOM.get(t.id),d=t.getDoc(),h,b;if(!isIE||!tinymce.relaxedDomain){d.open();d.write(t.iframeHTML);d.close();}if(!isIE){try{if(!s.readonly)d.designMode='On';}catch(ex){}}if(isIE){b=t.getBody();DOM.hide(b);if(!s.readonly)b.contentEditable=true;DOM.show(b);}t.dom=new tinymce.DOM.DOMUtils(t.getDoc(),{keep_values:true,url_converter:t.convertURL,url_converter_scope:t,hex_colors:s.force_hex_style_colors,class_filter:s.class_filter,update_styles:1,fix_ie_paragraphs:1});t.serializer=new tinymce.dom.Serializer({entity_encoding:s.entity_encoding,entities:s.entities,valid_elements:s.verify_html===false?'*[*]':s.valid_elements,extended_valid_elements:s.extended_valid_elements,valid_child_elements:s.valid_child_elements,invalid_elements:s.invalid_elements,fix_table_elements:s.fix_table_elements,fix_list_elements:s.fix_list_elements,fix_content_duplication:s.fix_content_duplication,convert_fonts_to_spans:s.convert_fonts_to_spans,font_size_classes:s.font_size_classes,font_size_style_values:s.font_size_style_values,apply_source_formatting:s.apply_source_formatting,remove_linebreaks:s.remove_linebreaks,element_format:s.element_format,dom:t.dom});t.selection=new tinymce.dom.Selection(t.dom,t.getWin(),t.serializer);t.forceBlocks=new tinymce.ForceBlocks(t,{forced_root_block:s.forced_root_block});t.editorCommands=new tinymce.EditorCommands(t);t.serializer.onPreProcess.add(function(se,o){return t.onPreProcess.dispatch(t,o,se);});t.serializer.onPostProcess.add(function(se,o){return t.onPostProcess.dispatch(t,o,se);});t.onPreInit.dispatch(t);if(!s.gecko_spellcheck)t.getBody().spellcheck=0;if(!s.readonly)t._addEvents();t.controlManager.onPostRender.dispatch(t,t.controlManager);t.onPostRender.dispatch(t);if(s.directionality)t.getBody().dir=s.directionality;if(s.nowrap)t.getBody().style.whiteSpace="nowrap";if(s.auto_resize)t.onNodeChange.add(t.resizeToContent,t);if(s.custom_elements){function handleCustom(ed,o){each(explode(s.custom_elements),function(v){var n;if(v.indexOf('~')===0){v=v.substring(1);n='span';}else n='div';o.content=o.content.replace(new RegExp('<('+v+')([^>]*)>','g'),'<'+n+' mce_name="$1"$2>');o.content=o.content.replace(new RegExp('','g'),'');});};t.onBeforeSetContent.add(handleCustom);t.onPostProcess.add(function(ed,o){if(o.set)handleCustom(ed,o)});}if(s.handle_node_change_callback){t.onNodeChange.add(function(ed,cm,n){t.execCallback('handle_node_change_callback',t.id,n,-1,-1,true,t.selection.isCollapsed());});}if(s.save_callback){t.onSaveContent.add(function(ed,o){var h=t.execCallback('save_callback',t.id,o.content,t.getBody());if(h)o.content=h;});}if(s.onchange_callback){t.onChange.add(function(ed,l){t.execCallback('onchange_callback',t,l);});}if(s.convert_newlines_to_brs){t.onBeforeSetContent.add(function(ed,o){if(o.initial)o.content=o.content.replace(/\r?\n/g,'
    ');});}if(s.fix_nesting&&isIE){t.onBeforeSetContent.add(function(ed,o){o.content=t._fixNesting(o.content);});}if(s.preformatted){t.onPostProcess.add(function(ed,o){o.content=o.content.replace(/^\s*/,'');o.content=o.content.replace(/<\/pre>\s*$/,'');if(o.set)o.content='
    '+o.content+'
    ';});}if(s.verify_css_classes){t.serializer.attribValueFilter=function(n,v){var s,cl;if(n=='class'){if(!t.classesRE){cl=t.dom.getClasses();if(cl.length>0){s='';each(cl,function(o){s+=(s?'|':'')+o['class'];});t.classesRE=new RegExp('('+s+')','gi');}}return!t.classesRE||/(\bmceItem\w+\b|\bmceTemp\w+\b)/g.test(v)||t.classesRE.test(v)?v:'';}return v;};}if(s.convert_fonts_to_spans)t._convertFonts();if(s.inline_styles)t._convertInlineElements();if(s.cleanup_callback){t.onBeforeSetContent.add(function(ed,o){o.content=t.execCallback('cleanup_callback','insert_to_editor',o.content,o);});t.onPreProcess.add(function(ed,o){if(o.set)t.execCallback('cleanup_callback','insert_to_editor_dom',o.node,o);if(o.get)t.execCallback('cleanup_callback','get_from_editor_dom',o.node,o);});t.onPostProcess.add(function(ed,o){if(o.set)o.content=t.execCallback('cleanup_callback','insert_to_editor',o.content,o);if(o.get)o.content=t.execCallback('cleanup_callback','get_from_editor',o.content,o);});}if(s.save_callback){t.onGetContent.add(function(ed,o){if(o.save)o.content=t.execCallback('save_callback',t.id,o.content,t.getBody());});}if(s.handle_event_callback){t.onEvent.add(function(ed,e,o){if(t.execCallback('handle_event_callback',e,ed,o)===false)Event.cancel(e);});}t.onSetContent.add(function(){t.addVisual(t.getBody());});if(s.padd_empty_editor){t.onPostProcess.add(function(ed,o){o.content=o.content.replace(/^(]*>( | |\s|\u00a0|)<\/p>[\r\n]*|
    [\r\n]*)$/,'');});}if(isGecko&&!s.readonly){try{d.designMode='Off';d.designMode='On';}catch(ex){}}setTimeout(function(){if(t.removed)return;t.load({initial:true,format:(s.cleanup_on_startup?'html':'raw')});t.startContent=t.getContent({format:'raw'});t.undoManager.add({initial:true});t.initialized=true;t.onInit.dispatch(t);t.execCallback('setupcontent_callback',t.id,t.getBody(),t.getDoc());t.execCallback('init_instance_callback',t);t.focus(true);t.nodeChanged({initial:1});if(s.content_css){tinymce.each(explode(s.content_css),function(u){t.dom.loadCSS(t.documentBaseURI.toAbsolute(u));});}if(s.auto_focus){setTimeout(function(){var ed=EditorManager.get(s.auto_focus);ed.selection.select(ed.getBody(),1);ed.selection.collapse(1);ed.getWin().focus();},100);}},1);e=null;},focus:function(sf){var oed,t=this,ce=t.settings.content_editable;if(!sf){if(!ce&&(!isIE||t.selection.getNode().ownerDocument!=t.getDoc()))t.getWin().focus();}if(EditorManager.activeEditor!=t){if((oed=EditorManager.activeEditor)!=null)oed.onDeactivate.dispatch(oed,t);t.onActivate.dispatch(t,oed);}EditorManager._setActive(t);},execCallback:function(n){var t=this,f=t.settings[n],s;if(!f)return;if(t.callbackLookup&&(s=t.callbackLookup[n])){f=s.func;s=s.scope;}if(is(f,'string')){s=f.replace(/\.\w+$/,'');s=s?tinymce.resolve(s):0;f=tinymce.resolve(f);t.callbackLookup=t.callbackLookup||{};t.callbackLookup[n]={func:f,scope:s};}return f.apply(s||t,Array.prototype.slice.call(arguments,1));},translate:function(s){var c=this.settings.language||'en',i18n=EditorManager.i18n;if(!s)return'';return i18n[c+'.'+s]||s.replace(/{\#([^}]+)\}/g,function(a,b){return i18n[c+'.'+b]||'{#'+b+'}';});},getLang:function(n,dv){return EditorManager.i18n[(this.settings.language||'en')+'.'+n]||(is(dv)?dv:'{#'+n+'}');},getParam:function(n,dv,ty){var tr=tinymce.trim,v=is(this.settings[n])?this.settings[n]:dv,o;if(ty==='hash'){o={};if(is(v,'string')){each(v.indexOf('=')>0?v.split(/[;,](?![^=;,]*(?:[;,]|$))/):v.split(','),function(v){v=v.split('=');if(v.length>1)o[tr(v[0])]=tr(v[1]);else o[tr(v[0])]=tr(v);});}else o=v;return o;}return v;},nodeChanged:function(o){var t=this,s=t.selection,n=s.getNode()||t.getBody();if(t.initialized){t.onNodeChange.dispatch(t,o?o.controlManager||t.controlManager:t.controlManager,isIE&&n.ownerDocument!=t.getDoc()?t.getBody():n,s.isCollapsed(),o);}},addButton:function(n,s){var t=this;t.buttons=t.buttons||{};t.buttons[n]=s;},addCommand:function(n,f,s){this.execCommands[n]={func:f,scope:s||this};},addQueryStateHandler:function(n,f,s){this.queryStateCommands[n]={func:f,scope:s||this};},addQueryValueHandler:function(n,f,s){this.queryValueCommands[n]={func:f,scope:s||this};},addShortcut:function(pa,desc,cmd_func,sc){var t=this,c;if(!t.settings.custom_shortcuts)return false;t.shortcuts=t.shortcuts||{};if(is(cmd_func,'string')){c=cmd_func;cmd_func=function(){t.execCommand(c,false,null);};}if(is(cmd_func,'object')){c=cmd_func;cmd_func=function(){t.execCommand(c[0],c[1],c[2]);};}each(explode(pa),function(pa){var o={func:cmd_func,scope:sc||this,desc:desc,alt:false,ctrl:false,shift:false};each(explode(pa,'+'),function(v){switch(v){case'alt':case'ctrl':case'shift':o[v]=true;break;default:o.charCode=v.charCodeAt(0);o.keyCode=v.toUpperCase().charCodeAt(0);}});t.shortcuts[(o.ctrl?'ctrl':'')+','+(o.alt?'alt':'')+','+(o.shift?'shift':'')+','+o.keyCode]=o;});return true;},execCommand:function(cmd,ui,val,a){var t=this,s=0,o,st;if(!/^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint|SelectAll)$/.test(cmd)&&(!a||!a.skip_focus))t.focus();o={};t.onBeforeExecCommand.dispatch(t,cmd,ui,val,o);if(o.terminate)return false;if(t.execCallback('execcommand_callback',t.id,t.selection.getNode(),cmd,ui,val)){t.onExecCommand.dispatch(t,cmd,ui,val,a);return true;}if(o=t.execCommands[cmd]){st=o.func.call(o.scope,ui,val);if(st!==true){t.onExecCommand.dispatch(t,cmd,ui,val,a);return st;}}each(t.plugins,function(p){if(p.execCommand&&p.execCommand(cmd,ui,val)){t.onExecCommand.dispatch(t,cmd,ui,val,a);s=1;return false;}});if(s)return true;if(t.theme.execCommand&&t.theme.execCommand(cmd,ui,val)){t.onExecCommand.dispatch(t,cmd,ui,val,a);return true;}if(t.editorCommands.execCommand(cmd,ui,val)){t.onExecCommand.dispatch(t,cmd,ui,val,a);return true;}t.getDoc().execCommand(cmd,ui,val);t.onExecCommand.dispatch(t,cmd,ui,val,a);},queryCommandState:function(c){var t=this,o,s;if(t._isHidden())return;if(o=t.queryStateCommands[c]){s=o.func.call(o.scope);if(s!==true)return s;}o=t.editorCommands.queryCommandState(c);if(o!==-1)return o;try{return this.getDoc().queryCommandState(c);}catch(ex){}},queryCommandValue:function(c){var t=this,o,s;if(t._isHidden())return;if(o=t.queryValueCommands[c]){s=o.func.call(o.scope);if(s!==true)return s;}o=t.editorCommands.queryCommandValue(c);if(is(o))return o;try{return this.getDoc().queryCommandValue(c);}catch(ex){}},show:function(){var t=this;DOM.show(t.getContainer());DOM.hide(t.id);t.load();},hide:function(){var t=this,d=t.getDoc();if(isIE&&d)d.execCommand('SelectAll');t.save();DOM.hide(t.getContainer());DOM.setStyle(t.id,'display',t.orgDisplay);},isHidden:function(){return!DOM.isHidden(this.id);},setProgressState:function(b,ti,o){this.onSetProgressState.dispatch(this,b,ti,o);return b;},resizeToContent:function(){var t=this;DOM.setStyle(t.id+"_ifr",'height',t.getBody().scrollHeight);},load:function(o){var t=this,e=t.getElement(),h;if(e){o=o||{};o.load=true;h=t.setContent(is(e.value)?e.value:e.innerHTML,o);o.element=e;if(!o.no_events)t.onLoadContent.dispatch(t,o);o.element=e=null;return h;}},save:function(o){var t=this,e=t.getElement(),h,f;if(!e||!t.initialized)return;o=o||{};o.save=true;if(!o.no_events){t.undoManager.typing=0;t.undoManager.add();}o.element=e;h=o.content=t.getContent(o);if(!o.no_events)t.onSaveContent.dispatch(t,o);h=o.content;if(!/TEXTAREA|INPUT/i.test(e.nodeName)){e.innerHTML=h;if(f=DOM.getParent(t.id,'form')){each(f.elements,function(e){if(e.name==t.id){e.value=h;return false;}});}}else e.value=h;o.element=e=null;return h;},setContent:function(h,o){var t=this;o=o||{};o.format=o.format||'html';o.set=true;o.content=h;if(!o.no_events)t.onBeforeSetContent.dispatch(t,o);if(!tinymce.isIE&&(h.length===0||/^\s+$/.test(h))){o.content=t.dom.setHTML(t.getBody(),'
    ');o.format='raw';}o.content=t.dom.setHTML(t.getBody(),tinymce.trim(o.content));if(o.format!='raw'&&t.settings.cleanup){o.getInner=true;o.content=t.dom.setHTML(t.getBody(),t.serializer.serialize(t.getBody(),o));}if(!o.no_events)t.onSetContent.dispatch(t,o);return o.content;},getContent:function(o){var t=this,h;o=o||{};o.format=o.format||'html';o.get=true;if(!o.no_events)t.onBeforeGetContent.dispatch(t,o);if(o.format!='raw'&&t.settings.cleanup){o.getInner=true;h=t.serializer.serialize(t.getBody(),o);}else h=t.getBody().innerHTML;h=h.replace(/^\s*|\s*$/g,'');o.content=h;if(!o.no_events)t.onGetContent.dispatch(t,o);return o.content;},isDirty:function(){var t=this;return tinymce.trim(t.startContent)!=tinymce.trim(t.getContent({format:'raw',no_events:1}))&&!t.isNotDirty;},getContainer:function(){var t=this;if(!t.container)t.container=DOM.get(t.editorContainer||t.id+'_parent');return t.container;},getContentAreaContainer:function(){return this.contentAreaContainer;},getElement:function(){return DOM.get(this.settings.content_element||this.id);},getWin:function(){var t=this,e;if(!t.contentWindow){e=DOM.get(t.id+"_ifr");if(e)t.contentWindow=e.contentWindow;}return t.contentWindow;},getDoc:function(){var t=this,w;if(!t.contentDocument){w=t.getWin();if(w)t.contentDocument=w.document;}return t.contentDocument;},getBody:function(){return this.bodyElement||this.getDoc().body;},convertURL:function(u,n,e){var t=this,s=t.settings;if(s.urlconverter_callback)return t.execCallback('urlconverter_callback',u,e,true,n);if(!s.convert_urls||(e&&e.nodeName=='LINK')||u.indexOf('file:')===0)return u;if(s.relative_urls)return t.documentBaseURI.toRelative(u);u=t.documentBaseURI.toAbsolute(u,s.remove_script_host);return u;},addVisual:function(e){var t=this,s=t.settings;e=e||t.getBody();if(!is(t.hasVisual))t.hasVisual=s.visual;each(t.dom.select('table,a',e),function(e){var v;switch(e.nodeName){case'TABLE':v=t.dom.getAttrib(e,'border');if(!v||v=='0'){if(t.hasVisual)t.dom.addClass(e,s.visual_table_class);else t.dom.removeClass(e,s.visual_table_class);}return;case'A':v=t.dom.getAttrib(e,'name');if(v){if(t.hasVisual)t.dom.addClass(e,'mceItemAnchor');else t.dom.removeClass(e,'mceItemAnchor');}return;}});t.onVisualAid.dispatch(t,e,t.hasVisual);},remove:function(){var t=this,e=t.getContainer();t.removed=1;t.hide();t.execCallback('remove_instance_callback',t);t.onRemove.dispatch(t);t.onExecCommand.listeners=[];EditorManager.remove(t);DOM.remove(e);},destroy:function(s){var t=this;if(t.destroyed)return;if(!s){tinymce.removeUnload(t.destroy);tinyMCE.onBeforeUnload.remove(t._beforeUnload);if(t.theme.destroy)t.theme.destroy();t.controlManager.destroy();t.selection.destroy();t.dom.destroy();if(!t.settings.content_editable){Event.clear(t.getWin());Event.clear(t.getDoc());}Event.clear(t.getBody());Event.clear(t.formElement);}if(t.formElement){t.formElement.submit=t.formElement._mceOldSubmit;t.formElement._mceOldSubmit=null;}t.contentAreaContainer=t.formElement=t.container=t.settings.content_element=t.bodyElement=t.contentDocument=t.contentWindow=null;if(t.selection)t.selection=t.selection.win=t.selection.dom=t.selection.dom.doc=null;t.destroyed=1;},_addEvents:function(){var t=this,i,s=t.settings,lo={mouseup:'onMouseUp',mousedown:'onMouseDown',click:'onClick',keyup:'onKeyUp',keydown:'onKeyDown',keypress:'onKeyPress',submit:'onSubmit',reset:'onReset',contextmenu:'onContextMenu',dblclick:'onDblClick',paste:'onPaste'};function eventHandler(e,o){var ty=e.type;if(t.removed)return;if(t.onEvent.dispatch(t,e,o)!==false){t[lo[e.fakeType||e.type]].dispatch(t,e,o);}};each(lo,function(v,k){switch(k){case'contextmenu':if(tinymce.isOpera){Event.add(t.getBody(),'mousedown',function(e){if(e.ctrlKey){e.fakeType='contextmenu';eventHandler(e);}});}else Event.add(t.getBody(),k,eventHandler);break;case'paste':Event.add(t.getBody(),k,function(e){var tx,h,el,r;if(e.clipboardData)tx=e.clipboardData.getData('text/plain');else if(tinymce.isIE)tx=t.getWin().clipboardData.getData('Text');eventHandler(e,{text:tx,html:h});});break;case'submit':case'reset':Event.add(t.getElement().form||DOM.getParent(t.id,'form'),k,eventHandler);break;default:Event.add(s.content_editable?t.getBody():t.getDoc(),k,eventHandler);}});Event.add(s.content_editable?t.getBody():(isGecko?t.getDoc():t.getWin()),'focus',function(e){t.focus(true);});if(tinymce.isGecko){Event.add(t.getDoc(),'DOMNodeInserted',function(e){var v;e=e.target;if(e.nodeType===1&&e.nodeName==='IMG'&&(v=e.getAttribute('mce_src')))e.src=t.documentBaseURI.toAbsolute(v);});}if(isGecko){function setOpts(){var t=this,d=t.getDoc(),s=t.settings;if(isGecko&&!s.readonly){if(t._isHidden()){try{if(!s.content_editable)d.designMode='On';}catch(ex){}}try{d.execCommand("styleWithCSS",0,false);}catch(ex){if(!t._isHidden())try{d.execCommand("useCSS",0,true);}catch(ex){}}if(!s.table_inline_editing)try{d.execCommand('enableInlineTableEditing',false,false);}catch(ex){}if(!s.object_resizing)try{d.execCommand('enableObjectResizing',false,false);}catch(ex){}}};t.onBeforeExecCommand.add(setOpts);t.onMouseDown.add(setOpts);}t.onMouseUp.add(t.nodeChanged);t.onClick.add(t.nodeChanged);t.onKeyUp.add(function(ed,e){var c=e.keyCode;if((c>=33&&c<=36)||(c>=37&&c<=40)||c==13||c==45||c==46||c==8||(tinymce.isMac&&(c==91||c==93))||e.ctrlKey)t.nodeChanged();});t.onReset.add(function(){t.setContent(t.startContent,{format:'raw'});});if(t.getParam('tab_focus')){function tabCancel(ed,e){if(e.keyCode===9)return Event.cancel(e);};function tabHandler(ed,e){var x,i,f,el,v;function find(d){f=DOM.getParent(ed.id,'form');el=f.elements;if(f){each(el,function(e,i){if(e.id==ed.id){x=i;return false;}});if(d>0){for(i=x+1;i=0;i--){if(el[i].type!='hidden')return el[i];}}}return null;};if(e.keyCode===9){v=explode(ed.getParam('tab_focus'));if(v.length==1){v[1]=v[0];v[0]=':prev';}if(e.shiftKey){if(v[0]==':prev')el=find(-1);else el=DOM.get(v[0]);}else{if(v[1]==':next')el=find(1);else el=DOM.get(v[1]);}if(el){if(ed=EditorManager.get(el.id||el.name))ed.focus();else window.setTimeout(function(){window.focus();el.focus();},10);return Event.cancel(e);}}};t.onKeyUp.add(tabCancel);if(isGecko){t.onKeyPress.add(tabHandler);t.onKeyDown.add(tabCancel);}else t.onKeyDown.add(tabHandler);}if(s.custom_shortcuts){if(s.custom_undo_redo_keyboard_shortcuts){t.addShortcut('ctrl+z',t.getLang('undo_desc'),'Undo');t.addShortcut('ctrl+y',t.getLang('redo_desc'),'Redo');}if(isGecko){t.addShortcut('ctrl+b',t.getLang('bold_desc'),'Bold');t.addShortcut('ctrl+i',t.getLang('italic_desc'),'Italic');t.addShortcut('ctrl+u',t.getLang('underline_desc'),'Underline');}for(i=1;i<=6;i++)t.addShortcut('ctrl+'+i,'',['FormatBlock',false,'']);t.addShortcut('ctrl+7','',['FormatBlock',false,'

    ']);t.addShortcut('ctrl+8','',['FormatBlock',false,'

    ']);t.addShortcut('ctrl+9','',['FormatBlock',false,'
    ']);function find(e){var v=null;if(!e.altKey&&!e.ctrlKey&&!e.metaKey)return v;each(t.shortcuts,function(o){if(tinymce.isMac&&o.ctrl!=e.metaKey)return;else if(!tinymce.isMac&&o.ctrl!=e.ctrlKey)return;if(o.alt!=e.altKey)return;if(o.shift!=e.shiftKey)return;if(e.keyCode==o.keyCode||(e.charCode&&e.charCode==o.charCode)){v=o;return false;}});return v;};t.onKeyUp.add(function(ed,e){var o=find(e);if(o)return Event.cancel(e);});t.onKeyPress.add(function(ed,e){var o=find(e);if(o)return Event.cancel(e);});t.onKeyDown.add(function(ed,e){var o=find(e);if(o){o.func.call(o.scope);return Event.cancel(e);}});}if(tinymce.isIE){Event.add(t.getDoc(),'controlselect',function(e){var re=t.resizeInfo,cb;e=e.target;if(e.nodeName!=='IMG')return;if(re)Event.remove(re.node,re.ev,re.cb);if(!t.dom.hasClass(e,'mceItemNoResize')){ev='resizeend';cb=Event.add(e,ev,function(e){var v;e=e.target;if(v=t.dom.getStyle(e,'width')){t.dom.setAttrib(e,'width',v.replace(/[^0-9%]+/g,''));t.dom.setStyle(e,'width','');}if(v=t.dom.getStyle(e,'height')){t.dom.setAttrib(e,'height',v.replace(/[^0-9%]+/g,''));t.dom.setStyle(e,'height','');}});}else{ev='resizestart';cb=Event.add(e,'resizestart',Event.cancel,Event);}re=t.resizeInfo={node:e,ev:ev,cb:cb};});t.onKeyDown.add(function(ed,e){switch(e.keyCode){case 8:if(t.selection.getRng().item){t.selection.getRng().item(0).removeNode();return Event.cancel(e);}}});}if(tinymce.isOpera){t.onClick.add(function(ed,e){Event.prevent(e);});}if(s.custom_undo_redo){function addUndo(){t.undoManager.typing=0;t.undoManager.add();};if(tinymce.isIE){Event.add(t.getWin(),'blur',function(e){var n;if(t.selection){n=t.selection.getNode();if(!t.removed&&n.ownerDocument&&n.ownerDocument!=t.getDoc())addUndo();}});}else{Event.add(t.getDoc(),'blur',function(){if(t.selection&&!t.removed)addUndo();});}t.onMouseDown.add(addUndo);t.onKeyUp.add(function(ed,e){if((e.keyCode>=33&&e.keyCode<=36)||(e.keyCode>=37&&e.keyCode<=40)||e.keyCode==13||e.keyCode==45||e.ctrlKey){t.undoManager.typing=0;t.undoManager.add();}});t.onKeyDown.add(function(ed,e){if((e.keyCode>=33&&e.keyCode<=36)||(e.keyCode>=37&&e.keyCode<=40)||e.keyCode==13||e.keyCode==45){if(t.undoManager.typing){t.undoManager.add();t.undoManager.typing=0;}return;}if(!t.undoManager.typing){t.undoManager.add();t.undoManager.typing=1;}});}},_convertInlineElements:function(){var t=this,s=t.settings,dom=t.dom,v,e,na,st,sp;function convert(ed,o){if(!s.inline_styles)return;if(o.get){each(t.dom.select('table,u,strike',o.node),function(n){switch(n.nodeName){case'TABLE':if(v=dom.getAttrib(n,'height')){dom.setStyle(n,'height',v);dom.setAttrib(n,'height','');}break;case'U':case'STRIKE':n.style.textDecoration=n.nodeName=='U'?'underline':'line-through';dom.setAttrib(n,'mce_style','');dom.setAttrib(n,'mce_name','span');break;}});}else if(o.set){each(t.dom.select('table,span',o.node).reverse(),function(n){if(n.nodeName=='TABLE'){if(v=dom.getStyle(n,'height'))dom.setAttrib(n,'height',v.replace(/[^0-9%]+/g,''));}else{if(n.style.textDecoration=='underline')na='u';else if(n.style.textDecoration=='line-through')na='strike';else na='';if(na){n.style.textDecoration='';dom.setAttrib(n,'mce_style','');e=dom.create(na,{style:dom.getAttrib(n,'style')});dom.replace(e,n,1);}}});}};t.onPreProcess.add(convert);if(!s.cleanup_on_startup){t.onSetContent.add(function(ed,o){if(o.initial)convert(t,{node:t.getBody(),set:1});});}},_convertFonts:function(){var t=this,s=t.settings,dom=t.dom,fz,fzn,sl,cl;if(!s.inline_styles)return;fz=[8,10,12,14,18,24,36];fzn=['xx-small','x-small','small','medium','large','x-large','xx-large'];if(sl=s.font_size_style_values)sl=explode(sl);if(cl=s.font_size_classes)cl=explode(cl);function process(no){var n,sp,nl,x;if(!s.inline_styles)return;nl=t.dom.select('font',no);for(x=nl.length-1;x>=0;x--){n=nl[x];sp=dom.create('span',{style:dom.getAttrib(n,'style'),'class':dom.getAttrib(n,'class')});dom.setStyles(sp,{fontFamily:dom.getAttrib(n,'face'),color:dom.getAttrib(n,'color'),backgroundColor:n.style.backgroundColor});if(n.size){if(sl)dom.setStyle(sp,'fontSize',sl[parseInt(n.size)-1]);else dom.setAttrib(sp,'class',cl[parseInt(n.size)-1]);}dom.setAttrib(sp,'mce_style','');dom.replace(sp,n,1);}};t.onPreProcess.add(function(ed,o){if(o.get)process(o.node);});t.onSetContent.add(function(ed,o){if(o.initial)process(o.node);});},_isHidden:function(){var s;if(!isGecko)return 0;s=this.selection.getSel();return(!s||!s.rangeCount||s.rangeCount==0);},_fixNesting:function(s){var d=[],i;s=s.replace(/<(\/)?([^\s>]+)[^>]*?>/g,function(a,b,c){var e;if(b==='/'){if(!d.length)return'';if(c!==d[d.length-1].tag){for(i=d.length-1;i>=0;i--){if(d[i].tag===c){d[i].close=1;break;}}return'';}else{d.pop();if(d.length&&d[d.length-1].close){a=a+'';d.pop();}}}else{if(/^(br|hr|input|meta|img|link|param)$/i.test(c))return a;if(/\/>$/.test(a))return a;d.push({tag:c});}return a;});for(i=d.length-1;i>=0;i--)s+='';return s;}});})();(function(){var each=tinymce.each,isIE=tinymce.isIE,isGecko=tinymce.isGecko,isOpera=tinymce.isOpera,isWebKit=tinymce.isWebKit;function isBlock(n){return/^(H[1-6]|HR|P|DIV|ADDRESS|PRE|FORM|TABLE|OL|UL|TD|CAPTION|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP)$/.test(n.nodeName);};tinymce.create('tinymce.EditorCommands',{EditorCommands:function(ed){this.editor=ed;},execCommand:function(cmd,ui,val){var t=this,ed=t.editor,f;switch(cmd){case'Cut':case'Copy':case'Paste':try{ed.getDoc().execCommand(cmd,ui,val);}catch(ex){if(isGecko){ed.windowManager.confirm(ed.getLang('clipboard_msg'),function(s){if(s)window.open('http://www.mozilla.org/editor/midasdemo/securityprefs.html','mceExternal');});}else ed.windowManager.alert(ed.getLang('clipboard_no_support'));}return true;case'mceResetDesignMode':case'mceBeginUndoLevel':return true;case'unlink':t.UnLink();return true;case'JustifyLeft':case'JustifyCenter':case'JustifyRight':case'JustifyFull':t.mceJustify(cmd,cmd.substring(7).toLowerCase());return true;case'mceEndUndoLevel':case'mceAddUndoLevel':ed.undoManager.add();return true;default:f=this[cmd];if(f){f.call(this,ui,val);return true;}}return false;},Indent:function(){var ed=this.editor,d=ed.dom,s=ed.selection,e,iv,iu;iv=ed.settings.indentation;iu=/[a-z%]+$/i.exec(iv);iv=parseInt(iv);if(ed.settings.inline_styles&&(!this.queryStateInsertUnorderedList()&&!this.queryStateInsertOrderedList())){each(this._getSelectedBlocks(),function(e){d.setStyle(e,'paddingLeft',(parseInt(e.style.paddingLeft||0)+iv)+iu);});return;}ed.getDoc().execCommand('Indent',false,null);if(isIE){d.getParent(s.getNode(),function(n){if(n.nodeName=='BLOCKQUOTE'){n.dir=n.style.cssText='';}});}},Outdent:function(){var ed=this.editor,d=ed.dom,s=ed.selection,e,v,iv,iu;iv=ed.settings.indentation;iu=/[a-z%]+$/i.exec(iv);iv=parseInt(iv);if(ed.settings.inline_styles&&(!this.queryStateInsertUnorderedList()&&!this.queryStateInsertOrderedList())){each(this._getSelectedBlocks(),function(e){v=Math.max(0,parseInt(e.style.paddingLeft||0)-iv);d.setStyle(e,'paddingLeft',v?v+iu:'');});return;}ed.getDoc().execCommand('Outdent',false,null);},mceSetAttribute:function(u,v){var ed=this.editor,d=ed.dom,e;if(e=d.getParent(ed.selection.getNode(),d.isBlock))d.setAttrib(e,v.name,v.value);},mceSetContent:function(u,v){this.editor.setContent(v);},mceToggleVisualAid:function(){var ed=this.editor;ed.hasVisual=!ed.hasVisual;ed.addVisual();},mceReplaceContent:function(u,v){var s=this.editor.selection;s.setContent(v.replace(/\{\$selection\}/g,s.getContent({format:'text'})));},mceInsertLink:function(u,v){var ed=this.editor,s=ed.selection,e=ed.dom.getParent(s.getNode(),'A');if(tinymce.is(v,'string'))v={href:v};function set(e){each(v,function(v,k){ed.dom.setAttrib(e,k,v);});};if(!e){ed.execCommand('CreateLink',false,'javascript:mctmp(0);');each(ed.dom.select('a'),function(e){if(e.href=='javascript:mctmp(0);')set(e);});}else{if(v.href)set(e);else ed.dom.remove(e,1);}},UnLink:function(){var ed=this.editor,s=ed.selection;if(s.isCollapsed())s.select(s.getNode());ed.getDoc().execCommand('unlink',false,null);s.collapse(0);},FontName:function(u,v){var t=this,ed=t.editor,s=ed.selection,e;if(!v){if(s.isCollapsed())s.select(s.getNode());t.RemoveFormat();}else{if(ed.settings.convert_fonts_to_spans)t._applyInlineStyle('span',{style:{fontFamily:v}});else ed.getDoc().execCommand('FontName',false,v);}},FontSize:function(u,v){var ed=this.editor,s=ed.settings,fc,fs;if(s.convert_fonts_to_spans&&v>=1&&v<=7){fs=tinymce.explode(s.font_size_style_values);fc=tinymce.explode(s.font_size_classes);if(fc)v=fc[v-1]||v;else v=fs[v-1]||v;}if(v>=1&&v<=7)ed.getDoc().execCommand('FontSize',false,v);else this._applyInlineStyle('span',{style:{fontSize:v}});},queryCommandValue:function(c){var f=this['queryValue'+c];if(f)return f.call(this,c);return false;},queryCommandState:function(cmd){var f;switch(cmd){case'JustifyLeft':case'JustifyCenter':case'JustifyRight':case'JustifyFull':return this.queryStateJustify(cmd,cmd.substring(7).toLowerCase());default:if(f=this['queryState'+cmd])return f.call(this,cmd);}return-1;},_queryState:function(c){try{return this.editor.getDoc().queryCommandState(c);}catch(ex){}},_queryVal:function(c){try{return this.editor.getDoc().queryCommandValue(c);}catch(ex){}},queryValueFontSize:function(){var ed=this.editor,v=0,p;if(p=ed.dom.getParent(ed.selection.getNode(),'SPAN'))v=p.style.fontSize;if(!v&&(isOpera||isWebKit)){if(p=ed.dom.getParent(ed.selection.getNode(),'FONT'))v=p.size;return v;}return v||this._queryVal('FontSize');},queryValueFontName:function(){var ed=this.editor,v=0,p;if(p=ed.dom.getParent(ed.selection.getNode(),'FONT'))v=p.face;if(p=ed.dom.getParent(ed.selection.getNode(),'SPAN'))v=p.style.fontFamily.replace(/, /g,',').replace(/[\'\"]/g,'').toLowerCase();if(!v)v=this._queryVal('FontName');return v;},mceJustify:function(c,v){var ed=this.editor,se=ed.selection,n=se.getNode(),nn=n.nodeName,bl,nb,dom=ed.dom,rm;if(ed.settings.inline_styles&&this.queryStateJustify(c,v))rm=1;bl=dom.getParent(n,ed.dom.isBlock);if(nn=='IMG'){if(v=='full')return;if(rm){if(v=='center')dom.setStyle(bl||n.parentNode,'textAlign','');dom.setStyle(n,'float','');this.mceRepaint();return;}if(v=='center'){if(bl&&/^(TD|TH)$/.test(bl.nodeName))bl=0;if(!bl||bl.childNodes.length>1){nb=dom.create('p');nb.appendChild(n.cloneNode(false));if(bl)dom.insertAfter(nb,bl);else dom.insertAfter(nb,n);dom.remove(n);n=nb.firstChild;bl=nb;}dom.setStyle(bl,'textAlign',v);dom.setStyle(n,'float','');}else{dom.setStyle(n,'float',v);dom.setStyle(bl||n.parentNode,'textAlign','');}this.mceRepaint();return;}if(ed.settings.inline_styles&&ed.settings.forced_root_block){if(rm)v='';each(this._getSelectedBlocks(dom.getParent(se.getStart(),dom.isBlock),dom.getParent(se.getEnd(),dom.isBlock)),function(e){dom.setAttrib(e,'align','');dom.setStyle(e,'textAlign',v=='full'?'justify':v);});return;}else if(!rm)ed.getDoc().execCommand(c,false,null);if(ed.settings.inline_styles){if(rm){dom.getParent(ed.selection.getNode(),function(n){if(n.style&&n.style.textAlign)dom.setStyle(n,'textAlign','');});return;}each(dom.select('*'),function(n){var v=n.align;if(v){if(v=='full')v='justify';dom.setStyle(n,'textAlign',v);dom.setAttrib(n,'align','');}});}},mceSetCSSClass:function(u,v){this.mceSetStyleInfo(0,{command:'setattrib',name:'class',value:v});},getSelectedElement:function(){var t=this,ed=t.editor,dom=ed.dom,se=ed.selection,r=se.getRng(),r1,r2,sc,ec,so,eo,e,sp,ep,re;if(se.isCollapsed()||r.item)return se.getNode();re=ed.settings.merge_styles_invalid_parents;if(tinymce.is(re,'string'))re=new RegExp(re,'i');if(isIE){r1=r.duplicate();r1.collapse(true);sc=r1.parentElement();r2=r.duplicate();r2.collapse(false);ec=r2.parentElement();if(sc!=ec){r1.move('character',1);sc=r1.parentElement();}if(sc==ec){r1=r.duplicate();r1.moveToElementText(sc);if(r1.compareEndPoints('StartToStart',r)==0&&r1.compareEndPoints('EndToEnd',r)==0)return re&&re.test(sc.nodeName)?null:sc;}}else{function getParent(n){return dom.getParent(n,function(n){return n.nodeType==1;});};sc=r.startContainer;ec=r.endContainer;so=r.startOffset;eo=r.endOffset;if(!r.collapsed){if(sc==ec){if(so-eo<2){if(sc.hasChildNodes()){sp=sc.childNodes[so];return re&&re.test(sp.nodeName)?null:sp;}}}}if(sc.nodeType!=3||ec.nodeType!=3)return null;if(so==0){sp=getParent(sc);if(sp&&sp.firstChild!=sc)sp=null;}if(so==sc.nodeValue.length){e=sc.nextSibling;if(e&&e.nodeType==1)sp=sc.nextSibling;}if(eo==0){e=ec.previousSibling;if(e&&e.nodeType==1)ep=e;}if(eo==ec.nodeValue.length){ep=getParent(ec);if(ep&&ep.lastChild!=ec)ep=null;}if(sp==ep)return re&&sp&&re.test(sp.nodeName)?null:sp;}return null;},InsertHorizontalRule:function(){if(isGecko||isIE)this.editor.selection.setContent('
    ');else this.editor.getDoc().execCommand('InsertHorizontalRule',false,'');},RemoveFormat:function(){var t=this,ed=t.editor,s=ed.selection,b;if(isWebKit)s.setContent(s.getContent({format:'raw'}).replace(/(<(span|b|i|strong|em|strike) [^>]+>|<(span|b|i|strong|em|strike)>|<\/(span|b|i|strong|em|strike)>|)/g,''),{format:'raw'});else ed.getDoc().execCommand('RemoveFormat',false,null);t.mceSetStyleInfo(0,{command:'removeformat'});ed.addVisual();},mceSetStyleInfo:function(u,v){var t=this,ed=t.editor,d=ed.getDoc(),dom=ed.dom,e,b,s=ed.selection,nn=v.wrapper||'span',b=s.getBookmark(),re;function set(n,e){if(n.nodeType==1){switch(v.command){case'setattrib':return dom.setAttrib(n,v.name,v.value);case'setstyle':return dom.setStyle(n,v.name,v.value);case'removeformat':return dom.setAttrib(n,'class','');}}};re=ed.settings.merge_styles_invalid_parents;if(tinymce.is(re,'string'))re=new RegExp(re,'i');if((e=t.getSelectedElement())&&!ed.settings.force_span_wrappers)set(e,1);else{d.execCommand('FontName',false,'__');each(isWebKit?dom.select('span'):dom.select('font'),function(n){var sp,e;if(dom.getAttrib(n,'face')=='__'||n.style.fontFamily==='__'){sp=dom.create(nn,{mce_new:'1'});set(sp);each(n.childNodes,function(n){sp.appendChild(n.cloneNode(true));});dom.replace(sp,n);}});}each(dom.select(nn).reverse(),function(n){var p=n.parentNode;if(!dom.getAttrib(n,'mce_new')){p=dom.getParent(n,function(n){return n.nodeType==1&&dom.getAttrib(n,'mce_new');});if(p)dom.remove(n,1);}});each(dom.select(nn).reverse(),function(n){var p=n.parentNode;if(!p||!dom.getAttrib(n,'mce_new'))return;if(ed.settings.force_span_wrappers&&p.nodeName!='SPAN')return;if(p.nodeName==nn.toUpperCase()&&p.childNodes.length==1)return dom.remove(p,1);if(n.nodeType==1&&(!re||!re.test(p.nodeName))&&p.childNodes.length==1){set(p);dom.setAttrib(n,'class','');}});each(dom.select(nn).reverse(),function(n){if(dom.getAttrib(n,'mce_new')||(dom.getAttribs(n).length<=1&&n.className==='')){if(!dom.getAttrib(n,'class')&&!dom.getAttrib(n,'style'))return dom.remove(n,1);dom.setAttrib(n,'mce_new','');}});s.moveToBookmark(b);},queryStateJustify:function(c,v){var ed=this.editor,n=ed.selection.getNode(),dom=ed.dom;if(n&&n.nodeName=='IMG'){if(dom.getStyle(n,'float')==v)return 1;return n.parentNode.style.textAlign==v;}n=dom.getParent(ed.selection.getStart(),function(n){return n.nodeType==1&&n.style.textAlign;});if(v=='full')v='justify';if(ed.settings.inline_styles)return(n&&n.style.textAlign==v);return this._queryState(c);},ForeColor:function(ui,v){var ed=this.editor;if(ed.settings.convert_fonts_to_spans){this._applyInlineStyle('span',{style:{color:v}});return;}else ed.getDoc().execCommand('ForeColor',false,v);},HiliteColor:function(ui,val){var t=this,ed=t.editor,d=ed.getDoc();if(ed.settings.convert_fonts_to_spans){this._applyInlineStyle('span',{style:{backgroundColor:val}});return;}function set(s){if(!isGecko)return;try{d.execCommand("styleWithCSS",0,s);}catch(ex){d.execCommand("useCSS",0,!s);}};if(isGecko||isOpera){set(true);d.execCommand('hilitecolor',false,val);set(false);}else d.execCommand('BackColor',false,val);},Undo:function(){var ed=this.editor;if(ed.settings.custom_undo_redo){ed.undoManager.undo();ed.nodeChanged();}else ed.getDoc().execCommand('Undo',false,null);},Redo:function(){var ed=this.editor;if(ed.settings.custom_undo_redo){ed.undoManager.redo();ed.nodeChanged();}else ed.getDoc().execCommand('Redo',false,null);},FormatBlock:function(ui,val){var t=this,ed=t.editor,s=ed.selection,dom=ed.dom,bl,nb,b;function isBlock(n){return/^(P|DIV|H[1-6]|ADDRESS|BLOCKQUOTE|PRE)$/.test(n.nodeName);};bl=dom.getParent(s.getNode(),function(n){return isBlock(n);});if(bl){if((isIE&&isBlock(bl.parentNode))||bl.nodeName=='DIV'){nb=ed.dom.create(val);each(dom.getAttribs(bl),function(v){dom.setAttrib(nb,v.nodeName,dom.getAttrib(bl,v.nodeName));});b=s.getBookmark();dom.replace(nb,bl,1);s.moveToBookmark(b);ed.nodeChanged();return;}}val=ed.settings.forced_root_block?(val||'

    '):val;if(val.indexOf('<')==-1)val='<'+val+'>';if(tinymce.isGecko)val=val.replace(/<(div|blockquote|code|dt|dd|dl|samp)>/gi,'$1');ed.getDoc().execCommand('FormatBlock',false,val);},mceCleanup:function(){var ed=this.editor,s=ed.selection,b=s.getBookmark();ed.setContent(ed.getContent());s.moveToBookmark(b);},mceRemoveNode:function(ui,val){var ed=this.editor,s=ed.selection,b,n=val||s.getNode();if(n==ed.getBody())return;b=s.getBookmark();ed.dom.remove(n,1);s.moveToBookmark(b);ed.nodeChanged();},mceSelectNodeDepth:function(ui,val){var ed=this.editor,s=ed.selection,c=0;ed.dom.getParent(s.getNode(),function(n){if(n.nodeType==1&&c++==val){s.select(n);ed.nodeChanged();return false;}},ed.getBody());},mceSelectNode:function(u,v){this.editor.selection.select(v);},mceInsertContent:function(ui,val){this.editor.selection.setContent(val);},mceInsertRawHTML:function(ui,val){var ed=this.editor;ed.selection.setContent('tiny_mce_marker');ed.setContent(ed.getContent().replace(/tiny_mce_marker/g,val));},mceRepaint:function(){var s,b,e=this.editor;if(tinymce.isGecko){try{s=e.selection;b=s.getBookmark(true);if(s.getSel())s.getSel().selectAllChildren(e.getBody());s.collapse(true);s.moveToBookmark(b);}catch(ex){}}},queryStateUnderline:function(){var ed=this.editor,n=ed.selection.getNode();if(n&&n.nodeName=='A')return false;return this._queryState('Underline');},queryStateOutdent:function(){var ed=this.editor,n;if(ed.settings.inline_styles){if((n=ed.dom.getParent(ed.selection.getStart(),ed.dom.isBlock))&&parseInt(n.style.paddingLeft)>0)return true;if((n=ed.dom.getParent(ed.selection.getEnd(),ed.dom.isBlock))&&parseInt(n.style.paddingLeft)>0)return true;}return this.queryStateInsertUnorderedList()||this.queryStateInsertOrderedList()||(!ed.settings.inline_styles&&!!ed.dom.getParent(ed.selection.getNode(),'BLOCKQUOTE'));},queryStateInsertUnorderedList:function(){return this.editor.dom.getParent(this.editor.selection.getNode(),'UL');},queryStateInsertOrderedList:function(){return this.editor.dom.getParent(this.editor.selection.getNode(),'OL');},queryStatemceBlockQuote:function(){return!!this.editor.dom.getParent(this.editor.selection.getStart(),function(n){return n.nodeName==='BLOCKQUOTE';});},mceBlockQuote:function(){var t=this,ed=t.editor,s=ed.selection,dom=ed.dom,sb,eb,n,bm,bq,r,bq2,i,nl;function getBQ(e){return dom.getParent(e,function(n){return n.nodeName==='BLOCKQUOTE';});};sb=dom.getParent(s.getStart(),isBlock);eb=dom.getParent(s.getEnd(),isBlock);if(bq=getBQ(sb)){if(sb!=eb||sb.childNodes.length>1||(sb.childNodes.length==1&&sb.firstChild.nodeName!='BR'))bm=s.getBookmark();if(getBQ(eb)){bq2=bq.cloneNode(false);while(n=eb.nextSibling)bq2.appendChild(n.parentNode.removeChild(n));}if(bq2)dom.insertAfter(bq2,bq);nl=t._getSelectedBlocks(sb,eb);for(i=nl.length-1;i>=0;i--){dom.insertAfter(nl[i],bq);}if(/^\s*$/.test(bq.innerHTML))dom.remove(bq,1);if(bq2&&/^\s*$/.test(bq2.innerHTML))dom.remove(bq2,1);if(!bm){if(!isIE){r=ed.getDoc().createRange();r.setStart(sb,0);r.setEnd(sb,0);s.setRng(r);}else{s.select(sb);s.collapse(0);if(dom.getParent(s.getStart(),isBlock)!=sb){r=s.getRng();r.move('character',-1);r.select();}}}else t.editor.selection.moveToBookmark(bm);return;}if(isIE&&!sb&&!eb){t.editor.getDoc().execCommand('Indent');n=getBQ(s.getNode());n.style.margin=n.dir='';return;}if(!sb||!eb)return;if(sb!=eb||sb.childNodes.length>1||(sb.childNodes.length==1&&sb.firstChild.nodeName!='BR'))bm=s.getBookmark();each(t._getSelectedBlocks(getBQ(s.getStart()),getBQ(s.getEnd())),function(e){if(e.nodeName=='BLOCKQUOTE'&&!bq){bq=e;return;}if(!bq){bq=dom.create('blockquote');e.parentNode.insertBefore(bq,e);}if(e.nodeName=='BLOCKQUOTE'&&bq){n=e.firstChild;while(n){bq.appendChild(n.cloneNode(true));n=n.nextSibling;}dom.remove(e);return;}bq.appendChild(dom.remove(e));});if(!bm){if(!isIE){r=ed.getDoc().createRange();r.setStart(sb,0);r.setEnd(sb,0);s.setRng(r);}else{s.select(sb);s.collapse(1);}}else s.moveToBookmark(bm);},_applyInlineStyle:function(na,at,op){var t=this,ed=t.editor,dom=ed.dom,bm,lo={},kh;na=na.toUpperCase();if(op&&op.check_classes&&at['class'])op.check_classes.push(at['class']);function replaceFonts(){var bm;each(dom.select(tinymce.isWebKit&&!tinymce.isAir?'span':'font'),function(n){if(n.style.fontFamily=='mceinline'||n.face=='mceinline'){if(!bm)bm=ed.selection.getBookmark();at._mce_new='1';dom.replace(dom.create(na,at),n,1);}});each(dom.select(na),function(n){if(n.getAttribute('_mce_new')){function removeStyle(n){if(n.nodeType==1){each(at.style,function(v,k){dom.setStyle(n,k,'');});if(at['class']&&n.className&&op){each(op.check_classes,function(c){if(dom.hasClass(n,c))dom.removeClass(n,c);});}}};each(dom.select(na,n),removeStyle);if(n.parentNode&&n.parentNode.nodeType==1&&n.parentNode.childNodes.length==1)removeStyle(n.parentNode);dom.getParent(n.parentNode,function(pn){if(pn.nodeType==1){if(at.style){each(at.style,function(v,k){var sv;if(!lo[k]&&(sv=dom.getStyle(pn,k))){if(sv===v)dom.setStyle(n,k,'');lo[k]=1;}});}if(at['class']&&pn.className&&op){each(op.check_classes,function(c){if(dom.hasClass(pn,c))dom.removeClass(n,c);});}}return false;});n.removeAttribute('_mce_new');}});each(dom.select(na).reverse(),function(n){var c=0;each(dom.getAttribs(n),function(an){if(an.nodeName.substring(0,1)!='_'&&dom.getAttrib(n,an.nodeName)!=''){c++;}});if(c==0)dom.remove(n,1);});ed.selection.moveToBookmark(bm);return!!bm;};ed.focus();ed.getDoc().execCommand('FontName',false,'mceinline');replaceFonts();if(kh=t._applyInlineStyle.keyhandler){ed.onKeyUp.remove(kh);ed.onKeyPress.remove(kh);ed.onKeyDown.remove(kh);ed.onSetContent.remove(t._applyInlineStyle.chandler);}if(ed.selection.isCollapsed()){t._pendingStyles=tinymce.extend(t._pendingStyles||{},at.style);t._applyInlineStyle.chandler=ed.onSetContent.add(function(){delete t._pendingStyles;});t._applyInlineStyle.keyhandler=kh=function(e){if(t._pendingStyles){at.style=t._pendingStyles;delete t._pendingStyles;}if(replaceFonts()){ed.onKeyDown.remove(t._applyInlineStyle.keyhandler);ed.onKeyPress.remove(t._applyInlineStyle.keyhandler);}if(e.type=='keyup')ed.onKeyUp.remove(t._applyInlineStyle.keyhandler);};ed.onKeyDown.add(kh);ed.onKeyPress.add(kh);ed.onKeyUp.add(kh);}else t._pendingStyles=0;},_getSelectedBlocks:function(st,en){var ed=this.editor,dom=ed.dom,s=ed.selection,sb,eb,n,bl=[];sb=dom.getParent(st||s.getStart(),isBlock);eb=dom.getParent(en||s.getEnd(),isBlock);if(sb)bl.push(sb);if(sb&&eb&&sb!=eb){n=sb;while((n=n.nextSibling)&&n!=eb){if(isBlock(n))bl.push(n);}}if(eb&&sb!=eb)bl.push(eb);return bl;}});})();tinymce.create('tinymce.UndoManager',{index:0,data:null,typing:0,UndoManager:function(ed){var t=this,Dispatcher=tinymce.util.Dispatcher;t.editor=ed;t.data=[];t.onAdd=new Dispatcher(this);t.onUndo=new Dispatcher(this);t.onRedo=new Dispatcher(this);},add:function(l){var t=this,i,ed=t.editor,b,s=ed.settings,la;l=l||{};l.content=l.content||ed.getContent({format:'raw',no_events:1});l.content=l.content.replace(/^\s*|\s*$/g,'');la=t.data[t.index>0&&(t.index==0||t.index==t.data.length)?t.index-1:t.index];if(!l.initial&&la&&l.content==la.content)return null;if(s.custom_undo_redo_levels){if(t.data.length>s.custom_undo_redo_levels){for(i=0;i0){if(t.index==t.data.length&&t.index>1){i=t.index;t.typing=0;if(!t.add())t.index=i;--t.index;}l=t.data[--t.index];ed.setContent(l.content,{format:'raw'});ed.selection.moveToBookmark(l.bookmark);t.onUndo.dispatch(t,l);}return l;},redo:function(){var t=this,ed=t.editor,l=null;if(t.index','gi');t.rePadd=new RegExp(']+)><\\\/p>|]+)\\\/>|]+)>\\s+<\\\/p>|

    <\\\/p>||

    \\s+<\\\/p>'.replace(/p/g,elm),'gi');t.reNbsp2BR1=new RegExp(']+)>[\\s\\u00a0]+<\\\/p>|

    [\\s\\u00a0]+<\\\/p>'.replace(/p/g,elm),'gi');t.reNbsp2BR2=new RegExp(']+)>( | )<\\\/p>|

    ( | )<\\\/p>'.replace(/p/g,elm),'gi');t.reBR2Nbsp=new RegExp(']+)>\\s*
    \\s*<\\\/p>|

    \\s*
    \\s*<\\\/p>'.replace(/p/g,elm),'gi');t.reTrailBr=new RegExp('\\s*
    \\s*<\\\/p>'.replace(/p/g,elm),'gi');function padd(ed,o){if(isOpera)o.content=o.content.replace(t.reOpera,'');o.content=o.content.replace(t.rePadd,'<'+elm+'$1$2$3$4$5$6>\u00a0');if(!isIE&&!isOpera&&o.set){o.content=o.content.replace(t.reNbsp2BR1,'<'+elm+'$1$2>
    ');o.content=o.content.replace(t.reNbsp2BR2,'<'+elm+'$1$2>
    ');}else{o.content=o.content.replace(t.reBR2Nbsp,'<'+elm+'$1$2>\u00a0');o.content=o.content.replace(t.reTrailBr,'');}};ed.onBeforeSetContent.add(padd);ed.onPostProcess.add(padd);if(s.forced_root_block){ed.onInit.add(t.forceRoots,t);ed.onSetContent.add(t.forceRoots,t);ed.onBeforeGetContent.add(t.forceRoots,t);}},setup:function(){var t=this,ed=t.editor,s=ed.settings;if(s.forced_root_block){ed.onKeyUp.add(t.forceRoots,t);ed.onPreProcess.add(t.forceRoots,t);}if(s.force_br_newlines){if(isIE){ed.onKeyPress.add(function(ed,e){var n,s=ed.selection;if(e.keyCode==13&&s.getNode().nodeName!='LI'){s.setContent('
    ',{format:'raw'});n=ed.dom.get('__');n.removeAttribute('id');s.select(n);s.collapse();return Event.cancel(e);}});}return;}if(!isIE&&s.force_p_newlines){ed.onKeyPress.add(function(ed,e){if(e.keyCode==13&&!e.shiftKey){if(!t.insertPara(e))Event.cancel(e);}});if(isGecko){ed.onKeyDown.add(function(ed,e){if((e.keyCode==8||e.keyCode==46)&&!e.shiftKey)t.backspaceDelete(e,e.keyCode==8);});}}function ren(rn,na){var ne=ed.dom.create(na);each(rn.attributes,function(a){if(a.specified&&a.nodeValue)ne.setAttribute(a.nodeName.toLowerCase(),a.nodeValue);});each(rn.childNodes,function(n){ne.appendChild(n.cloneNode(true));});rn.parentNode.replaceChild(ne,rn);return ne;};if(isIE&&s.element!='P'){ed.onKeyPress.add(function(ed,e){t.lastElm=ed.selection.getNode().nodeName;});ed.onKeyUp.add(function(ed,e){var bl,sel=ed.selection,n=sel.getNode(),b=ed.getBody();if(b.childNodes.length===1&&n.nodeName=='P'){n=ren(n,s.element);sel.select(n);sel.collapse();ed.nodeChanged();}else if(e.keyCode==13&&!e.shiftKey&&t.lastElm!='P'){bl=ed.dom.getParent(n,'P');if(bl){ren(bl,s.element);ed.nodeChanged();}}});}},find:function(n,t,s){var ed=this.editor,w=ed.getDoc().createTreeWalker(n,4,null,false),c=-1;while(n=w.nextNode()){c++;if(t==0&&n==s)return c;if(t==1&&c==s)return n;}return-1;},forceRoots:function(ed,e){var t=this,ed=t.editor,b=ed.getBody(),d=ed.getDoc(),se=ed.selection,s=se.getSel(),r=se.getRng(),si=-2,ei,so,eo,tr,c=-0xFFFFFF;var nx,bl,bp,sp,le,nl=b.childNodes,i,n,eid;for(i=nl.length-1;i>=0;i--){nx=nl[i];if(nx.nodeType==3||(!t.dom.isBlock(nx)&&nx.nodeType!=8)){if(!bl){if(nx.nodeType!=3||/[^\s]/g.test(nx.nodeValue)){if(si==-2&&r){if(!isIE){if(r.startContainer.nodeType==1&&(n=r.startContainer.childNodes[r.startOffset])&&n.nodeType==1){eid=n.getAttribute("id");n.setAttribute("id","__mce");}else{if(ed.dom.getParent(r.startContainer,function(e){return e===b;})){so=r.startOffset;eo=r.endOffset;si=t.find(b,0,r.startContainer);ei=t.find(b,0,r.endContainer);}}}else{tr=d.body.createTextRange();tr.moveToElementText(b);tr.collapse(1);bp=tr.move('character',c)*-1;tr=r.duplicate();tr.collapse(1);sp=tr.move('character',c)*-1;tr=r.duplicate();tr.collapse(0);le=(tr.move('character',c)*-1)-sp;si=sp-bp;ei=le;}}bl=ed.dom.create(ed.settings.forced_root_block);bl.appendChild(nx.cloneNode(1));nx.parentNode.replaceChild(bl,nx);}}else{if(bl.hasChildNodes())bl.insertBefore(nx,bl.firstChild);else bl.appendChild(nx);}}else bl=null;}if(si!=-2){if(!isIE){bl=b.getElementsByTagName(ed.settings.element)[0];r=d.createRange();if(si!=-1)r.setStart(t.find(b,1,si),so);else r.setStart(bl,0);if(ei!=-1)r.setEnd(t.find(b,1,ei),eo);else r.setEnd(bl,0);if(s){s.removeAllRanges();s.addRange(r);}}else{try{r=s.createRange();r.moveToElementText(b);r.collapse(1);r.moveStart('character',si);r.moveEnd('character',ei);r.select();}catch(ex){}}}else if(!isIE&&(n=ed.dom.get('__mce'))){if(eid)n.setAttribute('id',eid);else n.removeAttribute('id');r=d.createRange();r.setStartBefore(n);r.setEndBefore(n);se.setRng(r);}},getParentBlock:function(n){var d=this.dom;return d.getParent(n,d.isBlock);},insertPara:function(e){var t=this,ed=t.editor,dom=ed.dom,d=ed.getDoc(),se=ed.settings,s=ed.selection.getSel(),r=s.getRangeAt(0),b=d.body;var rb,ra,dir,sn,so,en,eo,sb,eb,bn,bef,aft,sc,ec,n,vp=dom.getViewPort(ed.getWin()),y,ch,car;function isEmpty(n){n=n.innerHTML;n=n.replace(/<(img|hr|table)/gi,'-');n=n.replace(/<[^>]+>/g,'');return n.replace(/[ \t\r\n]+/g,'')=='';};rb=d.createRange();rb.setStart(s.anchorNode,s.anchorOffset);rb.collapse(true);ra=d.createRange();ra.setStart(s.focusNode,s.focusOffset);ra.collapse(true);dir=rb.compareBoundaryPoints(rb.START_TO_END,ra)<0;sn=dir?s.anchorNode:s.focusNode;so=dir?s.anchorOffset:s.focusOffset;en=dir?s.focusNode:s.anchorNode;eo=dir?s.focusOffset:s.anchorOffset;if(sn===en&&/^(TD|TH)$/.test(sn.nodeName)){dom.remove(sn.firstChild);ed.dom.add(sn,se.element,null,'
    ');aft=ed.dom.add(sn,se.element,null,'
    ');r=d.createRange();r.selectNodeContents(aft);r.collapse(1);ed.selection.setRng(r);return false;}if(sn==b&&en==b&&b.firstChild&&ed.dom.isBlock(b.firstChild)){sn=en=sn.firstChild;so=eo=0;rb=d.createRange();rb.setStart(sn,0);ra=d.createRange();ra.setStart(en,0);}sn=sn.nodeName=="HTML"?d.body:sn;sn=sn.nodeName=="BODY"?sn.firstChild:sn;en=en.nodeName=="HTML"?d.body:en;en=en.nodeName=="BODY"?en.firstChild:en;sb=t.getParentBlock(sn);eb=t.getParentBlock(en);bn=sb?sb.nodeName:se.element;if(t.dom.getParent(sb,function(n){return/OL|UL|PRE/.test(n.nodeName);}))return true;if(sb&&(sb.nodeName=='CAPTION'||/absolute|relative|static/gi.test(sb.style.position))){bn=se.element;sb=null;}if(eb&&(eb.nodeName=='CAPTION'||/absolute|relative|static/gi.test(eb.style.position))){bn=se.element;eb=null;}if(/(TD|TABLE|TH|CAPTION)/.test(bn)||(sb&&bn=="DIV"&&/left|right/gi.test(sb.style.cssFloat))){bn=se.element;sb=eb=null;}bef=(sb&&sb.nodeName==bn)?sb.cloneNode(0):ed.dom.create(bn);aft=(eb&&eb.nodeName==bn)?eb.cloneNode(0):ed.dom.create(bn);aft.removeAttribute('id');if(/^(H[1-6])$/.test(bn)&&sn.nodeValue&&so==sn.nodeValue.length)aft=ed.dom.create(se.element);n=sc=sn;do{if(n==b||n.nodeType==9||t.dom.isBlock(n)||/(TD|TABLE|TH|CAPTION)/.test(n.nodeName))break;sc=n;}while((n=n.previousSibling?n.previousSibling:n.parentNode));n=ec=en;do{if(n==b||n.nodeType==9||t.dom.isBlock(n)||/(TD|TABLE|TH|CAPTION)/.test(n.nodeName))break;ec=n;}while((n=n.nextSibling?n.nextSibling:n.parentNode));if(sc.nodeName==bn)rb.setStart(sc,0);else rb.setStartBefore(sc);rb.setEnd(sn,so);bef.appendChild(rb.cloneContents()||d.createTextNode(''));try{ra.setEndAfter(ec);}catch(ex){}ra.setStart(en,eo);aft.appendChild(ra.cloneContents()||d.createTextNode(''));r=d.createRange();if(!sc.previousSibling&&sc.parentNode.nodeName==bn){r.setStartBefore(sc.parentNode);}else{if(rb.startContainer.nodeName==bn&&rb.startOffset==0)r.setStartBefore(rb.startContainer);else r.setStart(rb.startContainer,rb.startOffset);}if(!ec.nextSibling&&ec.parentNode.nodeName==bn)r.setEndAfter(ec.parentNode);else r.setEnd(ra.endContainer,ra.endOffset);r.deleteContents();if(isOpera)ed.getWin().scrollTo(0,vp.y);if(bef.firstChild&&bef.firstChild.nodeName==bn)bef.innerHTML=bef.firstChild.innerHTML;if(aft.firstChild&&aft.firstChild.nodeName==bn)aft.innerHTML=aft.firstChild.innerHTML;if(isEmpty(bef))bef.innerHTML='
    ';function appendStyles(e,en){var nl=[],nn,n,i;e.innerHTML='';if(se.keep_styles){n=en;do{if(/^(SPAN|STRONG|B|EM|I|FONT|STRIKE|U)$/.test(n.nodeName)){nn=n.cloneNode(false);dom.setAttrib(nn,'id','');nl.push(nn);}}while(n=n.parentNode);}if(nl.length>0){for(i=nl.length-1,nn=e;i>=0;i--)nn=nn.appendChild(nl[i]);nl[0].innerHTML=isOpera?' ':'
    ';return nl[0];}else e.innerHTML=isOpera?' ':'
    ';};if(isEmpty(aft))car=appendStyles(aft,en);if(isOpera&&parseFloat(opera.version())<9.5){r.insertNode(bef);r.insertNode(aft);}else{r.insertNode(aft);r.insertNode(bef);}aft.normalize();bef.normalize();function first(n){return d.createTreeWalker(n,NodeFilter.SHOW_TEXT,null,false).nextNode()||n;};r=d.createRange();r.selectNodeContents(isGecko?first(car||aft):car||aft);r.collapse(1);s.removeAllRanges();s.addRange(r);y=ed.dom.getPos(aft).y;ch=aft.clientHeight;if(yvp.y+vp.h){ed.getWin().scrollTo(0,y'); + tinymce.ScriptLoader.markDone(u); + } + } + }, + + pickColor : function(e, element_id) { + this.execCommand('mceColorPicker', true, { + color : document.getElementById(element_id).value, + func : function(c) { + document.getElementById(element_id).value = c; + + try { + document.getElementById(element_id).onchange(); + } catch (ex) { + // Try fire event, ignore errors + } + } + }); + }, + + openBrowser : function(element_id, type, option) { + tinyMCEPopup.restoreSelection(); + this.editor.execCallback('file_browser_callback', element_id, document.getElementById(element_id).value, type, window); + }, + + confirm : function(t, cb, s) { + this.editor.windowManager.confirm(t, cb, s, window); + }, + + alert : function(tx, cb, s) { + this.editor.windowManager.alert(tx, cb, s, window); + }, + + close : function() { + var t = this; + + // To avoid domain relaxing issue in Opera + function close() { + t.editor.windowManager.close(window); + tinymce = tinyMCE = t.editor = t.params = t.dom = t.dom.doc = null; // Cleanup + }; + + if (tinymce.isOpera) + t.getWin().setTimeout(close, 0); + else + close(); + }, + + // Internal functions + + _restoreSelection : function() { + var e = window.event.srcElement; + + if (e.nodeName == 'INPUT' && (e.type == 'submit' || e.type == 'button')) + tinyMCEPopup.restoreSelection(); + }, + +/* _restoreSelection : function() { + var e = window.event.srcElement; + + // If user focus a non text input or textarea + if ((e.nodeName != 'INPUT' && e.nodeName != 'TEXTAREA') || e.type != 'text') + tinyMCEPopup.restoreSelection(); + },*/ + + _onDOMLoaded : function() { + var t = this, ti = document.title, bm, h, nv; + + // Translate page + if (t.features.translate_i18n !== false) { + h = document.body.innerHTML; + + // Replace a=x with a="x" in IE + if (tinymce.isIE) + h = h.replace(/ (value|title|alt)=([^"][^\s>]+)/gi, ' $1="$2"') + + document.dir = t.editor.getParam('directionality',''); + + if ((nv = t.editor.translate(h)) && nv != h) + document.body.innerHTML = nv; + + if ((nv = t.editor.translate(ti)) && nv != ti) + document.title = ti = nv; + } + + document.body.style.display = ''; + + // Restore selection in IE when focus is placed on a non textarea or input element of the type text + if (tinymce.isIE) + document.attachEvent('onmouseup', tinyMCEPopup._restoreSelection); + + t.restoreSelection(); + t.resizeToInnerSize(); + + // Set inline title + if (!t.isWindow) + t.editor.windowManager.setTitle(window, ti); + else + window.focus(); + + if (!tinymce.isIE && !t.isWindow) { + tinymce.dom.Event._add(document, 'focus', function() { + t.editor.windowManager.focus(t.id) + }); + } + + // Patch for accessibility + tinymce.each(t.dom.select('select'), function(e) { + e.onkeydown = tinyMCEPopup._accessHandler; + }); + + // Call onInit + // Init must be called before focus so the selection won't get lost by the focus call + tinymce.each(t.listeners, function(o) { + o.func.call(o.scope, t.editor); + }); + + // Move focus to window + if (t.getWindowArg('mce_auto_focus', true)) { + window.focus(); + + // Focus element with mceFocus class + tinymce.each(document.forms, function(f) { + tinymce.each(f.elements, function(e) { + if (t.dom.hasClass(e, 'mceFocus') && !e.disabled) { + e.focus(); + return false; // Break loop + } + }); + }); + } + + document.onkeyup = tinyMCEPopup._closeWinKeyHandler; + }, + + _accessHandler : function(e) { + e = e || window.event; + + if (e.keyCode == 13 || e.keyCode == 32) { + e = e.target || e.srcElement; + + if (e.onchange) + e.onchange(); + + return tinymce.dom.Event.cancel(e); + } + }, + + _closeWinKeyHandler : function(e) { + e = e || window.event; + + if (e.keyCode == 27) + tinyMCEPopup.close(); + }, + + _wait : function() { + var t = this, ti; + + if (tinymce.isIE && document.location.protocol != 'https:') { + // Fake DOMContentLoaded on IE + document.write(''; + + bi = s.body_id || 'tinymce'; + if (bi.indexOf('=') != -1) { + bi = t.getParam('body_id', '', 'hash'); + bi = bi[t.id] || bi; + } + + bc = s.body_class || ''; + if (bc.indexOf('=') != -1) { + bc = t.getParam('body_class', '', 'hash'); + bc = bc[t.id] || ''; + } + + t.iframeHTML += ''; + + // Domain relaxing enabled, then set document domain + if (tinymce.relaxedDomain) { + // We need to write the contents here in IE since multiple writes messes up refresh button and back button + if (isIE || (tinymce.isOpera && parseFloat(opera.version()) >= 9.5)) + u = 'javascript:(function(){document.open();document.domain="' + document.domain + '";var ed = window.parent.tinyMCE.get("' + t.id + '");document.write(ed.iframeHTML);document.close();ed.setupIframe();})()'; + else if (tinymce.isOpera) + u = 'javascript:(function(){document.open();document.domain="' + document.domain + '";document.close();ed.setupIframe();})()'; + } + + // Create iframe + n = DOM.add(o.iframeContainer, 'iframe', { + id : t.id + "_ifr", + src : u || 'javascript:""', // Workaround for HTTPS warning in IE6/7 + frameBorder : '0', + style : { + width : '100%', + height : h + } + }); + + t.contentAreaContainer = o.iframeContainer; + DOM.get(o.editorContainer).style.display = t.orgDisplay; + DOM.get(t.id).style.display = 'none'; + + // Safari 2.x requires us to wait for the load event and load a real HTML doc + if (tinymce.isOldWebKit) { + Event.add(n, 'load', t.setupIframe, t); + n.src = tinymce.baseURL + '/plugins/safari/blank.htm'; + } else { + if (!isIE || !tinymce.relaxedDomain) + t.setupIframe(); + + e = n = o = null; // Cleanup + } + }, + + setupIframe : function() { + var t = this, s = t.settings, e = DOM.get(t.id), d = t.getDoc(), h, b; + + // Setup iframe body + if (!isIE || !tinymce.relaxedDomain) { + d.open(); + d.write(t.iframeHTML); + d.close(); + } + + // Design mode needs to be added here Ctrl+A will fail otherwise + if (!isIE) { + try { + if (!s.readonly) + d.designMode = 'On'; + } catch (ex) { + // Will fail on Gecko if the editor is placed in an hidden container element + // The design mode will be set ones the editor is focused + } + } + + // IE needs to use contentEditable or it will display non secure items for HTTPS + if (isIE) { + // It will not steal focus if we hide it while setting contentEditable + b = t.getBody(); + DOM.hide(b); + + if (!s.readonly) + b.contentEditable = true; + + DOM.show(b); + } + + // Setup objects + t.dom = new tinymce.DOM.DOMUtils(t.getDoc(), { + keep_values : true, + url_converter : t.convertURL, + url_converter_scope : t, + hex_colors : s.force_hex_style_colors, + class_filter : s.class_filter, + update_styles : 1, + fix_ie_paragraphs : 1 + }); + + t.serializer = new tinymce.dom.Serializer({ + entity_encoding : s.entity_encoding, + entities : s.entities, + valid_elements : s.verify_html === false ? '*[*]' : s.valid_elements, + extended_valid_elements : s.extended_valid_elements, + valid_child_elements : s.valid_child_elements, + invalid_elements : s.invalid_elements, + fix_table_elements : s.fix_table_elements, + fix_list_elements : s.fix_list_elements, + fix_content_duplication : s.fix_content_duplication, + convert_fonts_to_spans : s.convert_fonts_to_spans, + font_size_classes : s.font_size_classes, + font_size_style_values : s.font_size_style_values, + apply_source_formatting : s.apply_source_formatting, + remove_linebreaks : s.remove_linebreaks, + element_format : s.element_format, + dom : t.dom + }); + + t.selection = new tinymce.dom.Selection(t.dom, t.getWin(), t.serializer); + t.forceBlocks = new tinymce.ForceBlocks(t, { + forced_root_block : s.forced_root_block + }); + t.editorCommands = new tinymce.EditorCommands(t); + + // Pass through + t.serializer.onPreProcess.add(function(se, o) { + return t.onPreProcess.dispatch(t, o, se); + }); + + t.serializer.onPostProcess.add(function(se, o) { + return t.onPostProcess.dispatch(t, o, se); + }); + + t.onPreInit.dispatch(t); + + if (!s.gecko_spellcheck) + t.getBody().spellcheck = 0; + + if (!s.readonly) + t._addEvents(); + + t.controlManager.onPostRender.dispatch(t, t.controlManager); + t.onPostRender.dispatch(t); + + if (s.directionality) + t.getBody().dir = s.directionality; + + if (s.nowrap) + t.getBody().style.whiteSpace = "nowrap"; + + if (s.auto_resize) + t.onNodeChange.add(t.resizeToContent, t); + + if (s.custom_elements) { + function handleCustom(ed, o) { + each(explode(s.custom_elements), function(v) { + var n; + + if (v.indexOf('~') === 0) { + v = v.substring(1); + n = 'span'; + } else + n = 'div'; + + o.content = o.content.replace(new RegExp('<(' + v + ')([^>]*)>', 'g'), '<' + n + ' mce_name="$1"$2>'); + o.content = o.content.replace(new RegExp('', 'g'), ''); + }); + }; + + t.onBeforeSetContent.add(handleCustom); + t.onPostProcess.add(function(ed, o) { + if (o.set) + handleCustom(ed, o) + }); + } + + if (s.handle_node_change_callback) { + t.onNodeChange.add(function(ed, cm, n) { + t.execCallback('handle_node_change_callback', t.id, n, -1, -1, true, t.selection.isCollapsed()); + }); + } + + if (s.save_callback) { + t.onSaveContent.add(function(ed, o) { + var h = t.execCallback('save_callback', t.id, o.content, t.getBody()); + + if (h) + o.content = h; + }); + } + + if (s.onchange_callback) { + t.onChange.add(function(ed, l) { + t.execCallback('onchange_callback', t, l); + }); + } + + if (s.convert_newlines_to_brs) { + t.onBeforeSetContent.add(function(ed, o) { + if (o.initial) + o.content = o.content.replace(/\r?\n/g, '
    '); + }); + } + + if (s.fix_nesting && isIE) { + t.onBeforeSetContent.add(function(ed, o) { + o.content = t._fixNesting(o.content); + }); + } + + if (s.preformatted) { + t.onPostProcess.add(function(ed, o) { + o.content = o.content.replace(/^\s*/, ''); + o.content = o.content.replace(/<\/pre>\s*$/, ''); + + if (o.set) + o.content = '

    ' + o.content + '
    '; + }); + } + + if (s.verify_css_classes) { + t.serializer.attribValueFilter = function(n, v) { + var s, cl; + + if (n == 'class') { + // Build regexp for classes + if (!t.classesRE) { + cl = t.dom.getClasses(); + + if (cl.length > 0) { + s = ''; + + each (cl, function(o) { + s += (s ? '|' : '') + o['class']; + }); + + t.classesRE = new RegExp('(' + s + ')', 'gi'); + } + } + + return !t.classesRE || /(\bmceItem\w+\b|\bmceTemp\w+\b)/g.test(v) || t.classesRE.test(v) ? v : ''; + } + + return v; + }; + } + + if (s.convert_fonts_to_spans) + t._convertFonts(); + + if (s.inline_styles) + t._convertInlineElements(); + + if (s.cleanup_callback) { + t.onBeforeSetContent.add(function(ed, o) { + o.content = t.execCallback('cleanup_callback', 'insert_to_editor', o.content, o); + }); + + t.onPreProcess.add(function(ed, o) { + if (o.set) + t.execCallback('cleanup_callback', 'insert_to_editor_dom', o.node, o); + + if (o.get) + t.execCallback('cleanup_callback', 'get_from_editor_dom', o.node, o); + }); + + t.onPostProcess.add(function(ed, o) { + if (o.set) + o.content = t.execCallback('cleanup_callback', 'insert_to_editor', o.content, o); + + if (o.get) + o.content = t.execCallback('cleanup_callback', 'get_from_editor', o.content, o); + }); + } + + if (s.save_callback) { + t.onGetContent.add(function(ed, o) { + if (o.save) + o.content = t.execCallback('save_callback', t.id, o.content, t.getBody()); + }); + } + + if (s.handle_event_callback) { + t.onEvent.add(function(ed, e, o) { + if (t.execCallback('handle_event_callback', e, ed, o) === false) + Event.cancel(e); + }); + } + + t.onSetContent.add(function() { + // Safari needs some time, it will crash the browser when a link is created otherwise + // I think this crash issue is resolved in the latest 3.0.4 + //window.setTimeout(function() { + t.addVisual(t.getBody()); + //}, 1); + }); + + // Remove empty contents + if (s.padd_empty_editor) { + t.onPostProcess.add(function(ed, o) { + o.content = o.content.replace(/^(]*>( | |\s|\u00a0|)<\/p>[\r\n]*|
    [\r\n]*)$/, ''); + }); + } + + if (isGecko && !s.readonly) { + try { + // Design mode must be set here once again to fix a bug where + // Ctrl+A/Delete/Backspace didn't work if the editor was added using mceAddControl then removed then added again + d.designMode = 'Off'; + d.designMode = 'On'; + } catch (ex) { + // Will fail on Gecko if the editor is placed in an hidden container element + // The design mode will be set ones the editor is focused + } + } + + // A small timeout was needed since firefox will remove. Bug: #1838304 + setTimeout(function () { + if (t.removed) + return; + + t.load({initial : true, format : (s.cleanup_on_startup ? 'html' : 'raw')}); + t.startContent = t.getContent({format : 'raw'}); + t.undoManager.add({initial : true}); + t.initialized = true; + + t.onInit.dispatch(t); + t.execCallback('setupcontent_callback', t.id, t.getBody(), t.getDoc()); + t.execCallback('init_instance_callback', t); + t.focus(true); + t.nodeChanged({initial : 1}); + + // Load specified content CSS last + if (s.content_css) { + tinymce.each(explode(s.content_css), function(u) { + t.dom.loadCSS(t.documentBaseURI.toAbsolute(u)); + }); + } + + // Handle auto focus + if (s.auto_focus) { + setTimeout(function () { + var ed = EditorManager.get(s.auto_focus); + + ed.selection.select(ed.getBody(), 1); + ed.selection.collapse(1); + ed.getWin().focus(); + }, 100); + } + }, 1); + + e = null; + }, + + + focus : function(sf) { + var oed, t = this, ce = t.settings.content_editable; + + if (!sf) { + // Is not content editable or the selection is outside the area in IE + // the IE statement is needed to avoid bluring if element selections inside layers since + // the layer is like it's own document in IE + if (!ce && (!isIE || t.selection.getNode().ownerDocument != t.getDoc())) + t.getWin().focus(); + + } + + if (EditorManager.activeEditor != t) { + if ((oed = EditorManager.activeEditor) != null) + oed.onDeactivate.dispatch(oed, t); + + t.onActivate.dispatch(t, oed); + } + + EditorManager._setActive(t); + }, + + execCallback : function(n) { + var t = this, f = t.settings[n], s; + + if (!f) + return; + + // Look through lookup + if (t.callbackLookup && (s = t.callbackLookup[n])) { + f = s.func; + s = s.scope; + } + + if (is(f, 'string')) { + s = f.replace(/\.\w+$/, ''); + s = s ? tinymce.resolve(s) : 0; + f = tinymce.resolve(f); + t.callbackLookup = t.callbackLookup || {}; + t.callbackLookup[n] = {func : f, scope : s}; + } + + return f.apply(s || t, Array.prototype.slice.call(arguments, 1)); + }, + + translate : function(s) { + var c = this.settings.language || 'en', i18n = EditorManager.i18n; + + if (!s) + return ''; + + return i18n[c + '.' + s] || s.replace(/{\#([^}]+)\}/g, function(a, b) { + return i18n[c + '.' + b] || '{#' + b + '}'; + }); + }, + + getLang : function(n, dv) { + return EditorManager.i18n[(this.settings.language || 'en') + '.' + n] || (is(dv) ? dv : '{#' + n + '}'); + }, + + getParam : function(n, dv, ty) { + var tr = tinymce.trim, v = is(this.settings[n]) ? this.settings[n] : dv, o; + + if (ty === 'hash') { + o = {}; + + if (is(v, 'string')) { + each(v.indexOf('=') > 0 ? v.split(/[;,](?![^=;,]*(?:[;,]|$))/) : v.split(','), function(v) { + v = v.split('='); + + if (v.length > 1) + o[tr(v[0])] = tr(v[1]); + else + o[tr(v[0])] = tr(v); + }); + } else + o = v; + + return o; + } + + return v; + }, + + nodeChanged : function(o) { + var t = this, s = t.selection, n = s.getNode() || t.getBody(); + + // Fix for bug #1896577 it seems that this can not be fired while the editor is loading + if (t.initialized) { + t.onNodeChange.dispatch( + t, + o ? o.controlManager || t.controlManager : t.controlManager, + isIE && n.ownerDocument != t.getDoc() ? t.getBody() : n, // Fix for IE initial state + s.isCollapsed(), + o + ); + } + }, + + addButton : function(n, s) { + var t = this; + + t.buttons = t.buttons || {}; + t.buttons[n] = s; + }, + + addCommand : function(n, f, s) { + this.execCommands[n] = {func : f, scope : s || this}; + }, + + addQueryStateHandler : function(n, f, s) { + this.queryStateCommands[n] = {func : f, scope : s || this}; + }, + + addQueryValueHandler : function(n, f, s) { + this.queryValueCommands[n] = {func : f, scope : s || this}; + }, + + addShortcut : function(pa, desc, cmd_func, sc) { + var t = this, c; + + if (!t.settings.custom_shortcuts) + return false; + + t.shortcuts = t.shortcuts || {}; + + if (is(cmd_func, 'string')) { + c = cmd_func; + + cmd_func = function() { + t.execCommand(c, false, null); + }; + } + + if (is(cmd_func, 'object')) { + c = cmd_func; + + cmd_func = function() { + t.execCommand(c[0], c[1], c[2]); + }; + } + + each(explode(pa), function(pa) { + var o = { + func : cmd_func, + scope : sc || this, + desc : desc, + alt : false, + ctrl : false, + shift : false + }; + + each(explode(pa, '+'), function(v) { + switch (v) { + case 'alt': + case 'ctrl': + case 'shift': + o[v] = true; + break; + + default: + o.charCode = v.charCodeAt(0); + o.keyCode = v.toUpperCase().charCodeAt(0); + } + }); + + t.shortcuts[(o.ctrl ? 'ctrl' : '') + ',' + (o.alt ? 'alt' : '') + ',' + (o.shift ? 'shift' : '') + ',' + o.keyCode] = o; + }); + + return true; + }, + + execCommand : function(cmd, ui, val, a) { + var t = this, s = 0, o, st; + + if (!/^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint|SelectAll)$/.test(cmd) && (!a || !a.skip_focus)) + t.focus(); + + o = {}; + t.onBeforeExecCommand.dispatch(t, cmd, ui, val, o); + if (o.terminate) + return false; + + // Command callback + if (t.execCallback('execcommand_callback', t.id, t.selection.getNode(), cmd, ui, val)) { + t.onExecCommand.dispatch(t, cmd, ui, val, a); + return true; + } + + // Registred commands + if (o = t.execCommands[cmd]) { + st = o.func.call(o.scope, ui, val); + + // Fall through on true + if (st !== true) { + t.onExecCommand.dispatch(t, cmd, ui, val, a); + return st; + } + } + + // Plugin commands + each(t.plugins, function(p) { + if (p.execCommand && p.execCommand(cmd, ui, val)) { + t.onExecCommand.dispatch(t, cmd, ui, val, a); + s = 1; + return false; + } + }); + + if (s) + return true; + + // Theme commands + if (t.theme.execCommand && t.theme.execCommand(cmd, ui, val)) { + t.onExecCommand.dispatch(t, cmd, ui, val, a); + return true; + } + + // Editor commands + if (t.editorCommands.execCommand(cmd, ui, val)) { + t.onExecCommand.dispatch(t, cmd, ui, val, a); + return true; + } + + // Browser commands + t.getDoc().execCommand(cmd, ui, val); + t.onExecCommand.dispatch(t, cmd, ui, val, a); + }, + + queryCommandState : function(c) { + var t = this, o, s; + + // Is hidden then return undefined + if (t._isHidden()) + return; + + // Registred commands + if (o = t.queryStateCommands[c]) { + s = o.func.call(o.scope); + + // Fall though on true + if (s !== true) + return s; + } + + // Registred commands + o = t.editorCommands.queryCommandState(c); + if (o !== -1) + return o; + + // Browser commands + try { + return this.getDoc().queryCommandState(c); + } catch (ex) { + // Fails sometimes see bug: 1896577 + } + }, + + queryCommandValue : function(c) { + var t = this, o, s; + + // Is hidden then return undefined + if (t._isHidden()) + return; + + // Registred commands + if (o = t.queryValueCommands[c]) { + s = o.func.call(o.scope); + + // Fall though on true + if (s !== true) + return s; + } + + // Registred commands + o = t.editorCommands.queryCommandValue(c); + if (is(o)) + return o; + + // Browser commands + try { + return this.getDoc().queryCommandValue(c); + } catch (ex) { + // Fails sometimes see bug: 1896577 + } + }, + + show : function() { + var t = this; + + DOM.show(t.getContainer()); + DOM.hide(t.id); + t.load(); + }, + + hide : function() { + var t = this, d = t.getDoc(); + + // Fixed bug where IE has a blinking cursor left from the editor + if (isIE && d) + d.execCommand('SelectAll'); + + // We must save before we hide so Safari doesn't crash + t.save(); + DOM.hide(t.getContainer()); + DOM.setStyle(t.id, 'display', t.orgDisplay); + }, + + isHidden : function() { + return !DOM.isHidden(this.id); + }, + + setProgressState : function(b, ti, o) { + this.onSetProgressState.dispatch(this, b, ti, o); + + return b; + }, + + resizeToContent : function() { + var t = this; + + DOM.setStyle(t.id + "_ifr", 'height', t.getBody().scrollHeight); + }, + + load : function(o) { + var t = this, e = t.getElement(), h; + + if (e) { + o = o || {}; + o.load = true; + + h = t.setContent(is(e.value) ? e.value : e.innerHTML, o); + o.element = e; + + if (!o.no_events) + t.onLoadContent.dispatch(t, o); + + o.element = e = null; + + return h; + } + }, + + save : function(o) { + var t = this, e = t.getElement(), h, f; + + if (!e || !t.initialized) + return; + + o = o || {}; + o.save = true; + + // Add undo level will trigger onchange event + if (!o.no_events) { + t.undoManager.typing = 0; + t.undoManager.add(); + } + + o.element = e; + h = o.content = t.getContent(o); + + if (!o.no_events) + t.onSaveContent.dispatch(t, o); + + h = o.content; + + if (!/TEXTAREA|INPUT/i.test(e.nodeName)) { + e.innerHTML = h; + + // Update hidden form element + if (f = DOM.getParent(t.id, 'form')) { + each(f.elements, function(e) { + if (e.name == t.id) { + e.value = h; + return false; + } + }); + } + } else + e.value = h; + + o.element = e = null; + + return h; + }, + + setContent : function(h, o) { + var t = this; + + o = o || {}; + o.format = o.format || 'html'; + o.set = true; + o.content = h; + + if (!o.no_events) + t.onBeforeSetContent.dispatch(t, o); + + // Padd empty content in Gecko and Safari. Commands will otherwise fail on the content + // It will also be impossible to place the caret in the editor unless there is a BR element present + if (!tinymce.isIE && (h.length === 0 || /^\s+$/.test(h))) { + o.content = t.dom.setHTML(t.getBody(), '
    '); + o.format = 'raw'; + } + + o.content = t.dom.setHTML(t.getBody(), tinymce.trim(o.content)); + + if (o.format != 'raw' && t.settings.cleanup) { + o.getInner = true; + o.content = t.dom.setHTML(t.getBody(), t.serializer.serialize(t.getBody(), o)); + } + + if (!o.no_events) + t.onSetContent.dispatch(t, o); + + return o.content; + }, + + getContent : function(o) { + var t = this, h; + + o = o || {}; + o.format = o.format || 'html'; + o.get = true; + + if (!o.no_events) + t.onBeforeGetContent.dispatch(t, o); + + if (o.format != 'raw' && t.settings.cleanup) { + o.getInner = true; + h = t.serializer.serialize(t.getBody(), o); + } else + h = t.getBody().innerHTML; + + h = h.replace(/^\s*|\s*$/g, ''); + o.content = h; + + if (!o.no_events) + t.onGetContent.dispatch(t, o); + + return o.content; + }, + + isDirty : function() { + var t = this; + + return tinymce.trim(t.startContent) != tinymce.trim(t.getContent({format : 'raw', no_events : 1})) && !t.isNotDirty; + }, + + getContainer : function() { + var t = this; + + if (!t.container) + t.container = DOM.get(t.editorContainer || t.id + '_parent'); + + return t.container; + }, + + getContentAreaContainer : function() { + return this.contentAreaContainer; + }, + + getElement : function() { + return DOM.get(this.settings.content_element || this.id); + }, + + getWin : function() { + var t = this, e; + + if (!t.contentWindow) { + e = DOM.get(t.id + "_ifr"); + + if (e) + t.contentWindow = e.contentWindow; + } + + return t.contentWindow; + }, + + getDoc : function() { + var t = this, w; + + if (!t.contentDocument) { + w = t.getWin(); + + if (w) + t.contentDocument = w.document; + } + + return t.contentDocument; + }, + + getBody : function() { + return this.bodyElement || this.getDoc().body; + }, + + convertURL : function(u, n, e) { + var t = this, s = t.settings; + + // Use callback instead + if (s.urlconverter_callback) + return t.execCallback('urlconverter_callback', u, e, true, n); + + // Don't convert link href since thats the CSS files that gets loaded into the editor also skip local file URLs + if (!s.convert_urls || (e && e.nodeName == 'LINK') || u.indexOf('file:') === 0) + return u; + + // Convert to relative + if (s.relative_urls) + return t.documentBaseURI.toRelative(u); + + // Convert to absolute + u = t.documentBaseURI.toAbsolute(u, s.remove_script_host); + + return u; + }, + + addVisual : function(e) { + var t = this, s = t.settings; + + e = e || t.getBody(); + + if (!is(t.hasVisual)) + t.hasVisual = s.visual; + + each(t.dom.select('table,a', e), function(e) { + var v; + + switch (e.nodeName) { + case 'TABLE': + v = t.dom.getAttrib(e, 'border'); + + if (!v || v == '0') { + if (t.hasVisual) + t.dom.addClass(e, s.visual_table_class); + else + t.dom.removeClass(e, s.visual_table_class); + } + + return; + + case 'A': + v = t.dom.getAttrib(e, 'name'); + + if (v) { + if (t.hasVisual) + t.dom.addClass(e, 'mceItemAnchor'); + else + t.dom.removeClass(e, 'mceItemAnchor'); + } + + return; + } + }); + + t.onVisualAid.dispatch(t, e, t.hasVisual); + }, + + remove : function() { + var t = this, e = t.getContainer(); + + t.removed = 1; // Cancels post remove event execution + t.hide(); + + t.execCallback('remove_instance_callback', t); + t.onRemove.dispatch(t); + + // Clear all execCommand listeners this is required to avoid errors if the editor was removed inside another command + t.onExecCommand.listeners = []; + + EditorManager.remove(t); + DOM.remove(e); + }, + + destroy : function(s) { + var t = this; + + // One time is enough + if (t.destroyed) + return; + + if (!s) { + tinymce.removeUnload(t.destroy); + tinyMCE.onBeforeUnload.remove(t._beforeUnload); + + // Manual destroy + if (t.theme.destroy) + t.theme.destroy(); + + // Destroy controls, selection and dom + t.controlManager.destroy(); + t.selection.destroy(); + t.dom.destroy(); + + // Remove all events + + // Don't clear the window or document if content editable + // is enabled since other instances might still be present + if (!t.settings.content_editable) { + Event.clear(t.getWin()); + Event.clear(t.getDoc()); + } + + Event.clear(t.getBody()); + Event.clear(t.formElement); + } + + if (t.formElement) { + t.formElement.submit = t.formElement._mceOldSubmit; + t.formElement._mceOldSubmit = null; + } + + t.contentAreaContainer = t.formElement = t.container = t.settings.content_element = t.bodyElement = t.contentDocument = t.contentWindow = null; + + if (t.selection) + t.selection = t.selection.win = t.selection.dom = t.selection.dom.doc = null; + + t.destroyed = 1; + }, + + // Internal functions + + _addEvents : function() { + // 'focus', 'blur', 'dblclick', 'beforedeactivate', submit, reset + var t = this, i, s = t.settings, lo = { + mouseup : 'onMouseUp', + mousedown : 'onMouseDown', + click : 'onClick', + keyup : 'onKeyUp', + keydown : 'onKeyDown', + keypress : 'onKeyPress', + submit : 'onSubmit', + reset : 'onReset', + contextmenu : 'onContextMenu', + dblclick : 'onDblClick', + paste : 'onPaste' // Doesn't work in all browsers yet + }; + + function eventHandler(e, o) { + var ty = e.type; + + // Don't fire events when it's removed + if (t.removed) + return; + + // Generic event handler + if (t.onEvent.dispatch(t, e, o) !== false) { + // Specific event handler + t[lo[e.fakeType || e.type]].dispatch(t, e, o); + } + }; + + // Add DOM events + each(lo, function(v, k) { + switch (k) { + case 'contextmenu': + if (tinymce.isOpera) { + // Fake contextmenu on Opera + Event.add(t.getBody(), 'mousedown', function(e) { + if (e.ctrlKey) { + e.fakeType = 'contextmenu'; + eventHandler(e); + } + }); + } else + Event.add(t.getBody(), k, eventHandler); + break; + + case 'paste': + Event.add(t.getBody(), k, function(e) { + var tx, h, el, r; + + // Get plain text data + if (e.clipboardData) + tx = e.clipboardData.getData('text/plain'); + else if (tinymce.isIE) + tx = t.getWin().clipboardData.getData('Text'); + + // Get HTML data + /*if (tinymce.isIE) { + el = DOM.add(DOM.doc.body, 'div', {style : 'visibility:hidden;overflow:hidden;position:absolute;width:1px;height:1px'}); + r = DOM.doc.body.createTextRange(); + r.moveToElementText(el); + r.execCommand('Paste'); + h = el.innerHTML; + DOM.remove(el); + }*/ + + eventHandler(e, {text : tx, html : h}); + }); + break; + + case 'submit': + case 'reset': + Event.add(t.getElement().form || DOM.getParent(t.id, 'form'), k, eventHandler); + break; + + default: + Event.add(s.content_editable ? t.getBody() : t.getDoc(), k, eventHandler); + } + }); + + Event.add(s.content_editable ? t.getBody() : (isGecko ? t.getDoc() : t.getWin()), 'focus', function(e) { + t.focus(true); + }); + + + // Fixes bug where a specified document_base_uri could result in broken images + // This will also fix drag drop of images in Gecko + if (tinymce.isGecko) { + // Convert all images to absolute URLs +/* t.onSetContent.add(function(ed, o) { + each(ed.dom.select('img'), function(e) { + var v; + + if (v = e.getAttribute('mce_src')) + e.src = t.documentBaseURI.toAbsolute(v); + }) + });*/ + + Event.add(t.getDoc(), 'DOMNodeInserted', function(e) { + var v; + + e = e.target; + + if (e.nodeType === 1 && e.nodeName === 'IMG' && (v = e.getAttribute('mce_src'))) + e.src = t.documentBaseURI.toAbsolute(v); + }); + } + + // Set various midas options in Gecko + if (isGecko) { + function setOpts() { + var t = this, d = t.getDoc(), s = t.settings; + + if (isGecko && !s.readonly) { + if (t._isHidden()) { + try { + if (!s.content_editable) + d.designMode = 'On'; + } catch (ex) { + // Fails if it's hidden + } + } + + try { + // Try new Gecko method + d.execCommand("styleWithCSS", 0, false); + } catch (ex) { + // Use old method + if (!t._isHidden()) + try {d.execCommand("useCSS", 0, true);} catch (ex) {} + } + + if (!s.table_inline_editing) + try {d.execCommand('enableInlineTableEditing', false, false);} catch (ex) {} + + if (!s.object_resizing) + try {d.execCommand('enableObjectResizing', false, false);} catch (ex) {} + } + }; + + t.onBeforeExecCommand.add(setOpts); + t.onMouseDown.add(setOpts); + } + + // Add node change handlers + t.onMouseUp.add(t.nodeChanged); + t.onClick.add(t.nodeChanged); + t.onKeyUp.add(function(ed, e) { + var c = e.keyCode; + + if ((c >= 33 && c <= 36) || (c >= 37 && c <= 40) || c == 13 || c == 45 || c == 46 || c == 8 || (tinymce.isMac && (c == 91 || c == 93)) || e.ctrlKey) + t.nodeChanged(); + }); + + // Add reset handler + t.onReset.add(function() { + t.setContent(t.startContent, {format : 'raw'}); + }); + + if (t.getParam('tab_focus')) { + function tabCancel(ed, e) { + if (e.keyCode === 9) + return Event.cancel(e); + }; + + function tabHandler(ed, e) { + var x, i, f, el, v; + + function find(d) { + f = DOM.getParent(ed.id, 'form'); + el = f.elements; + + if (f) { + each(el, function(e, i) { + if (e.id == ed.id) { + x = i; + return false; + } + }); + + if (d > 0) { + for (i = x + 1; i < el.length; i++) { + if (el[i].type != 'hidden') + return el[i]; + } + } else { + for (i = x - 1; i >= 0; i--) { + if (el[i].type != 'hidden') + return el[i]; + } + } + } + + return null; + }; + + if (e.keyCode === 9) { + v = explode(ed.getParam('tab_focus')); + + if (v.length == 1) { + v[1] = v[0]; + v[0] = ':prev'; + } + + // Find element to focus + if (e.shiftKey) { + if (v[0] == ':prev') + el = find(-1); + else + el = DOM.get(v[0]); + } else { + if (v[1] == ':next') + el = find(1); + else + el = DOM.get(v[1]); + } + + if (el) { + if (ed = EditorManager.get(el.id || el.name)) + ed.focus(); + else + window.setTimeout(function() {window.focus();el.focus();}, 10); + + return Event.cancel(e); + } + } + }; + + t.onKeyUp.add(tabCancel); + + if (isGecko) { + t.onKeyPress.add(tabHandler); + t.onKeyDown.add(tabCancel); + } else + t.onKeyDown.add(tabHandler); + } + + // Add shortcuts + if (s.custom_shortcuts) { + if (s.custom_undo_redo_keyboard_shortcuts) { + t.addShortcut('ctrl+z', t.getLang('undo_desc'), 'Undo'); + t.addShortcut('ctrl+y', t.getLang('redo_desc'), 'Redo'); + } + + // Add default shortcuts for gecko + if (isGecko) { + t.addShortcut('ctrl+b', t.getLang('bold_desc'), 'Bold'); + t.addShortcut('ctrl+i', t.getLang('italic_desc'), 'Italic'); + t.addShortcut('ctrl+u', t.getLang('underline_desc'), 'Underline'); + } + + // BlockFormat shortcuts keys + for (i=1; i<=6; i++) + t.addShortcut('ctrl+' + i, '', ['FormatBlock', false, '']); + + t.addShortcut('ctrl+7', '', ['FormatBlock', false, '

    ']); + t.addShortcut('ctrl+8', '', ['FormatBlock', false, '

    ']); + t.addShortcut('ctrl+9', '', ['FormatBlock', false, '
    ']); + + function find(e) { + var v = null; + + if (!e.altKey && !e.ctrlKey && !e.metaKey) + return v; + + each(t.shortcuts, function(o) { + if (tinymce.isMac && o.ctrl != e.metaKey) + return; + else if (!tinymce.isMac && o.ctrl != e.ctrlKey) + return; + + if (o.alt != e.altKey) + return; + + if (o.shift != e.shiftKey) + return; + + if (e.keyCode == o.keyCode || (e.charCode && e.charCode == o.charCode)) { + v = o; + return false; + } + }); + + return v; + }; + + t.onKeyUp.add(function(ed, e) { + var o = find(e); + + if (o) + return Event.cancel(e); + }); + + t.onKeyPress.add(function(ed, e) { + var o = find(e); + + if (o) + return Event.cancel(e); + }); + + t.onKeyDown.add(function(ed, e) { + var o = find(e); + + if (o) { + o.func.call(o.scope); + return Event.cancel(e); + } + }); + } + + if (tinymce.isIE) { + // Fix so resize will only update the width and height attributes not the styles of an image + // It will also block mceItemNoResize items + Event.add(t.getDoc(), 'controlselect', function(e) { + var re = t.resizeInfo, cb; + + e = e.target; + + // Don't do this action for non image elements + if (e.nodeName !== 'IMG') + return; + + if (re) + Event.remove(re.node, re.ev, re.cb); + + if (!t.dom.hasClass(e, 'mceItemNoResize')) { + ev = 'resizeend'; + cb = Event.add(e, ev, function(e) { + var v; + + e = e.target; + + if (v = t.dom.getStyle(e, 'width')) { + t.dom.setAttrib(e, 'width', v.replace(/[^0-9%]+/g, '')); + t.dom.setStyle(e, 'width', ''); + } + + if (v = t.dom.getStyle(e, 'height')) { + t.dom.setAttrib(e, 'height', v.replace(/[^0-9%]+/g, '')); + t.dom.setStyle(e, 'height', ''); + } + }); + } else { + ev = 'resizestart'; + cb = Event.add(e, 'resizestart', Event.cancel, Event); + } + + re = t.resizeInfo = { + node : e, + ev : ev, + cb : cb + }; + }); + + t.onKeyDown.add(function(ed, e) { + switch (e.keyCode) { + case 8: + // Fix IE control + backspace browser bug + if (t.selection.getRng().item) { + t.selection.getRng().item(0).removeNode(); + return Event.cancel(e); + } + } + }); + } + + if (tinymce.isOpera) { + t.onClick.add(function(ed, e) { + Event.prevent(e); + }); + } + + // Add custom undo/redo handlers + if (s.custom_undo_redo) { + function addUndo() { + t.undoManager.typing = 0; + t.undoManager.add(); + }; + + // Add undo level on editor blur + if (tinymce.isIE) { + Event.add(t.getWin(), 'blur', function(e) { + var n; + + // Check added for fullscreen bug + if (t.selection) { + n = t.selection.getNode(); + + // Add undo level is selection was lost to another document + if (!t.removed && n.ownerDocument && n.ownerDocument != t.getDoc()) + addUndo(); + } + }); + } else { + Event.add(t.getDoc(), 'blur', function() { + if (t.selection && !t.removed) + addUndo(); + }); + } + + t.onMouseDown.add(addUndo); + + t.onKeyUp.add(function(ed, e) { + if ((e.keyCode >= 33 && e.keyCode <= 36) || (e.keyCode >= 37 && e.keyCode <= 40) || e.keyCode == 13 || e.keyCode == 45 || e.ctrlKey) { + t.undoManager.typing = 0; + t.undoManager.add(); + } + }); + + t.onKeyDown.add(function(ed, e) { + // Is caracter positon keys + if ((e.keyCode >= 33 && e.keyCode <= 36) || (e.keyCode >= 37 && e.keyCode <= 40) || e.keyCode == 13 || e.keyCode == 45) { + if (t.undoManager.typing) { + t.undoManager.add(); + t.undoManager.typing = 0; + } + + return; + } + + if (!t.undoManager.typing) { + t.undoManager.add(); + t.undoManager.typing = 1; + } + }); + } + }, + + _convertInlineElements : function() { + var t = this, s = t.settings, dom = t.dom, v, e, na, st, sp; + + function convert(ed, o) { + if (!s.inline_styles) + return; + + if (o.get) { + each(t.dom.select('table,u,strike', o.node), function(n) { + switch (n.nodeName) { + case 'TABLE': + if (v = dom.getAttrib(n, 'height')) { + dom.setStyle(n, 'height', v); + dom.setAttrib(n, 'height', ''); + } + break; + + case 'U': + case 'STRIKE': + //sp = dom.create('span', {style : dom.getAttrib(n, 'style')}); + n.style.textDecoration = n.nodeName == 'U' ? 'underline' : 'line-through'; + dom.setAttrib(n, 'mce_style', ''); + dom.setAttrib(n, 'mce_name', 'span'); + break; + } + }); + } else if (o.set) { + each(t.dom.select('table,span', o.node).reverse(), function(n) { + if (n.nodeName == 'TABLE') { + if (v = dom.getStyle(n, 'height')) + dom.setAttrib(n, 'height', v.replace(/[^0-9%]+/g, '')); + } else { + // Convert spans to elements + if (n.style.textDecoration == 'underline') + na = 'u'; + else if (n.style.textDecoration == 'line-through') + na = 'strike'; + else + na = ''; + + if (na) { + n.style.textDecoration = ''; + dom.setAttrib(n, 'mce_style', ''); + + e = dom.create(na, { + style : dom.getAttrib(n, 'style') + }); + + dom.replace(e, n, 1); + } + } + }); + } + }; + + t.onPreProcess.add(convert); + + if (!s.cleanup_on_startup) { + t.onSetContent.add(function(ed, o) { + if (o.initial) + convert(t, {node : t.getBody(), set : 1}); + }); + } + }, + + _convertFonts : function() { + var t = this, s = t.settings, dom = t.dom, fz, fzn, sl, cl; + + // No need + if (!s.inline_styles) + return; + + // Font pt values and font size names + fz = [8, 10, 12, 14, 18, 24, 36]; + fzn = ['xx-small', 'x-small','small','medium','large','x-large', 'xx-large']; + + if (sl = s.font_size_style_values) + sl = explode(sl); + + if (cl = s.font_size_classes) + cl = explode(cl); + + function process(no) { + var n, sp, nl, x; + + // Keep unit tests happy + if (!s.inline_styles) + return; + + nl = t.dom.select('font', no); + for (x = nl.length - 1; x >= 0; x--) { + n = nl[x]; + + sp = dom.create('span', { + style : dom.getAttrib(n, 'style'), + 'class' : dom.getAttrib(n, 'class') + }); + + dom.setStyles(sp, { + fontFamily : dom.getAttrib(n, 'face'), + color : dom.getAttrib(n, 'color'), + backgroundColor : n.style.backgroundColor + }); + + if (n.size) { + if (sl) + dom.setStyle(sp, 'fontSize', sl[parseInt(n.size) - 1]); + else + dom.setAttrib(sp, 'class', cl[parseInt(n.size) - 1]); + } + + dom.setAttrib(sp, 'mce_style', ''); + dom.replace(sp, n, 1); + } + }; + + // Run on cleanup + t.onPreProcess.add(function(ed, o) { + if (o.get) + process(o.node); + }); + + t.onSetContent.add(function(ed, o) { + if (o.initial) + process(o.node); + }); + }, + + _isHidden : function() { + var s; + + if (!isGecko) + return 0; + + // Weird, wheres that cursor selection? + s = this.selection.getSel(); + return (!s || !s.rangeCount || s.rangeCount == 0); + }, + + // Fix for bug #1867292 + _fixNesting : function(s) { + var d = [], i; + + s = s.replace(/<(\/)?([^\s>]+)[^>]*?>/g, function(a, b, c) { + var e; + + // Handle end element + if (b === '/') { + if (!d.length) + return ''; + + if (c !== d[d.length - 1].tag) { + for (i=d.length - 1; i>=0; i--) { + if (d[i].tag === c) { + d[i].close = 1; + break; + } + } + + return ''; + } else { + d.pop(); + + if (d.length && d[d.length - 1].close) { + a = a + ''; + d.pop(); + } + } + } else { + // Ignore these + if (/^(br|hr|input|meta|img|link|param)$/i.test(c)) + return a; + + // Ignore closed ones + if (/\/>$/.test(a)) + return a; + + d.push({tag : c}); // Push start element + } + + return a; + }); + + // End all open tags + for (i=d.length - 1; i>=0; i--) + s += ''; + + return s; + } + + }); +})(); + +/* file:jscripts/tiny_mce/classes/EditorCommands.js */ + +(function() { + var each = tinymce.each, isIE = tinymce.isIE, isGecko = tinymce.isGecko, isOpera = tinymce.isOpera, isWebKit = tinymce.isWebKit; + + function isBlock(n) { + return /^(H[1-6]|HR|P|DIV|ADDRESS|PRE|FORM|TABLE|OL|UL|TD|CAPTION|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP)$/.test(n.nodeName); + }; + + tinymce.create('tinymce.EditorCommands', { + EditorCommands : function(ed) { + this.editor = ed; + }, + + execCommand : function(cmd, ui, val) { + var t = this, ed = t.editor, f; + + switch (cmd) { + case 'Cut': + case 'Copy': + case 'Paste': + try { + ed.getDoc().execCommand(cmd, ui, val); + } catch (ex) { + if (isGecko) { + ed.windowManager.confirm(ed.getLang('clipboard_msg'), function(s) { + if (s) + window.open('http://www.mozilla.org/editor/midasdemo/securityprefs.html', 'mceExternal'); + }); + } else + ed.windowManager.alert(ed.getLang('clipboard_no_support')); + } + + return true; + + // Ignore these + case 'mceResetDesignMode': + case 'mceBeginUndoLevel': + return true; + + // Ignore these + case 'unlink': + t.UnLink(); + return true; + + // Bundle these together + case 'JustifyLeft': + case 'JustifyCenter': + case 'JustifyRight': + case 'JustifyFull': + t.mceJustify(cmd, cmd.substring(7).toLowerCase()); + return true; + + case 'mceEndUndoLevel': + case 'mceAddUndoLevel': + ed.undoManager.add(); + return true; + + default: + f = this[cmd]; + + if (f) { + f.call(this, ui, val); + return true; + } + } + + return false; + }, + + Indent : function() { + var ed = this.editor, d = ed.dom, s = ed.selection, e, iv, iu; + + // Setup indent level + iv = ed.settings.indentation; + iu = /[a-z%]+$/i.exec(iv); + iv = parseInt(iv); + + if (ed.settings.inline_styles && (!this.queryStateInsertUnorderedList() && !this.queryStateInsertOrderedList())) { + each(this._getSelectedBlocks(), function(e) { + d.setStyle(e, 'paddingLeft', (parseInt(e.style.paddingLeft || 0) + iv) + iu); + }); + + return; + } + + ed.getDoc().execCommand('Indent', false, null); + + if (isIE) { + d.getParent(s.getNode(), function(n) { + if (n.nodeName == 'BLOCKQUOTE') { + n.dir = n.style.cssText = ''; + } + }); + } + }, + + Outdent : function() { + var ed = this.editor, d = ed.dom, s = ed.selection, e, v, iv, iu; + + // Setup indent level + iv = ed.settings.indentation; + iu = /[a-z%]+$/i.exec(iv); + iv = parseInt(iv); + + if (ed.settings.inline_styles && (!this.queryStateInsertUnorderedList() && !this.queryStateInsertOrderedList())) { + each(this._getSelectedBlocks(), function(e) { + v = Math.max(0, parseInt(e.style.paddingLeft || 0) - iv); + d.setStyle(e, 'paddingLeft', v ? v + iu : ''); + }); + + return; + } + + ed.getDoc().execCommand('Outdent', false, null); + }, + + mceSetAttribute : function(u, v) { + var ed = this.editor, d = ed.dom, e; + + if (e = d.getParent(ed.selection.getNode(), d.isBlock)) + d.setAttrib(e, v.name, v.value); + }, + + mceSetContent : function(u, v) { + this.editor.setContent(v); + }, + + mceToggleVisualAid : function() { + var ed = this.editor; + + ed.hasVisual = !ed.hasVisual; + ed.addVisual(); + }, + + mceReplaceContent : function(u, v) { + var s = this.editor.selection; + + s.setContent(v.replace(/\{\$selection\}/g, s.getContent({format : 'text'}))); + }, + + mceInsertLink : function(u, v) { + var ed = this.editor, s = ed.selection, e = ed.dom.getParent(s.getNode(), 'A'); + + if (tinymce.is(v, 'string')) + v = {href : v}; + + function set(e) { + each(v, function(v, k) { + ed.dom.setAttrib(e, k, v); + }); + }; + + if (!e) { + ed.execCommand('CreateLink', false, 'javascript:mctmp(0);'); + each(ed.dom.select('a'), function(e) { + if (e.href == 'javascript:mctmp(0);') + set(e); + }); + } else { + if (v.href) + set(e); + else + ed.dom.remove(e, 1); + } + }, + + UnLink : function() { + var ed = this.editor, s = ed.selection; + + if (s.isCollapsed()) + s.select(s.getNode()); + + ed.getDoc().execCommand('unlink', false, null); + s.collapse(0); + }, + + FontName : function(u, v) { + var t = this, ed = t.editor, s = ed.selection, e; + + if (!v) { + if (s.isCollapsed()) + s.select(s.getNode()); + + t.RemoveFormat(); + } else { + if (ed.settings.convert_fonts_to_spans) + t._applyInlineStyle('span', {style : {fontFamily : v}}); + else + ed.getDoc().execCommand('FontName', false, v); + } + }, + + FontSize : function(u, v) { + var ed = this.editor, s = ed.settings, fc, fs; + + // Use style options instead + if (s.convert_fonts_to_spans && v >= 1 && v <= 7) { + fs = tinymce.explode(s.font_size_style_values); + fc = tinymce.explode(s.font_size_classes); + + if (fc) + v = fc[v - 1] || v; + else + v = fs[v - 1] || v; + } + + if (v >= 1 && v <= 7) + ed.getDoc().execCommand('FontSize', false, v); + else + this._applyInlineStyle('span', {style : {fontSize : v}}); + }, + + queryCommandValue : function(c) { + var f = this['queryValue' + c]; + + if (f) + return f.call(this, c); + + return false; + }, + + queryCommandState : function(cmd) { + var f; + + switch (cmd) { + // Bundle these together + case 'JustifyLeft': + case 'JustifyCenter': + case 'JustifyRight': + case 'JustifyFull': + return this.queryStateJustify(cmd, cmd.substring(7).toLowerCase()); + + default: + if (f = this['queryState' + cmd]) + return f.call(this, cmd); + } + + return -1; + }, + + _queryState : function(c) { + try { + return this.editor.getDoc().queryCommandState(c); + } catch (ex) { + // Ignore exception + } + }, + + _queryVal : function(c) { + try { + return this.editor.getDoc().queryCommandValue(c); + } catch (ex) { + // Ignore exception + } + }, + + queryValueFontSize : function() { + var ed = this.editor, v = 0, p; + + if (p = ed.dom.getParent(ed.selection.getNode(), 'SPAN')) + v = p.style.fontSize; + + if (!v && (isOpera || isWebKit)) { + if (p = ed.dom.getParent(ed.selection.getNode(), 'FONT')) + v = p.size; + + return v; + } + + return v || this._queryVal('FontSize'); + }, + + queryValueFontName : function() { + var ed = this.editor, v = 0, p; + + if (p = ed.dom.getParent(ed.selection.getNode(), 'FONT')) + v = p.face; + + if (p = ed.dom.getParent(ed.selection.getNode(), 'SPAN')) + v = p.style.fontFamily.replace(/, /g, ',').replace(/[\'\"]/g, '').toLowerCase(); + + if (!v) + v = this._queryVal('FontName'); + + return v; + }, + + mceJustify : function(c, v) { + var ed = this.editor, se = ed.selection, n = se.getNode(), nn = n.nodeName, bl, nb, dom = ed.dom, rm; + + if (ed.settings.inline_styles && this.queryStateJustify(c, v)) + rm = 1; + + bl = dom.getParent(n, ed.dom.isBlock); + + if (nn == 'IMG') { + if (v == 'full') + return; + + if (rm) { + if (v == 'center') + dom.setStyle(bl || n.parentNode, 'textAlign', ''); + + dom.setStyle(n, 'float', ''); + this.mceRepaint(); + return; + } + + if (v == 'center') { + // Do not change table elements + if (bl && /^(TD|TH)$/.test(bl.nodeName)) + bl = 0; + + if (!bl || bl.childNodes.length > 1) { + nb = dom.create('p'); + nb.appendChild(n.cloneNode(false)); + + if (bl) + dom.insertAfter(nb, bl); + else + dom.insertAfter(nb, n); + + dom.remove(n); + n = nb.firstChild; + bl = nb; + } + + dom.setStyle(bl, 'textAlign', v); + dom.setStyle(n, 'float', ''); + } else { + dom.setStyle(n, 'float', v); + dom.setStyle(bl || n.parentNode, 'textAlign', ''); + } + + this.mceRepaint(); + return; + } + + // Handle the alignment outselfs, less quirks in all browsers + if (ed.settings.inline_styles && ed.settings.forced_root_block) { + if (rm) + v = ''; + + each(this._getSelectedBlocks(dom.getParent(se.getStart(), dom.isBlock), dom.getParent(se.getEnd(), dom.isBlock)), function(e) { + dom.setAttrib(e, 'align', ''); + dom.setStyle(e, 'textAlign', v == 'full' ? 'justify' : v); + }); + + return; + } else if (!rm) + ed.getDoc().execCommand(c, false, null); + + if (ed.settings.inline_styles) { + if (rm) { + dom.getParent(ed.selection.getNode(), function(n) { + if (n.style && n.style.textAlign) + dom.setStyle(n, 'textAlign', ''); + }); + + return; + } + + each(dom.select('*'), function(n) { + var v = n.align; + + if (v) { + if (v == 'full') + v = 'justify'; + + dom.setStyle(n, 'textAlign', v); + dom.setAttrib(n, 'align', ''); + } + }); + } + }, + + mceSetCSSClass : function(u, v) { + this.mceSetStyleInfo(0, {command : 'setattrib', name : 'class', value : v}); + }, + + getSelectedElement : function() { + var t = this, ed = t.editor, dom = ed.dom, se = ed.selection, r = se.getRng(), r1, r2, sc, ec, so, eo, e, sp, ep, re; + + if (se.isCollapsed() || r.item) + return se.getNode(); + + // Setup regexp + re = ed.settings.merge_styles_invalid_parents; + if (tinymce.is(re, 'string')) + re = new RegExp(re, 'i'); + + if (isIE) { + r1 = r.duplicate(); + r1.collapse(true); + sc = r1.parentElement(); + + r2 = r.duplicate(); + r2.collapse(false); + ec = r2.parentElement(); + + if (sc != ec) { + r1.move('character', 1); + sc = r1.parentElement(); + } + + if (sc == ec) { + r1 = r.duplicate(); + r1.moveToElementText(sc); + + if (r1.compareEndPoints('StartToStart', r) == 0 && r1.compareEndPoints('EndToEnd', r) == 0) + return re && re.test(sc.nodeName) ? null : sc; + } + } else { + function getParent(n) { + return dom.getParent(n, function(n) {return n.nodeType == 1;}); + }; + + sc = r.startContainer; + ec = r.endContainer; + so = r.startOffset; + eo = r.endOffset; + + if (!r.collapsed) { + if (sc == ec) { + if (so - eo < 2) { + if (sc.hasChildNodes()) { + sp = sc.childNodes[so]; + return re && re.test(sp.nodeName) ? null : sp; + } + } + } + } + + if (sc.nodeType != 3 || ec.nodeType != 3) + return null; + + if (so == 0) { + sp = getParent(sc); + + if (sp && sp.firstChild != sc) + sp = null; + } + + if (so == sc.nodeValue.length) { + e = sc.nextSibling; + + if (e && e.nodeType == 1) + sp = sc.nextSibling; + } + + if (eo == 0) { + e = ec.previousSibling; + + if (e && e.nodeType == 1) + ep = e; + } + + if (eo == ec.nodeValue.length) { + ep = getParent(ec); + + if (ep && ep.lastChild != ec) + ep = null; + } + + // Same element + if (sp == ep) + return re && sp && re.test(sp.nodeName) ? null : sp; + } + + return null; + }, + + InsertHorizontalRule : function() { + // Fix for Gecko
    issue and IE bug rep(/(.*?)<\/a>/gi,"[url=$1]$2[/url]"); + if (isGecko || isIE) + this.editor.selection.setContent('
    '); + else + this.editor.getDoc().execCommand('InsertHorizontalRule', false, ''); + }, + + RemoveFormat : function() { + var t = this, ed = t.editor, s = ed.selection, b; + + // Safari breaks tables + if (isWebKit) + s.setContent(s.getContent({format : 'raw'}).replace(/(<(span|b|i|strong|em|strike) [^>]+>|<(span|b|i|strong|em|strike)>|<\/(span|b|i|strong|em|strike)>|)/g, ''), {format : 'raw'}); + else + ed.getDoc().execCommand('RemoveFormat', false, null); + + t.mceSetStyleInfo(0, {command : 'removeformat'}); + ed.addVisual(); + }, + + mceSetStyleInfo : function(u, v) { + var t = this, ed = t.editor, d = ed.getDoc(), dom = ed.dom, e, b, s = ed.selection, nn = v.wrapper || 'span', b = s.getBookmark(), re; + + function set(n, e) { + if (n.nodeType == 1) { + switch (v.command) { + case 'setattrib': + return dom.setAttrib(n, v.name, v.value); + + case 'setstyle': + return dom.setStyle(n, v.name, v.value); + + case 'removeformat': + return dom.setAttrib(n, 'class', ''); + } + } + }; + + // Setup regexp + re = ed.settings.merge_styles_invalid_parents; + if (tinymce.is(re, 'string')) + re = new RegExp(re, 'i'); + + // Set style info on selected element + if ((e = t.getSelectedElement()) && !ed.settings.force_span_wrappers) + set(e, 1); + else { + // Generate wrappers and set styles on them + d.execCommand('FontName', false, '__'); + each(isWebKit ? dom.select('span') : dom.select('font'), function(n) { + var sp, e; + + if (dom.getAttrib(n, 'face') == '__' || n.style.fontFamily === '__') { + sp = dom.create(nn, {mce_new : '1'}); + + set(sp); + + each (n.childNodes, function(n) { + sp.appendChild(n.cloneNode(true)); + }); + + dom.replace(sp, n); + } + }); + } + + // Remove wrappers inside new ones + each(dom.select(nn).reverse(), function(n) { + var p = n.parentNode; + + // Check if it's an old span in a new wrapper + if (!dom.getAttrib(n, 'mce_new')) { + // Find new wrapper + p = dom.getParent(n, function(n) { + return n.nodeType == 1 && dom.getAttrib(n, 'mce_new'); + }); + + if (p) + dom.remove(n, 1); + } + }); + + // Merge wrappers with parent wrappers + each(dom.select(nn).reverse(), function(n) { + var p = n.parentNode; + + if (!p || !dom.getAttrib(n, 'mce_new')) + return; + + if (ed.settings.force_span_wrappers && p.nodeName != 'SPAN') + return; + + // Has parent of the same type and only child + if (p.nodeName == nn.toUpperCase() && p.childNodes.length == 1) + return dom.remove(p, 1); + + // Has parent that is more suitable to have the class and only child + if (n.nodeType == 1 && (!re || !re.test(p.nodeName)) && p.childNodes.length == 1) { + set(p); // Set style info on parent instead + dom.setAttrib(n, 'class', ''); + } + }); + + // Remove empty wrappers + each(dom.select(nn).reverse(), function(n) { + if (dom.getAttrib(n, 'mce_new') || (dom.getAttribs(n).length <= 1 && n.className === '')) { + if (!dom.getAttrib(n, 'class') && !dom.getAttrib(n, 'style')) + return dom.remove(n, 1); + + dom.setAttrib(n, 'mce_new', ''); // Remove mce_new marker + } + }); + + s.moveToBookmark(b); + }, + + queryStateJustify : function(c, v) { + var ed = this.editor, n = ed.selection.getNode(), dom = ed.dom; + + if (n && n.nodeName == 'IMG') { + if (dom.getStyle(n, 'float') == v) + return 1; + + return n.parentNode.style.textAlign == v; + } + + n = dom.getParent(ed.selection.getStart(), function(n) { + return n.nodeType == 1 && n.style.textAlign; + }); + + if (v == 'full') + v = 'justify'; + + if (ed.settings.inline_styles) + return (n && n.style.textAlign == v); + + return this._queryState(c); + }, + + ForeColor : function(ui, v) { + var ed = this.editor; + + if (ed.settings.convert_fonts_to_spans) { + this._applyInlineStyle('span', {style : {color : v}}); + return; + } else + ed.getDoc().execCommand('ForeColor', false, v); + }, + + HiliteColor : function(ui, val) { + var t = this, ed = t.editor, d = ed.getDoc(); + + if (ed.settings.convert_fonts_to_spans) { + this._applyInlineStyle('span', {style : {backgroundColor : val}}); + return; + } + + function set(s) { + if (!isGecko) + return; + + try { + // Try new Gecko method + d.execCommand("styleWithCSS", 0, s); + } catch (ex) { + // Use old + d.execCommand("useCSS", 0, !s); + } + }; + + if (isGecko || isOpera) { + set(true); + d.execCommand('hilitecolor', false, val); + set(false); + } else + d.execCommand('BackColor', false, val); + }, + + Undo : function() { + var ed = this.editor; + + if (ed.settings.custom_undo_redo) { + ed.undoManager.undo(); + ed.nodeChanged(); + } else + ed.getDoc().execCommand('Undo', false, null); + }, + + Redo : function() { + var ed = this.editor; + + if (ed.settings.custom_undo_redo) { + ed.undoManager.redo(); + ed.nodeChanged(); + } else + ed.getDoc().execCommand('Redo', false, null); + }, + + FormatBlock : function(ui, val) { + var t = this, ed = t.editor, s = ed.selection, dom = ed.dom, bl, nb, b; + + function isBlock(n) { + return /^(P|DIV|H[1-6]|ADDRESS|BLOCKQUOTE|PRE)$/.test(n.nodeName); + }; + + bl = dom.getParent(s.getNode(), function(n) { + return isBlock(n); + }); + + // IE has an issue where it removes the parent div if you change format on the paragrah in

    Content

    + // FF and Opera doesn't change parent DIV elements if you switch format + if (bl) { + if ((isIE && isBlock(bl.parentNode)) || bl.nodeName == 'DIV') { + // Rename block element + nb = ed.dom.create(val); + + each(dom.getAttribs(bl), function(v) { + dom.setAttrib(nb, v.nodeName, dom.getAttrib(bl, v.nodeName)); + }); + + b = s.getBookmark(); + dom.replace(nb, bl, 1); + s.moveToBookmark(b); + ed.nodeChanged(); + return; + } + } + + val = ed.settings.forced_root_block ? (val || '

    ') : val; + + if (val.indexOf('<') == -1) + val = '<' + val + '>'; + + if (tinymce.isGecko) + val = val.replace(/<(div|blockquote|code|dt|dd|dl|samp)>/gi, '$1'); + + ed.getDoc().execCommand('FormatBlock', false, val); + }, + + mceCleanup : function() { + var ed = this.editor, s = ed.selection, b = s.getBookmark(); + ed.setContent(ed.getContent()); + s.moveToBookmark(b); + }, + + mceRemoveNode : function(ui, val) { + var ed = this.editor, s = ed.selection, b, n = val || s.getNode(); + + // Make sure that the body node isn't removed + if (n == ed.getBody()) + return; + + b = s.getBookmark(); + ed.dom.remove(n, 1); + s.moveToBookmark(b); + ed.nodeChanged(); + }, + + mceSelectNodeDepth : function(ui, val) { + var ed = this.editor, s = ed.selection, c = 0; + + ed.dom.getParent(s.getNode(), function(n) { + if (n.nodeType == 1 && c++ == val) { + s.select(n); + ed.nodeChanged(); + return false; + } + }, ed.getBody()); + }, + + mceSelectNode : function(u, v) { + this.editor.selection.select(v); + }, + + mceInsertContent : function(ui, val) { + this.editor.selection.setContent(val); + }, + + mceInsertRawHTML : function(ui, val) { + var ed = this.editor; + + ed.selection.setContent('tiny_mce_marker'); + ed.setContent(ed.getContent().replace(/tiny_mce_marker/g, val)); + }, + + mceRepaint : function() { + var s, b, e = this.editor; + + if (tinymce.isGecko) { + try { + s = e.selection; + b = s.getBookmark(true); + + if (s.getSel()) + s.getSel().selectAllChildren(e.getBody()); + + s.collapse(true); + s.moveToBookmark(b); + } catch (ex) { + // Ignore + } + } + }, + + queryStateUnderline : function() { + var ed = this.editor, n = ed.selection.getNode(); + + if (n && n.nodeName == 'A') + return false; + + return this._queryState('Underline'); + }, + + queryStateOutdent : function() { + var ed = this.editor, n; + + if (ed.settings.inline_styles) { + if ((n = ed.dom.getParent(ed.selection.getStart(), ed.dom.isBlock)) && parseInt(n.style.paddingLeft) > 0) + return true; + + if ((n = ed.dom.getParent(ed.selection.getEnd(), ed.dom.isBlock)) && parseInt(n.style.paddingLeft) > 0) + return true; + } + + return this.queryStateInsertUnorderedList() || this.queryStateInsertOrderedList() || (!ed.settings.inline_styles && !!ed.dom.getParent(ed.selection.getNode(), 'BLOCKQUOTE')); + }, + + queryStateInsertUnorderedList : function() { + return this.editor.dom.getParent(this.editor.selection.getNode(), 'UL'); + }, + + queryStateInsertOrderedList : function() { + return this.editor.dom.getParent(this.editor.selection.getNode(), 'OL'); + }, + + queryStatemceBlockQuote : function() { + return !!this.editor.dom.getParent(this.editor.selection.getStart(), function(n) {return n.nodeName === 'BLOCKQUOTE';}); + }, + + mceBlockQuote : function() { + var t = this, ed = t.editor, s = ed.selection, dom = ed.dom, sb, eb, n, bm, bq, r, bq2, i, nl; + + function getBQ(e) { + return dom.getParent(e, function(n) {return n.nodeName === 'BLOCKQUOTE';}); + }; + + // Get start/end block + sb = dom.getParent(s.getStart(), isBlock); + eb = dom.getParent(s.getEnd(), isBlock); + + // Remove blockquote(s) + if (bq = getBQ(sb)) { + if (sb != eb || sb.childNodes.length > 1 || (sb.childNodes.length == 1 && sb.firstChild.nodeName != 'BR')) + bm = s.getBookmark(); + + // Move all elements after the end block into new bq + if (getBQ(eb)) { + bq2 = bq.cloneNode(false); + + while (n = eb.nextSibling) + bq2.appendChild(n.parentNode.removeChild(n)); + } + + // Add new bq after + if (bq2) + dom.insertAfter(bq2, bq); + + // Move all selected blocks after the current bq + nl = t._getSelectedBlocks(sb, eb); + for (i = nl.length - 1; i >= 0; i--) { + dom.insertAfter(nl[i], bq); + } + + // Empty bq, then remove it + if (/^\s*$/.test(bq.innerHTML)) + dom.remove(bq, 1); // Keep children so boomark restoration works correctly + + // Empty bq, then remote it + if (bq2 && /^\s*$/.test(bq2.innerHTML)) + dom.remove(bq2, 1); // Keep children so boomark restoration works correctly + + if (!bm) { + // Move caret inside empty block element + if (!isIE) { + r = ed.getDoc().createRange(); + r.setStart(sb, 0); + r.setEnd(sb, 0); + s.setRng(r); + } else { + s.select(sb); + s.collapse(0); + + // IE misses the empty block some times element so we must move back the caret + if (dom.getParent(s.getStart(), isBlock) != sb) { + r = s.getRng(); + r.move('character', -1); + r.select(); + } + } + } else + t.editor.selection.moveToBookmark(bm); + + return; + } + + // Since IE can start with a totally empty document we need to add the first bq and paragraph + if (isIE && !sb && !eb) { + t.editor.getDoc().execCommand('Indent'); + n = getBQ(s.getNode()); + n.style.margin = n.dir = ''; // IE adds margin and dir to bq + return; + } + + if (!sb || !eb) + return; + + // If empty paragraph node then do not use bookmark + if (sb != eb || sb.childNodes.length > 1 || (sb.childNodes.length == 1 && sb.firstChild.nodeName != 'BR')) + bm = s.getBookmark(); + + // Move selected block elements into a bq + each(t._getSelectedBlocks(getBQ(s.getStart()), getBQ(s.getEnd())), function(e) { + // Found existing BQ add to this one + if (e.nodeName == 'BLOCKQUOTE' && !bq) { + bq = e; + return; + } + + // No BQ found, create one + if (!bq) { + bq = dom.create('blockquote'); + e.parentNode.insertBefore(bq, e); + } + + // Add children from existing BQ + if (e.nodeName == 'BLOCKQUOTE' && bq) { + n = e.firstChild; + + while (n) { + bq.appendChild(n.cloneNode(true)); + n = n.nextSibling; + } + + dom.remove(e); + return; + } + + // Add non BQ element to BQ + bq.appendChild(dom.remove(e)); + }); + + if (!bm) { + // Move caret inside empty block element + if (!isIE) { + r = ed.getDoc().createRange(); + r.setStart(sb, 0); + r.setEnd(sb, 0); + s.setRng(r); + } else { + s.select(sb); + s.collapse(1); + } + } else + s.moveToBookmark(bm); + }, + + _applyInlineStyle : function(na, at, op) { + var t = this, ed = t.editor, dom = ed.dom, bm, lo = {}, kh; + + na = na.toUpperCase(); + + if (op && op.check_classes && at['class']) + op.check_classes.push(at['class']); + + function replaceFonts() { + var bm; + + each(dom.select(tinymce.isWebKit && !tinymce.isAir ? 'span' : 'font'), function(n) { + if (n.style.fontFamily == 'mceinline' || n.face == 'mceinline') { + if (!bm) + bm = ed.selection.getBookmark(); + + at._mce_new = '1'; + dom.replace(dom.create(na, at), n, 1); + } + }); + + // Remove redundant elements + each(dom.select(na), function(n) { + if (n.getAttribute('_mce_new')) { + function removeStyle(n) { + if (n.nodeType == 1) { + each(at.style, function(v, k) { + dom.setStyle(n, k, ''); + }); + + // Remove spans with the same class or marked classes + if (at['class'] && n.className && op) { + each(op.check_classes, function(c) { + if (dom.hasClass(n, c)) + dom.removeClass(n, c); + }); + } + } + }; + + // Remove specified style information from child elements + each(dom.select(na, n), removeStyle); + + // Remove the specified style information on parent if current node is only child (IE) + if (n.parentNode && n.parentNode.nodeType == 1 && n.parentNode.childNodes.length == 1) + removeStyle(n.parentNode); + + // Remove the child elements style info if a parent already has it + dom.getParent(n.parentNode, function(pn) { + if (pn.nodeType == 1) { + if (at.style) { + each(at.style, function(v, k) { + var sv; + + if (!lo[k] && (sv = dom.getStyle(pn, k))) { + if (sv === v) + dom.setStyle(n, k, ''); + + lo[k] = 1; + } + }); + } + + // Remove spans with the same class or marked classes + if (at['class'] && pn.className && op) { + each(op.check_classes, function(c) { + if (dom.hasClass(pn, c)) + dom.removeClass(n, c); + }); + } + } + + return false; + }); + + n.removeAttribute('_mce_new'); + } + }); + + // Remove empty span elements + each(dom.select(na).reverse(), function(n) { + var c = 0; + + // Check if there is any attributes + each(dom.getAttribs(n), function(an) { + if (an.nodeName.substring(0, 1) != '_' && dom.getAttrib(n, an.nodeName) != '') { + //console.log(dom.getOuterHTML(n), dom.getAttrib(n, an.nodeName)); + c++; + } + }); + + // No attributes then remove the element and keep the children + if (c == 0) + dom.remove(n, 1); + }); + + ed.selection.moveToBookmark(bm); + + return !!bm; + }; + + // Create inline elements + ed.focus(); + ed.getDoc().execCommand('FontName', false, 'mceinline'); + replaceFonts(); + + if (kh = t._applyInlineStyle.keyhandler) { + ed.onKeyUp.remove(kh); + ed.onKeyPress.remove(kh); + ed.onKeyDown.remove(kh); + ed.onSetContent.remove(t._applyInlineStyle.chandler); + } + + if (ed.selection.isCollapsed()) { + // Start collecting styles + t._pendingStyles = tinymce.extend(t._pendingStyles || {}, at.style); + + t._applyInlineStyle.chandler = ed.onSetContent.add(function() { + delete t._pendingStyles; + }); + + t._applyInlineStyle.keyhandler = kh = function(e) { + // Use pending styles + if (t._pendingStyles) { + at.style = t._pendingStyles; + delete t._pendingStyles; + } + + if (replaceFonts()) { + ed.onKeyDown.remove(t._applyInlineStyle.keyhandler); + ed.onKeyPress.remove(t._applyInlineStyle.keyhandler); + } + + if (e.type == 'keyup') + ed.onKeyUp.remove(t._applyInlineStyle.keyhandler); + }; + + ed.onKeyDown.add(kh); + ed.onKeyPress.add(kh); + ed.onKeyUp.add(kh); + } else + t._pendingStyles = 0; + }, + +/* + _mceBlockQuote : function() { + var t = this, s = t.editor.selection, b = s.getBookmark(), bq, dom = t.editor.dom; + + function findBQ(e) { + return dom.getParent(e, function(n) {return n.nodeName === 'BLOCKQUOTE';}); + }; + + // Remove blockquote(s) + if (findBQ(s.getStart())) { + each(t._getSelectedBlocks(findBQ(s.getStart()), findBQ(s.getEnd())), function(e) { + // Found BQ lets remove it + if (e.nodeName == 'BLOCKQUOTE') + dom.remove(e, 1); + }); + + t.editor.selection.moveToBookmark(b); + return; + } + + each(t._getSelectedBlocks(findBQ(s.getStart()), findBQ(s.getEnd())), function(e) { + var n; + + // Found existing BQ add to this one + if (e.nodeName == 'BLOCKQUOTE' && !bq) { + bq = e; + return; + } + + // No BQ found, create one + if (!bq) { + bq = dom.create('blockquote'); + e.parentNode.insertBefore(bq, e); + } + + // Add children from existing BQ + if (e.nodeName == 'BLOCKQUOTE' && bq) { + n = e.firstChild; + + while (n) { + bq.appendChild(n.cloneNode(true)); + n = n.nextSibling; + } + + dom.remove(e); + + return; + } + + // Add non BQ element to BQ + bq.appendChild(dom.remove(e)); + }); + + t.editor.selection.moveToBookmark(b); + }, +*/ + _getSelectedBlocks : function(st, en) { + var ed = this.editor, dom = ed.dom, s = ed.selection, sb, eb, n, bl = []; + + sb = dom.getParent(st || s.getStart(), isBlock); + eb = dom.getParent(en || s.getEnd(), isBlock); + + if (sb) + bl.push(sb); + + if (sb && eb && sb != eb) { + n = sb; + + while ((n = n.nextSibling) && n != eb) { + if (isBlock(n)) + bl.push(n); + } + } + + if (eb && sb != eb) + bl.push(eb); + + return bl; + } + }); +})(); + + +/* file:jscripts/tiny_mce/classes/UndoManager.js */ + +tinymce.create('tinymce.UndoManager', { + index : 0, + data : null, + typing : 0, + + UndoManager : function(ed) { + var t = this, Dispatcher = tinymce.util.Dispatcher; + + t.editor = ed; + t.data = []; + t.onAdd = new Dispatcher(this); + t.onUndo = new Dispatcher(this); + t.onRedo = new Dispatcher(this); + }, + + add : function(l) { + var t = this, i, ed = t.editor, b, s = ed.settings, la; + + l = l || {}; + l.content = l.content || ed.getContent({format : 'raw', no_events : 1}); + + // Add undo level if needed + l.content = l.content.replace(/^\s*|\s*$/g, ''); + la = t.data[t.index > 0 && (t.index == 0 || t.index == t.data.length) ? t.index - 1 : t.index]; + if (!l.initial && la && l.content == la.content) + return null; + + // Time to compress + if (s.custom_undo_redo_levels) { + if (t.data.length > s.custom_undo_redo_levels) { + for (i = 0; i < t.data.length - 1; i++) + t.data[i] = t.data[i + 1]; + + t.data.length--; + t.index = t.data.length; + } + } + + if (s.custom_undo_redo_restore_selection && !l.initial) + l.bookmark = b = l.bookmark || ed.selection.getBookmark(); + + if (t.index < t.data.length) + t.index++; + + // Only initial marked undo levels should be allowed as first item + // This to workaround a bug with Firefox and the blur event + if (t.data.length === 0 && !l.initial) + return null; + + // Add level + t.data.length = t.index + 1; + t.data[t.index++] = l; + + if (l.initial) + t.index = 0; + + // Set initial bookmark use first real undo level + if (t.data.length == 2 && t.data[0].initial) + t.data[0].bookmark = b; + + t.onAdd.dispatch(t, l); + ed.isNotDirty = 0; + + //console.dir(t.data); + + return l; + }, + + undo : function() { + var t = this, ed = t.editor, l = l, i; + + if (t.typing) { + t.add(); + t.typing = 0; + } + + if (t.index > 0) { + // If undo on last index then take snapshot + if (t.index == t.data.length && t.index > 1) { + i = t.index; + t.typing = 0; + + if (!t.add()) + t.index = i; + + --t.index; + } + + l = t.data[--t.index]; + ed.setContent(l.content, {format : 'raw'}); + ed.selection.moveToBookmark(l.bookmark); + + t.onUndo.dispatch(t, l); + } + + return l; + }, + + redo : function() { + var t = this, ed = t.editor, l = null; + + if (t.index < t.data.length - 1) { + l = t.data[++t.index]; + ed.setContent(l.content, {format : 'raw'}); + ed.selection.moveToBookmark(l.bookmark); + + t.onRedo.dispatch(t, l); + } + + return l; + }, + + clear : function() { + var t = this; + + t.data = []; + t.index = 0; + t.typing = 0; + t.add({initial : true}); + }, + + hasUndo : function() { + return this.index != 0 || this.typing; + }, + + hasRedo : function() { + return this.index < this.data.length - 1; + } + + }); +/* file:jscripts/tiny_mce/classes/ForceBlocks.js */ + +(function() { + // Shorten names + var Event, isIE, isGecko, isOpera, each, extend; + + Event = tinymce.dom.Event; + isIE = tinymce.isIE; + isGecko = tinymce.isGecko; + isOpera = tinymce.isOpera; + each = tinymce.each; + extend = tinymce.extend; + + tinymce.create('tinymce.ForceBlocks', { + ForceBlocks : function(ed) { + var t = this, s = ed.settings, elm; + + t.editor = ed; + t.dom = ed.dom; + elm = (s.forced_root_block || 'p').toLowerCase(); + s.element = elm.toUpperCase(); + + ed.onPreInit.add(t.setup, t); + + t.reOpera = new RegExp('(\\u00a0| | )<\/' + elm + '>', 'gi'); + t.rePadd = new RegExp(']+)><\\\/p>|]+)\\\/>|]+)>\\s+<\\\/p>|

    <\\\/p>||

    \\s+<\\\/p>'.replace(/p/g, elm), 'gi'); + t.reNbsp2BR1 = new RegExp(']+)>[\\s\\u00a0]+<\\\/p>|

    [\\s\\u00a0]+<\\\/p>'.replace(/p/g, elm), 'gi'); + t.reNbsp2BR2 = new RegExp(']+)>( | )<\\\/p>|

    ( | )<\\\/p>'.replace(/p/g, elm), 'gi'); + t.reBR2Nbsp = new RegExp(']+)>\\s*
    \\s*<\\\/p>|

    \\s*
    \\s*<\\\/p>'.replace(/p/g, elm), 'gi'); + t.reTrailBr = new RegExp('\\s*
    \\s*<\\\/p>'.replace(/p/g, elm), 'gi'); + + function padd(ed, o) { + if (isOpera) + o.content = o.content.replace(t.reOpera, ''); + + o.content = o.content.replace(t.rePadd, '<' + elm + '$1$2$3$4$5$6>\u00a0'); + + if (!isIE && !isOpera && o.set) { + // Use   instead of BR in padded paragraphs + o.content = o.content.replace(t.reNbsp2BR1, '<' + elm + '$1$2>
    '); + o.content = o.content.replace(t.reNbsp2BR2, '<' + elm + '$1$2>
    '); + } else { + o.content = o.content.replace(t.reBR2Nbsp, '<' + elm + '$1$2>\u00a0'); + o.content = o.content.replace(t.reTrailBr, ''); + } + }; + + ed.onBeforeSetContent.add(padd); + ed.onPostProcess.add(padd); + + if (s.forced_root_block) { + ed.onInit.add(t.forceRoots, t); + ed.onSetContent.add(t.forceRoots, t); + ed.onBeforeGetContent.add(t.forceRoots, t); + } + }, + + setup : function() { + var t = this, ed = t.editor, s = ed.settings; + + // Force root blocks when typing and when getting output + if (s.forced_root_block) { + ed.onKeyUp.add(t.forceRoots, t); + ed.onPreProcess.add(t.forceRoots, t); + } + + if (s.force_br_newlines) { + // Force IE to produce BRs on enter + if (isIE) { + ed.onKeyPress.add(function(ed, e) { + var n, s = ed.selection; + + if (e.keyCode == 13 && s.getNode().nodeName != 'LI') { + s.setContent('
    ', {format : 'raw'}); + n = ed.dom.get('__'); + n.removeAttribute('id'); + s.select(n); + s.collapse(); + return Event.cancel(e); + } + }); + } + + return; + } + + if (!isIE && s.force_p_newlines) { +/* ed.onPreProcess.add(function(ed, o) { + each(ed.dom.select('br', o.node), function(n) { + var p = n.parentNode; + + // Replace


    with

     

    + if (p && p.nodeName == 'p' && (p.childNodes.length == 1 || p.lastChild == n)) { + p.replaceChild(ed.getDoc().createTextNode('\u00a0'), n); + } + }); + });*/ + + ed.onKeyPress.add(function(ed, e) { + if (e.keyCode == 13 && !e.shiftKey) { + if (!t.insertPara(e)) + Event.cancel(e); + } + }); + + if (isGecko) { + ed.onKeyDown.add(function(ed, e) { + if ((e.keyCode == 8 || e.keyCode == 46) && !e.shiftKey) + t.backspaceDelete(e, e.keyCode == 8); + }); + } + } + + function ren(rn, na) { + var ne = ed.dom.create(na); + + each(rn.attributes, function(a) { + if (a.specified && a.nodeValue) + ne.setAttribute(a.nodeName.toLowerCase(), a.nodeValue); + }); + + each(rn.childNodes, function(n) { + ne.appendChild(n.cloneNode(true)); + }); + + rn.parentNode.replaceChild(ne, rn); + + return ne; + }; + + // Replaces IE:s auto generated paragraphs with the specified element name + if (isIE && s.element != 'P') { + ed.onKeyPress.add(function(ed, e) { + t.lastElm = ed.selection.getNode().nodeName; + }); + + ed.onKeyUp.add(function(ed, e) { + var bl, sel = ed.selection, n = sel.getNode(), b = ed.getBody(); + + if (b.childNodes.length === 1 && n.nodeName == 'P') { + n = ren(n, s.element); + sel.select(n); + sel.collapse(); + ed.nodeChanged(); + } else if (e.keyCode == 13 && !e.shiftKey && t.lastElm != 'P') { + bl = ed.dom.getParent(n, 'P'); + + if (bl) { + ren(bl, s.element); + ed.nodeChanged(); + } + } + }); + } + }, + + find : function(n, t, s) { + var ed = this.editor, w = ed.getDoc().createTreeWalker(n, 4, null, false), c = -1; + + while (n = w.nextNode()) { + c++; + + // Index by node + if (t == 0 && n == s) + return c; + + // Node by index + if (t == 1 && c == s) + return n; + } + + return -1; + }, + + forceRoots : function(ed, e) { + var t = this, ed = t.editor, b = ed.getBody(), d = ed.getDoc(), se = ed.selection, s = se.getSel(), r = se.getRng(), si = -2, ei, so, eo, tr, c = -0xFFFFFF; + var nx, bl, bp, sp, le, nl = b.childNodes, i, n, eid; + + // Fix for bug #1863847 + //if (e && e.keyCode == 13) + // return true; + + // Wrap non blocks into blocks + for (i = nl.length - 1; i >= 0; i--) { + nx = nl[i]; + + // Is text or non block element + if (nx.nodeType == 3 || (!t.dom.isBlock(nx) && nx.nodeType != 8)) { + if (!bl) { + // Create new block but ignore whitespace + if (nx.nodeType != 3 || /[^\s]/g.test(nx.nodeValue)) { + // Store selection + if (si == -2 && r) { + if (!isIE) { + // If selection is element then mark it + if (r.startContainer.nodeType == 1 && (n = r.startContainer.childNodes[r.startOffset]) && n.nodeType == 1) { + // Save the id of the selected element + eid = n.getAttribute("id"); + n.setAttribute("id", "__mce"); + } else { + // If element is inside body, might not be the case in contentEdiable mode + if (ed.dom.getParent(r.startContainer, function(e) {return e === b;})) { + so = r.startOffset; + eo = r.endOffset; + si = t.find(b, 0, r.startContainer); + ei = t.find(b, 0, r.endContainer); + } + } + } else { + tr = d.body.createTextRange(); + tr.moveToElementText(b); + tr.collapse(1); + bp = tr.move('character', c) * -1; + + tr = r.duplicate(); + tr.collapse(1); + sp = tr.move('character', c) * -1; + + tr = r.duplicate(); + tr.collapse(0); + le = (tr.move('character', c) * -1) - sp; + + si = sp - bp; + ei = le; + } + } + + bl = ed.dom.create(ed.settings.forced_root_block); + bl.appendChild(nx.cloneNode(1)); + nx.parentNode.replaceChild(bl, nx); + } + } else { + if (bl.hasChildNodes()) + bl.insertBefore(nx, bl.firstChild); + else + bl.appendChild(nx); + } + } else + bl = null; // Time to create new block + } + + // Restore selection + if (si != -2) { + if (!isIE) { + bl = b.getElementsByTagName(ed.settings.element)[0]; + r = d.createRange(); + + // Select last location or generated block + if (si != -1) + r.setStart(t.find(b, 1, si), so); + else + r.setStart(bl, 0); + + // Select last location or generated block + if (ei != -1) + r.setEnd(t.find(b, 1, ei), eo); + else + r.setEnd(bl, 0); + + if (s) { + s.removeAllRanges(); + s.addRange(r); + } + } else { + try { + r = s.createRange(); + r.moveToElementText(b); + r.collapse(1); + r.moveStart('character', si); + r.moveEnd('character', ei); + r.select(); + } catch (ex) { + // Ignore + } + } + } else if (!isIE && (n = ed.dom.get('__mce'))) { + // Restore the id of the selected element + if (eid) + n.setAttribute('id', eid); + else + n.removeAttribute('id'); + + // Move caret before selected element + r = d.createRange(); + r.setStartBefore(n); + r.setEndBefore(n); + se.setRng(r); + } + }, + + getParentBlock : function(n) { + var d = this.dom; + + return d.getParent(n, d.isBlock); + }, + + insertPara : function(e) { + var t = this, ed = t.editor, dom = ed.dom, d = ed.getDoc(), se = ed.settings, s = ed.selection.getSel(), r = s.getRangeAt(0), b = d.body; + var rb, ra, dir, sn, so, en, eo, sb, eb, bn, bef, aft, sc, ec, n, vp = dom.getViewPort(ed.getWin()), y, ch, car; + + function isEmpty(n) { + n = n.innerHTML; + n = n.replace(/<(img|hr|table)/gi, '-'); // Keep these convert them to - chars + n = n.replace(/<[^>]+>/g, ''); // Remove all tags + + return n.replace(/[ \t\r\n]+/g, '') == ''; + }; + + // If root blocks are forced then use Operas default behavior since it's really good +// Removed due to bug: #1853816 +// if (se.forced_root_block && isOpera) +// return true; + + // Setup before range + rb = d.createRange(); + + // If is before the first block element and in body, then move it into first block element + rb.setStart(s.anchorNode, s.anchorOffset); + rb.collapse(true); + + // Setup after range + ra = d.createRange(); + + // If is before the first block element and in body, then move it into first block element + ra.setStart(s.focusNode, s.focusOffset); + ra.collapse(true); + + // Setup start/end points + dir = rb.compareBoundaryPoints(rb.START_TO_END, ra) < 0; + sn = dir ? s.anchorNode : s.focusNode; + so = dir ? s.anchorOffset : s.focusOffset; + en = dir ? s.focusNode : s.anchorNode; + eo = dir ? s.focusOffset : s.anchorOffset; + + // If selection is in empty table cell + if (sn === en && /^(TD|TH)$/.test(sn.nodeName)) { + dom.remove(sn.firstChild); // Remove BR + + // Create two new block elements + ed.dom.add(sn, se.element, null, '
    '); + aft = ed.dom.add(sn, se.element, null, '
    '); + + // Move caret into the last one + r = d.createRange(); + r.selectNodeContents(aft); + r.collapse(1); + ed.selection.setRng(r); + + return false; + } + + // If the caret is in an invalid location in FF we need to move it into the first block + if (sn == b && en == b && b.firstChild && ed.dom.isBlock(b.firstChild)) { + sn = en = sn.firstChild; + so = eo = 0; + rb = d.createRange(); + rb.setStart(sn, 0); + ra = d.createRange(); + ra.setStart(en, 0); + } + + // Never use body as start or end node + sn = sn.nodeName == "HTML" ? d.body : sn; // Fix for Opera bug: https://bugs.opera.com/show_bug.cgi?id=273224&comments=yes + sn = sn.nodeName == "BODY" ? sn.firstChild : sn; + en = en.nodeName == "HTML" ? d.body : en; // Fix for Opera bug: https://bugs.opera.com/show_bug.cgi?id=273224&comments=yes + en = en.nodeName == "BODY" ? en.firstChild : en; + + // Get start and end blocks + sb = t.getParentBlock(sn); + eb = t.getParentBlock(en); + bn = sb ? sb.nodeName : se.element; // Get block name to create + + // Return inside list use default browser behavior + if (t.dom.getParent(sb, function(n) { return /OL|UL|PRE/.test(n.nodeName); })) + return true; + + // If caption or absolute layers then always generate new blocks within + if (sb && (sb.nodeName == 'CAPTION' || /absolute|relative|static/gi.test(sb.style.position))) { + bn = se.element; + sb = null; + } + + // If caption or absolute layers then always generate new blocks within + if (eb && (eb.nodeName == 'CAPTION' || /absolute|relative|static/gi.test(eb.style.position))) { + bn = se.element; + eb = null; + } + + // Use P instead + if (/(TD|TABLE|TH|CAPTION)/.test(bn) || (sb && bn == "DIV" && /left|right/gi.test(sb.style.cssFloat))) { + bn = se.element; + sb = eb = null; + } + + // Setup new before and after blocks + bef = (sb && sb.nodeName == bn) ? sb.cloneNode(0) : ed.dom.create(bn); + aft = (eb && eb.nodeName == bn) ? eb.cloneNode(0) : ed.dom.create(bn); + + // Remove id from after clone + aft.removeAttribute('id'); + + // Is header and cursor is at the end, then force paragraph under + if (/^(H[1-6])$/.test(bn) && sn.nodeValue && so == sn.nodeValue.length) + aft = ed.dom.create(se.element); + + // Find start chop node + n = sc = sn; + do { + if (n == b || n.nodeType == 9 || t.dom.isBlock(n) || /(TD|TABLE|TH|CAPTION)/.test(n.nodeName)) + break; + + sc = n; + } while ((n = n.previousSibling ? n.previousSibling : n.parentNode)); + + // Find end chop node + n = ec = en; + do { + if (n == b || n.nodeType == 9 || t.dom.isBlock(n) || /(TD|TABLE|TH|CAPTION)/.test(n.nodeName)) + break; + + ec = n; + } while ((n = n.nextSibling ? n.nextSibling : n.parentNode)); + + // Place first chop part into before block element + if (sc.nodeName == bn) + rb.setStart(sc, 0); + else + rb.setStartBefore(sc); + + rb.setEnd(sn, so); + bef.appendChild(rb.cloneContents() || d.createTextNode('')); // Empty text node needed for Safari + + // Place secnd chop part within new block element + try { + ra.setEndAfter(ec); + } catch(ex) { + //console.debug(s.focusNode, s.focusOffset); + } + + ra.setStart(en, eo); + aft.appendChild(ra.cloneContents() || d.createTextNode('')); // Empty text node needed for Safari + + // Create range around everything + r = d.createRange(); + if (!sc.previousSibling && sc.parentNode.nodeName == bn) { + r.setStartBefore(sc.parentNode); + } else { + if (rb.startContainer.nodeName == bn && rb.startOffset == 0) + r.setStartBefore(rb.startContainer); + else + r.setStart(rb.startContainer, rb.startOffset); + } + + if (!ec.nextSibling && ec.parentNode.nodeName == bn) + r.setEndAfter(ec.parentNode); + else + r.setEnd(ra.endContainer, ra.endOffset); + + // Delete and replace it with new block elements + r.deleteContents(); + + if (isOpera) + ed.getWin().scrollTo(0, vp.y); + + // Never wrap blocks in blocks + if (bef.firstChild && bef.firstChild.nodeName == bn) + bef.innerHTML = bef.firstChild.innerHTML; + + if (aft.firstChild && aft.firstChild.nodeName == bn) + aft.innerHTML = aft.firstChild.innerHTML; + + // Padd empty blocks + if (isEmpty(bef)) + bef.innerHTML = '
    '; + + function appendStyles(e, en) { + var nl = [], nn, n, i; + + e.innerHTML = ''; + + // Make clones of style elements + if (se.keep_styles) { + n = en; + do { + // We only want style specific elements + if (/^(SPAN|STRONG|B|EM|I|FONT|STRIKE|U)$/.test(n.nodeName)) { + nn = n.cloneNode(false); + dom.setAttrib(nn, 'id', ''); // Remove ID since it needs to be unique + nl.push(nn); + } + } while (n = n.parentNode); + } + + // Append style elements to aft + if (nl.length > 0) { + for (i = nl.length - 1, nn = e; i >= 0; i--) + nn = nn.appendChild(nl[i]); + + // Padd most inner style element + nl[0].innerHTML = isOpera ? ' ' : '
    '; // Extra space for Opera so that the caret can move there + return nl[0]; // Move caret to most inner element + } else + e.innerHTML = isOpera ? ' ' : '
    '; // Extra space for Opera so that the caret can move there + }; + + // Fill empty afterblook with current style + if (isEmpty(aft)) + car = appendStyles(aft, en); + + // Opera needs this one backwards for older versions + if (isOpera && parseFloat(opera.version()) < 9.5) { + r.insertNode(bef); + r.insertNode(aft); + } else { + r.insertNode(aft); + r.insertNode(bef); + } + + // Normalize + aft.normalize(); + bef.normalize(); + + function first(n) { + return d.createTreeWalker(n, NodeFilter.SHOW_TEXT, null, false).nextNode() || n; + }; + + // Move cursor and scroll into view + r = d.createRange(); + r.selectNodeContents(isGecko ? first(car || aft) : car || aft); + r.collapse(1); + s.removeAllRanges(); + s.addRange(r); + + // scrollIntoView seems to scroll the parent window in most browsers now including FF 3.0b4 so it's time to stop using it and do it our selfs + y = ed.dom.getPos(aft).y; + ch = aft.clientHeight; + + // Is element within viewport + if (y < vp.y || y + ch > vp.y + vp.h) { + ed.getWin().scrollTo(0, y < vp.y ? y : y - vp.h + 25); // Needs to be hardcoded to roughly one line of text if a huge text block is broken into two blocks + //console.debug('SCROLL!', 'vp.y: ' + vp.y, 'y' + y, 'vp.h' + vp.h, 'clientHeight' + aft.clientHeight, 'yyy: ' + (y < vp.y ? y : y - vp.h + aft.clientHeight)); + } + + return false; + }, + + backspaceDelete : function(e, bs) { + var t = this, ed = t.editor, b = ed.getBody(), n, se = ed.selection, r = se.getRng(), sc = r.startContainer, n, w, tn; + + // The caret sometimes gets stuck in Gecko if you delete empty paragraphs + // This workaround removes the element by hand and moves the caret to the previous element + if (sc && ed.dom.isBlock(sc) && !/^(TD|TH)$/.test(sc.nodeName) && bs) { + if (sc.childNodes.length == 0 || (sc.childNodes.length == 1 && sc.firstChild.nodeName == 'BR')) { + // Find previous block element + n = sc; + while ((n = n.previousSibling) && !ed.dom.isBlock(n)) ; + + if (n) { + if (sc != b.firstChild) { + // Find last text node + w = ed.dom.doc.createTreeWalker(n, NodeFilter.SHOW_TEXT, null, false); + while (tn = w.nextNode()) + n = tn; + + // Place caret at the end of last text node + r = ed.getDoc().createRange(); + r.setStart(n, n.nodeValue ? n.nodeValue.length : 0); + r.setEnd(n, n.nodeValue ? n.nodeValue.length : 0); + se.setRng(r); + + // Remove the target container + ed.dom.remove(sc); + } + + return Event.cancel(e); + } + } + } + + // Gecko generates BR elements here and there, we don't like those so lets remove them + function handler(e) { + var pr; + + e = e.target; + + // A new BR was created in a block element, remove it + if (e && e.parentNode && e.nodeName == 'BR' && (n = t.getParentBlock(e))) { + pr = e.previousSibling; + + Event.remove(b, 'DOMNodeInserted', handler); + + // Is there whitespace at the end of the node before then we might need the pesky BR + // to place the caret at a correct location see bug: #2013943 + if (pr && pr.nodeType == 3 && /\s+$/.test(pr.nodeValue)) + return; + + // Only remove BR elements that got inserted in the middle of the text + if (e.previousSibling || e.nextSibling) + ed.dom.remove(e); + } + }; + + // Listen for new nodes + Event._add(b, 'DOMNodeInserted', handler); + + // Remove listener + window.setTimeout(function() { + Event._remove(b, 'DOMNodeInserted', handler); + }, 1); + } + }); +})(); + +/* file:jscripts/tiny_mce/classes/ControlManager.js */ + +(function() { + // Shorten names + var DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each, extend = tinymce.extend; + + tinymce.create('tinymce.ControlManager', { + ControlManager : function(ed, s) { + var t = this, i; + + s = s || {}; + t.editor = ed; + t.controls = {}; + t.onAdd = new tinymce.util.Dispatcher(t); + t.onPostRender = new tinymce.util.Dispatcher(t); + t.prefix = s.prefix || ed.id + '_'; + t._cls = {}; + + t.onPostRender.add(function() { + each(t.controls, function(c) { + c.postRender(); + }); + }); + }, + + get : function(id) { + return this.controls[this.prefix + id] || this.controls[id]; + }, + + setActive : function(id, s) { + var c = null; + + if (c = this.get(id)) + c.setActive(s); + + return c; + }, + + setDisabled : function(id, s) { + var c = null; + + if (c = this.get(id)) + c.setDisabled(s); + + return c; + }, + + add : function(c) { + var t = this; + + if (c) { + t.controls[c.id] = c; + t.onAdd.dispatch(c, t); + } + + return c; + }, + + createControl : function(n) { + var c, t = this, ed = t.editor; + + each(ed.plugins, function(p) { + if (p.createControl) { + c = p.createControl(n, t); + + if (c) + return false; + } + }); + + switch (n) { + case "|": + case "separator": + return t.createSeparator(); + } + + if (!c && ed.buttons && (c = ed.buttons[n])) + return t.createButton(n, c); + + return t.add(c); + }, + + createDropMenu : function(id, s, cc) { + var t = this, ed = t.editor, c, bm, v, cls; + + s = extend({ + 'class' : 'mceDropDown', + constrain : ed.settings.constrain_menus + }, s); + + s['class'] = s['class'] + ' ' + ed.getParam('skin') + 'Skin'; + if (v = ed.getParam('skin_variant')) + s['class'] += ' ' + ed.getParam('skin') + 'Skin' + v.substring(0, 1).toUpperCase() + v.substring(1); + + id = t.prefix + id; + cls = cc || t._cls.dropmenu || tinymce.ui.DropMenu; + c = t.controls[id] = new cls(id, s); + c.onAddItem.add(function(c, o) { + var s = o.settings; + + s.title = ed.getLang(s.title, s.title); + + if (!s.onclick) { + s.onclick = function(v) { + ed.execCommand(s.cmd, s.ui || false, s.value); + }; + } + }); + + ed.onRemove.add(function() { + c.destroy(); + }); + + // Fix for bug #1897785, #1898007 + if (tinymce.isIE) { + c.onShowMenu.add(function() { + bm = ed.selection.getBookmark(1); + }); + + c.onHideMenu.add(function() { + if (bm) + ed.selection.moveToBookmark(bm); + }); + } + + return t.add(c); + }, + + createListBox : function(id, s, cc) { + var t = this, ed = t.editor, cmd, c, cls; + + if (t.get(id)) + return null; + + s.title = ed.translate(s.title); + s.scope = s.scope || ed; + + if (!s.onselect) { + s.onselect = function(v) { + ed.execCommand(s.cmd, s.ui || false, v || s.value); + }; + } + + s = extend({ + title : s.title, + 'class' : 'mce_' + id, + scope : s.scope, + control_manager : t + }, s); + + id = t.prefix + id; + + if (ed.settings.use_native_selects) + c = new tinymce.ui.NativeListBox(id, s); + else { + cls = cc || t._cls.listbox || tinymce.ui.ListBox; + c = new cls(id, s); + } + + t.controls[id] = c; + + // Fix focus problem in Safari + if (tinymce.isWebKit) { + c.onPostRender.add(function(c, n) { + // Store bookmark on mousedown + Event.add(n, 'mousedown', function() { + ed.bookmark = ed.selection.getBookmark('simple'); + }); + + // Restore on focus, since it might be lost + Event.add(n, 'focus', function() { + ed.selection.moveToBookmark(ed.bookmark); + ed.bookmark = null; + }); + }); + } + + if (c.hideMenu) + ed.onMouseDown.add(c.hideMenu, c); + + return t.add(c); + }, + + createButton : function(id, s, cc) { + var t = this, ed = t.editor, o, c, cls; + + if (t.get(id)) + return null; + + s.title = ed.translate(s.title); + s.label = ed.translate(s.label); + s.scope = s.scope || ed; + + if (!s.onclick && !s.menu_button) { + s.onclick = function() { + ed.execCommand(s.cmd, s.ui || false, s.value); + }; + } + + s = extend({ + title : s.title, + 'class' : 'mce_' + id, + unavailable_prefix : ed.getLang('unavailable', ''), + scope : s.scope, + control_manager : t + }, s); + + id = t.prefix + id; + + if (s.menu_button) { + cls = cc || t._cls.menubutton || tinymce.ui.MenuButton; + c = new cls(id, s); + ed.onMouseDown.add(c.hideMenu, c); + } else { + cls = t._cls.button || tinymce.ui.Button; + c = new cls(id, s); + } + + return t.add(c); + }, + + createMenuButton : function(id, s, cc) { + s = s || {}; + s.menu_button = 1; + + return this.createButton(id, s, cc); + }, + + createSplitButton : function(id, s, cc) { + var t = this, ed = t.editor, cmd, c, cls; + + if (t.get(id)) + return null; + + s.title = ed.translate(s.title); + s.scope = s.scope || ed; + + if (!s.onclick) { + s.onclick = function(v) { + ed.execCommand(s.cmd, s.ui || false, v || s.value); + }; + } + + if (!s.onselect) { + s.onselect = function(v) { + ed.execCommand(s.cmd, s.ui || false, v || s.value); + }; + } + + s = extend({ + title : s.title, + 'class' : 'mce_' + id, + scope : s.scope, + control_manager : t + }, s); + + id = t.prefix + id; + cls = cc || t._cls.splitbutton || tinymce.ui.SplitButton; + c = t.add(new cls(id, s)); + ed.onMouseDown.add(c.hideMenu, c); + + return c; + }, + + createColorSplitButton : function(id, s, cc) { + var t = this, ed = t.editor, cmd, c, cls, bm; + + if (t.get(id)) + return null; + + s.title = ed.translate(s.title); + s.scope = s.scope || ed; + + if (!s.onclick) { + s.onclick = function(v) { + ed.execCommand(s.cmd, s.ui || false, v || s.value); + }; + } + + if (!s.onselect) { + s.onselect = function(v) { + ed.execCommand(s.cmd, s.ui || false, v || s.value); + }; + } + + s = extend({ + title : s.title, + 'class' : 'mce_' + id, + 'menu_class' : ed.getParam('skin') + 'Skin', + scope : s.scope, + more_colors_title : ed.getLang('more_colors') + }, s); + + id = t.prefix + id; + cls = cc || t._cls.colorsplitbutton || tinymce.ui.ColorSplitButton; + c = new cls(id, s); + ed.onMouseDown.add(c.hideMenu, c); + + // Remove the menu element when the editor is removed + ed.onRemove.add(function() { + c.destroy(); + }); + + // Fix for bug #1897785, #1898007 + if (tinymce.isIE) { + c.onShowMenu.add(function() { + bm = ed.selection.getBookmark(1); + }); + + c.onHideMenu.add(function() { + if (bm) { + ed.selection.moveToBookmark(bm); + bm = 0; + } + }); + } + + return t.add(c); + }, + + createToolbar : function(id, s, cc) { + var c, t = this, cls; + + id = t.prefix + id; + cls = cc || t._cls.toolbar || tinymce.ui.Toolbar; + c = new cls(id, s); + + if (t.get(id)) + return null; + + return t.add(c); + }, + + createSeparator : function(cc) { + var cls = cc || this._cls.separator || tinymce.ui.Separator; + + return new cls(); + }, + + setControlType : function(n, c) { + return this._cls[n.toLowerCase()] = c; + }, + + destroy : function() { + each(this.controls, function(c) { + c.destroy(); + }); + + this.controls = null; + } + + }); +})(); + +/* file:jscripts/tiny_mce/classes/WindowManager.js */ + +(function() { + var Dispatcher = tinymce.util.Dispatcher, each = tinymce.each, isIE = tinymce.isIE, isOpera = tinymce.isOpera; + + tinymce.create('tinymce.WindowManager', { + WindowManager : function(ed) { + var t = this; + + t.editor = ed; + t.onOpen = new Dispatcher(t); + t.onClose = new Dispatcher(t); + t.params = {}; + t.features = {}; + }, + + open : function(s, p) { + var t = this, f = '', x, y, mo = t.editor.settings.dialog_type == 'modal', w, sw, sh, vp = tinymce.DOM.getViewPort(), u; + + // Default some options + s = s || {}; + p = p || {}; + sw = isOpera ? vp.w : screen.width; // Opera uses windows inside the Opera window + sh = isOpera ? vp.h : screen.height; + s.name = s.name || 'mc_' + new Date().getTime(); + s.width = parseInt(s.width || 320); + s.height = parseInt(s.height || 240); + s.resizable = true; + s.left = s.left || parseInt(sw / 2.0) - (s.width / 2.0); + s.top = s.top || parseInt(sh / 2.0) - (s.height / 2.0); + p.inline = false; + p.mce_width = s.width; + p.mce_height = s.height; + p.mce_auto_focus = s.auto_focus; + + if (mo) { + if (isIE) { + s.center = true; + s.help = false; + s.dialogWidth = s.width + 'px'; + s.dialogHeight = s.height + 'px'; + s.scroll = s.scrollbars || false; + } + } + + // Build features string + each(s, function(v, k) { + if (tinymce.is(v, 'boolean')) + v = v ? 'yes' : 'no'; + + if (!/^(name|url)$/.test(k)) { + if (isIE && mo) + f += (f ? ';' : '') + k + ':' + v; + else + f += (f ? ',' : '') + k + '=' + v; + } + }); + + t.features = s; + t.params = p; + t.onOpen.dispatch(t, s, p); + + u = s.url || s.file; + if (tinymce.relaxedDomain) + u += (u.indexOf('?') == -1 ? '?' : '&') + 'mce_rdomain=' + tinymce.relaxedDomain; + + u = tinymce._addVer(u); + + try { + if (isIE && mo) { + w = 1; + window.showModalDialog(u, window, f); + } else + w = window.open(u, s.name, f); + } catch (ex) { + // Ignore + } + + if (!w) + alert(t.editor.getLang('popup_blocked')); + }, + + close : function(w) { + w.close(); + this.onClose.dispatch(this); + }, + + createInstance : function(cl, a, b, c, d, e) { + var f = tinymce.resolve(cl); + + return new f(a, b, c, d, e); + }, + + confirm : function(t, cb, s, w) { + w = w || window; + + cb.call(s || this, w.confirm(this._decode(this.editor.getLang(t, t)))); + }, + + alert : function(tx, cb, s, w) { + var t = this; + + w = w || window; + w.alert(t._decode(t.editor.getLang(tx, tx))); + + if (cb) + cb.call(s || t); + }, + + // Internal functions + + _decode : function(s) { + return tinymce.DOM.decode(s).replace(/\\n/g, '\n'); + } + + }); +}()); \ No newline at end of file diff --git a/include/javascript/tiny_mce/utils/editable_selects.js b/include/javascript/tiny_mce/utils/editable_selects.js new file mode 100755 index 00000000..15a2a09d --- /dev/null +++ b/include/javascript/tiny_mce/utils/editable_selects.js @@ -0,0 +1,69 @@ +/** + + * + * Makes select boxes editable. + * + * @author Moxiecode + * @copyright Copyright 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +var TinyMCE_EditableSelects = { + editSelectElm : null, + + init : function() { + var nl = document.getElementsByTagName("select"), i, d = document, o; + + for (i=0; i'; + h += ''; + + return h; +} + +function updateColor(img_id, form_element_id) { + document.getElementById(img_id).style.backgroundColor = document.forms[0].elements[form_element_id].value; +} + +function setBrowserDisabled(id, state) { + var img = document.getElementById(id); + var lnk = document.getElementById(id + "_link"); + + if (lnk) { + if (state) { + lnk.setAttribute("realhref", lnk.getAttribute("href")); + lnk.removeAttribute("href"); + tinyMCEPopup.dom.addClass(img, 'disabled'); + } else { + if (lnk.getAttribute("realhref")) + lnk.setAttribute("href", lnk.getAttribute("realhref")); + + tinyMCEPopup.dom.removeClass(img, 'disabled'); + } + } +} + +function getBrowserHTML(id, target_form_element, type, prefix) { + var option = prefix + "_" + type + "_browser_callback", cb, html; + + cb = tinyMCEPopup.getParam(option, tinyMCEPopup.getParam("file_browser_callback")); + + if (!cb) + return ""; + + html = ""; + html += ''; + html += ''; + + return html; +} + +function openBrowser(img_id, target_form_element, type, option) { + var img = document.getElementById(img_id); + + if (img.className != "mceButtonDisabled") + tinyMCEPopup.openBrowser(target_form_element, type, option); +} + +function selectByValue(form_obj, field_name, value, add_custom, ignore_case) { + if (!form_obj || !form_obj.elements[field_name]) + return; + + var sel = form_obj.elements[field_name]; + + var found = false; + for (var i=0; i parseInt(v)) + st = this.mark(f, n); + } + } + + return st; + }, + + hasClass : function(n, c, d) { + return new RegExp('\\b' + c + (d ? '[0-9]+' : '') + '\\b', 'g').test(n.className); + }, + + getNum : function(n, c) { + c = n.className.match(new RegExp('\\b' + c + '([0-9]+)\\b', 'g'))[0]; + c = c.replace(/[^0-9]/g, ''); + + return c; + }, + + addClass : function(n, c, b) { + var o = this.removeClass(n, c); + n.className = b ? c + (o != '' ? (' ' + o) : '') : (o != '' ? (o + ' ') : '') + c; + }, + + removeClass : function(n, c) { + c = n.className.replace(new RegExp("(^|\\s+)" + c + "(\\s+|$)"), ' '); + return n.className = c != ' ' ? c : ''; + }, + + tags : function(f, s) { + return f.getElementsByTagName(s); + }, + + mark : function(f, n) { + var s = this.settings; + + this.addClass(n, s.invalid_cls); + this.markLabels(f, n, s.invalid_cls); + + return false; + }, + + markLabels : function(f, n, ic) { + var nl, i; + + nl = this.tags(f, "label"); + for (i=0; i0)?F:0;}if(C in D&&!("style" in D&&C in D.style)){D[C]=F;}else{B.Dom.setStyle(D,C,F+E);}},getAttribute:function(C){var E=this.getEl();var G=B.Dom.getStyle(E,C);if(G!=="auto"&&!this.patterns.offsetUnit.test(G)){return parseFloat(G);}var D=this.patterns.offsetAttribute.exec(C)||[];var H=!!(D[3]);var F=!!(D[2]);if("style" in E){if(F||(B.Dom.getStyle(E,"position")=="absolute"&&H)){G=E["offset"+D[0].charAt(0).toUpperCase()+D[0].substr(1)];}else{G=0;}}else{if(C in E){G=E[C];}}return G;},getDefaultUnit:function(C){if(this.patterns.defaultUnit.test(C)){return"px";}return"";},setRuntimeAttribute:function(D){var I;var E;var F=this.attributes;this.runtimeAttributes[D]={};var H=function(J){return(typeof J!=="undefined");};if(!H(F[D]["to"])&&!H(F[D]["by"])){return false;}I=(H(F[D]["from"]))?F[D]["from"]:this.getAttribute(D);if(H(F[D]["to"])){E=F[D]["to"];}else{if(H(F[D]["by"])){if(I.constructor==Array){E=[];for(var G=0,C=I.length;G0&&isFinite(K)){if(G.currentFrame+K>=J){K=J-(I+1);}G.currentFrame+=K;}};this._queue=B;this._getIndex=E;};YAHOO.util.Bezier=new function(){this.getPosition=function(E,D){var F=E.length;var C=[];for(var B=0;B0&&!(L[0] instanceof Array)){L=[L];}else{var K=[];for(M=0,O=L.length;M0){this.runtimeAttributes[P]=this.runtimeAttributes[P].concat(L);}this.runtimeAttributes[P][this.runtimeAttributes[P].length]=I;}else{F.setRuntimeAttribute.call(this,P);}};var B=function(G,I){var H=E.Dom.getXY(this.getEl());G=[G[0]-H[0]+I[0],G[1]-H[1]+I[1]];return G;};var D=function(G){return(typeof G!=="undefined");};E.Motion=A;})();(function(){var D=function(F,E,G,H){if(F){D.superclass.constructor.call(this,F,E,G,H);}};D.NAME="Scroll";var B=YAHOO.util;YAHOO.extend(D,B.ColorAnim);var C=D.superclass;var A=D.prototype;A.doMethod=function(E,H,F){var G=null;if(E=="scroll"){G=[this.method(this.currentFrame,H[0],F[0]-H[0],this.totalFrames),this.method(this.currentFrame,H[1],F[1]-H[1],this.totalFrames)];}else{G=C.doMethod.call(this,E,H,F);}return G;};A.getAttribute=function(E){var G=null;var F=this.getEl();if(E=="scroll"){G=[F.scrollLeft,F.scrollTop];}else{G=C.getAttribute.call(this,E);}return G;};A.setAttribute=function(E,H,G){var F=this.getEl();if(E=="scroll"){F.scrollLeft=H[0];F.scrollTop=H[1];}else{C.setAttribute.call(this,E,H,G);}};B.Scroll=D;})();YAHOO.register("animation",YAHOO.util.Anim,{version:"2.8.0r4",build:"2449"}); \ No newline at end of file diff --git a/include/javascript/yui/build/animation/animation.js b/include/javascript/yui/build/animation/animation.js new file mode 100755 index 00000000..5737b68b --- /dev/null +++ b/include/javascript/yui/build/animation/animation.js @@ -0,0 +1,1392 @@ +/* +Copyright (c) 2009, Yahoo! Inc. All rights reserved. +Code licensed under the BSD License: +http://developer.yahoo.net/yui/license.txt +version: 2.8.0r4 +*/ +(function() { + +var Y = YAHOO.util; + +/* +Copyright (c) 2006, Yahoo! Inc. All rights reserved. +Code licensed under the BSD License: +http://developer.yahoo.net/yui/license.txt +*/ + +/** + * The animation module provides allows effects to be added to HTMLElements. + * @module animation + * @requires yahoo, event, dom + */ + +/** + * + * Base animation class that provides the interface for building animated effects. + *

    Usage: var myAnim = new YAHOO.util.Anim(el, { width: { from: 10, to: 100 } }, 1, YAHOO.util.Easing.easeOut);

    + * @class Anim + * @namespace YAHOO.util + * @requires YAHOO.util.AnimMgr + * @requires YAHOO.util.Easing + * @requires YAHOO.util.Dom + * @requires YAHOO.util.Event + * @requires YAHOO.util.CustomEvent + * @constructor + * @param {String | HTMLElement} el Reference to the element that will be animated + * @param {Object} attributes The attribute(s) to be animated. + * Each attribute is an object with at minimum a "to" or "by" member defined. + * Additional optional members are "from" (defaults to current value), "units" (defaults to "px"). + * All attribute names use camelCase. + * @param {Number} duration (optional, defaults to 1 second) Length of animation (frames or seconds), defaults to time-based + * @param {Function} method (optional, defaults to YAHOO.util.Easing.easeNone) Computes the values that are applied to the attributes per frame (generally a YAHOO.util.Easing method) + */ + +var Anim = function(el, attributes, duration, method) { + if (!el) { + } + this.init(el, attributes, duration, method); +}; + +Anim.NAME = 'Anim'; + +Anim.prototype = { + /** + * Provides a readable name for the Anim instance. + * @method toString + * @return {String} + */ + toString: function() { + var el = this.getEl() || {}; + var id = el.id || el.tagName; + return (this.constructor.NAME + ': ' + id); + }, + + patterns: { // cached for performance + noNegatives: /width|height|opacity|padding/i, // keep at zero or above + offsetAttribute: /^((width|height)|(top|left))$/, // use offsetValue as default + defaultUnit: /width|height|top$|bottom$|left$|right$/i, // use 'px' by default + offsetUnit: /\d+(em|%|en|ex|pt|in|cm|mm|pc)$/i // IE may return these, so convert these to offset + }, + + /** + * Returns the value computed by the animation's "method". + * @method doMethod + * @param {String} attr The name of the attribute. + * @param {Number} start The value this attribute should start from for this animation. + * @param {Number} end The value this attribute should end at for this animation. + * @return {Number} The Value to be applied to the attribute. + */ + doMethod: function(attr, start, end) { + return this.method(this.currentFrame, start, end - start, this.totalFrames); + }, + + /** + * Applies a value to an attribute. + * @method setAttribute + * @param {String} attr The name of the attribute. + * @param {Number} val The value to be applied to the attribute. + * @param {String} unit The unit ('px', '%', etc.) of the value. + */ + setAttribute: function(attr, val, unit) { + var el = this.getEl(); + if ( this.patterns.noNegatives.test(attr) ) { + val = (val > 0) ? val : 0; + } + + if (attr in el && !('style' in el && attr in el.style)) { + el[attr] = val; + } else { + Y.Dom.setStyle(el, attr, val + unit); + } + }, + + /** + * Returns current value of the attribute. + * @method getAttribute + * @param {String} attr The name of the attribute. + * @return {Number} val The current value of the attribute. + */ + getAttribute: function(attr) { + var el = this.getEl(); + var val = Y.Dom.getStyle(el, attr); + + if (val !== 'auto' && !this.patterns.offsetUnit.test(val)) { + return parseFloat(val); + } + + var a = this.patterns.offsetAttribute.exec(attr) || []; + var pos = !!( a[3] ); // top or left + var box = !!( a[2] ); // width or height + + if ('style' in el) { + // use offsets for width/height and abs pos top/left + if ( box || (Y.Dom.getStyle(el, 'position') == 'absolute' && pos) ) { + val = el['offset' + a[0].charAt(0).toUpperCase() + a[0].substr(1)]; + } else { // default to zero for other 'auto' + val = 0; + } + } else if (attr in el) { + val = el[attr]; + } + + return val; + }, + + /** + * Returns the unit to use when none is supplied. + * @method getDefaultUnit + * @param {attr} attr The name of the attribute. + * @return {String} The default unit to be used. + */ + getDefaultUnit: function(attr) { + if ( this.patterns.defaultUnit.test(attr) ) { + return 'px'; + } + + return ''; + }, + + /** + * Sets the actual values to be used during the animation. Should only be needed for subclass use. + * @method setRuntimeAttribute + * @param {Object} attr The attribute object + * @private + */ + setRuntimeAttribute: function(attr) { + var start; + var end; + var attributes = this.attributes; + + this.runtimeAttributes[attr] = {}; + + var isset = function(prop) { + return (typeof prop !== 'undefined'); + }; + + if ( !isset(attributes[attr]['to']) && !isset(attributes[attr]['by']) ) { + return false; // note return; nothing to animate to + } + + start = ( isset(attributes[attr]['from']) ) ? attributes[attr]['from'] : this.getAttribute(attr); + + // To beats by, per SMIL 2.1 spec + if ( isset(attributes[attr]['to']) ) { + end = attributes[attr]['to']; + } else if ( isset(attributes[attr]['by']) ) { + if (start.constructor == Array) { + end = []; + for (var i = 0, len = start.length; i < len; ++i) { + end[i] = start[i] + attributes[attr]['by'][i] * 1; // times 1 to cast "by" + } + } else { + end = start + attributes[attr]['by'] * 1; + } + } + + this.runtimeAttributes[attr].start = start; + this.runtimeAttributes[attr].end = end; + + // set units if needed + this.runtimeAttributes[attr].unit = ( isset(attributes[attr].unit) ) ? + attributes[attr]['unit'] : this.getDefaultUnit(attr); + return true; + }, + + /** + * Constructor for Anim instance. + * @method init + * @param {String | HTMLElement} el Reference to the element that will be animated + * @param {Object} attributes The attribute(s) to be animated. + * Each attribute is an object with at minimum a "to" or "by" member defined. + * Additional optional members are "from" (defaults to current value), "units" (defaults to "px"). + * All attribute names use camelCase. + * @param {Number} duration (optional, defaults to 1 second) Length of animation (frames or seconds), defaults to time-based + * @param {Function} method (optional, defaults to YAHOO.util.Easing.easeNone) Computes the values that are applied to the attributes per frame (generally a YAHOO.util.Easing method) + */ + init: function(el, attributes, duration, method) { + /** + * Whether or not the animation is running. + * @property isAnimated + * @private + * @type Boolean + */ + var isAnimated = false; + + /** + * A Date object that is created when the animation begins. + * @property startTime + * @private + * @type Date + */ + var startTime = null; + + /** + * The number of frames this animation was able to execute. + * @property actualFrames + * @private + * @type Int + */ + var actualFrames = 0; + + /** + * The element to be animated. + * @property el + * @private + * @type HTMLElement + */ + el = Y.Dom.get(el); + + /** + * The collection of attributes to be animated. + * Each attribute must have at least a "to" or "by" defined in order to animate. + * If "to" is supplied, the animation will end with the attribute at that value. + * If "by" is supplied, the animation will end at that value plus its starting value. + * If both are supplied, "to" is used, and "by" is ignored. + * Optional additional member include "from" (the value the attribute should start animating from, defaults to current value), and "unit" (the units to apply to the values). + * @property attributes + * @type Object + */ + this.attributes = attributes || {}; + + /** + * The length of the animation. Defaults to "1" (second). + * @property duration + * @type Number + */ + this.duration = !YAHOO.lang.isUndefined(duration) ? duration : 1; + + /** + * The method that will provide values to the attribute(s) during the animation. + * Defaults to "YAHOO.util.Easing.easeNone". + * @property method + * @type Function + */ + this.method = method || Y.Easing.easeNone; + + /** + * Whether or not the duration should be treated as seconds. + * Defaults to true. + * @property useSeconds + * @type Boolean + */ + this.useSeconds = true; // default to seconds + + /** + * The location of the current animation on the timeline. + * In time-based animations, this is used by AnimMgr to ensure the animation finishes on time. + * @property currentFrame + * @type Int + */ + this.currentFrame = 0; + + /** + * The total number of frames to be executed. + * In time-based animations, this is used by AnimMgr to ensure the animation finishes on time. + * @property totalFrames + * @type Int + */ + this.totalFrames = Y.AnimMgr.fps; + + /** + * Changes the animated element + * @method setEl + */ + this.setEl = function(element) { + el = Y.Dom.get(element); + }; + + /** + * Returns a reference to the animated element. + * @method getEl + * @return {HTMLElement} + */ + this.getEl = function() { return el; }; + + /** + * Checks whether the element is currently animated. + * @method isAnimated + * @return {Boolean} current value of isAnimated. + */ + this.isAnimated = function() { + return isAnimated; + }; + + /** + * Returns the animation start time. + * @method getStartTime + * @return {Date} current value of startTime. + */ + this.getStartTime = function() { + return startTime; + }; + + this.runtimeAttributes = {}; + + + + /** + * Starts the animation by registering it with the animation manager. + * @method animate + */ + this.animate = function() { + if ( this.isAnimated() ) { + return false; + } + + this.currentFrame = 0; + + this.totalFrames = ( this.useSeconds ) ? Math.ceil(Y.AnimMgr.fps * this.duration) : this.duration; + + if (this.duration === 0 && this.useSeconds) { // jump to last frame if zero second duration + this.totalFrames = 1; + } + Y.AnimMgr.registerElement(this); + return true; + }; + + /** + * Stops the animation. Normally called by AnimMgr when animation completes. + * @method stop + * @param {Boolean} finish (optional) If true, animation will jump to final frame. + */ + this.stop = function(finish) { + if (!this.isAnimated()) { // nothing to stop + return false; + } + + if (finish) { + this.currentFrame = this.totalFrames; + this._onTween.fire(); + } + Y.AnimMgr.stop(this); + }; + + var onStart = function() { + this.onStart.fire(); + + this.runtimeAttributes = {}; + for (var attr in this.attributes) { + this.setRuntimeAttribute(attr); + } + + isAnimated = true; + actualFrames = 0; + startTime = new Date(); + }; + + /** + * Feeds the starting and ending values for each animated attribute to doMethod once per frame, then applies the resulting value to the attribute(s). + * @private + */ + + var onTween = function() { + var data = { + duration: new Date() - this.getStartTime(), + currentFrame: this.currentFrame + }; + + data.toString = function() { + return ( + 'duration: ' + data.duration + + ', currentFrame: ' + data.currentFrame + ); + }; + + this.onTween.fire(data); + + var runtimeAttributes = this.runtimeAttributes; + + for (var attr in runtimeAttributes) { + this.setAttribute(attr, this.doMethod(attr, runtimeAttributes[attr].start, runtimeAttributes[attr].end), runtimeAttributes[attr].unit); + } + + actualFrames += 1; + }; + + var onComplete = function() { + var actual_duration = (new Date() - startTime) / 1000 ; + + var data = { + duration: actual_duration, + frames: actualFrames, + fps: actualFrames / actual_duration + }; + + data.toString = function() { + return ( + 'duration: ' + data.duration + + ', frames: ' + data.frames + + ', fps: ' + data.fps + ); + }; + + isAnimated = false; + actualFrames = 0; + this.onComplete.fire(data); + }; + + /** + * Custom event that fires after onStart, useful in subclassing + * @private + */ + this._onStart = new Y.CustomEvent('_start', this, true); + + /** + * Custom event that fires when animation begins + * Listen via subscribe method (e.g. myAnim.onStart.subscribe(someFunction) + * @event onStart + */ + this.onStart = new Y.CustomEvent('start', this); + + /** + * Custom event that fires between each frame + * Listen via subscribe method (e.g. myAnim.onTween.subscribe(someFunction) + * @event onTween + */ + this.onTween = new Y.CustomEvent('tween', this); + + /** + * Custom event that fires after onTween + * @private + */ + this._onTween = new Y.CustomEvent('_tween', this, true); + + /** + * Custom event that fires when animation ends + * Listen via subscribe method (e.g. myAnim.onComplete.subscribe(someFunction) + * @event onComplete + */ + this.onComplete = new Y.CustomEvent('complete', this); + /** + * Custom event that fires after onComplete + * @private + */ + this._onComplete = new Y.CustomEvent('_complete', this, true); + + this._onStart.subscribe(onStart); + this._onTween.subscribe(onTween); + this._onComplete.subscribe(onComplete); + } +}; + + Y.Anim = Anim; +})(); +/** + * Handles animation queueing and threading. + * Used by Anim and subclasses. + * @class AnimMgr + * @namespace YAHOO.util + */ +YAHOO.util.AnimMgr = new function() { + /** + * Reference to the animation Interval. + * @property thread + * @private + * @type Int + */ + var thread = null; + + /** + * The current queue of registered animation objects. + * @property queue + * @private + * @type Array + */ + var queue = []; + + /** + * The number of active animations. + * @property tweenCount + * @private + * @type Int + */ + var tweenCount = 0; + + /** + * Base frame rate (frames per second). + * Arbitrarily high for better x-browser calibration (slower browsers drop more frames). + * @property fps + * @type Int + * + */ + this.fps = 1000; + + /** + * Interval delay in milliseconds, defaults to fastest possible. + * @property delay + * @type Int + * + */ + this.delay = 1; + + /** + * Adds an animation instance to the animation queue. + * All animation instances must be registered in order to animate. + * @method registerElement + * @param {object} tween The Anim instance to be be registered + */ + this.registerElement = function(tween) { + queue[queue.length] = tween; + tweenCount += 1; + tween._onStart.fire(); + this.start(); + }; + + /** + * removes an animation instance from the animation queue. + * All animation instances must be registered in order to animate. + * @method unRegister + * @param {object} tween The Anim instance to be be registered + * @param {Int} index The index of the Anim instance + * @private + */ + this.unRegister = function(tween, index) { + index = index || getIndex(tween); + if (!tween.isAnimated() || index === -1) { + return false; + } + + tween._onComplete.fire(); + queue.splice(index, 1); + + tweenCount -= 1; + if (tweenCount <= 0) { + this.stop(); + } + + return true; + }; + + /** + * Starts the animation thread. + * Only one thread can run at a time. + * @method start + */ + this.start = function() { + if (thread === null) { + thread = setInterval(this.run, this.delay); + } + }; + + /** + * Stops the animation thread or a specific animation instance. + * @method stop + * @param {object} tween A specific Anim instance to stop (optional) + * If no instance given, Manager stops thread and all animations. + */ + this.stop = function(tween) { + if (!tween) { + clearInterval(thread); + + for (var i = 0, len = queue.length; i < len; ++i) { + this.unRegister(queue[0], 0); + } + + queue = []; + thread = null; + tweenCount = 0; + } + else { + this.unRegister(tween); + } + }; + + /** + * Called per Interval to handle each animation frame. + * @method run + */ + this.run = function() { + for (var i = 0, len = queue.length; i < len; ++i) { + var tween = queue[i]; + if ( !tween || !tween.isAnimated() ) { continue; } + + if (tween.currentFrame < tween.totalFrames || tween.totalFrames === null) + { + tween.currentFrame += 1; + + if (tween.useSeconds) { + correctFrame(tween); + } + tween._onTween.fire(); + } + else { YAHOO.util.AnimMgr.stop(tween, i); } + } + }; + + var getIndex = function(anim) { + for (var i = 0, len = queue.length; i < len; ++i) { + if (queue[i] === anim) { + return i; // note return; + } + } + return -1; + }; + + /** + * On the fly frame correction to keep animation on time. + * @method correctFrame + * @private + * @param {Object} tween The Anim instance being corrected. + */ + var correctFrame = function(tween) { + var frames = tween.totalFrames; + var frame = tween.currentFrame; + var expected = (tween.currentFrame * tween.duration * 1000 / tween.totalFrames); + var elapsed = (new Date() - tween.getStartTime()); + var tweak = 0; + + if (elapsed < tween.duration * 1000) { // check if falling behind + tweak = Math.round((elapsed / expected - 1) * tween.currentFrame); + } else { // went over duration, so jump to end + tweak = frames - (frame + 1); + } + if (tweak > 0 && isFinite(tweak)) { // adjust if needed + if (tween.currentFrame + tweak >= frames) {// dont go past last frame + tweak = frames - (frame + 1); + } + + tween.currentFrame += tweak; + } + }; + this._queue = queue; + this._getIndex = getIndex; +}; +/** + * Used to calculate Bezier splines for any number of control points. + * @class Bezier + * @namespace YAHOO.util + * + */ +YAHOO.util.Bezier = new function() { + /** + * Get the current position of the animated element based on t. + * Each point is an array of "x" and "y" values (0 = x, 1 = y) + * At least 2 points are required (start and end). + * First point is start. Last point is end. + * Additional control points are optional. + * @method getPosition + * @param {Array} points An array containing Bezier points + * @param {Number} t A number between 0 and 1 which is the basis for determining current position + * @return {Array} An array containing int x and y member data + */ + this.getPosition = function(points, t) { + var n = points.length; + var tmp = []; + + for (var i = 0; i < n; ++i){ + tmp[i] = [points[i][0], points[i][1]]; // save input + } + + for (var j = 1; j < n; ++j) { + for (i = 0; i < n - j; ++i) { + tmp[i][0] = (1 - t) * tmp[i][0] + t * tmp[parseInt(i + 1, 10)][0]; + tmp[i][1] = (1 - t) * tmp[i][1] + t * tmp[parseInt(i + 1, 10)][1]; + } + } + + return [ tmp[0][0], tmp[0][1] ]; + + }; +}; +(function() { +/** + * Anim subclass for color transitions. + *

    Usage: var myAnim = new Y.ColorAnim(el, { backgroundColor: { from: '#FF0000', to: '#FFFFFF' } }, 1, Y.Easing.easeOut); Color values can be specified with either 112233, #112233, + * [255,255,255], or rgb(255,255,255)

    + * @class ColorAnim + * @namespace YAHOO.util + * @requires YAHOO.util.Anim + * @requires YAHOO.util.AnimMgr + * @requires YAHOO.util.Easing + * @requires YAHOO.util.Bezier + * @requires YAHOO.util.Dom + * @requires YAHOO.util.Event + * @constructor + * @extends YAHOO.util.Anim + * @param {HTMLElement | String} el Reference to the element that will be animated + * @param {Object} attributes The attribute(s) to be animated. + * Each attribute is an object with at minimum a "to" or "by" member defined. + * Additional optional members are "from" (defaults to current value), "units" (defaults to "px"). + * All attribute names use camelCase. + * @param {Number} duration (optional, defaults to 1 second) Length of animation (frames or seconds), defaults to time-based + * @param {Function} method (optional, defaults to YAHOO.util.Easing.easeNone) Computes the values that are applied to the attributes per frame (generally a YAHOO.util.Easing method) + */ + var ColorAnim = function(el, attributes, duration, method) { + ColorAnim.superclass.constructor.call(this, el, attributes, duration, method); + }; + + ColorAnim.NAME = 'ColorAnim'; + + ColorAnim.DEFAULT_BGCOLOR = '#fff'; + // shorthand + var Y = YAHOO.util; + YAHOO.extend(ColorAnim, Y.Anim); + + var superclass = ColorAnim.superclass; + var proto = ColorAnim.prototype; + + proto.patterns.color = /color$/i; + proto.patterns.rgb = /^rgb\(([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\)$/i; + proto.patterns.hex = /^#?([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{2})$/i; + proto.patterns.hex3 = /^#?([0-9A-F]{1})([0-9A-F]{1})([0-9A-F]{1})$/i; + proto.patterns.transparent = /^transparent|rgba\(0, 0, 0, 0\)$/; // need rgba for safari + + /** + * Attempts to parse the given string and return a 3-tuple. + * @method parseColor + * @param {String} s The string to parse. + * @return {Array} The 3-tuple of rgb values. + */ + proto.parseColor = function(s) { + if (s.length == 3) { return s; } + + var c = this.patterns.hex.exec(s); + if (c && c.length == 4) { + return [ parseInt(c[1], 16), parseInt(c[2], 16), parseInt(c[3], 16) ]; + } + + c = this.patterns.rgb.exec(s); + if (c && c.length == 4) { + return [ parseInt(c[1], 10), parseInt(c[2], 10), parseInt(c[3], 10) ]; + } + + c = this.patterns.hex3.exec(s); + if (c && c.length == 4) { + return [ parseInt(c[1] + c[1], 16), parseInt(c[2] + c[2], 16), parseInt(c[3] + c[3], 16) ]; + } + + return null; + }; + + proto.getAttribute = function(attr) { + var el = this.getEl(); + if (this.patterns.color.test(attr) ) { + var val = YAHOO.util.Dom.getStyle(el, attr); + + var that = this; + if (this.patterns.transparent.test(val)) { // bgcolor default + var parent = YAHOO.util.Dom.getAncestorBy(el, function(node) { + return !that.patterns.transparent.test(val); + }); + + if (parent) { + val = Y.Dom.getStyle(parent, attr); + } else { + val = ColorAnim.DEFAULT_BGCOLOR; + } + } + } else { + val = superclass.getAttribute.call(this, attr); + } + + return val; + }; + + proto.doMethod = function(attr, start, end) { + var val; + + if ( this.patterns.color.test(attr) ) { + val = []; + for (var i = 0, len = start.length; i < len; ++i) { + val[i] = superclass.doMethod.call(this, attr, start[i], end[i]); + } + + val = 'rgb('+Math.floor(val[0])+','+Math.floor(val[1])+','+Math.floor(val[2])+')'; + } + else { + val = superclass.doMethod.call(this, attr, start, end); + } + + return val; + }; + + proto.setRuntimeAttribute = function(attr) { + superclass.setRuntimeAttribute.call(this, attr); + + if ( this.patterns.color.test(attr) ) { + var attributes = this.attributes; + var start = this.parseColor(this.runtimeAttributes[attr].start); + var end = this.parseColor(this.runtimeAttributes[attr].end); + // fix colors if going "by" + if ( typeof attributes[attr]['to'] === 'undefined' && typeof attributes[attr]['by'] !== 'undefined' ) { + end = this.parseColor(attributes[attr].by); + + for (var i = 0, len = start.length; i < len; ++i) { + end[i] = start[i] + end[i]; + } + } + + this.runtimeAttributes[attr].start = start; + this.runtimeAttributes[attr].end = end; + } + }; + + Y.ColorAnim = ColorAnim; +})(); +/*! +TERMS OF USE - EASING EQUATIONS +Open source under the BSD License. +Copyright 2001 Robert Penner All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + * Neither the name of the author nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/** + * Singleton that determines how an animation proceeds from start to end. + * @class Easing + * @namespace YAHOO.util +*/ + +YAHOO.util.Easing = { + + /** + * Uniform speed between points. + * @method easeNone + * @param {Number} t Time value used to compute current value + * @param {Number} b Starting value + * @param {Number} c Delta between start and end values + * @param {Number} d Total length of animation + * @return {Number} The computed value for the current animation frame + */ + easeNone: function (t, b, c, d) { + return c*t/d + b; + }, + + /** + * Begins slowly and accelerates towards end. + * @method easeIn + * @param {Number} t Time value used to compute current value + * @param {Number} b Starting value + * @param {Number} c Delta between start and end values + * @param {Number} d Total length of animation + * @return {Number} The computed value for the current animation frame + */ + easeIn: function (t, b, c, d) { + return c*(t/=d)*t + b; + }, + + /** + * Begins quickly and decelerates towards end. + * @method easeOut + * @param {Number} t Time value used to compute current value + * @param {Number} b Starting value + * @param {Number} c Delta between start and end values + * @param {Number} d Total length of animation + * @return {Number} The computed value for the current animation frame + */ + easeOut: function (t, b, c, d) { + return -c *(t/=d)*(t-2) + b; + }, + + /** + * Begins slowly and decelerates towards end. + * @method easeBoth + * @param {Number} t Time value used to compute current value + * @param {Number} b Starting value + * @param {Number} c Delta between start and end values + * @param {Number} d Total length of animation + * @return {Number} The computed value for the current animation frame + */ + easeBoth: function (t, b, c, d) { + if ((t/=d/2) < 1) { + return c/2*t*t + b; + } + + return -c/2 * ((--t)*(t-2) - 1) + b; + }, + + /** + * Begins slowly and accelerates towards end. + * @method easeInStrong + * @param {Number} t Time value used to compute current value + * @param {Number} b Starting value + * @param {Number} c Delta between start and end values + * @param {Number} d Total length of animation + * @return {Number} The computed value for the current animation frame + */ + easeInStrong: function (t, b, c, d) { + return c*(t/=d)*t*t*t + b; + }, + + /** + * Begins quickly and decelerates towards end. + * @method easeOutStrong + * @param {Number} t Time value used to compute current value + * @param {Number} b Starting value + * @param {Number} c Delta between start and end values + * @param {Number} d Total length of animation + * @return {Number} The computed value for the current animation frame + */ + easeOutStrong: function (t, b, c, d) { + return -c * ((t=t/d-1)*t*t*t - 1) + b; + }, + + /** + * Begins slowly and decelerates towards end. + * @method easeBothStrong + * @param {Number} t Time value used to compute current value + * @param {Number} b Starting value + * @param {Number} c Delta between start and end values + * @param {Number} d Total length of animation + * @return {Number} The computed value for the current animation frame + */ + easeBothStrong: function (t, b, c, d) { + if ((t/=d/2) < 1) { + return c/2*t*t*t*t + b; + } + + return -c/2 * ((t-=2)*t*t*t - 2) + b; + }, + + /** + * Snap in elastic effect. + * @method elasticIn + * @param {Number} t Time value used to compute current value + * @param {Number} b Starting value + * @param {Number} c Delta between start and end values + * @param {Number} d Total length of animation + * @param {Number} a Amplitude (optional) + * @param {Number} p Period (optional) + * @return {Number} The computed value for the current animation frame + */ + + elasticIn: function (t, b, c, d, a, p) { + if (t == 0) { + return b; + } + if ( (t /= d) == 1 ) { + return b+c; + } + if (!p) { + p=d*.3; + } + + if (!a || a < Math.abs(c)) { + a = c; + var s = p/4; + } + else { + var s = p/(2*Math.PI) * Math.asin (c/a); + } + + return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; + }, + + /** + * Snap out elastic effect. + * @method elasticOut + * @param {Number} t Time value used to compute current value + * @param {Number} b Starting value + * @param {Number} c Delta between start and end values + * @param {Number} d Total length of animation + * @param {Number} a Amplitude (optional) + * @param {Number} p Period (optional) + * @return {Number} The computed value for the current animation frame + */ + elasticOut: function (t, b, c, d, a, p) { + if (t == 0) { + return b; + } + if ( (t /= d) == 1 ) { + return b+c; + } + if (!p) { + p=d*.3; + } + + if (!a || a < Math.abs(c)) { + a = c; + var s = p / 4; + } + else { + var s = p/(2*Math.PI) * Math.asin (c/a); + } + + return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b; + }, + + /** + * Snap both elastic effect. + * @method elasticBoth + * @param {Number} t Time value used to compute current value + * @param {Number} b Starting value + * @param {Number} c Delta between start and end values + * @param {Number} d Total length of animation + * @param {Number} a Amplitude (optional) + * @param {Number} p Period (optional) + * @return {Number} The computed value for the current animation frame + */ + elasticBoth: function (t, b, c, d, a, p) { + if (t == 0) { + return b; + } + + if ( (t /= d/2) == 2 ) { + return b+c; + } + + if (!p) { + p = d*(.3*1.5); + } + + if ( !a || a < Math.abs(c) ) { + a = c; + var s = p/4; + } + else { + var s = p/(2*Math.PI) * Math.asin (c/a); + } + + if (t < 1) { + return -.5*(a*Math.pow(2,10*(t-=1)) * + Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; + } + return a*Math.pow(2,-10*(t-=1)) * + Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b; + }, + + + /** + * Backtracks slightly, then reverses direction and moves to end. + * @method backIn + * @param {Number} t Time value used to compute current value + * @param {Number} b Starting value + * @param {Number} c Delta between start and end values + * @param {Number} d Total length of animation + * @param {Number} s Overshoot (optional) + * @return {Number} The computed value for the current animation frame + */ + backIn: function (t, b, c, d, s) { + if (typeof s == 'undefined') { + s = 1.70158; + } + return c*(t/=d)*t*((s+1)*t - s) + b; + }, + + /** + * Overshoots end, then reverses and comes back to end. + * @method backOut + * @param {Number} t Time value used to compute current value + * @param {Number} b Starting value + * @param {Number} c Delta between start and end values + * @param {Number} d Total length of animation + * @param {Number} s Overshoot (optional) + * @return {Number} The computed value for the current animation frame + */ + backOut: function (t, b, c, d, s) { + if (typeof s == 'undefined') { + s = 1.70158; + } + return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b; + }, + + /** + * Backtracks slightly, then reverses direction, overshoots end, + * then reverses and comes back to end. + * @method backBoth + * @param {Number} t Time value used to compute current value + * @param {Number} b Starting value + * @param {Number} c Delta between start and end values + * @param {Number} d Total length of animation + * @param {Number} s Overshoot (optional) + * @return {Number} The computed value for the current animation frame + */ + backBoth: function (t, b, c, d, s) { + if (typeof s == 'undefined') { + s = 1.70158; + } + + if ((t /= d/2 ) < 1) { + return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b; + } + return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b; + }, + + /** + * Bounce off of start. + * @method bounceIn + * @param {Number} t Time value used to compute current value + * @param {Number} b Starting value + * @param {Number} c Delta between start and end values + * @param {Number} d Total length of animation + * @return {Number} The computed value for the current animation frame + */ + bounceIn: function (t, b, c, d) { + return c - YAHOO.util.Easing.bounceOut(d-t, 0, c, d) + b; + }, + + /** + * Bounces off end. + * @method bounceOut + * @param {Number} t Time value used to compute current value + * @param {Number} b Starting value + * @param {Number} c Delta between start and end values + * @param {Number} d Total length of animation + * @return {Number} The computed value for the current animation frame + */ + bounceOut: function (t, b, c, d) { + if ((t/=d) < (1/2.75)) { + return c*(7.5625*t*t) + b; + } else if (t < (2/2.75)) { + return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b; + } else if (t < (2.5/2.75)) { + return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b; + } + return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b; + }, + + /** + * Bounces off start and end. + * @method bounceBoth + * @param {Number} t Time value used to compute current value + * @param {Number} b Starting value + * @param {Number} c Delta between start and end values + * @param {Number} d Total length of animation + * @return {Number} The computed value for the current animation frame + */ + bounceBoth: function (t, b, c, d) { + if (t < d/2) { + return YAHOO.util.Easing.bounceIn(t*2, 0, c, d) * .5 + b; + } + return YAHOO.util.Easing.bounceOut(t*2-d, 0, c, d) * .5 + c*.5 + b; + } +}; + +(function() { +/** + * Anim subclass for moving elements along a path defined by the "points" + * member of "attributes". All "points" are arrays with x, y coordinates. + *

    Usage: var myAnim = new YAHOO.util.Motion(el, { points: { to: [800, 800] } }, 1, YAHOO.util.Easing.easeOut);

    + * @class Motion + * @namespace YAHOO.util + * @requires YAHOO.util.Anim + * @requires YAHOO.util.AnimMgr + * @requires YAHOO.util.Easing + * @requires YAHOO.util.Bezier + * @requires YAHOO.util.Dom + * @requires YAHOO.util.Event + * @requires YAHOO.util.CustomEvent + * @constructor + * @extends YAHOO.util.ColorAnim + * @param {String | HTMLElement} el Reference to the element that will be animated + * @param {Object} attributes The attribute(s) to be animated. + * Each attribute is an object with at minimum a "to" or "by" member defined. + * Additional optional members are "from" (defaults to current value), "units" (defaults to "px"). + * All attribute names use camelCase. + * @param {Number} duration (optional, defaults to 1 second) Length of animation (frames or seconds), defaults to time-based + * @param {Function} method (optional, defaults to YAHOO.util.Easing.easeNone) Computes the values that are applied to the attributes per frame (generally a YAHOO.util.Easing method) + */ + var Motion = function(el, attributes, duration, method) { + if (el) { // dont break existing subclasses not using YAHOO.extend + Motion.superclass.constructor.call(this, el, attributes, duration, method); + } + }; + + + Motion.NAME = 'Motion'; + + // shorthand + var Y = YAHOO.util; + YAHOO.extend(Motion, Y.ColorAnim); + + var superclass = Motion.superclass; + var proto = Motion.prototype; + + proto.patterns.points = /^points$/i; + + proto.setAttribute = function(attr, val, unit) { + if ( this.patterns.points.test(attr) ) { + unit = unit || 'px'; + superclass.setAttribute.call(this, 'left', val[0], unit); + superclass.setAttribute.call(this, 'top', val[1], unit); + } else { + superclass.setAttribute.call(this, attr, val, unit); + } + }; + + proto.getAttribute = function(attr) { + if ( this.patterns.points.test(attr) ) { + var val = [ + superclass.getAttribute.call(this, 'left'), + superclass.getAttribute.call(this, 'top') + ]; + } else { + val = superclass.getAttribute.call(this, attr); + } + + return val; + }; + + proto.doMethod = function(attr, start, end) { + var val = null; + + if ( this.patterns.points.test(attr) ) { + var t = this.method(this.currentFrame, 0, 100, this.totalFrames) / 100; + val = Y.Bezier.getPosition(this.runtimeAttributes[attr], t); + } else { + val = superclass.doMethod.call(this, attr, start, end); + } + return val; + }; + + proto.setRuntimeAttribute = function(attr) { + if ( this.patterns.points.test(attr) ) { + var el = this.getEl(); + var attributes = this.attributes; + var start; + var control = attributes['points']['control'] || []; + var end; + var i, len; + + if (control.length > 0 && !(control[0] instanceof Array) ) { // could be single point or array of points + control = [control]; + } else { // break reference to attributes.points.control + var tmp = []; + for (i = 0, len = control.length; i< len; ++i) { + tmp[i] = control[i]; + } + control = tmp; + } + + if (Y.Dom.getStyle(el, 'position') == 'static') { // default to relative + Y.Dom.setStyle(el, 'position', 'relative'); + } + + if ( isset(attributes['points']['from']) ) { + Y.Dom.setXY(el, attributes['points']['from']); // set position to from point + } + else { Y.Dom.setXY( el, Y.Dom.getXY(el) ); } // set it to current position + + start = this.getAttribute('points'); // get actual top & left + + // TO beats BY, per SMIL 2.1 spec + if ( isset(attributes['points']['to']) ) { + end = translateValues.call(this, attributes['points']['to'], start); + + var pageXY = Y.Dom.getXY(this.getEl()); + for (i = 0, len = control.length; i < len; ++i) { + control[i] = translateValues.call(this, control[i], start); + } + + + } else if ( isset(attributes['points']['by']) ) { + end = [ start[0] + attributes['points']['by'][0], start[1] + attributes['points']['by'][1] ]; + + for (i = 0, len = control.length; i < len; ++i) { + control[i] = [ start[0] + control[i][0], start[1] + control[i][1] ]; + } + } + + this.runtimeAttributes[attr] = [start]; + + if (control.length > 0) { + this.runtimeAttributes[attr] = this.runtimeAttributes[attr].concat(control); + } + + this.runtimeAttributes[attr][this.runtimeAttributes[attr].length] = end; + } + else { + superclass.setRuntimeAttribute.call(this, attr); + } + }; + + var translateValues = function(val, start) { + var pageXY = Y.Dom.getXY(this.getEl()); + val = [ val[0] - pageXY[0] + start[0], val[1] - pageXY[1] + start[1] ]; + + return val; + }; + + var isset = function(prop) { + return (typeof prop !== 'undefined'); + }; + + Y.Motion = Motion; +})(); +(function() { +/** + * Anim subclass for scrolling elements to a position defined by the "scroll" + * member of "attributes". All "scroll" members are arrays with x, y scroll positions. + *

    Usage: var myAnim = new YAHOO.util.Scroll(el, { scroll: { to: [0, 800] } }, 1, YAHOO.util.Easing.easeOut);

    + * @class Scroll + * @namespace YAHOO.util + * @requires YAHOO.util.Anim + * @requires YAHOO.util.AnimMgr + * @requires YAHOO.util.Easing + * @requires YAHOO.util.Bezier + * @requires YAHOO.util.Dom + * @requires YAHOO.util.Event + * @requires YAHOO.util.CustomEvent + * @extends YAHOO.util.ColorAnim + * @constructor + * @param {String or HTMLElement} el Reference to the element that will be animated + * @param {Object} attributes The attribute(s) to be animated. + * Each attribute is an object with at minimum a "to" or "by" member defined. + * Additional optional members are "from" (defaults to current value), "units" (defaults to "px"). + * All attribute names use camelCase. + * @param {Number} duration (optional, defaults to 1 second) Length of animation (frames or seconds), defaults to time-based + * @param {Function} method (optional, defaults to YAHOO.util.Easing.easeNone) Computes the values that are applied to the attributes per frame (generally a YAHOO.util.Easing method) + */ + var Scroll = function(el, attributes, duration, method) { + if (el) { // dont break existing subclasses not using YAHOO.extend + Scroll.superclass.constructor.call(this, el, attributes, duration, method); + } + }; + + Scroll.NAME = 'Scroll'; + + // shorthand + var Y = YAHOO.util; + YAHOO.extend(Scroll, Y.ColorAnim); + + var superclass = Scroll.superclass; + var proto = Scroll.prototype; + + proto.doMethod = function(attr, start, end) { + var val = null; + + if (attr == 'scroll') { + val = [ + this.method(this.currentFrame, start[0], end[0] - start[0], this.totalFrames), + this.method(this.currentFrame, start[1], end[1] - start[1], this.totalFrames) + ]; + + } else { + val = superclass.doMethod.call(this, attr, start, end); + } + return val; + }; + + proto.getAttribute = function(attr) { + var val = null; + var el = this.getEl(); + + if (attr == 'scroll') { + val = [ el.scrollLeft, el.scrollTop ]; + } else { + val = superclass.getAttribute.call(this, attr); + } + + return val; + }; + + proto.setAttribute = function(attr, val, unit) { + var el = this.getEl(); + + if (attr == 'scroll') { + el.scrollLeft = val[0]; + el.scrollTop = val[1]; + } else { + superclass.setAttribute.call(this, attr, val, unit); + } + }; + + Y.Scroll = Scroll; +})(); +YAHOO.register("animation", YAHOO.util.Anim, {version: "2.8.0r4", build: "2449"}); diff --git a/include/javascript/yui/build/autocomplete/autocomplete-min.js b/include/javascript/yui/build/autocomplete/autocomplete-min.js new file mode 100755 index 00000000..0737f4a8 --- /dev/null +++ b/include/javascript/yui/build/autocomplete/autocomplete-min.js @@ -0,0 +1,12 @@ +/* +Copyright (c) 2009, Yahoo! Inc. All rights reserved. +Code licensed under the BSD License: +http://developer.yahoo.net/yui/license.txt +version: 2.8.0r4 +*/ +YAHOO.widget.DS_JSArray=YAHOO.util.LocalDataSource;YAHOO.widget.DS_JSFunction=YAHOO.util.FunctionDataSource;YAHOO.widget.DS_XHR=function(B,A,D){var C=new YAHOO.util.XHRDataSource(B,D);C._aDeprecatedSchema=A;return C;};YAHOO.widget.DS_ScriptNode=function(B,A,D){var C=new YAHOO.util.ScriptNodeDataSource(B,D);C._aDeprecatedSchema=A;return C;};YAHOO.widget.DS_XHR.TYPE_JSON=YAHOO.util.DataSourceBase.TYPE_JSON;YAHOO.widget.DS_XHR.TYPE_XML=YAHOO.util.DataSourceBase.TYPE_XML;YAHOO.widget.DS_XHR.TYPE_FLAT=YAHOO.util.DataSourceBase.TYPE_TEXT;YAHOO.widget.AutoComplete=function(G,B,J,C){if(G&&B&&J){if(J&&YAHOO.lang.isFunction(J.sendRequest)){this.dataSource=J;}else{return;}this.key=0;var D=J.responseSchema;if(J._aDeprecatedSchema){var K=J._aDeprecatedSchema;if(YAHOO.lang.isArray(K)){if((J.responseType===YAHOO.util.DataSourceBase.TYPE_JSON)||(J.responseType===YAHOO.util.DataSourceBase.TYPE_UNKNOWN)){D.resultsList=K[0];this.key=K[1];D.fields=(K.length<3)?null:K.slice(1);}else{if(J.responseType===YAHOO.util.DataSourceBase.TYPE_XML){D.resultNode=K[0];this.key=K[1];D.fields=K.slice(1);}else{if(J.responseType===YAHOO.util.DataSourceBase.TYPE_TEXT){D.recordDelim=K[0];D.fieldDelim=K[1];}}}J.responseSchema=D;}}if(YAHOO.util.Dom.inDocument(G)){if(YAHOO.lang.isString(G)){this._sName="instance"+YAHOO.widget.AutoComplete._nIndex+" "+G;this._elTextbox=document.getElementById(G);}else{this._sName=(G.id)?"instance"+YAHOO.widget.AutoComplete._nIndex+" "+G.id:"instance"+YAHOO.widget.AutoComplete._nIndex;this._elTextbox=G;}YAHOO.util.Dom.addClass(this._elTextbox,"yui-ac-input");}else{return;}if(YAHOO.util.Dom.inDocument(B)){if(YAHOO.lang.isString(B)){this._elContainer=document.getElementById(B);}else{this._elContainer=B;}if(this._elContainer.style.display=="none"){}var E=this._elContainer.parentNode;var A=E.tagName.toLowerCase();if(A=="div"){YAHOO.util.Dom.addClass(E,"yui-ac");}else{}}else{return;}if(this.dataSource.dataType===YAHOO.util.DataSourceBase.TYPE_LOCAL){this.applyLocalFilter=true;}if(C&&(C.constructor==Object)){for(var I in C){if(I){this[I]=C[I];}}}this._initContainerEl();this._initProps();this._initListEl();this._initContainerHelperEls();var H=this;var F=this._elTextbox;YAHOO.util.Event.addListener(F,"keyup",H._onTextboxKeyUp,H);YAHOO.util.Event.addListener(F,"keydown",H._onTextboxKeyDown,H);YAHOO.util.Event.addListener(F,"focus",H._onTextboxFocus,H);YAHOO.util.Event.addListener(F,"blur",H._onTextboxBlur,H);YAHOO.util.Event.addListener(B,"mouseover",H._onContainerMouseover,H);YAHOO.util.Event.addListener(B,"mouseout",H._onContainerMouseout,H);YAHOO.util.Event.addListener(B,"click",H._onContainerClick,H);YAHOO.util.Event.addListener(B,"scroll",H._onContainerScroll,H);YAHOO.util.Event.addListener(B,"resize",H._onContainerResize,H);YAHOO.util.Event.addListener(F,"keypress",H._onTextboxKeyPress,H);YAHOO.util.Event.addListener(window,"unload",H._onWindowUnload,H);this.textboxFocusEvent=new YAHOO.util.CustomEvent("textboxFocus",this);this.textboxKeyEvent=new YAHOO.util.CustomEvent("textboxKey",this);this.dataRequestEvent=new YAHOO.util.CustomEvent("dataRequest",this);this.dataReturnEvent=new YAHOO.util.CustomEvent("dataReturn",this);this.dataErrorEvent=new YAHOO.util.CustomEvent("dataError",this);this.containerPopulateEvent=new YAHOO.util.CustomEvent("containerPopulate",this);this.containerExpandEvent=new YAHOO.util.CustomEvent("containerExpand",this);this.typeAheadEvent=new YAHOO.util.CustomEvent("typeAhead",this);this.itemMouseOverEvent=new YAHOO.util.CustomEvent("itemMouseOver",this);this.itemMouseOutEvent=new YAHOO.util.CustomEvent("itemMouseOut",this);this.itemArrowToEvent=new YAHOO.util.CustomEvent("itemArrowTo",this);this.itemArrowFromEvent=new YAHOO.util.CustomEvent("itemArrowFrom",this);this.itemSelectEvent=new YAHOO.util.CustomEvent("itemSelect",this);this.unmatchedItemSelectEvent=new YAHOO.util.CustomEvent("unmatchedItemSelect",this);this.selectionEnforceEvent=new YAHOO.util.CustomEvent("selectionEnforce",this);this.containerCollapseEvent=new YAHOO.util.CustomEvent("containerCollapse",this);this.textboxBlurEvent=new YAHOO.util.CustomEvent("textboxBlur",this);this.textboxChangeEvent=new YAHOO.util.CustomEvent("textboxChange",this);F.setAttribute("autocomplete","off");YAHOO.widget.AutoComplete._nIndex++;}else{}};YAHOO.widget.AutoComplete.prototype.dataSource=null;YAHOO.widget.AutoComplete.prototype.applyLocalFilter=null;YAHOO.widget.AutoComplete.prototype.queryMatchCase=false;YAHOO.widget.AutoComplete.prototype.queryMatchContains=false;YAHOO.widget.AutoComplete.prototype.queryMatchSubset=false;YAHOO.widget.AutoComplete.prototype.minQueryLength=1;YAHOO.widget.AutoComplete.prototype.maxResultsDisplayed=10;YAHOO.widget.AutoComplete.prototype.queryDelay=0.2;YAHOO.widget.AutoComplete.prototype.typeAheadDelay=0.5;YAHOO.widget.AutoComplete.prototype.queryInterval=500;YAHOO.widget.AutoComplete.prototype.highlightClassName="yui-ac-highlight";YAHOO.widget.AutoComplete.prototype.prehighlightClassName=null;YAHOO.widget.AutoComplete.prototype.delimChar=null;YAHOO.widget.AutoComplete.prototype.autoHighlight=true;YAHOO.widget.AutoComplete.prototype.typeAhead=false;YAHOO.widget.AutoComplete.prototype.animHoriz=false;YAHOO.widget.AutoComplete.prototype.animVert=true;YAHOO.widget.AutoComplete.prototype.animSpeed=0.3;YAHOO.widget.AutoComplete.prototype.forceSelection=false;YAHOO.widget.AutoComplete.prototype.allowBrowserAutocomplete=true;YAHOO.widget.AutoComplete.prototype.alwaysShowContainer=false;YAHOO.widget.AutoComplete.prototype.useIFrame=false;YAHOO.widget.AutoComplete.prototype.useShadow=false;YAHOO.widget.AutoComplete.prototype.suppressInputUpdate=false;YAHOO.widget.AutoComplete.prototype.resultTypeList=true;YAHOO.widget.AutoComplete.prototype.queryQuestionMark=true;YAHOO.widget.AutoComplete.prototype.autoSnapContainer=true;YAHOO.widget.AutoComplete.prototype.toString=function(){return"AutoComplete "+this._sName;};YAHOO.widget.AutoComplete.prototype.getInputEl=function(){return this._elTextbox;};YAHOO.widget.AutoComplete.prototype.getContainerEl=function(){return this._elContainer; +};YAHOO.widget.AutoComplete.prototype.isFocused=function(){return this._bFocused;};YAHOO.widget.AutoComplete.prototype.isContainerOpen=function(){return this._bContainerOpen;};YAHOO.widget.AutoComplete.prototype.getListEl=function(){return this._elList;};YAHOO.widget.AutoComplete.prototype.getListItemMatch=function(A){if(A._sResultMatch){return A._sResultMatch;}else{return null;}};YAHOO.widget.AutoComplete.prototype.getListItemData=function(A){if(A._oResultData){return A._oResultData;}else{return null;}};YAHOO.widget.AutoComplete.prototype.getListItemIndex=function(A){if(YAHOO.lang.isNumber(A._nItemIndex)){return A._nItemIndex;}else{return null;}};YAHOO.widget.AutoComplete.prototype.setHeader=function(B){if(this._elHeader){var A=this._elHeader;if(B){A.innerHTML=B;A.style.display="";}else{A.innerHTML="";A.style.display="none";}}};YAHOO.widget.AutoComplete.prototype.setFooter=function(B){if(this._elFooter){var A=this._elFooter;if(B){A.innerHTML=B;A.style.display="";}else{A.innerHTML="";A.style.display="none";}}};YAHOO.widget.AutoComplete.prototype.setBody=function(A){if(this._elBody){var B=this._elBody;YAHOO.util.Event.purgeElement(B,true);if(A){B.innerHTML=A;B.style.display="";}else{B.innerHTML="";B.style.display="none";}this._elList=null;}};YAHOO.widget.AutoComplete.prototype.generateRequest=function(B){var A=this.dataSource.dataType;if(A===YAHOO.util.DataSourceBase.TYPE_XHR){if(!this.dataSource.connMethodPost){B=(this.queryQuestionMark?"?":"")+(this.dataSource.scriptQueryParam||"query")+"="+B+(this.dataSource.scriptQueryAppend?("&"+this.dataSource.scriptQueryAppend):"");}else{B=(this.dataSource.scriptQueryParam||"query")+"="+B+(this.dataSource.scriptQueryAppend?("&"+this.dataSource.scriptQueryAppend):"");}}else{if(A===YAHOO.util.DataSourceBase.TYPE_SCRIPTNODE){B="&"+(this.dataSource.scriptQueryParam||"query")+"="+B+(this.dataSource.scriptQueryAppend?("&"+this.dataSource.scriptQueryAppend):"");}}return B;};YAHOO.widget.AutoComplete.prototype.sendQuery=function(B){this._bFocused=true;var A=(this.delimChar)?this._elTextbox.value+B:B;this._sendQuery(A);};YAHOO.widget.AutoComplete.prototype.snapContainer=function(){var A=this._elTextbox,B=YAHOO.util.Dom.getXY(A);B[1]+=YAHOO.util.Dom.get(A).offsetHeight+2;YAHOO.util.Dom.setXY(this._elContainer,B);};YAHOO.widget.AutoComplete.prototype.expandContainer=function(){this._toggleContainer(true);};YAHOO.widget.AutoComplete.prototype.collapseContainer=function(){this._toggleContainer(false);};YAHOO.widget.AutoComplete.prototype.clearList=function(){var B=this._elList.childNodes,A=B.length-1;for(;A>-1;A--){B[A].style.display="none";}};YAHOO.widget.AutoComplete.prototype.getSubsetMatches=function(E){var D,C,A;for(var B=E.length;B>=this.minQueryLength;B--){A=this.generateRequest(E.substr(0,B));this.dataRequestEvent.fire(this,D,A);C=this.dataSource.getCachedResponse(A);if(C){return this.filterResults.apply(this.dataSource,[E,C,C,{scope:this}]);}}return null;};YAHOO.widget.AutoComplete.prototype.preparseRawResponse=function(C,B,A){var D=((this.responseStripAfter!=="")&&(B.indexOf))?B.indexOf(this.responseStripAfter):-1;if(D!=-1){B=B.substring(0,D);}return B;};YAHOO.widget.AutoComplete.prototype.filterResults=function(K,M,Q,L){if(L&&L.argument&&L.argument.query){K=L.argument.query;}if(K&&K!==""){Q=YAHOO.widget.AutoComplete._cloneObject(Q);var I=L.scope,P=this,C=Q.results,N=[],B=I.maxResultsDisplayed,J=(P.queryMatchCase||I.queryMatchCase),A=(P.queryMatchContains||I.queryMatchContains);for(var D=0,H=C.length;D-1))){N.push(F);}}if(H>B&&N.length===B){break;}}Q.results=N;}else{}return Q;};YAHOO.widget.AutoComplete.prototype.handleResponse=function(C,A,B){if((this instanceof YAHOO.widget.AutoComplete)&&this._sName){this._populateList(C,A,B);}};YAHOO.widget.AutoComplete.prototype.doBeforeLoadData=function(C,A,B){return true;};YAHOO.widget.AutoComplete.prototype.formatResult=function(B,D,A){var C=(A)?A:"";return C;};YAHOO.widget.AutoComplete.prototype.doBeforeExpandContainer=function(D,A,C,B){return true;};YAHOO.widget.AutoComplete.prototype.destroy=function(){var B=this.toString();var A=this._elTextbox;var D=this._elContainer;this.textboxFocusEvent.unsubscribeAll();this.textboxKeyEvent.unsubscribeAll();this.dataRequestEvent.unsubscribeAll();this.dataReturnEvent.unsubscribeAll();this.dataErrorEvent.unsubscribeAll();this.containerPopulateEvent.unsubscribeAll();this.containerExpandEvent.unsubscribeAll();this.typeAheadEvent.unsubscribeAll();this.itemMouseOverEvent.unsubscribeAll();this.itemMouseOutEvent.unsubscribeAll();this.itemArrowToEvent.unsubscribeAll();this.itemArrowFromEvent.unsubscribeAll();this.itemSelectEvent.unsubscribeAll();this.unmatchedItemSelectEvent.unsubscribeAll();this.selectionEnforceEvent.unsubscribeAll();this.containerCollapseEvent.unsubscribeAll();this.textboxBlurEvent.unsubscribeAll();this.textboxChangeEvent.unsubscribeAll();YAHOO.util.Event.purgeElement(A,true);YAHOO.util.Event.purgeElement(D,true);D.innerHTML="";for(var C in this){if(YAHOO.lang.hasOwnProperty(this,C)){this[C]=null;}}};YAHOO.widget.AutoComplete.prototype.textboxFocusEvent=null;YAHOO.widget.AutoComplete.prototype.textboxKeyEvent=null;YAHOO.widget.AutoComplete.prototype.dataRequestEvent=null;YAHOO.widget.AutoComplete.prototype.dataReturnEvent=null;YAHOO.widget.AutoComplete.prototype.dataErrorEvent=null;YAHOO.widget.AutoComplete.prototype.containerPopulateEvent=null;YAHOO.widget.AutoComplete.prototype.containerExpandEvent=null;YAHOO.widget.AutoComplete.prototype.typeAheadEvent=null;YAHOO.widget.AutoComplete.prototype.itemMouseOverEvent=null;YAHOO.widget.AutoComplete.prototype.itemMouseOutEvent=null; +YAHOO.widget.AutoComplete.prototype.itemArrowToEvent=null;YAHOO.widget.AutoComplete.prototype.itemArrowFromEvent=null;YAHOO.widget.AutoComplete.prototype.itemSelectEvent=null;YAHOO.widget.AutoComplete.prototype.unmatchedItemSelectEvent=null;YAHOO.widget.AutoComplete.prototype.selectionEnforceEvent=null;YAHOO.widget.AutoComplete.prototype.containerCollapseEvent=null;YAHOO.widget.AutoComplete.prototype.textboxBlurEvent=null;YAHOO.widget.AutoComplete.prototype.textboxChangeEvent=null;YAHOO.widget.AutoComplete._nIndex=0;YAHOO.widget.AutoComplete.prototype._sName=null;YAHOO.widget.AutoComplete.prototype._elTextbox=null;YAHOO.widget.AutoComplete.prototype._elContainer=null;YAHOO.widget.AutoComplete.prototype._elContent=null;YAHOO.widget.AutoComplete.prototype._elHeader=null;YAHOO.widget.AutoComplete.prototype._elBody=null;YAHOO.widget.AutoComplete.prototype._elFooter=null;YAHOO.widget.AutoComplete.prototype._elShadow=null;YAHOO.widget.AutoComplete.prototype._elIFrame=null;YAHOO.widget.AutoComplete.prototype._bFocused=false;YAHOO.widget.AutoComplete.prototype._oAnim=null;YAHOO.widget.AutoComplete.prototype._bContainerOpen=false;YAHOO.widget.AutoComplete.prototype._bOverContainer=false;YAHOO.widget.AutoComplete.prototype._elList=null;YAHOO.widget.AutoComplete.prototype._nDisplayedItems=0;YAHOO.widget.AutoComplete.prototype._sCurQuery=null;YAHOO.widget.AutoComplete.prototype._sPastSelections="";YAHOO.widget.AutoComplete.prototype._sInitInputValue=null;YAHOO.widget.AutoComplete.prototype._elCurListItem=null;YAHOO.widget.AutoComplete.prototype._elCurPrehighlightItem=null;YAHOO.widget.AutoComplete.prototype._bItemSelected=false;YAHOO.widget.AutoComplete.prototype._nKeyCode=null;YAHOO.widget.AutoComplete.prototype._nDelayID=-1;YAHOO.widget.AutoComplete.prototype._nTypeAheadDelayID=-1;YAHOO.widget.AutoComplete.prototype._iFrameSrc="javascript:false;";YAHOO.widget.AutoComplete.prototype._queryInterval=null;YAHOO.widget.AutoComplete.prototype._sLastTextboxValue=null;YAHOO.widget.AutoComplete.prototype._initProps=function(){var B=this.minQueryLength;if(!YAHOO.lang.isNumber(B)){this.minQueryLength=1;}var E=this.maxResultsDisplayed;if(!YAHOO.lang.isNumber(E)||(E<1)){this.maxResultsDisplayed=10;}var F=this.queryDelay;if(!YAHOO.lang.isNumber(F)||(F<0)){this.queryDelay=0.2;}var C=this.typeAheadDelay;if(!YAHOO.lang.isNumber(C)||(C<0)){this.typeAheadDelay=0.2;}var A=this.delimChar;if(YAHOO.lang.isString(A)&&(A.length>0)){this.delimChar=[A];}else{if(!YAHOO.lang.isArray(A)){this.delimChar=null;}}var D=this.animSpeed;if((this.animHoriz||this.animVert)&&YAHOO.util.Anim){if(!YAHOO.lang.isNumber(D)||(D<0)){this.animSpeed=0.3;}if(!this._oAnim){this._oAnim=new YAHOO.util.Anim(this._elContent,{},this.animSpeed);}else{this._oAnim.duration=this.animSpeed;}}if(this.forceSelection&&A){}};YAHOO.widget.AutoComplete.prototype._initContainerHelperEls=function(){if(this.useShadow&&!this._elShadow){var A=document.createElement("div");A.className="yui-ac-shadow";A.style.width=0;A.style.height=0;this._elShadow=this._elContainer.appendChild(A);}if(this.useIFrame&&!this._elIFrame){var B=document.createElement("iframe");B.src=this._iFrameSrc;B.frameBorder=0;B.scrolling="no";B.style.position="absolute";B.style.width=0;B.style.height=0;B.style.padding=0;B.tabIndex=-1;B.role="presentation";B.title="Presentational iframe shim";this._elIFrame=this._elContainer.appendChild(B);}};YAHOO.widget.AutoComplete.prototype._initContainerEl=function(){YAHOO.util.Dom.addClass(this._elContainer,"yui-ac-container");if(!this._elContent){var C=document.createElement("div");C.className="yui-ac-content";C.style.display="none";this._elContent=this._elContainer.appendChild(C);var B=document.createElement("div");B.className="yui-ac-hd";B.style.display="none";this._elHeader=this._elContent.appendChild(B);var D=document.createElement("div");D.className="yui-ac-bd";this._elBody=this._elContent.appendChild(D);var A=document.createElement("div");A.className="yui-ac-ft";A.style.display="none";this._elFooter=this._elContent.appendChild(A);}else{}};YAHOO.widget.AutoComplete.prototype._initListEl=function(){var C=this.maxResultsDisplayed,A=this._elList||document.createElement("ul"),B;while(A.childNodes.length=18&&A<=20)||(A==27)||(A>=33&&A<=35)||(A>=36&&A<=40)||(A>=44&&A<=45)||(A==229)){return true;}return false;};YAHOO.widget.AutoComplete.prototype._sendQuery=function(D){if(this.minQueryLength<0){this._toggleContainer(false);return;}if(this.delimChar){var A=this._extractQuery(D);D=A.query;this._sPastSelections=A.previous;}if((D&&(D.length0)){if(this._nDelayID!=-1){clearTimeout(this._nDelayID);}this._toggleContainer(false);return;}D=encodeURIComponent(D);this._nDelayID=-1;if(this.dataSource.queryMatchSubset||this.queryMatchSubset){var C=this.getSubsetMatches(D);if(C){this.handleResponse(D,C,{query:D});return; +}}if(this.dataSource.responseStripAfter){this.dataSource.doBeforeParseData=this.preparseRawResponse;}if(this.applyLocalFilter){this.dataSource.doBeforeCallback=this.filterResults;}var B=this.generateRequest(D);this.dataRequestEvent.fire(this,D,B);this.dataSource.sendRequest(B,{success:this.handleResponse,failure:this.handleResponse,scope:this,argument:{query:D}});};YAHOO.widget.AutoComplete.prototype._populateListItem=function(B,A,C){B.innerHTML=this.formatResult(A,C,B._sResultMatch);};YAHOO.widget.AutoComplete.prototype._populateList=function(K,F,C){if(this._nTypeAheadDelayID!=-1){clearTimeout(this._nTypeAheadDelayID);}K=(C&&C.query)?C.query:K;var H=this.doBeforeLoadData(K,F,C);if(H&&!F.error){this.dataReturnEvent.fire(this,K,F.results);if(this._bFocused){var M=decodeURIComponent(K);this._sCurQuery=M;this._bItemSelected=false;var R=F.results,A=Math.min(R.length,this.maxResultsDisplayed),J=(this.dataSource.responseSchema.fields)?(this.dataSource.responseSchema.fields[0].key||this.dataSource.responseSchema.fields[0]):0;if(A>0){if(!this._elList||(this._elList.childNodes.length=0;Q--){var P=I[Q],E=R[Q];if(this.resultTypeList){var B=[];B[0]=(YAHOO.lang.isString(E))?E:E[J]||E[this.key];var L=this.dataSource.responseSchema.fields;if(YAHOO.lang.isArray(L)&&(L.length>1)){for(var N=1,S=L.length;N=A;O--){G=I[O];G.style.display="none";}}this._nDisplayedItems=A;this.containerPopulateEvent.fire(this,K,R);if(this.autoHighlight){var D=this._elList.firstChild;this._toggleHighlight(D,"to");this.itemArrowToEvent.fire(this,D);this._typeAhead(D,K);}else{this._toggleHighlight(this._elCurListItem,"from");}H=this._doBeforeExpandContainer(this._elTextbox,this._elContainer,K,R);this._toggleContainer(H);}else{this._toggleContainer(false);}return;}}else{this.dataErrorEvent.fire(this,K,F);}};YAHOO.widget.AutoComplete.prototype._doBeforeExpandContainer=function(D,A,C,B){if(this.autoSnapContainer){this.snapContainer();}return this.doBeforeExpandContainer(D,A,C,B);};YAHOO.widget.AutoComplete.prototype._clearSelection=function(){var A=(this.delimChar)?this._extractQuery(this._elTextbox.value):{previous:"",query:this._elTextbox.value};this._elTextbox.value=A.previous;this.selectionEnforceEvent.fire(this,A.query);};YAHOO.widget.AutoComplete.prototype._textMatchesOption=function(){var A=null;for(var B=0;B=0;B--){G=H.lastIndexOf(C[B]);if(G>F){F=G;}}if(C[B]==" "){for(var A=C.length-1;A>=0;A--){if(H[F-1]==C[A]){F--;break;}}}if(F>-1){E=F+1;while(H.charAt(E)==" "){E+=1;}D=H.substring(0,E);H=H.substr(E);}else{D="";}return{previous:D,query:H};};YAHOO.widget.AutoComplete.prototype._toggleContainerHelpers=function(D){var E=this._elContent.offsetWidth+"px";var B=this._elContent.offsetHeight+"px";if(this.useIFrame&&this._elIFrame){var C=this._elIFrame;if(D){C.style.width=E;C.style.height=B;C.style.padding="";}else{C.style.width=0;C.style.height=0;C.style.padding=0;}}if(this.useShadow&&this._elShadow){var A=this._elShadow;if(D){A.style.width=E;A.style.height=B;}else{A.style.width=0;A.style.height=0;}}};YAHOO.widget.AutoComplete.prototype._toggleContainer=function(I){var D=this._elContainer;if(this.alwaysShowContainer&&this._bContainerOpen){return;}if(!I){this._toggleHighlight(this._elCurListItem,"from");this._nDisplayedItems=0;this._sCurQuery=null;if(this._elContent.style.display=="none"){return;}}var A=this._oAnim;if(A&&A.getEl()&&(this.animHoriz||this.animVert)){if(A.isAnimated()){A.stop(true);}var G=this._elContent.cloneNode(true);D.appendChild(G);G.style.top="-9000px";G.style.width="";G.style.height="";G.style.display="";var F=G.offsetWidth;var C=G.offsetHeight;var B=(this.animHoriz)?0:F;var E=(this.animVert)?0:C;A.attributes=(I)?{width:{to:F},height:{to:C}}:{width:{to:B},height:{to:E}};if(I&&!this._bContainerOpen){this._elContent.style.width=B+"px";this._elContent.style.height=E+"px";}else{this._elContent.style.width=F+"px";this._elContent.style.height=C+"px";}D.removeChild(G);G=null;var H=this;var J=function(){A.onComplete.unsubscribeAll();if(I){H._toggleContainerHelpers(true);H._bContainerOpen=I;H.containerExpandEvent.fire(H);}else{H._elContent.style.display="none";H._bContainerOpen=I;H.containerCollapseEvent.fire(H);}};this._toggleContainerHelpers(false);this._elContent.style.display="";A.onComplete.subscribe(J);A.animate();}else{if(I){this._elContent.style.display="";this._toggleContainerHelpers(true);this._bContainerOpen=I;this.containerExpandEvent.fire(this);}else{this._toggleContainerHelpers(false);this._elContent.style.display="none";this._bContainerOpen=I;this.containerCollapseEvent.fire(this);}}};YAHOO.widget.AutoComplete.prototype._toggleHighlight=function(A,C){if(A){var B=this.highlightClassName; +if(this._elCurListItem){YAHOO.util.Dom.removeClass(this._elCurListItem,B);this._elCurListItem=null;}if((C=="to")&&B){YAHOO.util.Dom.addClass(A,B);this._elCurListItem=A;}}};YAHOO.widget.AutoComplete.prototype._togglePrehighlight=function(B,C){var A=this.prehighlightClassName;if(this._elCurPrehighlightItem){YAHOO.util.Dom.removeClass(this._elCurPrehighlightItem,A);}if(B==this._elCurListItem){return;}if((C=="mouseover")&&A){YAHOO.util.Dom.addClass(B,A);this._elCurPrehighlightItem=B;}else{YAHOO.util.Dom.removeClass(B,A);}};YAHOO.widget.AutoComplete.prototype._updateValue=function(C){if(!this.suppressInputUpdate){var F=this._elTextbox;var E=(this.delimChar)?(this.delimChar[0]||this.delimChar):null;var B=C._sResultMatch;var D="";if(E){D=this._sPastSelections;D+=B+E;if(E!=" "){D+=" ";}}else{D=B;}F.value=D;if(F.type=="textarea"){F.scrollTop=F.scrollHeight;}var A=F.value.length;this._selectText(F,A,A);this._elCurListItem=C;}};YAHOO.widget.AutoComplete.prototype._selectItem=function(A){this._bItemSelected=true;this._updateValue(A);this._sPastSelections=this._elTextbox.value;this._clearInterval();this.itemSelectEvent.fire(this,A,A._oResultData);this._toggleContainer(false);};YAHOO.widget.AutoComplete.prototype._jumpSelection=function(){if(this._elCurListItem){this._selectItem(this._elCurListItem);}else{this._toggleContainer(false);}};YAHOO.widget.AutoComplete.prototype._moveSelection=function(G){if(this._bContainerOpen){var H=this._elCurListItem,D=-1;if(H){D=H._nItemIndex;}var E=(G==40)?(D+1):(D-1);if(E<-2||E>=this._nDisplayedItems){return;}if(H){this._toggleHighlight(H,"from");this.itemArrowFromEvent.fire(this,H);}if(E==-1){if(this.delimChar){this._elTextbox.value=this._sPastSelections+this._sCurQuery;}else{this._elTextbox.value=this._sCurQuery;}return;}if(E==-2){this._toggleContainer(false);return;}var F=this._elList.childNodes[E],B=this._elContent,C=YAHOO.util.Dom.getStyle(B,"overflow"),I=YAHOO.util.Dom.getStyle(B,"overflowY"),A=((C=="auto")||(C=="scroll")||(I=="auto")||(I=="scroll"));if(A&&(E>-1)&&(E(B.scrollTop+B.offsetHeight)){B.scrollTop=(F.offsetTop+F.offsetHeight)-B.offsetHeight;}else{if((F.offsetTop+F.offsetHeight)(B.scrollTop+B.offsetHeight)){this._elContent.scrollTop=(F.offsetTop+F.offsetHeight)-B.offsetHeight;}}}}this._toggleHighlight(F,"to");this.itemArrowToEvent.fire(this,F);if(this.typeAhead){this._updateValue(F);}}};YAHOO.widget.AutoComplete.prototype._onContainerMouseover=function(A,C){var D=YAHOO.util.Event.getTarget(A);var B=D.nodeName.toLowerCase();while(D&&(B!="table")){switch(B){case"body":return;case"li":if(C.prehighlightClassName){C._togglePrehighlight(D,"mouseover");}else{C._toggleHighlight(D,"to");}C.itemMouseOverEvent.fire(C,D);break;case"div":if(YAHOO.util.Dom.hasClass(D,"yui-ac-container")){C._bOverContainer=true;return;}break;default:break;}D=D.parentNode;if(D){B=D.nodeName.toLowerCase();}}};YAHOO.widget.AutoComplete.prototype._onContainerMouseout=function(A,C){var D=YAHOO.util.Event.getTarget(A);var B=D.nodeName.toLowerCase();while(D&&(B!="table")){switch(B){case"body":return;case"li":if(C.prehighlightClassName){C._togglePrehighlight(D,"mouseout");}else{C._toggleHighlight(D,"from");}C.itemMouseOutEvent.fire(C,D);break;case"ul":C._toggleHighlight(C._elCurListItem,"to");break;case"div":if(YAHOO.util.Dom.hasClass(D,"yui-ac-container")){C._bOverContainer=false;return;}break;default:break;}D=D.parentNode;if(D){B=D.nodeName.toLowerCase();}}};YAHOO.widget.AutoComplete.prototype._onContainerClick=function(A,C){var D=YAHOO.util.Event.getTarget(A);var B=D.nodeName.toLowerCase();while(D&&(B!="table")){switch(B){case"body":return;case"li":C._toggleHighlight(D,"to");C._selectItem(D);return;default:break;}D=D.parentNode;if(D){B=D.nodeName.toLowerCase();}}};YAHOO.widget.AutoComplete.prototype._onContainerScroll=function(A,B){B._focus();};YAHOO.widget.AutoComplete.prototype._onContainerResize=function(A,B){B._toggleContainerHelpers(B._bContainerOpen);};YAHOO.widget.AutoComplete.prototype._onTextboxKeyDown=function(A,B){var C=A.keyCode;if(B._nTypeAheadDelayID!=-1){clearTimeout(B._nTypeAheadDelayID);}switch(C){case 9:if(!YAHOO.env.ua.opera&&(navigator.userAgent.toLowerCase().indexOf("mac")==-1)||(YAHOO.env.ua.webkit>420)){if(B._elCurListItem){if(B.delimChar&&(B._nKeyCode!=C)){if(B._bContainerOpen){YAHOO.util.Event.stopEvent(A);}}B._selectItem(B._elCurListItem);}else{B._toggleContainer(false);}}break;case 13:if(!YAHOO.env.ua.opera&&(navigator.userAgent.toLowerCase().indexOf("mac")==-1)||(YAHOO.env.ua.webkit>420)){if(B._elCurListItem){if(B._nKeyCode!=C){if(B._bContainerOpen){YAHOO.util.Event.stopEvent(A);}}B._selectItem(B._elCurListItem);}else{B._toggleContainer(false);}}break;case 27:B._toggleContainer(false);return;case 39:B._jumpSelection();break;case 38:if(B._bContainerOpen){YAHOO.util.Event.stopEvent(A);B._moveSelection(C);}break;case 40:if(B._bContainerOpen){YAHOO.util.Event.stopEvent(A);B._moveSelection(C);}break;default:B._bItemSelected=false;B._toggleHighlight(B._elCurListItem,"from");B.textboxKeyEvent.fire(B,C);break;}if(C===18){B._enableIntervalDetection();}B._nKeyCode=C;};YAHOO.widget.AutoComplete.prototype._onTextboxKeyPress=function(A,B){var C=A.keyCode;if(YAHOO.env.ua.opera||(navigator.userAgent.toLowerCase().indexOf("mac")!=-1)&&(YAHOO.env.ua.webkit<420)){switch(C){case 9:if(B._bContainerOpen){if(B.delimChar){YAHOO.util.Event.stopEvent(A);}if(B._elCurListItem){B._selectItem(B._elCurListItem);}else{B._toggleContainer(false);}}break;case 13:if(B._bContainerOpen){YAHOO.util.Event.stopEvent(A);if(B._elCurListItem){B._selectItem(B._elCurListItem);}else{B._toggleContainer(false);}}break;default:break;}}else{if(C==229){B._enableIntervalDetection();}}};YAHOO.widget.AutoComplete.prototype._onTextboxKeyUp=function(A,C){var B=this.value;C._initProps();var D=A.keyCode;if(C._isIgnoreKey(D)){return; +}if(C._nDelayID!=-1){clearTimeout(C._nDelayID);}C._nDelayID=setTimeout(function(){C._sendQuery(B);},(C.queryDelay*1000));};YAHOO.widget.AutoComplete.prototype._onTextboxFocus=function(A,B){if(!B._bFocused){B._elTextbox.setAttribute("autocomplete","off");B._bFocused=true;B._sInitInputValue=B._elTextbox.value;B.textboxFocusEvent.fire(B);}};YAHOO.widget.AutoComplete.prototype._onTextboxBlur=function(A,C){if(!C._bOverContainer||(C._nKeyCode==9)){if(!C._bItemSelected){var B=C._textMatchesOption();if(!C._bContainerOpen||(C._bContainerOpen&&(B===null))){if(C.forceSelection){C._clearSelection();}else{C.unmatchedItemSelectEvent.fire(C,C._sCurQuery);}}else{if(C.forceSelection){C._selectItem(B);}}}C._clearInterval();C._bFocused=false;if(C._sInitInputValue!==C._elTextbox.value){C.textboxChangeEvent.fire(C);}C.textboxBlurEvent.fire(C);C._toggleContainer(false);}else{C._focus();}};YAHOO.widget.AutoComplete.prototype._onWindowUnload=function(A,B){if(B&&B._elTextbox&&B.allowBrowserAutocomplete){B._elTextbox.setAttribute("autocomplete","on");}};YAHOO.widget.AutoComplete.prototype.doBeforeSendQuery=function(A){return this.generateRequest(A);};YAHOO.widget.AutoComplete.prototype.getListItems=function(){var C=[],B=this._elList.childNodes;for(var A=B.length-1;A>=0;A--){C[A]=B[A];}return C;};YAHOO.widget.AutoComplete._cloneObject=function(D){if(!YAHOO.lang.isValue(D)){return D;}var F={};if(YAHOO.lang.isFunction(D)){F=D;}else{if(YAHOO.lang.isArray(D)){var E=[];for(var C=0,B=D.length;C + *
  • Navigate with up/down arrow keys and/or mouse to pick a selection
  • + *
  • The drop down container can "roll down" or "fly out" via configurable + * animation
  • + *
  • UI look-and-feel customizable through CSS, including container + * attributes, borders, position, fonts, etc
  • + * + * + * @class AutoComplete + * @constructor + * @param elInput {HTMLElement} DOM element reference of an input field. + * @param elInput {String} String ID of an input field. + * @param elContainer {HTMLElement} DOM element reference of an existing DIV. + * @param elContainer {String} String ID of an existing DIV. + * @param oDataSource {YAHOO.widget.DataSource} DataSource instance. + * @param oConfigs {Object} (optional) Object literal of configuration params. + */ +YAHOO.widget.AutoComplete = function(elInput,elContainer,oDataSource,oConfigs) { + if(elInput && elContainer && oDataSource) { + // Validate DataSource + if(oDataSource && YAHOO.lang.isFunction(oDataSource.sendRequest)) { + this.dataSource = oDataSource; + } + else { + return; + } + + // YAHOO.widget.DataSource schema backwards compatibility + // Converted deprecated schema into supported schema + // First assume key data is held in position 0 of results array + this.key = 0; + var schema = oDataSource.responseSchema; + // An old school schema has been defined in the deprecated DataSource constructor + if(oDataSource._aDeprecatedSchema) { + var aDeprecatedSchema = oDataSource._aDeprecatedSchema; + if(YAHOO.lang.isArray(aDeprecatedSchema)) { + + if((oDataSource.responseType === YAHOO.util.DataSourceBase.TYPE_JSON) || + (oDataSource.responseType === YAHOO.util.DataSourceBase.TYPE_UNKNOWN)) { // Used to default to unknown + // Store the resultsList + schema.resultsList = aDeprecatedSchema[0]; + // Store the key + this.key = aDeprecatedSchema[1]; + // Only resultsList and key are defined, so grab all the data + schema.fields = (aDeprecatedSchema.length < 3) ? null : aDeprecatedSchema.slice(1); + } + else if(oDataSource.responseType === YAHOO.util.DataSourceBase.TYPE_XML) { + schema.resultNode = aDeprecatedSchema[0]; + this.key = aDeprecatedSchema[1]; + schema.fields = aDeprecatedSchema.slice(1); + } + else if(oDataSource.responseType === YAHOO.util.DataSourceBase.TYPE_TEXT) { + schema.recordDelim = aDeprecatedSchema[0]; + schema.fieldDelim = aDeprecatedSchema[1]; + } + oDataSource.responseSchema = schema; + } + } + + // Validate input element + if(YAHOO.util.Dom.inDocument(elInput)) { + if(YAHOO.lang.isString(elInput)) { + this._sName = "instance" + YAHOO.widget.AutoComplete._nIndex + " " + elInput; + this._elTextbox = document.getElementById(elInput); + } + else { + this._sName = (elInput.id) ? + "instance" + YAHOO.widget.AutoComplete._nIndex + " " + elInput.id: + "instance" + YAHOO.widget.AutoComplete._nIndex; + this._elTextbox = elInput; + } + YAHOO.util.Dom.addClass(this._elTextbox, "yui-ac-input"); + } + else { + return; + } + + // Validate container element + if(YAHOO.util.Dom.inDocument(elContainer)) { + if(YAHOO.lang.isString(elContainer)) { + this._elContainer = document.getElementById(elContainer); + } + else { + this._elContainer = elContainer; + } + if(this._elContainer.style.display == "none") { + } + + // For skinning + var elParent = this._elContainer.parentNode; + var elTag = elParent.tagName.toLowerCase(); + if(elTag == "div") { + YAHOO.util.Dom.addClass(elParent, "yui-ac"); + } + else { + } + } + else { + return; + } + + // Default applyLocalFilter setting is to enable for local sources + if(this.dataSource.dataType === YAHOO.util.DataSourceBase.TYPE_LOCAL) { + this.applyLocalFilter = true; + } + + // Set any config params passed in to override defaults + if(oConfigs && (oConfigs.constructor == Object)) { + for(var sConfig in oConfigs) { + if(sConfig) { + this[sConfig] = oConfigs[sConfig]; + } + } + } + + // Initialization sequence + this._initContainerEl(); + this._initProps(); + this._initListEl(); + this._initContainerHelperEls(); + + // Set up events + var oSelf = this; + var elTextbox = this._elTextbox; + + // Dom events + YAHOO.util.Event.addListener(elTextbox,"keyup",oSelf._onTextboxKeyUp,oSelf); + YAHOO.util.Event.addListener(elTextbox,"keydown",oSelf._onTextboxKeyDown,oSelf); + YAHOO.util.Event.addListener(elTextbox,"focus",oSelf._onTextboxFocus,oSelf); + YAHOO.util.Event.addListener(elTextbox,"blur",oSelf._onTextboxBlur,oSelf); + YAHOO.util.Event.addListener(elContainer,"mouseover",oSelf._onContainerMouseover,oSelf); + YAHOO.util.Event.addListener(elContainer,"mouseout",oSelf._onContainerMouseout,oSelf); + YAHOO.util.Event.addListener(elContainer,"click",oSelf._onContainerClick,oSelf); + YAHOO.util.Event.addListener(elContainer,"scroll",oSelf._onContainerScroll,oSelf); + YAHOO.util.Event.addListener(elContainer,"resize",oSelf._onContainerResize,oSelf); + YAHOO.util.Event.addListener(elTextbox,"keypress",oSelf._onTextboxKeyPress,oSelf); + YAHOO.util.Event.addListener(window,"unload",oSelf._onWindowUnload,oSelf); + + // Custom events + this.textboxFocusEvent = new YAHOO.util.CustomEvent("textboxFocus", this); + this.textboxKeyEvent = new YAHOO.util.CustomEvent("textboxKey", this); + this.dataRequestEvent = new YAHOO.util.CustomEvent("dataRequest", this); + this.dataReturnEvent = new YAHOO.util.CustomEvent("dataReturn", this); + this.dataErrorEvent = new YAHOO.util.CustomEvent("dataError", this); + this.containerPopulateEvent = new YAHOO.util.CustomEvent("containerPopulate", this); + this.containerExpandEvent = new YAHOO.util.CustomEvent("containerExpand", this); + this.typeAheadEvent = new YAHOO.util.CustomEvent("typeAhead", this); + this.itemMouseOverEvent = new YAHOO.util.CustomEvent("itemMouseOver", this); + this.itemMouseOutEvent = new YAHOO.util.CustomEvent("itemMouseOut", this); + this.itemArrowToEvent = new YAHOO.util.CustomEvent("itemArrowTo", this); + this.itemArrowFromEvent = new YAHOO.util.CustomEvent("itemArrowFrom", this); + this.itemSelectEvent = new YAHOO.util.CustomEvent("itemSelect", this); + this.unmatchedItemSelectEvent = new YAHOO.util.CustomEvent("unmatchedItemSelect", this); + this.selectionEnforceEvent = new YAHOO.util.CustomEvent("selectionEnforce", this); + this.containerCollapseEvent = new YAHOO.util.CustomEvent("containerCollapse", this); + this.textboxBlurEvent = new YAHOO.util.CustomEvent("textboxBlur", this); + this.textboxChangeEvent = new YAHOO.util.CustomEvent("textboxChange", this); + + // Finish up + elTextbox.setAttribute("autocomplete","off"); + YAHOO.widget.AutoComplete._nIndex++; + } + // Required arguments were not found + else { + } +}; + +///////////////////////////////////////////////////////////////////////////// +// +// Public member variables +// +///////////////////////////////////////////////////////////////////////////// + +/** + * The DataSource object that encapsulates the data used for auto completion. + * This object should be an inherited object from YAHOO.widget.DataSource. + * + * @property dataSource + * @type YAHOO.widget.DataSource + */ +YAHOO.widget.AutoComplete.prototype.dataSource = null; + +/** + * By default, results from local DataSources will pass through the filterResults + * method to apply a client-side matching algorithm. + * + * @property applyLocalFilter + * @type Boolean + * @default true for local arrays and json, otherwise false + */ +YAHOO.widget.AutoComplete.prototype.applyLocalFilter = null; + +/** + * When applyLocalFilter is true, the local filtering algorthim can have case sensitivity + * enabled. + * + * @property queryMatchCase + * @type Boolean + * @default false + */ +YAHOO.widget.AutoComplete.prototype.queryMatchCase = false; + +/** + * When applyLocalFilter is true, results can be locally filtered to return + * matching strings that "contain" the query string rather than simply "start with" + * the query string. + * + * @property queryMatchContains + * @type Boolean + * @default false + */ +YAHOO.widget.AutoComplete.prototype.queryMatchContains = false; + +/** + * Enables query subset matching. When the DataSource's cache is enabled and queryMatchSubset is + * true, substrings of queries will return matching cached results. For + * instance, if the first query is for "abc" susequent queries that start with + * "abc", like "abcd", will be queried against the cache, and not the live data + * source. Recommended only for DataSources that return comprehensive results + * for queries with very few characters. + * + * @property queryMatchSubset + * @type Boolean + * @default false + * + */ +YAHOO.widget.AutoComplete.prototype.queryMatchSubset = false; + +/** + * Number of characters that must be entered before querying for results. A negative value + * effectively turns off the widget. A value of 0 allows queries of null or empty string + * values. + * + * @property minQueryLength + * @type Number + * @default 1 + */ +YAHOO.widget.AutoComplete.prototype.minQueryLength = 1; + +/** + * Maximum number of results to display in results container. + * + * @property maxResultsDisplayed + * @type Number + * @default 10 + */ +YAHOO.widget.AutoComplete.prototype.maxResultsDisplayed = 10; + +/** + * Number of seconds to delay before submitting a query request. If a query + * request is received before a previous one has completed its delay, the + * previous request is cancelled and the new request is set to the delay. If + * typeAhead is also enabled, this value must always be less than the typeAheadDelay + * in order to avoid certain race conditions. + * + * @property queryDelay + * @type Number + * @default 0.2 + */ +YAHOO.widget.AutoComplete.prototype.queryDelay = 0.2; + +/** + * If typeAhead is true, number of seconds to delay before updating input with + * typeAhead value. In order to prevent certain race conditions, this value must + * always be greater than the queryDelay. + * + * @property typeAheadDelay + * @type Number + * @default 0.5 + */ +YAHOO.widget.AutoComplete.prototype.typeAheadDelay = 0.5; + +/** + * When IME usage is detected or interval detection is explicitly enabled, + * AutoComplete will detect the input value at the given interval and send a + * query if the value has changed. + * + * @property queryInterval + * @type Number + * @default 500 + */ +YAHOO.widget.AutoComplete.prototype.queryInterval = 500; + +/** + * Class name of a highlighted item within results container. + * + * @property highlightClassName + * @type String + * @default "yui-ac-highlight" + */ +YAHOO.widget.AutoComplete.prototype.highlightClassName = "yui-ac-highlight"; + +/** + * Class name of a pre-highlighted item within results container. + * + * @property prehighlightClassName + * @type String + */ +YAHOO.widget.AutoComplete.prototype.prehighlightClassName = null; + +/** + * Query delimiter. A single character separator for multiple delimited + * selections. Multiple delimiter characteres may be defined as an array of + * strings. A null value or empty string indicates that query results cannot + * be delimited. This feature is not recommended if you need forceSelection to + * be true. + * + * @property delimChar + * @type String | String[] + */ +YAHOO.widget.AutoComplete.prototype.delimChar = null; + +/** + * Whether or not the first item in results container should be automatically highlighted + * on expand. + * + * @property autoHighlight + * @type Boolean + * @default true + */ +YAHOO.widget.AutoComplete.prototype.autoHighlight = true; + +/** + * If autohighlight is enabled, whether or not the input field should be automatically updated + * with the first query result as the user types, auto-selecting the substring portion + * of the first result that the user has not yet typed. + * + * @property typeAhead + * @type Boolean + * @default false + */ +YAHOO.widget.AutoComplete.prototype.typeAhead = false; + +/** + * Whether or not to animate the expansion/collapse of the results container in the + * horizontal direction. + * + * @property animHoriz + * @type Boolean + * @default false + */ +YAHOO.widget.AutoComplete.prototype.animHoriz = false; + +/** + * Whether or not to animate the expansion/collapse of the results container in the + * vertical direction. + * + * @property animVert + * @type Boolean + * @default true + */ +YAHOO.widget.AutoComplete.prototype.animVert = true; + +/** + * Speed of container expand/collapse animation, in seconds.. + * + * @property animSpeed + * @type Number + * @default 0.3 + */ +YAHOO.widget.AutoComplete.prototype.animSpeed = 0.3; + +/** + * Whether or not to force the user's selection to match one of the query + * results. Enabling this feature essentially transforms the input field into a + * <select> field. This feature is not recommended with delimiter character(s) + * defined. + * + * @property forceSelection + * @type Boolean + * @default false + */ +YAHOO.widget.AutoComplete.prototype.forceSelection = false; + +/** + * Whether or not to allow browsers to cache user-typed input in the input + * field. Disabling this feature will prevent the widget from setting the + * autocomplete="off" on the input field. When autocomplete="off" + * and users click the back button after form submission, user-typed input can + * be prefilled by the browser from its cache. This caching of user input may + * not be desired for sensitive data, such as credit card numbers, in which + * case, implementers should consider setting allowBrowserAutocomplete to false. + * + * @property allowBrowserAutocomplete + * @type Boolean + * @default true + */ +YAHOO.widget.AutoComplete.prototype.allowBrowserAutocomplete = true; + +/** + * Enabling this feature prevents the toggling of the container to a collapsed state. + * Setting to true does not automatically trigger the opening of the container. + * Implementers are advised to pre-load the container with an explicit "sendQuery()" call. + * + * @property alwaysShowContainer + * @type Boolean + * @default false + */ +YAHOO.widget.AutoComplete.prototype.alwaysShowContainer = false; + +/** + * Whether or not to use an iFrame to layer over Windows form elements in + * IE. Set to true only when the results container will be on top of a + * <select> field in IE and thus exposed to the IE z-index bug (i.e., + * 5.5 < IE < 7). + * + * @property useIFrame + * @type Boolean + * @default false + */ +YAHOO.widget.AutoComplete.prototype.useIFrame = false; + +/** + * Whether or not the results container should have a shadow. + * + * @property useShadow + * @type Boolean + * @default false + */ +YAHOO.widget.AutoComplete.prototype.useShadow = false; + +/** + * Whether or not the input field should be updated with selections. + * + * @property suppressInputUpdate + * @type Boolean + * @default false + */ +YAHOO.widget.AutoComplete.prototype.suppressInputUpdate = false; + +/** + * For backward compatibility to pre-2.6.0 formatResults() signatures, setting + * resultsTypeList to true will take each object literal result returned by + * DataSource and flatten into an array. + * + * @property resultTypeList + * @type Boolean + * @default true + */ +YAHOO.widget.AutoComplete.prototype.resultTypeList = true; + +/** + * For XHR DataSources, AutoComplete will automatically insert a "?" between the server URI and + * the "query" param/value pair. To prevent this behavior, implementers should + * set this value to false. To more fully customize the query syntax, implementers + * should override the generateRequest() method. + * + * @property queryQuestionMark + * @type Boolean + * @default true + */ +YAHOO.widget.AutoComplete.prototype.queryQuestionMark = true; + +/** + * If true, before each time the container expands, the container element will be + * positioned to snap to the bottom-left corner of the input element. If + * autoSnapContainer is set to false, this positioning will not be done. + * + * @property autoSnapContainer + * @type Boolean + * @default true + */ +YAHOO.widget.AutoComplete.prototype.autoSnapContainer = true; + +///////////////////////////////////////////////////////////////////////////// +// +// Public methods +// +///////////////////////////////////////////////////////////////////////////// + + /** + * Public accessor to the unique name of the AutoComplete instance. + * + * @method toString + * @return {String} Unique name of the AutoComplete instance. + */ +YAHOO.widget.AutoComplete.prototype.toString = function() { + return "AutoComplete " + this._sName; +}; + + /** + * Returns DOM reference to input element. + * + * @method getInputEl + * @return {HTMLELement} DOM reference to input element. + */ +YAHOO.widget.AutoComplete.prototype.getInputEl = function() { + return this._elTextbox; +}; + + /** + * Returns DOM reference to container element. + * + * @method getContainerEl + * @return {HTMLELement} DOM reference to container element. + */ +YAHOO.widget.AutoComplete.prototype.getContainerEl = function() { + return this._elContainer; +}; + + /** + * Returns true if widget instance is currently active. + * + * @method isFocused + * @return {Boolean} Returns true if widget instance is currently active. + */ +YAHOO.widget.AutoComplete.prototype.isFocused = function() { + return this._bFocused; +}; + + /** + * Returns true if container is in an expanded state, false otherwise. + * + * @method isContainerOpen + * @return {Boolean} Returns true if container is in an expanded state, false otherwise. + */ +YAHOO.widget.AutoComplete.prototype.isContainerOpen = function() { + return this._bContainerOpen; +}; + +/** + * Public accessor to the <ul> element that displays query results within the results container. + * + * @method getListEl + * @return {HTMLElement[]} Reference to <ul> element within the results container. + */ +YAHOO.widget.AutoComplete.prototype.getListEl = function() { + return this._elList; +}; + +/** + * Public accessor to the matching string associated with a given <li> result. + * + * @method getListItemMatch + * @param elListItem {HTMLElement} Reference to <LI> element. + * @return {String} Matching string. + */ +YAHOO.widget.AutoComplete.prototype.getListItemMatch = function(elListItem) { + if(elListItem._sResultMatch) { + return elListItem._sResultMatch; + } + else { + return null; + } +}; + +/** + * Public accessor to the result data associated with a given <li> result. + * + * @method getListItemData + * @param elListItem {HTMLElement} Reference to <LI> element. + * @return {Object} Result data. + */ +YAHOO.widget.AutoComplete.prototype.getListItemData = function(elListItem) { + if(elListItem._oResultData) { + return elListItem._oResultData; + } + else { + return null; + } +}; + +/** + * Public accessor to the index of the associated with a given <li> result. + * + * @method getListItemIndex + * @param elListItem {HTMLElement} Reference to <LI> element. + * @return {Number} Index. + */ +YAHOO.widget.AutoComplete.prototype.getListItemIndex = function(elListItem) { + if(YAHOO.lang.isNumber(elListItem._nItemIndex)) { + return elListItem._nItemIndex; + } + else { + return null; + } +}; + +/** + * Sets HTML markup for the results container header. This markup will be + * inserted within a <div> tag with a class of "yui-ac-hd". + * + * @method setHeader + * @param sHeader {String} HTML markup for results container header. + */ +YAHOO.widget.AutoComplete.prototype.setHeader = function(sHeader) { + if(this._elHeader) { + var elHeader = this._elHeader; + if(sHeader) { + elHeader.innerHTML = sHeader; + elHeader.style.display = ""; + } + else { + elHeader.innerHTML = ""; + elHeader.style.display = "none"; + } + } +}; + +/** + * Sets HTML markup for the results container footer. This markup will be + * inserted within a <div> tag with a class of "yui-ac-ft". + * + * @method setFooter + * @param sFooter {String} HTML markup for results container footer. + */ +YAHOO.widget.AutoComplete.prototype.setFooter = function(sFooter) { + if(this._elFooter) { + var elFooter = this._elFooter; + if(sFooter) { + elFooter.innerHTML = sFooter; + elFooter.style.display = ""; + } + else { + elFooter.innerHTML = ""; + elFooter.style.display = "none"; + } + } +}; + +/** + * Sets HTML markup for the results container body. This markup will be + * inserted within a <div> tag with a class of "yui-ac-bd". + * + * @method setBody + * @param sBody {String} HTML markup for results container body. + */ +YAHOO.widget.AutoComplete.prototype.setBody = function(sBody) { + if(this._elBody) { + var elBody = this._elBody; + YAHOO.util.Event.purgeElement(elBody, true); + if(sBody) { + elBody.innerHTML = sBody; + elBody.style.display = ""; + } + else { + elBody.innerHTML = ""; + elBody.style.display = "none"; + } + this._elList = null; + } +}; + +/** +* A function that converts an AutoComplete query into a request value which is then +* passed to the DataSource's sendRequest method in order to retrieve data for +* the query. By default, returns a String with the syntax: "query={query}" +* Implementers can customize this method for custom request syntaxes. +* +* @method generateRequest +* @param sQuery {String} Query string +* @return {MIXED} Request +*/ +YAHOO.widget.AutoComplete.prototype.generateRequest = function(sQuery) { + var dataType = this.dataSource.dataType; + + // Transform query string in to a request for remote data + // By default, local data doesn't need a transformation, just passes along the query as is. + if(dataType === YAHOO.util.DataSourceBase.TYPE_XHR) { + // By default, XHR GET requests look like "{scriptURI}?{scriptQueryParam}={sQuery}&{scriptQueryAppend}" + if(!this.dataSource.connMethodPost) { + sQuery = (this.queryQuestionMark ? "?" : "") + (this.dataSource.scriptQueryParam || "query") + "=" + sQuery + + (this.dataSource.scriptQueryAppend ? ("&" + this.dataSource.scriptQueryAppend) : ""); + } + // By default, XHR POST bodies are sent to the {scriptURI} like "{scriptQueryParam}={sQuery}&{scriptQueryAppend}" + else { + sQuery = (this.dataSource.scriptQueryParam || "query") + "=" + sQuery + + (this.dataSource.scriptQueryAppend ? ("&" + this.dataSource.scriptQueryAppend) : ""); + } + } + // By default, remote script node requests look like "{scriptURI}&{scriptCallbackParam}={callbackString}&{scriptQueryParam}={sQuery}&{scriptQueryAppend}" + else if(dataType === YAHOO.util.DataSourceBase.TYPE_SCRIPTNODE) { + sQuery = "&" + (this.dataSource.scriptQueryParam || "query") + "=" + sQuery + + (this.dataSource.scriptQueryAppend ? ("&" + this.dataSource.scriptQueryAppend) : ""); + } + + return sQuery; +}; + +/** + * Makes query request to the DataSource. + * + * @method sendQuery + * @param sQuery {String} Query string. + */ +YAHOO.widget.AutoComplete.prototype.sendQuery = function(sQuery) { + // Activate focus for a new interaction + this._bFocused = true; + + // Adjust programatically sent queries to look like they were input by user + // when delimiters are enabled + var newQuery = (this.delimChar) ? this._elTextbox.value + sQuery : sQuery; + this._sendQuery(newQuery); +}; + +/** + * Snaps container to bottom-left corner of input element + * + * @method snapContainer + */ +YAHOO.widget.AutoComplete.prototype.snapContainer = function() { + var oTextbox = this._elTextbox, + pos = YAHOO.util.Dom.getXY(oTextbox); + pos[1] += YAHOO.util.Dom.get(oTextbox).offsetHeight + 2; + YAHOO.util.Dom.setXY(this._elContainer,pos); +}; + +/** + * Expands container. + * + * @method expandContainer + */ +YAHOO.widget.AutoComplete.prototype.expandContainer = function() { + this._toggleContainer(true); +}; + +/** + * Collapses container. + * + * @method collapseContainer + */ +YAHOO.widget.AutoComplete.prototype.collapseContainer = function() { + this._toggleContainer(false); +}; + +/** + * Clears entire list of suggestions. + * + * @method clearList + */ +YAHOO.widget.AutoComplete.prototype.clearList = function() { + var allItems = this._elList.childNodes, + i=allItems.length-1; + for(; i>-1; i--) { + allItems[i].style.display = "none"; + } +}; + +/** + * Handles subset matching for when queryMatchSubset is enabled. + * + * @method getSubsetMatches + * @param sQuery {String} Query string. + * @return {Object} oParsedResponse or null. + */ +YAHOO.widget.AutoComplete.prototype.getSubsetMatches = function(sQuery) { + var subQuery, oCachedResponse, subRequest; + // Loop through substrings of each cached element's query property... + for(var i = sQuery.length; i >= this.minQueryLength ; i--) { + subRequest = this.generateRequest(sQuery.substr(0,i)); + this.dataRequestEvent.fire(this, subQuery, subRequest); + + // If a substring of the query is found in the cache + oCachedResponse = this.dataSource.getCachedResponse(subRequest); + if(oCachedResponse) { + return this.filterResults.apply(this.dataSource, [sQuery, oCachedResponse, oCachedResponse, {scope:this}]); + } + } + return null; +}; + +/** + * Executed by DataSource (within DataSource scope via doBeforeParseData()) to + * handle responseStripAfter cleanup. + * + * @method preparseRawResponse + * @param sQuery {String} Query string. + * @return {Object} oParsedResponse or null. + */ +YAHOO.widget.AutoComplete.prototype.preparseRawResponse = function(oRequest, oFullResponse, oCallback) { + var nEnd = ((this.responseStripAfter !== "") && (oFullResponse.indexOf)) ? + oFullResponse.indexOf(this.responseStripAfter) : -1; + if(nEnd != -1) { + oFullResponse = oFullResponse.substring(0,nEnd); + } + return oFullResponse; +}; + +/** + * Executed by DataSource (within DataSource scope via doBeforeCallback()) to + * filter results through a simple client-side matching algorithm. + * + * @method filterResults + * @param sQuery {String} Original request. + * @param oFullResponse {Object} Full response object. + * @param oParsedResponse {Object} Parsed response object. + * @param oCallback {Object} Callback object. + * @return {Object} Filtered response object. + */ + +YAHOO.widget.AutoComplete.prototype.filterResults = function(sQuery, oFullResponse, oParsedResponse, oCallback) { + // If AC has passed a query string value back to itself, grab it + if(oCallback && oCallback.argument && oCallback.argument.query) { + sQuery = oCallback.argument.query; + } + + // Only if a query string is available to match against + if(sQuery && sQuery !== "") { + // First make a copy of the oParseResponse + oParsedResponse = YAHOO.widget.AutoComplete._cloneObject(oParsedResponse); + + var oAC = oCallback.scope, + oDS = this, + allResults = oParsedResponse.results, // the array of results + filteredResults = [], // container for filtered results, + nMax = oAC.maxResultsDisplayed, // max to find + bMatchCase = (oDS.queryMatchCase || oAC.queryMatchCase), // backward compat + bMatchContains = (oDS.queryMatchContains || oAC.queryMatchContains); // backward compat + + // Loop through each result object... + for(var i=0, len=allResults.length; i -1))) { + // Stash the match + filteredResults.push(oResult); + } + } + + // Filter no more if maxResultsDisplayed is reached + if(len>nMax && filteredResults.length===nMax) { + break; + } + } + oParsedResponse.results = filteredResults; + } + else { + } + + return oParsedResponse; +}; + +/** + * Handles response for display. This is the callback function method passed to + * YAHOO.util.DataSourceBase#sendRequest so results from the DataSource are + * returned to the AutoComplete instance. + * + * @method handleResponse + * @param sQuery {String} Original request. + * @param oResponse {Object} Response object. + * @param oPayload {MIXED} (optional) Additional argument(s) + */ +YAHOO.widget.AutoComplete.prototype.handleResponse = function(sQuery, oResponse, oPayload) { + if((this instanceof YAHOO.widget.AutoComplete) && this._sName) { + this._populateList(sQuery, oResponse, oPayload); + } +}; + +/** + * Overridable method called before container is loaded with result data. + * + * @method doBeforeLoadData + * @param sQuery {String} Original request. + * @param oResponse {Object} Response object. + * @param oPayload {MIXED} (optional) Additional argument(s) + * @return {Boolean} Return true to continue loading data, false to cancel. + */ +YAHOO.widget.AutoComplete.prototype.doBeforeLoadData = function(sQuery, oResponse, oPayload) { + return true; +}; + +/** + * Overridable method that returns HTML markup for one result to be populated + * as innerHTML of an <LI> element. + * + * @method formatResult + * @param oResultData {Object} Result data object. + * @param sQuery {String} The corresponding query string. + * @param sResultMatch {HTMLElement} The current query string. + * @return {String} HTML markup of formatted result data. + */ +YAHOO.widget.AutoComplete.prototype.formatResult = function(oResultData, sQuery, sResultMatch) { + var sMarkup = (sResultMatch) ? sResultMatch : ""; + return sMarkup; +}; + +/** + * Overridable method called before container expands allows implementers to access data + * and DOM elements. + * + * @method doBeforeExpandContainer + * @param elTextbox {HTMLElement} The text input box. + * @param elContainer {HTMLElement} The container element. + * @param sQuery {String} The query string. + * @param aResults {Object[]} An array of query results. + * @return {Boolean} Return true to continue expanding container, false to cancel the expand. + */ +YAHOO.widget.AutoComplete.prototype.doBeforeExpandContainer = function(elTextbox, elContainer, sQuery, aResults) { + return true; +}; + + +/** + * Nulls out the entire AutoComplete instance and related objects, removes attached + * event listeners, and clears out DOM elements inside the container. After + * calling this method, the instance reference should be expliclitly nulled by + * implementer, as in myAutoComplete = null. Use with caution! + * + * @method destroy + */ +YAHOO.widget.AutoComplete.prototype.destroy = function() { + var instanceName = this.toString(); + var elInput = this._elTextbox; + var elContainer = this._elContainer; + + // Unhook custom events + this.textboxFocusEvent.unsubscribeAll(); + this.textboxKeyEvent.unsubscribeAll(); + this.dataRequestEvent.unsubscribeAll(); + this.dataReturnEvent.unsubscribeAll(); + this.dataErrorEvent.unsubscribeAll(); + this.containerPopulateEvent.unsubscribeAll(); + this.containerExpandEvent.unsubscribeAll(); + this.typeAheadEvent.unsubscribeAll(); + this.itemMouseOverEvent.unsubscribeAll(); + this.itemMouseOutEvent.unsubscribeAll(); + this.itemArrowToEvent.unsubscribeAll(); + this.itemArrowFromEvent.unsubscribeAll(); + this.itemSelectEvent.unsubscribeAll(); + this.unmatchedItemSelectEvent.unsubscribeAll(); + this.selectionEnforceEvent.unsubscribeAll(); + this.containerCollapseEvent.unsubscribeAll(); + this.textboxBlurEvent.unsubscribeAll(); + this.textboxChangeEvent.unsubscribeAll(); + + // Unhook DOM events + YAHOO.util.Event.purgeElement(elInput, true); + YAHOO.util.Event.purgeElement(elContainer, true); + + // Remove DOM elements + elContainer.innerHTML = ""; + + // Null out objects + for(var key in this) { + if(YAHOO.lang.hasOwnProperty(this, key)) { + this[key] = null; + } + } + +}; + +///////////////////////////////////////////////////////////////////////////// +// +// Public events +// +///////////////////////////////////////////////////////////////////////////// + +/** + * Fired when the input field receives focus. + * + * @event textboxFocusEvent + * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance. + */ +YAHOO.widget.AutoComplete.prototype.textboxFocusEvent = null; + +/** + * Fired when the input field receives key input. + * + * @event textboxKeyEvent + * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance. + * @param nKeycode {Number} The keycode number. + */ +YAHOO.widget.AutoComplete.prototype.textboxKeyEvent = null; + +/** + * Fired when the AutoComplete instance makes a request to the DataSource. + * + * @event dataRequestEvent + * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance. + * @param sQuery {String} The query string. + * @param oRequest {Object} The request. + */ +YAHOO.widget.AutoComplete.prototype.dataRequestEvent = null; + +/** + * Fired when the AutoComplete instance receives query results from the data + * source. + * + * @event dataReturnEvent + * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance. + * @param sQuery {String} The query string. + * @param aResults {Object[]} Results array. + */ +YAHOO.widget.AutoComplete.prototype.dataReturnEvent = null; + +/** + * Fired when the AutoComplete instance does not receive query results from the + * DataSource due to an error. + * + * @event dataErrorEvent + * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance. + * @param sQuery {String} The query string. + * @param oResponse {Object} The response object, if available. + */ +YAHOO.widget.AutoComplete.prototype.dataErrorEvent = null; + +/** + * Fired when the results container is populated. + * + * @event containerPopulateEvent + * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance. + */ +YAHOO.widget.AutoComplete.prototype.containerPopulateEvent = null; + +/** + * Fired when the results container is expanded. + * + * @event containerExpandEvent + * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance. + */ +YAHOO.widget.AutoComplete.prototype.containerExpandEvent = null; + +/** + * Fired when the input field has been prefilled by the type-ahead + * feature. + * + * @event typeAheadEvent + * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance. + * @param sQuery {String} The query string. + * @param sPrefill {String} The prefill string. + */ +YAHOO.widget.AutoComplete.prototype.typeAheadEvent = null; + +/** + * Fired when result item has been moused over. + * + * @event itemMouseOverEvent + * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance. + * @param elItem {HTMLElement} The <li> element item moused to. + */ +YAHOO.widget.AutoComplete.prototype.itemMouseOverEvent = null; + +/** + * Fired when result item has been moused out. + * + * @event itemMouseOutEvent + * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance. + * @param elItem {HTMLElement} The <li> element item moused from. + */ +YAHOO.widget.AutoComplete.prototype.itemMouseOutEvent = null; + +/** + * Fired when result item has been arrowed to. + * + * @event itemArrowToEvent + * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance. + * @param elItem {HTMLElement} The <li> element item arrowed to. + */ +YAHOO.widget.AutoComplete.prototype.itemArrowToEvent = null; + +/** + * Fired when result item has been arrowed away from. + * + * @event itemArrowFromEvent + * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance. + * @param elItem {HTMLElement} The <li> element item arrowed from. + */ +YAHOO.widget.AutoComplete.prototype.itemArrowFromEvent = null; + +/** + * Fired when an item is selected via mouse click, ENTER key, or TAB key. + * + * @event itemSelectEvent + * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance. + * @param elItem {HTMLElement} The selected <li> element item. + * @param oData {Object} The data returned for the item, either as an object, + * or mapped from the schema into an array. + */ +YAHOO.widget.AutoComplete.prototype.itemSelectEvent = null; + +/** + * Fired when a user selection does not match any of the displayed result items. + * + * @event unmatchedItemSelectEvent + * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance. + * @param sSelection {String} The selected string. + */ +YAHOO.widget.AutoComplete.prototype.unmatchedItemSelectEvent = null; + +/** + * Fired if forceSelection is enabled and the user's input has been cleared + * because it did not match one of the returned query results. + * + * @event selectionEnforceEvent + * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance. + * @param sClearedValue {String} The cleared value (including delimiters if applicable). + */ +YAHOO.widget.AutoComplete.prototype.selectionEnforceEvent = null; + +/** + * Fired when the results container is collapsed. + * + * @event containerCollapseEvent + * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance. + */ +YAHOO.widget.AutoComplete.prototype.containerCollapseEvent = null; + +/** + * Fired when the input field loses focus. + * + * @event textboxBlurEvent + * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance. + */ +YAHOO.widget.AutoComplete.prototype.textboxBlurEvent = null; + +/** + * Fired when the input field value has changed when it loses focus. + * + * @event textboxChangeEvent + * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance. + */ +YAHOO.widget.AutoComplete.prototype.textboxChangeEvent = null; + +///////////////////////////////////////////////////////////////////////////// +// +// Private member variables +// +///////////////////////////////////////////////////////////////////////////// + +/** + * Internal class variable to index multiple AutoComplete instances. + * + * @property _nIndex + * @type Number + * @default 0 + * @private + */ +YAHOO.widget.AutoComplete._nIndex = 0; + +/** + * Name of AutoComplete instance. + * + * @property _sName + * @type String + * @private + */ +YAHOO.widget.AutoComplete.prototype._sName = null; + +/** + * Text input field DOM element. + * + * @property _elTextbox + * @type HTMLElement + * @private + */ +YAHOO.widget.AutoComplete.prototype._elTextbox = null; + +/** + * Container DOM element. + * + * @property _elContainer + * @type HTMLElement + * @private + */ +YAHOO.widget.AutoComplete.prototype._elContainer = null; + +/** + * Reference to content element within container element. + * + * @property _elContent + * @type HTMLElement + * @private + */ +YAHOO.widget.AutoComplete.prototype._elContent = null; + +/** + * Reference to header element within content element. + * + * @property _elHeader + * @type HTMLElement + * @private + */ +YAHOO.widget.AutoComplete.prototype._elHeader = null; + +/** + * Reference to body element within content element. + * + * @property _elBody + * @type HTMLElement + * @private + */ +YAHOO.widget.AutoComplete.prototype._elBody = null; + +/** + * Reference to footer element within content element. + * + * @property _elFooter + * @type HTMLElement + * @private + */ +YAHOO.widget.AutoComplete.prototype._elFooter = null; + +/** + * Reference to shadow element within container element. + * + * @property _elShadow + * @type HTMLElement + * @private + */ +YAHOO.widget.AutoComplete.prototype._elShadow = null; + +/** + * Reference to iframe element within container element. + * + * @property _elIFrame + * @type HTMLElement + * @private + */ +YAHOO.widget.AutoComplete.prototype._elIFrame = null; + +/** + * Whether or not the widget instance is currently active. If query results come back + * but the user has already moved on, do not proceed with auto complete behavior. + * + * @property _bFocused + * @type Boolean + * @private + */ +YAHOO.widget.AutoComplete.prototype._bFocused = false; + +/** + * Animation instance for container expand/collapse. + * + * @property _oAnim + * @type Boolean + * @private + */ +YAHOO.widget.AutoComplete.prototype._oAnim = null; + +/** + * Whether or not the results container is currently open. + * + * @property _bContainerOpen + * @type Boolean + * @private + */ +YAHOO.widget.AutoComplete.prototype._bContainerOpen = false; + +/** + * Whether or not the mouse is currently over the results + * container. This is necessary in order to prevent clicks on container items + * from being text input field blur events. + * + * @property _bOverContainer + * @type Boolean + * @private + */ +YAHOO.widget.AutoComplete.prototype._bOverContainer = false; + +/** + * Internal reference to <ul> elements that contains query results within the + * results container. + * + * @property _elList + * @type HTMLElement + * @private + */ +YAHOO.widget.AutoComplete.prototype._elList = null; + +/* + * Array of <li> elements references that contain query results within the + * results container. + * + * @property _aListItemEls + * @type HTMLElement[] + * @private + */ +//YAHOO.widget.AutoComplete.prototype._aListItemEls = null; + +/** + * Number of <li> elements currently displayed in results container. + * + * @property _nDisplayedItems + * @type Number + * @private + */ +YAHOO.widget.AutoComplete.prototype._nDisplayedItems = 0; + +/* + * Internal count of <li> elements displayed and hidden in results container. + * + * @property _maxResultsDisplayed + * @type Number + * @private + */ +//YAHOO.widget.AutoComplete.prototype._maxResultsDisplayed = 0; + +/** + * Current query string + * + * @property _sCurQuery + * @type String + * @private + */ +YAHOO.widget.AutoComplete.prototype._sCurQuery = null; + +/** + * Selections from previous queries (for saving delimited queries). + * + * @property _sPastSelections + * @type String + * @default "" + * @private + */ +YAHOO.widget.AutoComplete.prototype._sPastSelections = ""; + +/** + * Stores initial input value used to determine if textboxChangeEvent should be fired. + * + * @property _sInitInputValue + * @type String + * @private + */ +YAHOO.widget.AutoComplete.prototype._sInitInputValue = null; + +/** + * Pointer to the currently highlighted <li> element in the container. + * + * @property _elCurListItem + * @type HTMLElement + * @private + */ +YAHOO.widget.AutoComplete.prototype._elCurListItem = null; + +/** + * Pointer to the currently pre-highlighted <li> element in the container. + * + * @property _elCurPrehighlightItem + * @type HTMLElement + * @private + */ +YAHOO.widget.AutoComplete.prototype._elCurPrehighlightItem = null; + +/** + * Whether or not an item has been selected since the container was populated + * with results. Reset to false by _populateList, and set to true when item is + * selected. + * + * @property _bItemSelected + * @type Boolean + * @private + */ +YAHOO.widget.AutoComplete.prototype._bItemSelected = false; + +/** + * Key code of the last key pressed in textbox. + * + * @property _nKeyCode + * @type Number + * @private + */ +YAHOO.widget.AutoComplete.prototype._nKeyCode = null; + +/** + * Delay timeout ID. + * + * @property _nDelayID + * @type Number + * @private + */ +YAHOO.widget.AutoComplete.prototype._nDelayID = -1; + +/** + * TypeAhead delay timeout ID. + * + * @property _nTypeAheadDelayID + * @type Number + * @private + */ +YAHOO.widget.AutoComplete.prototype._nTypeAheadDelayID = -1; + +/** + * Src to iFrame used when useIFrame = true. Supports implementations over SSL + * as well. + * + * @property _iFrameSrc + * @type String + * @private + */ +YAHOO.widget.AutoComplete.prototype._iFrameSrc = "javascript:false;"; + +/** + * For users typing via certain IMEs, queries must be triggered by intervals, + * since key events yet supported across all browsers for all IMEs. + * + * @property _queryInterval + * @type Object + * @private + */ +YAHOO.widget.AutoComplete.prototype._queryInterval = null; + +/** + * Internal tracker to last known textbox value, used to determine whether or not + * to trigger a query via interval for certain IME users. + * + * @event _sLastTextboxValue + * @type String + * @private + */ +YAHOO.widget.AutoComplete.prototype._sLastTextboxValue = null; + +///////////////////////////////////////////////////////////////////////////// +// +// Private methods +// +///////////////////////////////////////////////////////////////////////////// + +/** + * Updates and validates latest public config properties. + * + * @method __initProps + * @private + */ +YAHOO.widget.AutoComplete.prototype._initProps = function() { + // Correct any invalid values + var minQueryLength = this.minQueryLength; + if(!YAHOO.lang.isNumber(minQueryLength)) { + this.minQueryLength = 1; + } + var maxResultsDisplayed = this.maxResultsDisplayed; + if(!YAHOO.lang.isNumber(maxResultsDisplayed) || (maxResultsDisplayed < 1)) { + this.maxResultsDisplayed = 10; + } + var queryDelay = this.queryDelay; + if(!YAHOO.lang.isNumber(queryDelay) || (queryDelay < 0)) { + this.queryDelay = 0.2; + } + var typeAheadDelay = this.typeAheadDelay; + if(!YAHOO.lang.isNumber(typeAheadDelay) || (typeAheadDelay < 0)) { + this.typeAheadDelay = 0.2; + } + var delimChar = this.delimChar; + if(YAHOO.lang.isString(delimChar) && (delimChar.length > 0)) { + this.delimChar = [delimChar]; + } + else if(!YAHOO.lang.isArray(delimChar)) { + this.delimChar = null; + } + var animSpeed = this.animSpeed; + if((this.animHoriz || this.animVert) && YAHOO.util.Anim) { + if(!YAHOO.lang.isNumber(animSpeed) || (animSpeed < 0)) { + this.animSpeed = 0.3; + } + if(!this._oAnim ) { + this._oAnim = new YAHOO.util.Anim(this._elContent, {}, this.animSpeed); + } + else { + this._oAnim.duration = this.animSpeed; + } + } + if(this.forceSelection && delimChar) { + } +}; + +/** + * Initializes the results container helpers if they are enabled and do + * not exist + * + * @method _initContainerHelperEls + * @private + */ +YAHOO.widget.AutoComplete.prototype._initContainerHelperEls = function() { + if(this.useShadow && !this._elShadow) { + var elShadow = document.createElement("div"); + elShadow.className = "yui-ac-shadow"; + elShadow.style.width = 0; + elShadow.style.height = 0; + this._elShadow = this._elContainer.appendChild(elShadow); + } + if(this.useIFrame && !this._elIFrame) { + var elIFrame = document.createElement("iframe"); + elIFrame.src = this._iFrameSrc; + elIFrame.frameBorder = 0; + elIFrame.scrolling = "no"; + elIFrame.style.position = "absolute"; + elIFrame.style.width = 0; + elIFrame.style.height = 0; + elIFrame.style.padding = 0; + elIFrame.tabIndex = -1; + elIFrame.role = "presentation"; + elIFrame.title = "Presentational iframe shim"; + this._elIFrame = this._elContainer.appendChild(elIFrame); + } +}; + +/** + * Initializes the results container once at object creation + * + * @method _initContainerEl + * @private + */ +YAHOO.widget.AutoComplete.prototype._initContainerEl = function() { + YAHOO.util.Dom.addClass(this._elContainer, "yui-ac-container"); + + if(!this._elContent) { + // The elContent div is assigned DOM listeners and + // helps size the iframe and shadow properly + var elContent = document.createElement("div"); + elContent.className = "yui-ac-content"; + elContent.style.display = "none"; + + this._elContent = this._elContainer.appendChild(elContent); + + var elHeader = document.createElement("div"); + elHeader.className = "yui-ac-hd"; + elHeader.style.display = "none"; + this._elHeader = this._elContent.appendChild(elHeader); + + var elBody = document.createElement("div"); + elBody.className = "yui-ac-bd"; + this._elBody = this._elContent.appendChild(elBody); + + var elFooter = document.createElement("div"); + elFooter.className = "yui-ac-ft"; + elFooter.style.display = "none"; + this._elFooter = this._elContent.appendChild(elFooter); + } + else { + } +}; + +/** + * Clears out contents of container body and creates up to + * YAHOO.widget.AutoComplete#maxResultsDisplayed <li> elements in an + * <ul> element. + * + * @method _initListEl + * @private + */ +YAHOO.widget.AutoComplete.prototype._initListEl = function() { + var nListLength = this.maxResultsDisplayed, + elList = this._elList || document.createElement("ul"), + elListItem; + + while(elList.childNodes.length < nListLength) { + elListItem = document.createElement("li"); + elListItem.style.display = "none"; + elListItem._nItemIndex = elList.childNodes.length; + elList.appendChild(elListItem); + } + if(!this._elList) { + var elBody = this._elBody; + YAHOO.util.Event.purgeElement(elBody, true); + elBody.innerHTML = ""; + this._elList = elBody.appendChild(elList); + } + + this._elBody.style.display = ""; +}; + +/** + * Focuses input field. + * + * @method _focus + * @private + */ +YAHOO.widget.AutoComplete.prototype._focus = function() { + // http://developer.mozilla.org/en/docs/index.php?title=Key-navigable_custom_DHTML_widgets + var oSelf = this; + setTimeout(function() { + try { + oSelf._elTextbox.focus(); + } + catch(e) { + } + },0); +}; + +/** + * Enables interval detection for IME support. + * + * @method _enableIntervalDetection + * @private + */ +YAHOO.widget.AutoComplete.prototype._enableIntervalDetection = function() { + var oSelf = this; + if(!oSelf._queryInterval && oSelf.queryInterval) { + oSelf._queryInterval = setInterval(function() { oSelf._onInterval(); }, oSelf.queryInterval); + } +}; + +/** + * Enables interval detection for a less performant but brute force mechanism to + * detect input values at an interval set by queryInterval and send queries if + * input value has changed. Needed to support right-click+paste or shift+insert + * edge cases. Please note that intervals are cleared at the end of each interaction, + * so enableIntervalDetection must be called for each new interaction. The + * recommended approach is to call it in response to textboxFocusEvent. + * + * @method enableIntervalDetection + */ +YAHOO.widget.AutoComplete.prototype.enableIntervalDetection = + YAHOO.widget.AutoComplete.prototype._enableIntervalDetection; + +/** + * Enables query triggers based on text input detection by intervals (rather + * than by key events). + * + * @method _onInterval + * @private + */ +YAHOO.widget.AutoComplete.prototype._onInterval = function() { + var currValue = this._elTextbox.value; + var lastValue = this._sLastTextboxValue; + if(currValue != lastValue) { + this._sLastTextboxValue = currValue; + this._sendQuery(currValue); + } +}; + +/** + * Cancels text input detection by intervals. + * + * @method _clearInterval + * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance. + * @private + */ +YAHOO.widget.AutoComplete.prototype._clearInterval = function() { + if(this._queryInterval) { + clearInterval(this._queryInterval); + this._queryInterval = null; + } +}; + +/** + * Whether or not key is functional or should be ignored. Note that the right + * arrow key is NOT an ignored key since it triggers queries for certain intl + * charsets. + * + * @method _isIgnoreKey + * @param nKeycode {Number} Code of key pressed. + * @return {Boolean} True if key should be ignored, false otherwise. + * @private + */ +YAHOO.widget.AutoComplete.prototype._isIgnoreKey = function(nKeyCode) { + if((nKeyCode == 9) || (nKeyCode == 13) || // tab, enter + (nKeyCode == 16) || (nKeyCode == 17) || // shift, ctl + (nKeyCode >= 18 && nKeyCode <= 20) || // alt, pause/break,caps lock + (nKeyCode == 27) || // esc + (nKeyCode >= 33 && nKeyCode <= 35) || // page up,page down,end + /*(nKeyCode >= 36 && nKeyCode <= 38) || // home,left,up + (nKeyCode == 40) || // down*/ + (nKeyCode >= 36 && nKeyCode <= 40) || // home,left,up, right, down + (nKeyCode >= 44 && nKeyCode <= 45) || // print screen,insert + (nKeyCode == 229) // Bug 2041973: Korean XP fires 2 keyup events, the key and 229 + ) { + return true; + } + return false; +}; + +/** + * Makes query request to the DataSource. + * + * @method _sendQuery + * @param sQuery {String} Query string. + * @private + */ +YAHOO.widget.AutoComplete.prototype._sendQuery = function(sQuery) { + // Widget has been effectively turned off + if(this.minQueryLength < 0) { + this._toggleContainer(false); + return; + } + // Delimiter has been enabled + if(this.delimChar) { + var extraction = this._extractQuery(sQuery); + // Here is the query itself + sQuery = extraction.query; + // ...and save the rest of the string for later + this._sPastSelections = extraction.previous; + } + + // Don't search queries that are too short + if((sQuery && (sQuery.length < this.minQueryLength)) || (!sQuery && this.minQueryLength > 0)) { + if(this._nDelayID != -1) { + clearTimeout(this._nDelayID); + } + this._toggleContainer(false); + return; + } + + sQuery = encodeURIComponent(sQuery); + this._nDelayID = -1; // Reset timeout ID because request is being made + + // Subset matching + if(this.dataSource.queryMatchSubset || this.queryMatchSubset) { // backward compat + var oResponse = this.getSubsetMatches(sQuery); + if(oResponse) { + this.handleResponse(sQuery, oResponse, {query: sQuery}); + return; + } + } + + if(this.dataSource.responseStripAfter) { + this.dataSource.doBeforeParseData = this.preparseRawResponse; + } + if(this.applyLocalFilter) { + this.dataSource.doBeforeCallback = this.filterResults; + } + + var sRequest = this.generateRequest(sQuery); + this.dataRequestEvent.fire(this, sQuery, sRequest); + + this.dataSource.sendRequest(sRequest, { + success : this.handleResponse, + failure : this.handleResponse, + scope : this, + argument: { + query: sQuery + } + }); +}; + +/** + * Populates the given <li> element with return value from formatResult(). + * + * @method _populateListItem + * @param elListItem {HTMLElement} The LI element. + * @param oResult {Object} The result object. + * @param sCurQuery {String} The query string. + * @private + */ +YAHOO.widget.AutoComplete.prototype._populateListItem = function(elListItem, oResult, sQuery) { + elListItem.innerHTML = this.formatResult(oResult, sQuery, elListItem._sResultMatch); +}; + +/** + * Populates the array of <li> elements in the container with query + * results. + * + * @method _populateList + * @param sQuery {String} Original request. + * @param oResponse {Object} Response object. + * @param oPayload {MIXED} (optional) Additional argument(s) + * @private + */ +YAHOO.widget.AutoComplete.prototype._populateList = function(sQuery, oResponse, oPayload) { + // Clear previous timeout + if(this._nTypeAheadDelayID != -1) { + clearTimeout(this._nTypeAheadDelayID); + } + + sQuery = (oPayload && oPayload.query) ? oPayload.query : sQuery; + + // Pass data through abstract method for any transformations + var ok = this.doBeforeLoadData(sQuery, oResponse, oPayload); + + // Data is ok + if(ok && !oResponse.error) { + this.dataReturnEvent.fire(this, sQuery, oResponse.results); + + // Continue only if instance is still active (i.e., user hasn't already moved on) + if(this._bFocused) { + // Store state for this interaction + var sCurQuery = decodeURIComponent(sQuery); + this._sCurQuery = sCurQuery; + this._bItemSelected = false; + + var allResults = oResponse.results, + nItemsToShow = Math.min(allResults.length,this.maxResultsDisplayed), + sMatchKey = (this.dataSource.responseSchema.fields) ? + (this.dataSource.responseSchema.fields[0].key || this.dataSource.responseSchema.fields[0]) : 0; + + if(nItemsToShow > 0) { + // Make sure container and helpers are ready to go + if(!this._elList || (this._elList.childNodes.length < nItemsToShow)) { + this._initListEl(); + } + this._initContainerHelperEls(); + + var allListItemEls = this._elList.childNodes; + // Fill items with data from the bottom up + for(var i = nItemsToShow-1; i >= 0; i--) { + var elListItem = allListItemEls[i], + oResult = allResults[i]; + + // Backward compatibility + if(this.resultTypeList) { + // Results need to be converted back to an array + var aResult = []; + // Match key is first + aResult[0] = (YAHOO.lang.isString(oResult)) ? oResult : oResult[sMatchKey] || oResult[this.key]; + // Add additional data to the result array + var fields = this.dataSource.responseSchema.fields; + if(YAHOO.lang.isArray(fields) && (fields.length > 1)) { + for(var k=1, len=fields.length; k= nItemsToShow; j--) { + extraListItem = allListItemEls[j]; + extraListItem.style.display = "none"; + } + } + + this._nDisplayedItems = nItemsToShow; + + this.containerPopulateEvent.fire(this, sQuery, allResults); + + // Highlight the first item + if(this.autoHighlight) { + var elFirstListItem = this._elList.firstChild; + this._toggleHighlight(elFirstListItem,"to"); + this.itemArrowToEvent.fire(this, elFirstListItem); + this._typeAhead(elFirstListItem,sQuery); + } + // Unhighlight any previous time + else { + this._toggleHighlight(this._elCurListItem,"from"); + } + + // Pre-expansion stuff + ok = this._doBeforeExpandContainer(this._elTextbox, this._elContainer, sQuery, allResults); + + // Expand the container + this._toggleContainer(ok); + } + else { + this._toggleContainer(false); + } + + return; + } + } + // Error + else { + this.dataErrorEvent.fire(this, sQuery, oResponse); + } + +}; + +/** + * Called before container expands, by default snaps container to the + * bottom-left corner of the input element, then calls public overrideable method. + * + * @method _doBeforeExpandContainer + * @param elTextbox {HTMLElement} The text input box. + * @param elContainer {HTMLElement} The container element. + * @param sQuery {String} The query string. + * @param aResults {Object[]} An array of query results. + * @return {Boolean} Return true to continue expanding container, false to cancel the expand. + * @private + */ +YAHOO.widget.AutoComplete.prototype._doBeforeExpandContainer = function(elTextbox, elContainer, sQuery, aResults) { + if(this.autoSnapContainer) { + this.snapContainer(); + } + + return this.doBeforeExpandContainer(elTextbox, elContainer, sQuery, aResults); +}; + +/** + * When forceSelection is true and the user attempts + * leave the text input box without selecting an item from the query results, + * the user selection is cleared. + * + * @method _clearSelection + * @private + */ +YAHOO.widget.AutoComplete.prototype._clearSelection = function() { + var extraction = (this.delimChar) ? this._extractQuery(this._elTextbox.value) : + {previous:"",query:this._elTextbox.value}; + this._elTextbox.value = extraction.previous; + this.selectionEnforceEvent.fire(this, extraction.query); +}; + +/** + * Whether or not user-typed value in the text input box matches any of the + * query results. + * + * @method _textMatchesOption + * @return {HTMLElement} Matching list item element if user-input text matches + * a result, null otherwise. + * @private + */ +YAHOO.widget.AutoComplete.prototype._textMatchesOption = function() { + var elMatch = null; + + for(var i=0; i= 0; i--) { + nNewIndex = sQuery.lastIndexOf(aDelimChar[i]); + if(nNewIndex > nDelimIndex) { + nDelimIndex = nNewIndex; + } + } + // If we think the last delimiter is a space (" "), make sure it is NOT + // a false positive by also checking the char directly before it + if(aDelimChar[i] == " ") { + for (var j = aDelimChar.length-1; j >= 0; j--) { + if(sQuery[nDelimIndex - 1] == aDelimChar[j]) { + nDelimIndex--; + break; + } + } + } + // A delimiter has been found in the query so extract the latest query from past selections + if(nDelimIndex > -1) { + nQueryStart = nDelimIndex + 1; + // Trim any white space from the beginning... + while(sQuery.charAt(nQueryStart) == " ") { + nQueryStart += 1; + } + // ...and save the rest of the string for later + sPrevious = sQuery.substring(0,nQueryStart); + // Here is the query itself + sQuery = sQuery.substr(nQueryStart); + } + // No delimiter found in the query, so there are no selections from past queries + else { + sPrevious = ""; + } + + return { + previous: sPrevious, + query: sQuery + }; +}; + +/** + * Syncs results container with its helpers. + * + * @method _toggleContainerHelpers + * @param bShow {Boolean} True if container is expanded, false if collapsed + * @private + */ +YAHOO.widget.AutoComplete.prototype._toggleContainerHelpers = function(bShow) { + var width = this._elContent.offsetWidth + "px"; + var height = this._elContent.offsetHeight + "px"; + + if(this.useIFrame && this._elIFrame) { + var elIFrame = this._elIFrame; + if(bShow) { + elIFrame.style.width = width; + elIFrame.style.height = height; + elIFrame.style.padding = ""; + } + else { + elIFrame.style.width = 0; + elIFrame.style.height = 0; + elIFrame.style.padding = 0; + } + } + if(this.useShadow && this._elShadow) { + var elShadow = this._elShadow; + if(bShow) { + elShadow.style.width = width; + elShadow.style.height = height; + } + else { + elShadow.style.width = 0; + elShadow.style.height = 0; + } + } +}; + +/** + * Animates expansion or collapse of the container. + * + * @method _toggleContainer + * @param bShow {Boolean} True if container should be expanded, false if container should be collapsed + * @private + */ +YAHOO.widget.AutoComplete.prototype._toggleContainer = function(bShow) { + + var elContainer = this._elContainer; + + // If implementer has container always open and it's already open, don't mess with it + // Container is initialized with display "none" so it may need to be shown first time through + if(this.alwaysShowContainer && this._bContainerOpen) { + return; + } + + // Reset states + if(!bShow) { + this._toggleHighlight(this._elCurListItem,"from"); + this._nDisplayedItems = 0; + this._sCurQuery = null; + + // Container is already closed, so don't bother with changing the UI + if(this._elContent.style.display == "none") { + return; + } + } + + // If animation is enabled... + var oAnim = this._oAnim; + if(oAnim && oAnim.getEl() && (this.animHoriz || this.animVert)) { + if(oAnim.isAnimated()) { + oAnim.stop(true); + } + + // Clone container to grab current size offscreen + var oClone = this._elContent.cloneNode(true); + elContainer.appendChild(oClone); + oClone.style.top = "-9000px"; + oClone.style.width = ""; + oClone.style.height = ""; + oClone.style.display = ""; + + // Current size of the container is the EXPANDED size + var wExp = oClone.offsetWidth; + var hExp = oClone.offsetHeight; + + // Calculate COLLAPSED sizes based on horiz and vert anim + var wColl = (this.animHoriz) ? 0 : wExp; + var hColl = (this.animVert) ? 0 : hExp; + + // Set animation sizes + oAnim.attributes = (bShow) ? + {width: { to: wExp }, height: { to: hExp }} : + {width: { to: wColl}, height: { to: hColl }}; + + // If opening anew, set to a collapsed size... + if(bShow && !this._bContainerOpen) { + this._elContent.style.width = wColl+"px"; + this._elContent.style.height = hColl+"px"; + } + // Else, set it to its last known size. + else { + this._elContent.style.width = wExp+"px"; + this._elContent.style.height = hExp+"px"; + } + + elContainer.removeChild(oClone); + oClone = null; + + var oSelf = this; + var onAnimComplete = function() { + // Finish the collapse + oAnim.onComplete.unsubscribeAll(); + + if(bShow) { + oSelf._toggleContainerHelpers(true); + oSelf._bContainerOpen = bShow; + oSelf.containerExpandEvent.fire(oSelf); + } + else { + oSelf._elContent.style.display = "none"; + oSelf._bContainerOpen = bShow; + oSelf.containerCollapseEvent.fire(oSelf); + } + }; + + // Display container and animate it + this._toggleContainerHelpers(false); // Bug 1424486: Be early to hide, late to show; + this._elContent.style.display = ""; + oAnim.onComplete.subscribe(onAnimComplete); + oAnim.animate(); + } + // Else don't animate, just show or hide + else { + if(bShow) { + this._elContent.style.display = ""; + this._toggleContainerHelpers(true); + this._bContainerOpen = bShow; + this.containerExpandEvent.fire(this); + } + else { + this._toggleContainerHelpers(false); + this._elContent.style.display = "none"; + this._bContainerOpen = bShow; + this.containerCollapseEvent.fire(this); + } + } + +}; + +/** + * Toggles the highlight on or off for an item in the container, and also cleans + * up highlighting of any previous item. + * + * @method _toggleHighlight + * @param elNewListItem {HTMLElement} The <li> element item to receive highlight behavior. + * @param sType {String} Type "mouseover" will toggle highlight on, and "mouseout" will toggle highlight off. + * @private + */ +YAHOO.widget.AutoComplete.prototype._toggleHighlight = function(elNewListItem, sType) { + if(elNewListItem) { + var sHighlight = this.highlightClassName; + if(this._elCurListItem) { + // Remove highlight from old item + YAHOO.util.Dom.removeClass(this._elCurListItem, sHighlight); + this._elCurListItem = null; + } + + if((sType == "to") && sHighlight) { + // Apply highlight to new item + YAHOO.util.Dom.addClass(elNewListItem, sHighlight); + this._elCurListItem = elNewListItem; + } + } +}; + +/** + * Toggles the pre-highlight on or off for an item in the container, and also cleans + * up pre-highlighting of any previous item. + * + * @method _togglePrehighlight + * @param elNewListItem {HTMLElement} The <li> element item to receive highlight behavior. + * @param sType {String} Type "mouseover" will toggle highlight on, and "mouseout" will toggle highlight off. + * @private + */ +YAHOO.widget.AutoComplete.prototype._togglePrehighlight = function(elNewListItem, sType) { + var sPrehighlight = this.prehighlightClassName; + + if(this._elCurPrehighlightItem) { + YAHOO.util.Dom.removeClass(this._elCurPrehighlightItem, sPrehighlight); + } + if(elNewListItem == this._elCurListItem) { + return; + } + + if((sType == "mouseover") && sPrehighlight) { + // Apply prehighlight to new item + YAHOO.util.Dom.addClass(elNewListItem, sPrehighlight); + this._elCurPrehighlightItem = elNewListItem; + } + else { + // Remove prehighlight from old item + YAHOO.util.Dom.removeClass(elNewListItem, sPrehighlight); + } +}; + +/** + * Updates the text input box value with selected query result. If a delimiter + * has been defined, then the value gets appended with the delimiter. + * + * @method _updateValue + * @param elListItem {HTMLElement} The <li> element item with which to update the value. + * @private + */ +YAHOO.widget.AutoComplete.prototype._updateValue = function(elListItem) { + if(!this.suppressInputUpdate) { + var elTextbox = this._elTextbox; + var sDelimChar = (this.delimChar) ? (this.delimChar[0] || this.delimChar) : null; + var sResultMatch = elListItem._sResultMatch; + + // Calculate the new value + var sNewValue = ""; + if(sDelimChar) { + // Preserve selections from past queries + sNewValue = this._sPastSelections; + // Add new selection plus delimiter + sNewValue += sResultMatch + sDelimChar; + if(sDelimChar != " ") { + sNewValue += " "; + } + } + else { + sNewValue = sResultMatch; + } + + // Update input field + elTextbox.value = sNewValue; + + // Scroll to bottom of textarea if necessary + if(elTextbox.type == "textarea") { + elTextbox.scrollTop = elTextbox.scrollHeight; + } + + // Move cursor to end + var end = elTextbox.value.length; + this._selectText(elTextbox,end,end); + + this._elCurListItem = elListItem; + } +}; + +/** + * Selects a result item from the container + * + * @method _selectItem + * @param elListItem {HTMLElement} The selected <li> element item. + * @private + */ +YAHOO.widget.AutoComplete.prototype._selectItem = function(elListItem) { + this._bItemSelected = true; + this._updateValue(elListItem); + this._sPastSelections = this._elTextbox.value; + this._clearInterval(); + this.itemSelectEvent.fire(this, elListItem, elListItem._oResultData); + this._toggleContainer(false); +}; + +/** + * If an item is highlighted in the container, the right arrow key jumps to the + * end of the textbox and selects the highlighted item, otherwise the container + * is closed. + * + * @method _jumpSelection + * @private + */ +YAHOO.widget.AutoComplete.prototype._jumpSelection = function() { + if(this._elCurListItem) { + this._selectItem(this._elCurListItem); + } + else { + this._toggleContainer(false); + } +}; + +/** + * Triggered by up and down arrow keys, changes the current highlighted + * <li> element item. Scrolls container if necessary. + * + * @method _moveSelection + * @param nKeyCode {Number} Code of key pressed. + * @private + */ +YAHOO.widget.AutoComplete.prototype._moveSelection = function(nKeyCode) { + if(this._bContainerOpen) { + // Determine current item's id number + var elCurListItem = this._elCurListItem, + nCurItemIndex = -1; + + if(elCurListItem) { + nCurItemIndex = elCurListItem._nItemIndex; + } + + var nNewItemIndex = (nKeyCode == 40) ? + (nCurItemIndex + 1) : (nCurItemIndex - 1); + + // Out of bounds + if(nNewItemIndex < -2 || nNewItemIndex >= this._nDisplayedItems) { + return; + } + + if(elCurListItem) { + // Unhighlight current item + this._toggleHighlight(elCurListItem, "from"); + this.itemArrowFromEvent.fire(this, elCurListItem); + } + if(nNewItemIndex == -1) { + // Go back to query (remove type-ahead string) + if(this.delimChar) { + this._elTextbox.value = this._sPastSelections + this._sCurQuery; + } + else { + this._elTextbox.value = this._sCurQuery; + } + return; + } + if(nNewItemIndex == -2) { + // Close container + this._toggleContainer(false); + return; + } + + var elNewListItem = this._elList.childNodes[nNewItemIndex], + + // Scroll the container if necessary + elContent = this._elContent, + sOF = YAHOO.util.Dom.getStyle(elContent,"overflow"), + sOFY = YAHOO.util.Dom.getStyle(elContent,"overflowY"), + scrollOn = ((sOF == "auto") || (sOF == "scroll") || (sOFY == "auto") || (sOFY == "scroll")); + if(scrollOn && (nNewItemIndex > -1) && + (nNewItemIndex < this._nDisplayedItems)) { + // User is keying down + if(nKeyCode == 40) { + // Bottom of selected item is below scroll area... + if((elNewListItem.offsetTop+elNewListItem.offsetHeight) > (elContent.scrollTop + elContent.offsetHeight)) { + // Set bottom of scroll area to bottom of selected item + elContent.scrollTop = (elNewListItem.offsetTop+elNewListItem.offsetHeight) - elContent.offsetHeight; + } + // Bottom of selected item is above scroll area... + else if((elNewListItem.offsetTop+elNewListItem.offsetHeight) < elContent.scrollTop) { + // Set top of selected item to top of scroll area + elContent.scrollTop = elNewListItem.offsetTop; + + } + } + // User is keying up + else { + // Top of selected item is above scroll area + if(elNewListItem.offsetTop < elContent.scrollTop) { + // Set top of scroll area to top of selected item + this._elContent.scrollTop = elNewListItem.offsetTop; + } + // Top of selected item is below scroll area + else if(elNewListItem.offsetTop > (elContent.scrollTop + elContent.offsetHeight)) { + // Set bottom of selected item to bottom of scroll area + this._elContent.scrollTop = (elNewListItem.offsetTop+elNewListItem.offsetHeight) - elContent.offsetHeight; + } + } + } + + this._toggleHighlight(elNewListItem, "to"); + this.itemArrowToEvent.fire(this, elNewListItem); + if(this.typeAhead) { + this._updateValue(elNewListItem); + } + } +}; + +///////////////////////////////////////////////////////////////////////////// +// +// Private event handlers +// +///////////////////////////////////////////////////////////////////////////// + +/** + * Handles container mouseover events. + * + * @method _onContainerMouseover + * @param v {HTMLEvent} The mouseover event. + * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance. + * @private + */ +YAHOO.widget.AutoComplete.prototype._onContainerMouseover = function(v,oSelf) { + var elTarget = YAHOO.util.Event.getTarget(v); + var elTag = elTarget.nodeName.toLowerCase(); + while(elTarget && (elTag != "table")) { + switch(elTag) { + case "body": + return; + case "li": + if(oSelf.prehighlightClassName) { + oSelf._togglePrehighlight(elTarget,"mouseover"); + } + else { + oSelf._toggleHighlight(elTarget,"to"); + } + + oSelf.itemMouseOverEvent.fire(oSelf, elTarget); + break; + case "div": + if(YAHOO.util.Dom.hasClass(elTarget,"yui-ac-container")) { + oSelf._bOverContainer = true; + return; + } + break; + default: + break; + } + + elTarget = elTarget.parentNode; + if(elTarget) { + elTag = elTarget.nodeName.toLowerCase(); + } + } +}; + +/** + * Handles container mouseout events. + * + * @method _onContainerMouseout + * @param v {HTMLEvent} The mouseout event. + * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance. + * @private + */ +YAHOO.widget.AutoComplete.prototype._onContainerMouseout = function(v,oSelf) { + var elTarget = YAHOO.util.Event.getTarget(v); + var elTag = elTarget.nodeName.toLowerCase(); + while(elTarget && (elTag != "table")) { + switch(elTag) { + case "body": + return; + case "li": + if(oSelf.prehighlightClassName) { + oSelf._togglePrehighlight(elTarget,"mouseout"); + } + else { + oSelf._toggleHighlight(elTarget,"from"); + } + + oSelf.itemMouseOutEvent.fire(oSelf, elTarget); + break; + case "ul": + oSelf._toggleHighlight(oSelf._elCurListItem,"to"); + break; + case "div": + if(YAHOO.util.Dom.hasClass(elTarget,"yui-ac-container")) { + oSelf._bOverContainer = false; + return; + } + break; + default: + break; + } + + elTarget = elTarget.parentNode; + if(elTarget) { + elTag = elTarget.nodeName.toLowerCase(); + } + } +}; + +/** + * Handles container click events. + * + * @method _onContainerClick + * @param v {HTMLEvent} The click event. + * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance. + * @private + */ +YAHOO.widget.AutoComplete.prototype._onContainerClick = function(v,oSelf) { + var elTarget = YAHOO.util.Event.getTarget(v); + var elTag = elTarget.nodeName.toLowerCase(); + while(elTarget && (elTag != "table")) { + switch(elTag) { + case "body": + return; + case "li": + // In case item has not been moused over + oSelf._toggleHighlight(elTarget,"to"); + oSelf._selectItem(elTarget); + return; + default: + break; + } + + elTarget = elTarget.parentNode; + if(elTarget) { + elTag = elTarget.nodeName.toLowerCase(); + } + } +}; + + +/** + * Handles container scroll events. + * + * @method _onContainerScroll + * @param v {HTMLEvent} The scroll event. + * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance. + * @private + */ +YAHOO.widget.AutoComplete.prototype._onContainerScroll = function(v,oSelf) { + oSelf._focus(); +}; + +/** + * Handles container resize events. + * + * @method _onContainerResize + * @param v {HTMLEvent} The resize event. + * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance. + * @private + */ +YAHOO.widget.AutoComplete.prototype._onContainerResize = function(v,oSelf) { + oSelf._toggleContainerHelpers(oSelf._bContainerOpen); +}; + + +/** + * Handles textbox keydown events of functional keys, mainly for UI behavior. + * + * @method _onTextboxKeyDown + * @param v {HTMLEvent} The keydown event. + * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance. + * @private + */ +YAHOO.widget.AutoComplete.prototype._onTextboxKeyDown = function(v,oSelf) { + var nKeyCode = v.keyCode; + + // Clear timeout + if(oSelf._nTypeAheadDelayID != -1) { + clearTimeout(oSelf._nTypeAheadDelayID); + } + + switch (nKeyCode) { + case 9: // tab + if(!YAHOO.env.ua.opera && (navigator.userAgent.toLowerCase().indexOf("mac") == -1) || (YAHOO.env.ua.webkit>420)) { + // select an item or clear out + if(oSelf._elCurListItem) { + if(oSelf.delimChar && (oSelf._nKeyCode != nKeyCode)) { + if(oSelf._bContainerOpen) { + YAHOO.util.Event.stopEvent(v); + } + } + oSelf._selectItem(oSelf._elCurListItem); + } + else { + oSelf._toggleContainer(false); + } + } + break; + case 13: // enter + if(!YAHOO.env.ua.opera && (navigator.userAgent.toLowerCase().indexOf("mac") == -1) || (YAHOO.env.ua.webkit>420)) { + if(oSelf._elCurListItem) { + if(oSelf._nKeyCode != nKeyCode) { + if(oSelf._bContainerOpen) { + YAHOO.util.Event.stopEvent(v); + } + } + oSelf._selectItem(oSelf._elCurListItem); + } + else { + oSelf._toggleContainer(false); + } + } + break; + case 27: // esc + oSelf._toggleContainer(false); + return; + case 39: // right + oSelf._jumpSelection(); + break; + case 38: // up + if(oSelf._bContainerOpen) { + YAHOO.util.Event.stopEvent(v); + oSelf._moveSelection(nKeyCode); + } + break; + case 40: // down + if(oSelf._bContainerOpen) { + YAHOO.util.Event.stopEvent(v); + oSelf._moveSelection(nKeyCode); + } + break; + default: + oSelf._bItemSelected = false; + oSelf._toggleHighlight(oSelf._elCurListItem, "from"); + + oSelf.textboxKeyEvent.fire(oSelf, nKeyCode); + break; + } + + if(nKeyCode === 18){ + oSelf._enableIntervalDetection(); + } + oSelf._nKeyCode = nKeyCode; +}; + +/** + * Handles textbox keypress events. + * @method _onTextboxKeyPress + * @param v {HTMLEvent} The keypress event. + * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance. + * @private + */ +YAHOO.widget.AutoComplete.prototype._onTextboxKeyPress = function(v,oSelf) { + var nKeyCode = v.keyCode; + + // Expose only to non SF3 (bug 1978549) Mac browsers (bug 790337) and Opera browsers (bug 583531), + // where stopEvent is ineffective on keydown events + if(YAHOO.env.ua.opera || (navigator.userAgent.toLowerCase().indexOf("mac") != -1) && (YAHOO.env.ua.webkit < 420)) { + switch (nKeyCode) { + case 9: // tab + // select an item or clear out + if(oSelf._bContainerOpen) { + if(oSelf.delimChar) { + YAHOO.util.Event.stopEvent(v); + } + if(oSelf._elCurListItem) { + oSelf._selectItem(oSelf._elCurListItem); + } + else { + oSelf._toggleContainer(false); + } + } + break; + case 13: // enter + if(oSelf._bContainerOpen) { + YAHOO.util.Event.stopEvent(v); + if(oSelf._elCurListItem) { + oSelf._selectItem(oSelf._elCurListItem); + } + else { + oSelf._toggleContainer(false); + } + } + break; + default: + break; + } + } + + //TODO: (?) limit only to non-IE, non-Mac-FF for Korean IME support (bug 811948) + // Korean IME detected + else if(nKeyCode == 229) { + oSelf._enableIntervalDetection(); + } +}; + +/** + * Handles textbox keyup events to trigger queries. + * + * @method _onTextboxKeyUp + * @param v {HTMLEvent} The keyup event. + * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance. + * @private + */ +YAHOO.widget.AutoComplete.prototype._onTextboxKeyUp = function(v,oSelf) { + var sText = this.value; //string in textbox + + // Check to see if any of the public properties have been updated + oSelf._initProps(); + + // Filter out chars that don't trigger queries + var nKeyCode = v.keyCode; + if(oSelf._isIgnoreKey(nKeyCode)) { + return; + } + + // Clear previous timeout + if(oSelf._nDelayID != -1) { + clearTimeout(oSelf._nDelayID); + } + + // Set new timeout + oSelf._nDelayID = setTimeout(function(){ + oSelf._sendQuery(sText); + },(oSelf.queryDelay * 1000)); +}; + +/** + * Handles text input box receiving focus. + * + * @method _onTextboxFocus + * @param v {HTMLEvent} The focus event. + * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance. + * @private + */ +YAHOO.widget.AutoComplete.prototype._onTextboxFocus = function (v,oSelf) { + // Start of a new interaction + if(!oSelf._bFocused) { + oSelf._elTextbox.setAttribute("autocomplete","off"); + oSelf._bFocused = true; + oSelf._sInitInputValue = oSelf._elTextbox.value; + oSelf.textboxFocusEvent.fire(oSelf); + } +}; + +/** + * Handles text input box losing focus. + * + * @method _onTextboxBlur + * @param v {HTMLEvent} The focus event. + * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance. + * @private + */ +YAHOO.widget.AutoComplete.prototype._onTextboxBlur = function (v,oSelf) { + // Is a true blur + if(!oSelf._bOverContainer || (oSelf._nKeyCode == 9)) { + // Current query needs to be validated as a selection + if(!oSelf._bItemSelected) { + var elMatchListItem = oSelf._textMatchesOption(); + // Container is closed or current query doesn't match any result + if(!oSelf._bContainerOpen || (oSelf._bContainerOpen && (elMatchListItem === null))) { + // Force selection is enabled so clear the current query + if(oSelf.forceSelection) { + oSelf._clearSelection(); + } + // Treat current query as a valid selection + else { + oSelf.unmatchedItemSelectEvent.fire(oSelf, oSelf._sCurQuery); + } + } + // Container is open and current query matches a result + else { + // Force a selection when textbox is blurred with a match + if(oSelf.forceSelection) { + oSelf._selectItem(elMatchListItem); + } + } + } + + oSelf._clearInterval(); + oSelf._bFocused = false; + if(oSelf._sInitInputValue !== oSelf._elTextbox.value) { + oSelf.textboxChangeEvent.fire(oSelf); + } + oSelf.textboxBlurEvent.fire(oSelf); + + oSelf._toggleContainer(false); + } + // Not a true blur if it was a selection via mouse click + else { + oSelf._focus(); + } +}; + +/** + * Handles window unload event. + * + * @method _onWindowUnload + * @param v {HTMLEvent} The unload event. + * @param oSelf {YAHOO.widget.AutoComplete} The AutoComplete instance. + * @private + */ +YAHOO.widget.AutoComplete.prototype._onWindowUnload = function(v,oSelf) { + if(oSelf && oSelf._elTextbox && oSelf.allowBrowserAutocomplete) { + oSelf._elTextbox.setAttribute("autocomplete","on"); + } +}; + +///////////////////////////////////////////////////////////////////////////// +// +// Deprecated for Backwards Compatibility +// +///////////////////////////////////////////////////////////////////////////// +/** + * @method doBeforeSendQuery + * @deprecated Use generateRequest. + */ +YAHOO.widget.AutoComplete.prototype.doBeforeSendQuery = function(sQuery) { + return this.generateRequest(sQuery); +}; + +/** + * @method getListItems + * @deprecated Use getListEl().childNodes. + */ +YAHOO.widget.AutoComplete.prototype.getListItems = function() { + var allListItemEls = [], + els = this._elList.childNodes; + for(var i=els.length-1; i>=0; i--) { + allListItemEls[i] = els[i]; + } + return allListItemEls; +}; + +///////////////////////////////////////////////////////////////////////// +// +// Private static methods +// +///////////////////////////////////////////////////////////////////////// + +/** + * Clones object literal or array of object literals. + * + * @method AutoComplete._cloneObject + * @param o {Object} Object. + * @private + * @static + */ +YAHOO.widget.AutoComplete._cloneObject = function(o) { + if(!YAHOO.lang.isValue(o)) { + return o; + } + + var copy = {}; + + if(YAHOO.lang.isFunction(o)) { + copy = o; + } + else if(YAHOO.lang.isArray(o)) { + var array = []; + for(var i=0,len=o.length;i0){V.label=Q;}}}function A(P){var O=P.attributes,N=O.srcelement,R=N.nodeName.toUpperCase(),Q=this;if(R==this.NODE_NAME){P.element=N;P.id=N.id;G.getElementsBy(function(S){switch(S.nodeName.toUpperCase()){case"BUTTON":case"A":case"INPUT":H.call(Q,S,O);break;}},"*",N);}else{switch(R){case"BUTTON":case"A":case"INPUT":H.call(this,N,O);break;}}}YAHOO.widget.Button=function(R,O){if(!B&&YAHOO.widget.Overlay){B=YAHOO.widget.Overlay;}if(!J&&YAHOO.widget.Menu){J=YAHOO.widget.Menu;}var Q=YAHOO.widget.Button.superclass.constructor,P,N;if(arguments.length==1&&!I.isString(R)&&!R.nodeName){if(!R.id){R.id=G.generateId();}Q.call(this,(this.createButtonElement(R.type)),R);}else{P={element:null,attributes:(O||{})};if(I.isString(R)){N=G.get(R);if(N){if(!P.attributes.id){P.attributes.id=R;}P.attributes.srcelement=N;A.call(this,P);if(!P.element){P.element=this.createButtonElement(P.attributes.type);}Q.call(this,P.element,P.attributes);}}else{if(R.nodeName){if(!P.attributes.id){if(R.id){P.attributes.id=R.id;}else{P.attributes.id=G.generateId();}}P.attributes.srcelement=R;A.call(this,P);if(!P.element){P.element=this.createButtonElement(P.attributes.type);}Q.call(this,P.element,P.attributes);}}}};YAHOO.extend(YAHOO.widget.Button,YAHOO.util.Element,{_button:null,_menu:null,_hiddenFields:null,_onclickAttributeValue:null,_activationKeyPressed:false,_activationButtonPressed:false,_hasKeyEventHandlers:false,_hasMouseEventHandlers:false,_nOptionRegionX:0,CLASS_NAME_PREFIX:"yui-",NODE_NAME:"SPAN",CHECK_ACTIVATION_KEYS:[32],ACTIVATION_KEYS:[13,32],OPTION_AREA_WIDTH:20,CSS_CLASS_NAME:"button",_setType:function(N){if(N=="split"){this.on("option",this._onOption);}},_setLabel:function(O){this._button.innerHTML=O;var P,N=L.gecko;if(N&&N<1.9&&G.inDocument(this.get("element"))){P=(this.CLASS_NAME_PREFIX+this.CSS_CLASS_NAME);this.removeClass(P);I.later(0,this,this.addClass,P);}},_setTabIndex:function(N){this._button.tabIndex=N;},_setTitle:function(N){if(this.get("type")!="link"){this._button.title=N;}},_setDisabled:function(N){if(this.get("type")!="link"){if(N){if(this._menu){this._menu.hide();}if(this.hasFocus()){this.blur();}this._button.setAttribute("disabled","disabled");this.addStateCSSClasses("disabled");this.removeStateCSSClasses("hover");this.removeStateCSSClasses("active");this.removeStateCSSClasses("focus");}else{this._button.removeAttribute("disabled");this.removeStateCSSClasses("disabled");}}},_setHref:function(N){if(this.get("type")=="link"){this._button.href=N;}},_setTarget:function(N){if(this.get("type")=="link"){this._button.setAttribute("target",N);}},_setChecked:function(N){var O=this.get("type");if(O=="checkbox"||O=="radio"){if(N){this.addStateCSSClasses("checked");}else{this.removeStateCSSClasses("checked");}}},_setMenu:function(U){var P=this.get("lazyloadmenu"),R=this.get("element"),N,W=false,X,O,Q;function V(){X.render(R.parentNode);this.removeListener("appendTo",V);}function T(){X.cfg.queueProperty("container",R.parentNode);this.removeListener("appendTo",T);}function S(){var Y;if(X){G.addClass(X.element,this.get("menuclassname"));G.addClass(X.element,this.CLASS_NAME_PREFIX+this.get("type")+"-button-menu");X.showEvent.subscribe(this._onMenuShow,null,this);X.hideEvent.subscribe(this._onMenuHide,null,this);X.renderEvent.subscribe(this._onMenuRender,null,this);if(J&&X instanceof J){if(P){Y=this.get("container");if(Y){X.cfg.queueProperty("container",Y);}else{this.on("appendTo",T);}}X.cfg.queueProperty("clicktohide",false);X.keyDownEvent.subscribe(this._onMenuKeyDown,this,true);X.subscribe("click",this._onMenuClick,this,true);this.on("selectedMenuItemChange",this._onSelectedMenuItemChange);Q=X.srcElement;if(Q&&Q.nodeName.toUpperCase()=="SELECT"){Q.style.display="none";Q.parentNode.removeChild(Q);}}else{if(B&&X instanceof B){if(!K){K=new YAHOO.widget.OverlayManager();}K.register(X);}}this._menu=X;if(!W&&!P){if(G.inDocument(R)){X.render(R.parentNode);}else{this.on("appendTo",V);}}}}if(B){if(J){N=J.prototype.CSS_CLASS_NAME;}if(U&&J&&(U instanceof J)){X=U;W=true;S.call(this);}else{if(B&&U&&(U instanceof B)){X=U;W=true;X.cfg.queueProperty("visible",false);S.call(this);}else{if(J&&I.isArray(U)){X=new J(G.generateId(),{lazyload:P,itemdata:U});this._menu=X;this.on("appendTo",S);}else{if(I.isString(U)){O=G.get(U);if(O){if(J&&G.hasClass(O,N)||O.nodeName.toUpperCase()=="SELECT"){X=new J(U,{lazyload:P});S.call(this);}else{if(B){X=new B(U,{visible:false});S.call(this);}}}}else{if(U&&U.nodeName){if(J&&G.hasClass(U,N)||U.nodeName.toUpperCase()=="SELECT"){X=new J(U,{lazyload:P});S.call(this);}else{if(B){if(!U.id){G.generateId(U);}X=new B(U,{visible:false});S.call(this);}}}}}}}}},_setOnClick:function(N){if(this._onclickAttributeValue&&(this._onclickAttributeValue!=N)){this.removeListener("click",this._onclickAttributeValue.fn); +this._onclickAttributeValue=null;}if(!this._onclickAttributeValue&&I.isObject(N)&&I.isFunction(N.fn)){this.on("click",N.fn,N.obj,N.scope);this._onclickAttributeValue=N;}},_isActivationKey:function(N){var S=this.get("type"),O=(S=="checkbox"||S=="radio")?this.CHECK_ACTIVATION_KEYS:this.ACTIVATION_KEYS,Q=O.length,R=false,P;if(Q>0){P=Q-1;do{if(N==O[P]){R=true;break;}}while(P--);}return R;},_isSplitButtonOptionKey:function(P){var O=(M.getCharCode(P)==40);var N=function(Q){M.preventDefault(Q);this.removeListener("keypress",N);};if(O){if(L.opera){this.on("keypress",N);}M.preventDefault(P);}return O;},_addListenersToForm:function(){var T=this.getForm(),S=YAHOO.widget.Button.onFormKeyPress,R,N,Q,P,O;if(T){M.on(T,"reset",this._onFormReset,null,this);M.on(T,"submit",this._onFormSubmit,null,this);N=this.get("srcelement");if(this.get("type")=="submit"||(N&&N.type=="submit")){Q=M.getListeners(T,"keypress");R=false;if(Q){P=Q.length;if(P>0){O=P-1;do{if(Q[O].fn==S){R=true;break;}}while(O--);}}if(!R){M.on(T,"keypress",S);}}}},_showMenu:function(R){if(YAHOO.widget.MenuManager){YAHOO.widget.MenuManager.hideVisible();}if(K){K.hideAll();}var N=this._menu,Q=this.get("menualignment"),P=this.get("focusmenu"),O;if(this._renderedMenu){N.cfg.setProperty("context",[this.get("element"),Q[0],Q[1]]);N.cfg.setProperty("preventcontextoverlap",true);N.cfg.setProperty("constraintoviewport",true);}else{N.cfg.queueProperty("context",[this.get("element"),Q[0],Q[1]]);N.cfg.queueProperty("preventcontextoverlap",true);N.cfg.queueProperty("constraintoviewport",true);}this.focus();if(J&&N&&(N instanceof J)){O=N.focus;N.focus=function(){};if(this._renderedMenu){N.cfg.setProperty("minscrollheight",this.get("menuminscrollheight"));N.cfg.setProperty("maxheight",this.get("menumaxheight"));}else{N.cfg.queueProperty("minscrollheight",this.get("menuminscrollheight"));N.cfg.queueProperty("maxheight",this.get("menumaxheight"));}N.show();N.focus=O;N.align();if(R.type=="mousedown"){M.stopPropagation(R);}if(P){N.focus();}}else{if(B&&N&&(N instanceof B)){if(!this._renderedMenu){N.render(this.get("element").parentNode);}N.show();N.align();}}},_hideMenu:function(){var N=this._menu;if(N){N.hide();}},_onMouseOver:function(O){var Q=this.get("type"),N,P;if(Q==="split"){N=this.get("element");P=(G.getX(N)+(N.offsetWidth-this.OPTION_AREA_WIDTH));this._nOptionRegionX=P;}if(!this._hasMouseEventHandlers){if(Q==="split"){this.on("mousemove",this._onMouseMove);}this.on("mouseout",this._onMouseOut);this._hasMouseEventHandlers=true;}this.addStateCSSClasses("hover");if(Q==="split"&&(M.getPageX(O)>P)){this.addStateCSSClasses("hoveroption");}if(this._activationButtonPressed){this.addStateCSSClasses("active");}if(this._bOptionPressed){this.addStateCSSClasses("activeoption");}if(this._activationButtonPressed||this._bOptionPressed){M.removeListener(document,"mouseup",this._onDocumentMouseUp);}},_onMouseMove:function(N){var O=this._nOptionRegionX;if(O){if(M.getPageX(N)>O){this.addStateCSSClasses("hoveroption");}else{this.removeStateCSSClasses("hoveroption");}}},_onMouseOut:function(N){var O=this.get("type");this.removeStateCSSClasses("hover");if(O!="menu"){this.removeStateCSSClasses("active");}if(this._activationButtonPressed||this._bOptionPressed){M.on(document,"mouseup",this._onDocumentMouseUp,null,this);}if(O==="split"&&(M.getPageX(N)>this._nOptionRegionX)){this.removeStateCSSClasses("hoveroption");}},_onDocumentMouseUp:function(P){this._activationButtonPressed=false;this._bOptionPressed=false;var Q=this.get("type"),N,O;if(Q=="menu"||Q=="split"){N=M.getTarget(P);O=this._menu.element;if(N!=O&&!G.isAncestor(O,N)){this.removeStateCSSClasses((Q=="menu"?"active":"activeoption"));this._hideMenu();}}M.removeListener(document,"mouseup",this._onDocumentMouseUp);},_onMouseDown:function(P){var Q,O=true;function N(){this._hideMenu();this.removeListener("mouseup",N);}if((P.which||P.button)==1){if(!this.hasFocus()){this.focus();}Q=this.get("type");if(Q=="split"){if(M.getPageX(P)>this._nOptionRegionX){this.fireEvent("option",P);O=false;}else{this.addStateCSSClasses("active");this._activationButtonPressed=true;}}else{if(Q=="menu"){if(this.isActive()){this._hideMenu();this._activationButtonPressed=false;}else{this._showMenu(P);this._activationButtonPressed=true;}}else{this.addStateCSSClasses("active");this._activationButtonPressed=true;}}if(Q=="split"||Q=="menu"){this._hideMenuTimer=I.later(250,this,this.on,["mouseup",N]);}}return O;},_onMouseUp:function(P){var Q=this.get("type"),N=this._hideMenuTimer,O=true;if(N){N.cancel();}if(Q=="checkbox"||Q=="radio"){this.set("checked",!(this.get("checked")));}this._activationButtonPressed=false;if(Q!="menu"){this.removeStateCSSClasses("active");}if(Q=="split"&&M.getPageX(P)>this._nOptionRegionX){O=false;}return O;},_onFocus:function(O){var N;this.addStateCSSClasses("focus");if(this._activationKeyPressed){this.addStateCSSClasses("active");}C=this;if(!this._hasKeyEventHandlers){N=this._button;M.on(N,"blur",this._onBlur,null,this);M.on(N,"keydown",this._onKeyDown,null,this);M.on(N,"keyup",this._onKeyUp,null,this);this._hasKeyEventHandlers=true;}this.fireEvent("focus",O);},_onBlur:function(N){this.removeStateCSSClasses("focus");if(this.get("type")!="menu"){this.removeStateCSSClasses("active");}if(this._activationKeyPressed){M.on(document,"keyup",this._onDocumentKeyUp,null,this);}C=null;this.fireEvent("blur",N);},_onDocumentKeyUp:function(N){if(this._isActivationKey(M.getCharCode(N))){this._activationKeyPressed=false;M.removeListener(document,"keyup",this._onDocumentKeyUp);}},_onKeyDown:function(O){var N=this._menu;if(this.get("type")=="split"&&this._isSplitButtonOptionKey(O)){this.fireEvent("option",O);}else{if(this._isActivationKey(M.getCharCode(O))){if(this.get("type")=="menu"){this._showMenu(O);}else{this._activationKeyPressed=true;this.addStateCSSClasses("active");}}}if(N&&N.cfg.getProperty("visible")&&M.getCharCode(O)==27){N.hide();this.focus();}},_onKeyUp:function(N){var O;if(this._isActivationKey(M.getCharCode(N))){O=this.get("type");if(O=="checkbox"||O=="radio"){this.set("checked",!(this.get("checked"))); +}this._activationKeyPressed=false;if(this.get("type")!="menu"){this.removeStateCSSClasses("active");}}},_onClick:function(P){var R=this.get("type"),Q,N,O;switch(R){case"submit":if(P.returnValue!==false){this.submitForm();}break;case"reset":Q=this.getForm();if(Q){Q.reset();}break;case"split":if(this._nOptionRegionX>0&&(M.getPageX(P)>this._nOptionRegionX)){O=false;}else{this._hideMenu();N=this.get("srcelement");if(N&&N.type=="submit"&&P.returnValue!==false){this.submitForm();}}break;}return O;},_onDblClick:function(O){var N=true;if(this.get("type")=="split"&&M.getPageX(O)>this._nOptionRegionX){N=false;}return N;},_onAppendTo:function(N){I.later(0,this,this._addListenersToForm);},_onFormReset:function(O){var P=this.get("type"),N=this._menu;if(P=="checkbox"||P=="radio"){this.resetValue("checked");}if(J&&N&&(N instanceof J)){this.resetValue("selectedMenuItem");}},_onFormSubmit:function(N){this.createHiddenFields();},_onDocumentMouseDown:function(Q){var N=M.getTarget(Q),P=this.get("element"),O=this._menu.element;if(N!=P&&!G.isAncestor(P,N)&&N!=O&&!G.isAncestor(O,N)){this._hideMenu();if(L.ie&&N.focus){N.setActive();}M.removeListener(document,"mousedown",this._onDocumentMouseDown);}},_onOption:function(N){if(this.hasClass(this.CLASS_NAME_PREFIX+"split-button-activeoption")){this._hideMenu();this._bOptionPressed=false;}else{this._showMenu(N);this._bOptionPressed=true;}},_onMenuShow:function(N){M.on(document,"mousedown",this._onDocumentMouseDown,null,this);var O=(this.get("type")=="split")?"activeoption":"active";this.addStateCSSClasses(O);},_onMenuHide:function(N){var O=(this.get("type")=="split")?"activeoption":"active";this.removeStateCSSClasses(O);if(this.get("type")=="split"){this._bOptionPressed=false;}},_onMenuKeyDown:function(P,O){var N=O[0];if(M.getCharCode(N)==27){this.focus();if(this.get("type")=="split"){this._bOptionPressed=false;}}},_onMenuRender:function(P){var S=this.get("element"),O=S.parentNode,N=this._menu,R=N.element,Q=N.srcElement,T;if(O!=R.parentNode){O.appendChild(R);}this._renderedMenu=true;if(Q&&Q.nodeName.toLowerCase()==="select"&&Q.value){T=N.getItem(Q.selectedIndex);this.set("selectedMenuItem",T,true);this._onSelectedMenuItemChange({newValue:T});}},_onMenuClick:function(O,N){var Q=N[1],P;if(Q){this.set("selectedMenuItem",Q);P=this.get("srcelement");if(P&&P.type=="submit"){this.submitForm();}this._hideMenu();}},_onSelectedMenuItemChange:function(O){var P=O.prevValue,Q=O.newValue,N=this.CLASS_NAME_PREFIX;if(P){G.removeClass(P.element,(N+"button-selectedmenuitem"));}if(Q){G.addClass(Q.element,(N+"button-selectedmenuitem"));}},_onLabelClick:function(N){this.focus();var O=this.get("type");if(O=="radio"||O=="checkbox"){this.set("checked",(!this.get("checked")));}},createButtonElement:function(N){var P=this.NODE_NAME,O=document.createElement(P);O.innerHTML="<"+P+' class="first-child">'+(N=="link"?"":'')+"";return O;},addStateCSSClasses:function(O){var P=this.get("type"),N=this.CLASS_NAME_PREFIX;if(I.isString(O)){if(O!="activeoption"&&O!="hoveroption"){this.addClass(N+this.CSS_CLASS_NAME+("-"+O));}this.addClass(N+P+("-button-"+O));}},removeStateCSSClasses:function(O){var P=this.get("type"),N=this.CLASS_NAME_PREFIX;if(I.isString(O)){this.removeClass(N+this.CSS_CLASS_NAME+("-"+O));this.removeClass(N+P+("-button-"+O));}},createHiddenFields:function(){this.removeHiddenFields();var V=this.getForm(),Z,O,S,X,Y,T,U,N,R,W,P,Q=false;if(V&&!this.get("disabled")){O=this.get("type");S=(O=="checkbox"||O=="radio");if((S&&this.get("checked"))||(E==this)){Z=F((S?O:"hidden"),this.get("name"),this.get("value"),this.get("checked"));if(Z){if(S){Z.style.display="none";}V.appendChild(Z);}}X=this._menu;if(J&&X&&(X instanceof J)){Y=this.get("selectedMenuItem");P=X.srcElement;Q=(P&&P.nodeName.toUpperCase()=="SELECT");if(Y){U=(Y.value===null||Y.value==="")?Y.cfg.getProperty("text"):Y.value;T=this.get("name");if(Q){W=P.name;}else{if(T){W=(T+"_options");}}if(U&&W){N=F("hidden",W,U);V.appendChild(N);}}else{if(Q){N=V.appendChild(P);}}}if(Z&&N){this._hiddenFields=[Z,N];}else{if(!Z&&N){this._hiddenFields=N;}else{if(Z&&!N){this._hiddenFields=Z;}}}R=this._hiddenFields;}return R;},removeHiddenFields:function(){var Q=this._hiddenFields,O,P;function N(R){if(G.inDocument(R)){R.parentNode.removeChild(R);}}if(Q){if(I.isArray(Q)){O=Q.length;if(O>0){P=O-1;do{N(Q[P]);}while(P--);}}else{N(Q);}this._hiddenFields=null;}},submitForm:function(){var Q=this.getForm(),P=this.get("srcelement"),O=false,N;if(Q){if(this.get("type")=="submit"||(P&&P.type=="submit")){E=this;}if(L.ie){O=Q.fireEvent("onsubmit");}else{N=document.createEvent("HTMLEvents");N.initEvent("submit",true,true);O=Q.dispatchEvent(N);}if((L.ie||L.webkit)&&O){Q.submit();}}return O;},init:function(P,d){var V=d.type=="link"?"a":"button",a=d.srcelement,S=P.getElementsByTagName(V)[0],U;if(!S){U=P.getElementsByTagName("input")[0];if(U){S=document.createElement("button");S.setAttribute("type","button");U.parentNode.replaceChild(S,U);}}this._button=S;YAHOO.widget.Button.superclass.init.call(this,P,d);var T=this.get("id"),Z=T+"-button";S.id=Z;var X,Q;var e=function(f){return(f.htmlFor===T);};var c=function(){Q.setAttribute((L.ie?"htmlFor":"for"),Z);};if(a&&this.get("type")!="link"){X=G.getElementsBy(e,"label");if(I.isArray(X)&&X.length>0){Q=X[0];}}D[T]=this;var b=this.CLASS_NAME_PREFIX;this.addClass(b+this.CSS_CLASS_NAME);this.addClass(b+this.get("type")+"-button");M.on(this._button,"focus",this._onFocus,null,this);this.on("mouseover",this._onMouseOver);this.on("mousedown",this._onMouseDown);this.on("mouseup",this._onMouseUp);this.on("click",this._onClick);var R=this.get("onclick");this.set("onclick",null);this.set("onclick",R);this.on("dblclick",this._onDblClick);var O;if(Q){if(this.get("replaceLabel")){this.set("label",Q.innerHTML);O=Q.parentNode;O.removeChild(Q);}else{this.on("appendTo",c);M.on(Q,"click",this._onLabelClick,null,this);this._label=Q;}}this.on("appendTo",this._onAppendTo);var N=this.get("container"),Y=this.get("element"),W=G.inDocument(Y); +if(N){if(a&&a!=Y){O=a.parentNode;if(O){O.removeChild(a);}}if(I.isString(N)){M.onContentReady(N,this.appendTo,N,this);}else{this.on("init",function(){I.later(0,this,this.appendTo,N);});}}else{if(!W&&a&&a!=Y){O=a.parentNode;if(O){this.fireEvent("beforeAppendTo",{type:"beforeAppendTo",target:O});O.replaceChild(Y,a);this.fireEvent("appendTo",{type:"appendTo",target:O});}}else{if(this.get("type")!="link"&&W&&a&&a==Y){this._addListenersToForm();}}}this.fireEvent("init",{type:"init",target:this});},initAttributes:function(O){var N=O||{};YAHOO.widget.Button.superclass.initAttributes.call(this,N);this.setAttributeConfig("type",{value:(N.type||"push"),validator:I.isString,writeOnce:true,method:this._setType});this.setAttributeConfig("label",{value:N.label,validator:I.isString,method:this._setLabel});this.setAttributeConfig("value",{value:N.value});this.setAttributeConfig("name",{value:N.name,validator:I.isString});this.setAttributeConfig("tabindex",{value:N.tabindex,validator:I.isNumber,method:this._setTabIndex});this.configureAttribute("title",{value:N.title,validator:I.isString,method:this._setTitle});this.setAttributeConfig("disabled",{value:(N.disabled||false),validator:I.isBoolean,method:this._setDisabled});this.setAttributeConfig("href",{value:N.href,validator:I.isString,method:this._setHref});this.setAttributeConfig("target",{value:N.target,validator:I.isString,method:this._setTarget});this.setAttributeConfig("checked",{value:(N.checked||false),validator:I.isBoolean,method:this._setChecked});this.setAttributeConfig("container",{value:N.container,writeOnce:true});this.setAttributeConfig("srcelement",{value:N.srcelement,writeOnce:true});this.setAttributeConfig("menu",{value:null,method:this._setMenu,writeOnce:true});this.setAttributeConfig("lazyloadmenu",{value:(N.lazyloadmenu===false?false:true),validator:I.isBoolean,writeOnce:true});this.setAttributeConfig("menuclassname",{value:(N.menuclassname||(this.CLASS_NAME_PREFIX+"button-menu")),validator:I.isString,method:this._setMenuClassName,writeOnce:true});this.setAttributeConfig("menuminscrollheight",{value:(N.menuminscrollheight||90),validator:I.isNumber});this.setAttributeConfig("menumaxheight",{value:(N.menumaxheight||0),validator:I.isNumber});this.setAttributeConfig("menualignment",{value:(N.menualignment||["tl","bl"]),validator:I.isArray});this.setAttributeConfig("selectedMenuItem",{value:null});this.setAttributeConfig("onclick",{value:N.onclick,method:this._setOnClick});this.setAttributeConfig("focusmenu",{value:(N.focusmenu===false?false:true),validator:I.isBoolean});this.setAttributeConfig("replaceLabel",{value:false,validator:I.isBoolean,writeOnce:true});},focus:function(){if(!this.get("disabled")){this._button.focus();}},blur:function(){if(!this.get("disabled")){this._button.blur();}},hasFocus:function(){return(C==this);},isActive:function(){return this.hasClass(this.CLASS_NAME_PREFIX+this.CSS_CLASS_NAME+"-active");},getMenu:function(){return this._menu;},getForm:function(){var N=this._button,O;if(N){O=N.form;}return O;},getHiddenFields:function(){return this._hiddenFields;},destroy:function(){var P=this.get("element"),N=this._menu,T=this._label,O,S;if(N){if(K&&K.find(N)){K.remove(N);}N.destroy();}M.purgeElement(P);M.purgeElement(this._button);M.removeListener(document,"mouseup",this._onDocumentMouseUp);M.removeListener(document,"keyup",this._onDocumentKeyUp);M.removeListener(document,"mousedown",this._onDocumentMouseDown);if(T){M.removeListener(T,"click",this._onLabelClick);O=T.parentNode;O.removeChild(T);}var Q=this.getForm();if(Q){M.removeListener(Q,"reset",this._onFormReset);M.removeListener(Q,"submit",this._onFormSubmit);}this.unsubscribeAll();O=P.parentNode;if(O){O.removeChild(P);}delete D[this.get("id")];var R=(this.CLASS_NAME_PREFIX+this.CSS_CLASS_NAME);S=G.getElementsByClassName(R,this.NODE_NAME,Q);if(I.isArray(S)&&S.length===0){M.removeListener(Q,"keypress",YAHOO.widget.Button.onFormKeyPress);}},fireEvent:function(O,N){var P=arguments[0];if(this.DOM_EVENTS[P]&&this.get("disabled")){return false;}return YAHOO.widget.Button.superclass.fireEvent.apply(this,arguments);},toString:function(){return("Button "+this.get("id"));}});YAHOO.widget.Button.onFormKeyPress=function(R){var P=M.getTarget(R),S=M.getCharCode(R),Q=P.nodeName&&P.nodeName.toUpperCase(),N=P.type,T=false,V,X,O,W;function U(a){var Z,Y;switch(a.nodeName.toUpperCase()){case"INPUT":case"BUTTON":if(a.type=="submit"&&!a.disabled){if(!T&&!O){O=a;}}break;default:Z=a.id;if(Z){V=D[Z];if(V){T=true;if(!V.get("disabled")){Y=V.get("srcelement");if(!X&&(V.get("type")=="submit"||(Y&&Y.type=="submit"))){X=V;}}}}break;}}if(S==13&&((Q=="INPUT"&&(N=="text"||N=="password"||N=="checkbox"||N=="radio"||N=="file"))||Q=="SELECT")){G.getElementsBy(U,"*",this);if(O){O.focus();}else{if(!O&&X){M.preventDefault(R);if(L.ie){X.get("element").fireEvent("onclick");}else{W=document.createEvent("HTMLEvents");W.initEvent("click",true,true);if(L.gecko<1.9){X.fireEvent("click",W);}else{X.get("element").dispatchEvent(W);}}}}}};YAHOO.widget.Button.addHiddenFieldsToForm=function(N){var R=YAHOO.widget.Button.prototype,T=G.getElementsByClassName((R.CLASS_NAME_PREFIX+R.CSS_CLASS_NAME),"*",N),Q=T.length,S,O,P;if(Q>0){for(P=0;P0){F=H-1;do{this._buttons[F].set("disabled",G);}while(F--);}},_onKeyDown:function(K){var G=B.getTarget(K),I=B.getCharCode(K),H=G.parentNode.parentNode.id,J=E[H],F=-1;if(I==37||I==38){F=(J.index===0)?(this._buttons.length-1):(J.index-1);}else{if(I==39||I==40){F=(J.index===(this._buttons.length-1))?0:(J.index+1);}}if(F>-1){this.check(F);this.getButton(F).focus();}},_onAppendTo:function(H){var I=this._buttons,G=I.length,F;for(F=0;F0){this.addButtons(J);}function F(L){return(L.type=="radio");}J=C.getElementsBy(F,"input",this.get("element"));if(J.length>0){this.addButtons(J);}this.on("keydown",this._onKeyDown);this.on("appendTo",this._onAppendTo);var G=this.get("container");if(G){if(D.isString(G)){B.onContentReady(G,function(){this.appendTo(G);},null,this);}else{this.appendTo(G);}}},initAttributes:function(G){var F=G||{};YAHOO.widget.ButtonGroup.superclass.initAttributes.call(this,F);this.setAttributeConfig("name",{value:F.name,validator:D.isString});this.setAttributeConfig("disabled",{value:(F.disabled||false),validator:D.isBoolean,method:this._setDisabled});this.setAttributeConfig("value",{value:F.value});this.setAttributeConfig("container",{value:F.container,writeOnce:true});this.setAttributeConfig("checkedButton",{value:null});},addButton:function(J){var L,K,G,F,H,I;if(J instanceof A&&J.get("type")=="radio"){L=J;}else{if(!D.isString(J)&&!J.nodeName){J.type="radio";L=new A(J);}else{L=new A(J,{type:"radio"});}}if(L){F=this._buttons.length;H=L.get("name");I=this.get("name");L.index=F;this._buttons[F]=L;E[L.get("id")]=L;if(H!=I){L.set("name",I);}if(this.get("disabled")){L.set("disabled",true);}if(L.get("checked")){this.set("checkedButton",L);}K=L.get("element");G=this.get("element");if(K.parentNode!=G){G.appendChild(K);}L.on("checkedChange",this._onButtonCheckedChange,L,this);}return L;},addButtons:function(G){var H,I,J,F;if(D.isArray(G)){H=G.length;J=[];if(H>0){for(F=0;F0){F=this._buttons.length-1;do{this._buttons[F].index=F;}while(F--);}}},getButton:function(F){return this._buttons[F];},getButtons:function(){return this._buttons;},getCount:function(){return this._buttons.length;},focus:function(H){var I,G,F;if(D.isNumber(H)){I=this._buttons[H];if(I){I.focus();}}else{G=this.getCount();for(F=0;F0){G=this._buttons.length-1;do{this._buttons[G].destroy();}while(G--);}B.purgeElement(H);F.removeChild(H);},toString:function(){return("ButtonGroup "+this.get("id"));}});})();YAHOO.register("button",YAHOO.widget.Button,{version:"2.8.0r4",build:"2449"}); \ No newline at end of file diff --git a/include/javascript/yui/build/button/button.js b/include/javascript/yui/build/button/button.js new file mode 100755 index 00000000..b57c819e --- /dev/null +++ b/include/javascript/yui/build/button/button.js @@ -0,0 +1,4633 @@ +/* +Copyright (c) 2009, Yahoo! Inc. All rights reserved. +Code licensed under the BSD License: +http://developer.yahoo.net/yui/license.txt +version: 2.8.0r4 +*/ +/** +* @module button +* @description

    The Button Control enables the creation of rich, graphical +* buttons that function like traditional HTML form buttons. Unlike +* traditional HTML form buttons, buttons created with the Button Control can have +* a label that is different from its value. With the inclusion of the optional +* Menu Control, the Button Control can also be +* used to create menu buttons and split buttons, controls that are not +* available natively in HTML. The Button Control can also be thought of as a +* way to create more visually engaging implementations of the browser's +* default radio-button and check-box controls.

    +*

    The Button Control supports the following types:

    +*
    +*
    push
    +*
    Basic push button that can execute a user-specified command when +* pressed.
    +*
    link
    +*
    Navigates to a specified url when pressed.
    +*
    submit
    +*
    Submits the parent form when pressed.
    +*
    reset
    +*
    Resets the parent form when pressed.
    +*
    checkbox
    +*
    Maintains a "checked" state that can be toggled on and off.
    +*
    radio
    +*
    Maintains a "checked" state that can be toggled on and off. Use with +* the ButtonGroup class to create a set of controls that are mutually +* exclusive; checking one button in the set will uncheck all others in +* the group.
    +*
    menu
    +*
    When pressed will show/hide a menu.
    +*
    split
    +*
    Can execute a user-specified command or display a menu when pressed.
    +*
    +* @title Button +* @namespace YAHOO.widget +* @requires yahoo, dom, element, event +* @optional container, menu +*/ + + +(function () { + + + /** + * The Button class creates a rich, graphical button. + * @param {String} p_oElement String specifying the id attribute of the + * <input>, <button>, + * <a>, or <span> element to + * be used to create the button. + * @param {HTMLInputElement| + * HTMLButtonElement|HTMLElement} p_oElement Object reference for the + * <input>, <button>, + * <a>, or <span> element to be + * used to create the button. + * @param {Object} p_oElement Object literal specifying a set of + * configuration attributes used to create the button. + * @param {Object} p_oAttributes Optional. Object literal specifying a set + * of configuration attributes used to create the button. + * @namespace YAHOO.widget + * @class Button + * @constructor + * @extends YAHOO.util.Element + */ + + + + // Shorthard for utilities + + var Dom = YAHOO.util.Dom, + Event = YAHOO.util.Event, + Lang = YAHOO.lang, + UA = YAHOO.env.ua, + Overlay = YAHOO.widget.Overlay, + Menu = YAHOO.widget.Menu, + + + // Private member variables + + m_oButtons = {}, // Collection of all Button instances + m_oOverlayManager = null, // YAHOO.widget.OverlayManager instance + m_oSubmitTrigger = null, // The button that submitted the form + m_oFocusedButton = null; // The button that has focus + + + + // Private methods + + + + /** + * @method createInputElement + * @description Creates an <input> element of the + * specified type. + * @private + * @param {String} p_sType String specifying the type of + * <input> element to create. + * @param {String} p_sName String specifying the name of + * <input> element to create. + * @param {String} p_sValue String specifying the value of + * <input> element to create. + * @param {String} p_bChecked Boolean specifying if the + * <input> element is to be checked. + * @return {HTMLInputElement} + */ + function createInputElement(p_sType, p_sName, p_sValue, p_bChecked) { + + var oInput, + sInput; + + if (Lang.isString(p_sType) && Lang.isString(p_sName)) { + + if (UA.ie) { + + /* + For IE it is necessary to create the element with the + "type," "name," "value," and "checked" properties set all + at once. + */ + + sInput = "<input> or <a>) that + * map to Button configuration attributes and sets them into a collection + * that is passed to the Button constructor. + * @private + * @param {HTMLInputElement|HTMLAnchorElement} p_oElement Object reference to the HTML + * element (either <input> or <span> + * ) used to create the button. + * @param {Object} p_oAttributes Object reference for the collection of + * configuration attributes used to create the button. + */ + function setAttributesFromSrcElement(p_oElement, p_oAttributes) { + + var sSrcElementNodeName = p_oElement.nodeName.toUpperCase(), + sClass = (this.CLASS_NAME_PREFIX + this.CSS_CLASS_NAME), + me = this, + oAttribute, + oRootNode, + sText; + + + /** + * @method setAttributeFromDOMAttribute + * @description Gets the value of the specified DOM attribute and sets it + * into the collection of configuration attributes used to configure + * the button. + * @private + * @param {String} p_sAttribute String representing the name of the + * attribute to retrieve from the DOM element. + */ + function setAttributeFromDOMAttribute(p_sAttribute) { + + if (!(p_sAttribute in p_oAttributes)) { + + /* + Need to use "getAttributeNode" instead of "getAttribute" + because using "getAttribute," IE will return the innerText + of a <button> for the value attribute + rather than the value of the "value" attribute. + */ + + oAttribute = p_oElement.getAttributeNode(p_sAttribute); + + + if (oAttribute && ("value" in oAttribute)) { + + + p_oAttributes[p_sAttribute] = oAttribute.value; + + } + + } + + } + + + /** + * @method setFormElementProperties + * @description Gets the value of the attributes from the form element + * and sets them into the collection of configuration attributes used to + * configure the button. + * @private + */ + function setFormElementProperties() { + + setAttributeFromDOMAttribute("type"); + + if (p_oAttributes.type == "button") { + + p_oAttributes.type = "push"; + + } + + if (!("disabled" in p_oAttributes)) { + + p_oAttributes.disabled = p_oElement.disabled; + + } + + setAttributeFromDOMAttribute("name"); + setAttributeFromDOMAttribute("value"); + setAttributeFromDOMAttribute("title"); + + } + + + switch (sSrcElementNodeName) { + + case "A": + + p_oAttributes.type = "link"; + + setAttributeFromDOMAttribute("href"); + setAttributeFromDOMAttribute("target"); + + break; + + case "INPUT": + + setFormElementProperties(); + + if (!("checked" in p_oAttributes)) { + + p_oAttributes.checked = p_oElement.checked; + + } + + break; + + case "BUTTON": + + setFormElementProperties(); + + oRootNode = p_oElement.parentNode.parentNode; + + if (Dom.hasClass(oRootNode, sClass + "-checked")) { + + p_oAttributes.checked = true; + + } + + if (Dom.hasClass(oRootNode, sClass + "-disabled")) { + + p_oAttributes.disabled = true; + + } + + p_oElement.removeAttribute("value"); + + p_oElement.setAttribute("type", "button"); + + break; + + } + + p_oElement.removeAttribute("id"); + p_oElement.removeAttribute("name"); + + if (!("tabindex" in p_oAttributes)) { + + p_oAttributes.tabindex = p_oElement.tabIndex; + + } + + if (!("label" in p_oAttributes)) { + + // Set the "label" property + + sText = sSrcElementNodeName == "INPUT" ? + p_oElement.value : p_oElement.innerHTML; + + + if (sText && sText.length > 0) { + + p_oAttributes.label = sText; + + } + + } + + } + + + /** + * @method initConfig + * @description Initializes the set of configuration attributes that are + * used to instantiate the button. + * @private + * @param {Object} Object representing the button's set of + * configuration attributes. + */ + function initConfig(p_oConfig) { + + var oAttributes = p_oConfig.attributes, + oSrcElement = oAttributes.srcelement, + sSrcElementNodeName = oSrcElement.nodeName.toUpperCase(), + me = this; + + + if (sSrcElementNodeName == this.NODE_NAME) { + + p_oConfig.element = oSrcElement; + p_oConfig.id = oSrcElement.id; + + Dom.getElementsBy(function (p_oElement) { + + switch (p_oElement.nodeName.toUpperCase()) { + + case "BUTTON": + case "A": + case "INPUT": + + setAttributesFromSrcElement.call(me, p_oElement, + oAttributes); + + break; + + } + + }, "*", oSrcElement); + + } + else { + + switch (sSrcElementNodeName) { + + case "BUTTON": + case "A": + case "INPUT": + + setAttributesFromSrcElement.call(this, oSrcElement, + oAttributes); + + break; + + } + + } + + } + + + + // Constructor + + YAHOO.widget.Button = function (p_oElement, p_oAttributes) { + + if (!Overlay && YAHOO.widget.Overlay) { + + Overlay = YAHOO.widget.Overlay; + + } + + + if (!Menu && YAHOO.widget.Menu) { + + Menu = YAHOO.widget.Menu; + + } + + + var fnSuperClass = YAHOO.widget.Button.superclass.constructor, + oConfig, + oElement; + + + if (arguments.length == 1 && !Lang.isString(p_oElement) && !p_oElement.nodeName) { + + if (!p_oElement.id) { + + p_oElement.id = Dom.generateId(); + + + } + + + fnSuperClass.call(this, (this.createButtonElement(p_oElement.type)), p_oElement); + + } + else { + + oConfig = { element: null, attributes: (p_oAttributes || {}) }; + + + if (Lang.isString(p_oElement)) { + + oElement = Dom.get(p_oElement); + + if (oElement) { + + if (!oConfig.attributes.id) { + + oConfig.attributes.id = p_oElement; + + } + + + + oConfig.attributes.srcelement = oElement; + + initConfig.call(this, oConfig); + + + if (!oConfig.element) { + + + oConfig.element = this.createButtonElement(oConfig.attributes.type); + + } + + fnSuperClass.call(this, oConfig.element, oConfig.attributes); + + } + + } + else if (p_oElement.nodeName) { + + if (!oConfig.attributes.id) { + + if (p_oElement.id) { + + oConfig.attributes.id = p_oElement.id; + + } + else { + + oConfig.attributes.id = Dom.generateId(); + + + } + + } + + + + oConfig.attributes.srcelement = p_oElement; + + initConfig.call(this, oConfig); + + + if (!oConfig.element) { + + + oConfig.element = this.createButtonElement(oConfig.attributes.type); + + } + + fnSuperClass.call(this, oConfig.element, oConfig.attributes); + + } + + } + + }; + + + + YAHOO.extend(YAHOO.widget.Button, YAHOO.util.Element, { + + + // Protected properties + + + /** + * @property _button + * @description Object reference to the button's internal + * <a> or <button> element. + * @default null + * @protected + * @type HTMLAnchorElement|HTMLButtonElement + */ + _button: null, + + + /** + * @property _menu + * @description Object reference to the button's menu. + * @default null + * @protected + * @type {YAHOO.widget.Overlay| + * YAHOO.widget.Menu} + */ + _menu: null, + + + /** + * @property _hiddenFields + * @description Object reference to the <input> + * element, or array of HTML form elements used to represent the button + * when its parent form is submitted. + * @default null + * @protected + * @type HTMLInputElement|Array + */ + _hiddenFields: null, + + + /** + * @property _onclickAttributeValue + * @description Object reference to the button's current value for the + * "onclick" configuration attribute. + * @default null + * @protected + * @type Object + */ + _onclickAttributeValue: null, + + + /** + * @property _activationKeyPressed + * @description Boolean indicating if the key(s) that toggle the button's + * "active" state have been pressed. + * @default false + * @protected + * @type Boolean + */ + _activationKeyPressed: false, + + + /** + * @property _activationButtonPressed + * @description Boolean indicating if the mouse button that toggles + * the button's "active" state has been pressed. + * @default false + * @protected + * @type Boolean + */ + _activationButtonPressed: false, + + + /** + * @property _hasKeyEventHandlers + * @description Boolean indicating if the button's "blur", "keydown" and + * "keyup" event handlers are assigned + * @default false + * @protected + * @type Boolean + */ + _hasKeyEventHandlers: false, + + + /** + * @property _hasMouseEventHandlers + * @description Boolean indicating if the button's "mouseout," + * "mousedown," and "mouseup" event handlers are assigned + * @default false + * @protected + * @type Boolean + */ + _hasMouseEventHandlers: false, + + + /** + * @property _nOptionRegionX + * @description Number representing the X coordinate of the leftmost edge of the Button's + * option region. Applies only to Buttons of type "split". + * @default 0 + * @protected + * @type Number + */ + _nOptionRegionX: 0, + + + + // Constants + + /** + * @property CLASS_NAME_PREFIX + * @description Prefix used for all class names applied to a Button. + * @default "yui-" + * @final + * @type String + */ + CLASS_NAME_PREFIX: "yui-", + + + /** + * @property NODE_NAME + * @description The name of the node to be used for the button's + * root element. + * @default "SPAN" + * @final + * @type String + */ + NODE_NAME: "SPAN", + + + /** + * @property CHECK_ACTIVATION_KEYS + * @description Array of numbers representing keys that (when pressed) + * toggle the button's "checked" attribute. + * @default [32] + * @final + * @type Array + */ + CHECK_ACTIVATION_KEYS: [32], + + + /** + * @property ACTIVATION_KEYS + * @description Array of numbers representing keys that (when presed) + * toggle the button's "active" state. + * @default [13, 32] + * @final + * @type Array + */ + ACTIVATION_KEYS: [13, 32], + + + /** + * @property OPTION_AREA_WIDTH + * @description Width (in pixels) of the area of a split button that + * when pressed will display a menu. + * @default 20 + * @final + * @type Number + */ + OPTION_AREA_WIDTH: 20, + + + /** + * @property CSS_CLASS_NAME + * @description String representing the CSS class(es) to be applied to + * the button's root element. + * @default "button" + * @final + * @type String + */ + CSS_CLASS_NAME: "button", + + + + // Protected attribute setter methods + + + /** + * @method _setType + * @description Sets the value of the button's "type" attribute. + * @protected + * @param {String} p_sType String indicating the value for the button's + * "type" attribute. + */ + _setType: function (p_sType) { + + if (p_sType == "split") { + + this.on("option", this._onOption); + + } + + }, + + + /** + * @method _setLabel + * @description Sets the value of the button's "label" attribute. + * @protected + * @param {String} p_sLabel String indicating the value for the button's + * "label" attribute. + */ + _setLabel: function (p_sLabel) { + + this._button.innerHTML = p_sLabel; + + + /* + Remove and add the default class name from the root element + for Gecko to ensure that the button shrinkwraps to the label. + Without this the button will not be rendered at the correct + width when the label changes. The most likely cause for this + bug is button's use of the Gecko-specific CSS display type of + "-moz-inline-box" to simulate "inline-block" supported by IE, + Safari and Opera. + */ + + var sClass, + nGeckoVersion = UA.gecko; + + + if (nGeckoVersion && nGeckoVersion < 1.9 && Dom.inDocument(this.get("element"))) { + + sClass = (this.CLASS_NAME_PREFIX + this.CSS_CLASS_NAME); + + this.removeClass(sClass); + + Lang.later(0, this, this.addClass, sClass); + + } + + }, + + + /** + * @method _setTabIndex + * @description Sets the value of the button's "tabindex" attribute. + * @protected + * @param {Number} p_nTabIndex Number indicating the value for the + * button's "tabindex" attribute. + */ + _setTabIndex: function (p_nTabIndex) { + + this._button.tabIndex = p_nTabIndex; + + }, + + + /** + * @method _setTitle + * @description Sets the value of the button's "title" attribute. + * @protected + * @param {String} p_nTabIndex Number indicating the value for + * the button's "title" attribute. + */ + _setTitle: function (p_sTitle) { + + if (this.get("type") != "link") { + + this._button.title = p_sTitle; + + } + + }, + + + /** + * @method _setDisabled + * @description Sets the value of the button's "disabled" attribute. + * @protected + * @param {Boolean} p_bDisabled Boolean indicating the value for + * the button's "disabled" attribute. + */ + _setDisabled: function (p_bDisabled) { + + if (this.get("type") != "link") { + + if (p_bDisabled) { + + if (this._menu) { + + this._menu.hide(); + + } + + if (this.hasFocus()) { + + this.blur(); + + } + + this._button.setAttribute("disabled", "disabled"); + + this.addStateCSSClasses("disabled"); + + this.removeStateCSSClasses("hover"); + this.removeStateCSSClasses("active"); + this.removeStateCSSClasses("focus"); + + } + else { + + this._button.removeAttribute("disabled"); + + this.removeStateCSSClasses("disabled"); + + } + + } + + }, + + + /** + * @method _setHref + * @description Sets the value of the button's "href" attribute. + * @protected + * @param {String} p_sHref String indicating the value for the button's + * "href" attribute. + */ + _setHref: function (p_sHref) { + + if (this.get("type") == "link") { + + this._button.href = p_sHref; + + } + + }, + + + /** + * @method _setTarget + * @description Sets the value of the button's "target" attribute. + * @protected + * @param {String} p_sTarget String indicating the value for the button's + * "target" attribute. + */ + _setTarget: function (p_sTarget) { + + if (this.get("type") == "link") { + + this._button.setAttribute("target", p_sTarget); + + } + + }, + + + /** + * @method _setChecked + * @description Sets the value of the button's "target" attribute. + * @protected + * @param {Boolean} p_bChecked Boolean indicating the value for + * the button's "checked" attribute. + */ + _setChecked: function (p_bChecked) { + + var sType = this.get("type"); + + if (sType == "checkbox" || sType == "radio") { + + if (p_bChecked) { + this.addStateCSSClasses("checked"); + } + else { + this.removeStateCSSClasses("checked"); + } + + } + + }, + + + /** + * @method _setMenu + * @description Sets the value of the button's "menu" attribute. + * @protected + * @param {Object} p_oMenu Object indicating the value for the button's + * "menu" attribute. + */ + _setMenu: function (p_oMenu) { + + var bLazyLoad = this.get("lazyloadmenu"), + oButtonElement = this.get("element"), + sMenuCSSClassName, + + /* + Boolean indicating if the value of p_oMenu is an instance + of YAHOO.widget.Menu or YAHOO.widget.Overlay. + */ + + bInstance = false, + oMenu, + oMenuElement, + oSrcElement; + + + function onAppendTo() { + + oMenu.render(oButtonElement.parentNode); + + this.removeListener("appendTo", onAppendTo); + + } + + + function setMenuContainer() { + + oMenu.cfg.queueProperty("container", oButtonElement.parentNode); + + this.removeListener("appendTo", setMenuContainer); + + } + + + function initMenu() { + + var oContainer; + + if (oMenu) { + + Dom.addClass(oMenu.element, this.get("menuclassname")); + Dom.addClass(oMenu.element, this.CLASS_NAME_PREFIX + this.get("type") + "-button-menu"); + + oMenu.showEvent.subscribe(this._onMenuShow, null, this); + oMenu.hideEvent.subscribe(this._onMenuHide, null, this); + oMenu.renderEvent.subscribe(this._onMenuRender, null, this); + + + if (Menu && oMenu instanceof Menu) { + + if (bLazyLoad) { + + oContainer = this.get("container"); + + if (oContainer) { + + oMenu.cfg.queueProperty("container", oContainer); + + } + else { + + this.on("appendTo", setMenuContainer); + + } + + } + + oMenu.cfg.queueProperty("clicktohide", false); + + oMenu.keyDownEvent.subscribe(this._onMenuKeyDown, this, true); + oMenu.subscribe("click", this._onMenuClick, this, true); + + this.on("selectedMenuItemChange", this._onSelectedMenuItemChange); + + oSrcElement = oMenu.srcElement; + + if (oSrcElement && oSrcElement.nodeName.toUpperCase() == "SELECT") { + + oSrcElement.style.display = "none"; + oSrcElement.parentNode.removeChild(oSrcElement); + + } + + } + else if (Overlay && oMenu instanceof Overlay) { + + if (!m_oOverlayManager) { + + m_oOverlayManager = new YAHOO.widget.OverlayManager(); + + } + + m_oOverlayManager.register(oMenu); + + } + + + this._menu = oMenu; + + + if (!bInstance && !bLazyLoad) { + + if (Dom.inDocument(oButtonElement)) { + + oMenu.render(oButtonElement.parentNode); + + } + else { + + this.on("appendTo", onAppendTo); + + } + + } + + } + + } + + + if (Overlay) { + + if (Menu) { + + sMenuCSSClassName = Menu.prototype.CSS_CLASS_NAME; + + } + + if (p_oMenu && Menu && (p_oMenu instanceof Menu)) { + + oMenu = p_oMenu; + bInstance = true; + + initMenu.call(this); + + } + else if (Overlay && p_oMenu && (p_oMenu instanceof Overlay)) { + + oMenu = p_oMenu; + bInstance = true; + + oMenu.cfg.queueProperty("visible", false); + + initMenu.call(this); + + } + else if (Menu && Lang.isArray(p_oMenu)) { + + oMenu = new Menu(Dom.generateId(), { lazyload: bLazyLoad, itemdata: p_oMenu }); + + this._menu = oMenu; + + this.on("appendTo", initMenu); + + } + else if (Lang.isString(p_oMenu)) { + + oMenuElement = Dom.get(p_oMenu); + + if (oMenuElement) { + + if (Menu && Dom.hasClass(oMenuElement, sMenuCSSClassName) || + oMenuElement.nodeName.toUpperCase() == "SELECT") { + + oMenu = new Menu(p_oMenu, { lazyload: bLazyLoad }); + + initMenu.call(this); + + } + else if (Overlay) { + + oMenu = new Overlay(p_oMenu, { visible: false }); + + initMenu.call(this); + + } + + } + + } + else if (p_oMenu && p_oMenu.nodeName) { + + if (Menu && Dom.hasClass(p_oMenu, sMenuCSSClassName) || + p_oMenu.nodeName.toUpperCase() == "SELECT") { + + oMenu = new Menu(p_oMenu, { lazyload: bLazyLoad }); + + initMenu.call(this); + + } + else if (Overlay) { + + if (!p_oMenu.id) { + + Dom.generateId(p_oMenu); + + } + + oMenu = new Overlay(p_oMenu, { visible: false }); + + initMenu.call(this); + + } + + } + + } + + }, + + + /** + * @method _setOnClick + * @description Sets the value of the button's "onclick" attribute. + * @protected + * @param {Object} p_oObject Object indicating the value for the button's + * "onclick" attribute. + */ + _setOnClick: function (p_oObject) { + + /* + Remove any existing listeners if a "click" event handler + has already been specified. + */ + + if (this._onclickAttributeValue && + (this._onclickAttributeValue != p_oObject)) { + + this.removeListener("click", this._onclickAttributeValue.fn); + + this._onclickAttributeValue = null; + + } + + + if (!this._onclickAttributeValue && + Lang.isObject(p_oObject) && + Lang.isFunction(p_oObject.fn)) { + + this.on("click", p_oObject.fn, p_oObject.obj, p_oObject.scope); + + this._onclickAttributeValue = p_oObject; + + } + + }, + + + + // Protected methods + + + + /** + * @method _isActivationKey + * @description Determines if the specified keycode is one that toggles + * the button's "active" state. + * @protected + * @param {Number} p_nKeyCode Number representing the keycode to + * be evaluated. + * @return {Boolean} + */ + _isActivationKey: function (p_nKeyCode) { + + var sType = this.get("type"), + aKeyCodes = (sType == "checkbox" || sType == "radio") ? + this.CHECK_ACTIVATION_KEYS : this.ACTIVATION_KEYS, + + nKeyCodes = aKeyCodes.length, + bReturnVal = false, + i; + + + if (nKeyCodes > 0) { + + i = nKeyCodes - 1; + + do { + + if (p_nKeyCode == aKeyCodes[i]) { + + bReturnVal = true; + break; + + } + + } + while (i--); + + } + + return bReturnVal; + + }, + + + /** + * @method _isSplitButtonOptionKey + * @description Determines if the specified keycode is one that toggles + * the display of the split button's menu. + * @protected + * @param {Event} p_oEvent Object representing the DOM event object + * passed back by the event utility (YAHOO.util.Event). + * @return {Boolean} + */ + _isSplitButtonOptionKey: function (p_oEvent) { + + var bShowMenu = (Event.getCharCode(p_oEvent) == 40); + + + var onKeyPress = function (p_oEvent) { + + Event.preventDefault(p_oEvent); + + this.removeListener("keypress", onKeyPress); + + }; + + + // Prevent the browser from scrolling the window + if (bShowMenu) { + + if (UA.opera) { + + this.on("keypress", onKeyPress); + + } + + Event.preventDefault(p_oEvent); + } + + return bShowMenu; + + }, + + + /** + * @method _addListenersToForm + * @description Adds event handlers to the button's form. + * @protected + */ + _addListenersToForm: function () { + + var oForm = this.getForm(), + onFormKeyPress = YAHOO.widget.Button.onFormKeyPress, + bHasKeyPressListener, + oSrcElement, + aListeners, + nListeners, + i; + + + if (oForm) { + + Event.on(oForm, "reset", this._onFormReset, null, this); + Event.on(oForm, "submit", this._onFormSubmit, null, this); + + oSrcElement = this.get("srcelement"); + + + if (this.get("type") == "submit" || + (oSrcElement && oSrcElement.type == "submit")) + { + + aListeners = Event.getListeners(oForm, "keypress"); + bHasKeyPressListener = false; + + if (aListeners) { + + nListeners = aListeners.length; + + if (nListeners > 0) { + + i = nListeners - 1; + + do { + + if (aListeners[i].fn == onFormKeyPress) { + + bHasKeyPressListener = true; + break; + + } + + } + while (i--); + + } + + } + + + if (!bHasKeyPressListener) { + + Event.on(oForm, "keypress", onFormKeyPress); + + } + + } + + } + + }, + + + + /** + * @method _showMenu + * @description Shows the button's menu. + * @protected + * @param {Event} p_oEvent Object representing the DOM event object + * passed back by the event utility (YAHOO.util.Event) that triggered + * the display of the menu. + */ + _showMenu: function (p_oEvent) { + + if (YAHOO.widget.MenuManager) { + YAHOO.widget.MenuManager.hideVisible(); + } + + + if (m_oOverlayManager) { + m_oOverlayManager.hideAll(); + } + + + var oMenu = this._menu, + aMenuAlignment = this.get("menualignment"), + bFocusMenu = this.get("focusmenu"), + fnFocusMethod; + + + if (this._renderedMenu) { + + oMenu.cfg.setProperty("context", + [this.get("element"), aMenuAlignment[0], aMenuAlignment[1]]); + + oMenu.cfg.setProperty("preventcontextoverlap", true); + oMenu.cfg.setProperty("constraintoviewport", true); + + } + else { + + oMenu.cfg.queueProperty("context", + [this.get("element"), aMenuAlignment[0], aMenuAlignment[1]]); + + oMenu.cfg.queueProperty("preventcontextoverlap", true); + oMenu.cfg.queueProperty("constraintoviewport", true); + + } + + + /* + Refocus the Button before showing its Menu in case the call to + YAHOO.widget.MenuManager.hideVisible() resulted in another element in the + DOM being focused after another Menu was hidden. + */ + + this.focus(); + + + if (Menu && oMenu && (oMenu instanceof Menu)) { + + // Since Menus automatically focus themselves when made visible, temporarily + // replace the Menu focus method so that the value of the Button's "focusmenu" + // attribute determines if the Menu should be focus when made visible. + + fnFocusMethod = oMenu.focus; + + oMenu.focus = function () {}; + + if (this._renderedMenu) { + + oMenu.cfg.setProperty("minscrollheight", this.get("menuminscrollheight")); + oMenu.cfg.setProperty("maxheight", this.get("menumaxheight")); + + } + else { + + oMenu.cfg.queueProperty("minscrollheight", this.get("menuminscrollheight")); + oMenu.cfg.queueProperty("maxheight", this.get("menumaxheight")); + + } + + + oMenu.show(); + + oMenu.focus = fnFocusMethod; + + oMenu.align(); + + + /* + Stop the propagation of the event so that the MenuManager + doesn't blur the menu after it gets focus. + */ + + if (p_oEvent.type == "mousedown") { + Event.stopPropagation(p_oEvent); + } + + + if (bFocusMenu) { + oMenu.focus(); + } + + } + else if (Overlay && oMenu && (oMenu instanceof Overlay)) { + + if (!this._renderedMenu) { + oMenu.render(this.get("element").parentNode); + } + + oMenu.show(); + oMenu.align(); + + } + + }, + + + /** + * @method _hideMenu + * @description Hides the button's menu. + * @protected + */ + _hideMenu: function () { + + var oMenu = this._menu; + + if (oMenu) { + + oMenu.hide(); + + } + + }, + + + + + // Protected event handlers + + + /** + * @method _onMouseOver + * @description "mouseover" event handler for the button. + * @protected + * @param {Event} p_oEvent Object representing the DOM event object + * passed back by the event utility (YAHOO.util.Event). + */ + _onMouseOver: function (p_oEvent) { + + var sType = this.get("type"), + oElement, + nOptionRegionX; + + + if (sType === "split") { + + oElement = this.get("element"); + nOptionRegionX = + (Dom.getX(oElement) + (oElement.offsetWidth - this.OPTION_AREA_WIDTH)); + + this._nOptionRegionX = nOptionRegionX; + + } + + + if (!this._hasMouseEventHandlers) { + + if (sType === "split") { + + this.on("mousemove", this._onMouseMove); + + } + + this.on("mouseout", this._onMouseOut); + + this._hasMouseEventHandlers = true; + + } + + + this.addStateCSSClasses("hover"); + + + if (sType === "split" && (Event.getPageX(p_oEvent) > nOptionRegionX)) { + + this.addStateCSSClasses("hoveroption"); + + } + + + if (this._activationButtonPressed) { + + this.addStateCSSClasses("active"); + + } + + + if (this._bOptionPressed) { + + this.addStateCSSClasses("activeoption"); + + } + + + if (this._activationButtonPressed || this._bOptionPressed) { + + Event.removeListener(document, "mouseup", this._onDocumentMouseUp); + + } + + }, + + + /** + * @method _onMouseMove + * @description "mousemove" event handler for the button. + * @protected + * @param {Event} p_oEvent Object representing the DOM event object + * passed back by the event utility (YAHOO.util.Event). + */ + _onMouseMove: function (p_oEvent) { + + var nOptionRegionX = this._nOptionRegionX; + + if (nOptionRegionX) { + + if (Event.getPageX(p_oEvent) > nOptionRegionX) { + + this.addStateCSSClasses("hoveroption"); + + } + else { + + this.removeStateCSSClasses("hoveroption"); + + } + + } + + }, + + /** + * @method _onMouseOut + * @description "mouseout" event handler for the button. + * @protected + * @param {Event} p_oEvent Object representing the DOM event object + * passed back by the event utility (YAHOO.util.Event). + */ + _onMouseOut: function (p_oEvent) { + + var sType = this.get("type"); + + this.removeStateCSSClasses("hover"); + + + if (sType != "menu") { + + this.removeStateCSSClasses("active"); + + } + + + if (this._activationButtonPressed || this._bOptionPressed) { + + Event.on(document, "mouseup", this._onDocumentMouseUp, null, this); + + } + + + if (sType === "split" && (Event.getPageX(p_oEvent) > this._nOptionRegionX)) { + + this.removeStateCSSClasses("hoveroption"); + + } + + }, + + + /** + * @method _onDocumentMouseUp + * @description "mouseup" event handler for the button. + * @protected + * @param {Event} p_oEvent Object representing the DOM event object + * passed back by the event utility (YAHOO.util.Event). + */ + _onDocumentMouseUp: function (p_oEvent) { + + this._activationButtonPressed = false; + this._bOptionPressed = false; + + var sType = this.get("type"), + oTarget, + oMenuElement; + + if (sType == "menu" || sType == "split") { + + oTarget = Event.getTarget(p_oEvent); + oMenuElement = this._menu.element; + + if (oTarget != oMenuElement && + !Dom.isAncestor(oMenuElement, oTarget)) { + + this.removeStateCSSClasses((sType == "menu" ? + "active" : "activeoption")); + + this._hideMenu(); + + } + + } + + Event.removeListener(document, "mouseup", this._onDocumentMouseUp); + + }, + + + /** + * @method _onMouseDown + * @description "mousedown" event handler for the button. + * @protected + * @param {Event} p_oEvent Object representing the DOM event object + * passed back by the event utility (YAHOO.util.Event). + */ + _onMouseDown: function (p_oEvent) { + + var sType, + bReturnVal = true; + + + function onMouseUp() { + + this._hideMenu(); + this.removeListener("mouseup", onMouseUp); + + } + + + if ((p_oEvent.which || p_oEvent.button) == 1) { + + + if (!this.hasFocus()) { + + this.focus(); + + } + + + sType = this.get("type"); + + + if (sType == "split") { + + if (Event.getPageX(p_oEvent) > this._nOptionRegionX) { + + this.fireEvent("option", p_oEvent); + bReturnVal = false; + + } + else { + + this.addStateCSSClasses("active"); + + this._activationButtonPressed = true; + + } + + } + else if (sType == "menu") { + + if (this.isActive()) { + + this._hideMenu(); + + this._activationButtonPressed = false; + + } + else { + + this._showMenu(p_oEvent); + + this._activationButtonPressed = true; + + } + + } + else { + + this.addStateCSSClasses("active"); + + this._activationButtonPressed = true; + + } + + + + if (sType == "split" || sType == "menu") { + + this._hideMenuTimer = Lang.later(250, this, this.on, ["mouseup", onMouseUp]); + + } + + } + + return bReturnVal; + + }, + + + /** + * @method _onMouseUp + * @description "mouseup" event handler for the button. + * @protected + * @param {Event} p_oEvent Object representing the DOM event object + * passed back by the event utility (YAHOO.util.Event). + */ + _onMouseUp: function (p_oEvent) { + + var sType = this.get("type"), + oHideMenuTimer = this._hideMenuTimer, + bReturnVal = true; + + + if (oHideMenuTimer) { + + oHideMenuTimer.cancel(); + + } + + + if (sType == "checkbox" || sType == "radio") { + + this.set("checked", !(this.get("checked"))); + + } + + + this._activationButtonPressed = false; + + + if (sType != "menu") { + + this.removeStateCSSClasses("active"); + + } + + + if (sType == "split" && Event.getPageX(p_oEvent) > this._nOptionRegionX) { + + bReturnVal = false; + + } + + return bReturnVal; + + }, + + + /** + * @method _onFocus + * @description "focus" event handler for the button. + * @protected + * @param {Event} p_oEvent Object representing the DOM event object + * passed back by the event utility (YAHOO.util.Event). + */ + _onFocus: function (p_oEvent) { + + var oElement; + + this.addStateCSSClasses("focus"); + + if (this._activationKeyPressed) { + + this.addStateCSSClasses("active"); + + } + + m_oFocusedButton = this; + + + if (!this._hasKeyEventHandlers) { + + oElement = this._button; + + Event.on(oElement, "blur", this._onBlur, null, this); + Event.on(oElement, "keydown", this._onKeyDown, null, this); + Event.on(oElement, "keyup", this._onKeyUp, null, this); + + this._hasKeyEventHandlers = true; + + } + + + this.fireEvent("focus", p_oEvent); + + }, + + + /** + * @method _onBlur + * @description "blur" event handler for the button. + * @protected + * @param {Event} p_oEvent Object representing the DOM event object + * passed back by the event utility (YAHOO.util.Event). + */ + _onBlur: function (p_oEvent) { + + this.removeStateCSSClasses("focus"); + + if (this.get("type") != "menu") { + + this.removeStateCSSClasses("active"); + + } + + if (this._activationKeyPressed) { + + Event.on(document, "keyup", this._onDocumentKeyUp, null, this); + + } + + + m_oFocusedButton = null; + + this.fireEvent("blur", p_oEvent); + + }, + + + /** + * @method _onDocumentKeyUp + * @description "keyup" event handler for the document. + * @protected + * @param {Event} p_oEvent Object representing the DOM event object + * passed back by the event utility (YAHOO.util.Event). + */ + _onDocumentKeyUp: function (p_oEvent) { + + if (this._isActivationKey(Event.getCharCode(p_oEvent))) { + + this._activationKeyPressed = false; + + Event.removeListener(document, "keyup", this._onDocumentKeyUp); + + } + + }, + + + /** + * @method _onKeyDown + * @description "keydown" event handler for the button. + * @protected + * @param {Event} p_oEvent Object representing the DOM event object + * passed back by the event utility (YAHOO.util.Event). + */ + _onKeyDown: function (p_oEvent) { + + var oMenu = this._menu; + + + if (this.get("type") == "split" && + this._isSplitButtonOptionKey(p_oEvent)) { + + this.fireEvent("option", p_oEvent); + + } + else if (this._isActivationKey(Event.getCharCode(p_oEvent))) { + + if (this.get("type") == "menu") { + + this._showMenu(p_oEvent); + + } + else { + + this._activationKeyPressed = true; + + this.addStateCSSClasses("active"); + + } + + } + + + if (oMenu && oMenu.cfg.getProperty("visible") && + Event.getCharCode(p_oEvent) == 27) { + + oMenu.hide(); + this.focus(); + + } + + }, + + + /** + * @method _onKeyUp + * @description "keyup" event handler for the button. + * @protected + * @param {Event} p_oEvent Object representing the DOM event object + * passed back by the event utility (YAHOO.util.Event). + */ + _onKeyUp: function (p_oEvent) { + + var sType; + + if (this._isActivationKey(Event.getCharCode(p_oEvent))) { + + sType = this.get("type"); + + if (sType == "checkbox" || sType == "radio") { + + this.set("checked", !(this.get("checked"))); + + } + + this._activationKeyPressed = false; + + if (this.get("type") != "menu") { + + this.removeStateCSSClasses("active"); + + } + + } + + }, + + + /** + * @method _onClick + * @description "click" event handler for the button. + * @protected + * @param {Event} p_oEvent Object representing the DOM event object + * passed back by the event utility (YAHOO.util.Event). + */ + _onClick: function (p_oEvent) { + + var sType = this.get("type"), + oForm, + oSrcElement, + bReturnVal; + + + switch (sType) { + + case "submit": + + if (p_oEvent.returnValue !== false) { + + this.submitForm(); + + } + + break; + + case "reset": + + oForm = this.getForm(); + + if (oForm) { + + oForm.reset(); + + } + + break; + + + case "split": + + if (this._nOptionRegionX > 0 && + (Event.getPageX(p_oEvent) > this._nOptionRegionX)) { + + bReturnVal = false; + + } + else { + + this._hideMenu(); + + oSrcElement = this.get("srcelement"); + + if (oSrcElement && oSrcElement.type == "submit" && + p_oEvent.returnValue !== false) { + + this.submitForm(); + + } + + } + + break; + + } + + return bReturnVal; + + }, + + + /** + * @method _onDblClick + * @description "dblclick" event handler for the button. + * @protected + * @param {Event} p_oEvent Object representing the DOM event object + * passed back by the event utility (YAHOO.util.Event). + */ + _onDblClick: function (p_oEvent) { + + var bReturnVal = true; + + if (this.get("type") == "split" && Event.getPageX(p_oEvent) > this._nOptionRegionX) { + + bReturnVal = false; + + } + + return bReturnVal; + + }, + + + /** + * @method _onAppendTo + * @description "appendTo" event handler for the button. + * @protected + * @param {Event} p_oEvent Object representing the DOM event object + * passed back by the event utility (YAHOO.util.Event). + */ + _onAppendTo: function (p_oEvent) { + + /* + It is necessary to call "_addListenersToForm" using + "setTimeout" to make sure that the button's "form" property + returns a node reference. Sometimes, if you try to get the + reference immediately after appending the field, it is null. + */ + + Lang.later(0, this, this._addListenersToForm); + + }, + + + /** + * @method _onFormReset + * @description "reset" event handler for the button's form. + * @protected + * @param {Event} p_oEvent Object representing the DOM event + * object passed back by the event utility (YAHOO.util.Event). + */ + _onFormReset: function (p_oEvent) { + + var sType = this.get("type"), + oMenu = this._menu; + + if (sType == "checkbox" || sType == "radio") { + + this.resetValue("checked"); + + } + + + if (Menu && oMenu && (oMenu instanceof Menu)) { + + this.resetValue("selectedMenuItem"); + + } + + }, + + + /** + * @method _onFormSubmit + * @description "submit" event handler for the button's form. + * @protected + * @param {Event} p_oEvent Object representing the DOM event + * object passed back by the event utility (YAHOO.util.Event). + */ + _onFormSubmit: function (p_oEvent) { + + this.createHiddenFields(); + + }, + + + /** + * @method _onDocumentMouseDown + * @description "mousedown" event handler for the document. + * @protected + * @param {Event} p_oEvent Object representing the DOM event object + * passed back by the event utility (YAHOO.util.Event). + */ + _onDocumentMouseDown: function (p_oEvent) { + + var oTarget = Event.getTarget(p_oEvent), + oButtonElement = this.get("element"), + oMenuElement = this._menu.element; + + + if (oTarget != oButtonElement && + !Dom.isAncestor(oButtonElement, oTarget) && + oTarget != oMenuElement && + !Dom.isAncestor(oMenuElement, oTarget)) { + + this._hideMenu(); + + // In IE when the user mouses down on a focusable element + // that element will be focused and become the "activeElement". + // (http://msdn.microsoft.com/en-us/library/ms533065(VS.85).aspx) + // However, there is a bug in IE where if there is a + // positioned element with a focused descendant that is + // hidden in response to the mousedown event, the target of + // the mousedown event will appear to have focus, but will + // not be set as the activeElement. This will result + // in the element not firing key events, even though it + // appears to have focus. The following call to "setActive" + // fixes this bug. + + if (UA.ie && oTarget.focus) { + oTarget.setActive(); + } + + Event.removeListener(document, "mousedown", + this._onDocumentMouseDown); + + } + + }, + + + /** + * @method _onOption + * @description "option" event handler for the button. + * @protected + * @param {Event} p_oEvent Object representing the DOM event object + * passed back by the event utility (YAHOO.util.Event). + */ + _onOption: function (p_oEvent) { + + if (this.hasClass(this.CLASS_NAME_PREFIX + "split-button-activeoption")) { + + this._hideMenu(); + + this._bOptionPressed = false; + + } + else { + + this._showMenu(p_oEvent); + + this._bOptionPressed = true; + + } + + }, + + + /** + * @method _onMenuShow + * @description "show" event handler for the button's menu. + * @private + * @param {String} p_sType String representing the name of the event + * that was fired. + */ + _onMenuShow: function (p_sType) { + + Event.on(document, "mousedown", this._onDocumentMouseDown, + null, this); + + var sState = (this.get("type") == "split") ? "activeoption" : "active"; + + this.addStateCSSClasses(sState); + + }, + + + /** + * @method _onMenuHide + * @description "hide" event handler for the button's menu. + * @private + * @param {String} p_sType String representing the name of the event + * that was fired. + */ + _onMenuHide: function (p_sType) { + + var sState = (this.get("type") == "split") ? "activeoption" : "active"; + + this.removeStateCSSClasses(sState); + + + if (this.get("type") == "split") { + + this._bOptionPressed = false; + + } + + }, + + + /** + * @method _onMenuKeyDown + * @description "keydown" event handler for the button's menu. + * @private + * @param {String} p_sType String representing the name of the event + * that was fired. + * @param {Array} p_aArgs Array of arguments sent when the event + * was fired. + */ + _onMenuKeyDown: function (p_sType, p_aArgs) { + + var oEvent = p_aArgs[0]; + + if (Event.getCharCode(oEvent) == 27) { + + this.focus(); + + if (this.get("type") == "split") { + + this._bOptionPressed = false; + + } + + } + + }, + + + /** + * @method _onMenuRender + * @description "render" event handler for the button's menu. + * @private + * @param {String} p_sType String representing the name of the + * event thatwas fired. + */ + _onMenuRender: function (p_sType) { + + var oButtonElement = this.get("element"), + oButtonParent = oButtonElement.parentNode, + oMenu = this._menu, + oMenuElement = oMenu.element, + oSrcElement = oMenu.srcElement, + oItem; + + + if (oButtonParent != oMenuElement.parentNode) { + + oButtonParent.appendChild(oMenuElement); + + } + + this._renderedMenu = true; + + // If the user has designated an
    ",K=document.createElement("div");document.body.appendChild(K);K.innerHTML=J;}function B(L,I,J,M,K){H[parseInt(L.tId)]={"o":L,"c":M};if(K){M.method=I;M.data=K;}L.conn.send(J,M,L.tId);}function E(I){D(I);G._transport=document.getElementById("YUIConnectionSwf");}function C(){G.xdrReadyEvent.fire();}function A(J,I){if(J){G.startEvent.fire(J,I.argument);if(J.startEvent){J.startEvent.fire(J,I.argument);}}}function F(J){var K=H[J.tId].o,I=H[J.tId].c;if(J.statusText==="xdr:start"){A(K,I);return;}J.responseText=decodeURI(J.responseText);K.r=J;if(I.argument){K.r.argument=I.argument;}this.handleTransactionResponse(K,I,J.statusText==="xdr:abort"?true:false);delete H[J.tId];}G.xdr=B;G.swf=D;G.transport=E;G.xdrReadyEvent=new YAHOO.util.CustomEvent("xdrReady");G.xdrReady=C;G.handleXdrResponse=F;})();(function(){var D=YAHOO.util.Connect,F=YAHOO.util.Event;D._isFormSubmit=false;D._isFileUpload=false;D._formNode=null;D._sFormData=null;D._submitElementValue=null;D.uploadEvent=new YAHOO.util.CustomEvent("upload"),D._hasSubmitListener=function(){if(F){F.addListener(document,"click",function(J){var I=F.getTarget(J),H=I.nodeName.toLowerCase();if((H==="input"||H==="button")&&(I.type&&I.type.toLowerCase()=="submit")){D._submitElementValue=encodeURIComponent(I.name)+"="+encodeURIComponent(I.value);}});return true;}return false;}();function G(T,O,J){var S,I,R,P,W,Q=false,M=[],V=0,L,N,K,U,H;this.resetFormState();if(typeof T=="string"){S=(document.getElementById(T)||document.forms[T]);}else{if(typeof T=="object"){S=T;}else{return;}}if(O){this.createFrame(J?J:null);this._isFormSubmit=true;this._isFileUpload=true;this._formNode=S;return;}for(L=0,N=S.elements.length;L-1){H=I.options[I.selectedIndex];M[V++]=R+encodeURIComponent((H.attributes.value&&H.attributes.value.specified)?H.value:H.text);}break;case"select-multiple":if(I.selectedIndex>-1){for(K=I.selectedIndex,U=I.options.length;K');if(typeof H=="boolean"){J.src="javascript:false";}}else{J=document.createElement("iframe");J.id=I;J.name=I;}J.style.position="absolute";J.style.top="-1000px";J.style.left="-1000px";document.body.appendChild(J);}function E(H){var K=[],I=H.split("&"),J,L;for(J=0;J0){for(P=0;P= 200 && httpStatus < 300) || httpStatus === 1223 || xdrS){ + responseObject = o.xdr ? o.r : this.createResponseObject(o, args); + if(callback && callback.success){ + if(!callback.scope){ + callback.success(responseObject); + } + else{ + // If a scope property is defined, the callback will be fired from + // the context of the object. + callback.success.apply(callback.scope, [responseObject]); + } + } + + // Fire global custom event -- successEvent + this.successEvent.fire(responseObject); + + if(o.successEvent){ + // Fire transaction custom event -- successEvent + o.successEvent.fire(responseObject); + } + } + else{ + switch(httpStatus){ + // The following cases are wininet.dll error codes that may be encountered. + case 12002: // Server timeout + case 12029: // 12029 to 12031 correspond to dropped connections. + case 12030: + case 12031: + case 12152: // Connection closed by server. + case 13030: // See above comments for variable status. + // XDR transactions will not resolve to this case, since the + // response object is already built in the xdr response. + responseObject = this.createExceptionObject(o.tId, args, (isAbort?isAbort:false)); + if(callback && callback.failure){ + if(!callback.scope){ + callback.failure(responseObject); + } + else{ + callback.failure.apply(callback.scope, [responseObject]); + } + } + + break; + default: + responseObject = (o.xdr) ? o.response : this.createResponseObject(o, args); + if(callback && callback.failure){ + if(!callback.scope){ + callback.failure(responseObject); + } + else{ + callback.failure.apply(callback.scope, [responseObject]); + } + } + } + + // Fire global custom event -- failureEvent + this.failureEvent.fire(responseObject); + + if(o.failureEvent){ + // Fire transaction custom event -- failureEvent + o.failureEvent.fire(responseObject); + } + + } + + this.releaseObject(o); + responseObject = null; + }, + + /** + * @description This method evaluates the server response, creates and returns the results via + * its properties. Success and failure cases will differ in the response + * object's property values. + * @method createResponseObject + * @private + * @static + * @param {object} o The connection object + * @param {callbackArg} callbackArg The user-defined argument or arguments to be passed to the callback + * @return {object} + */ + createResponseObject:function(o, callbackArg) + { + var obj = {}, headerObj = {}, + i, headerStr, header, delimitPos; + + try + { + headerStr = o.conn.getAllResponseHeaders(); + header = headerStr.split('\n'); + for(i=0; i' + + '' + + '' + + '
    ', + c = document.createElement('div'); + + document.body.appendChild(c); + c.innerHTML = o; + } + + /** + * @description This method calls the public method on the + * Flash transport to start the XDR transaction. It is analogous + * to Connection Manager's asyncRequest method. + * @method xdr + * @private + * @static + * @param {object} The transaction object. + * @param {string} HTTP request method. + * @param {string} URI for the transaction. + * @param {object} The transaction's callback object. + * @param {object} The JSON object used as HTTP POST data. + * @return {void} + */ + function _xdr(o, m, u, c, d) { + _fn[parseInt(o.tId)] = { 'o':o, 'c':c }; + if (d) { + c.method = m; + c.data = d; + } + + o.conn.send(u, c, o.tId); + } + + /** + * @description This method instantiates the Flash transport and + * establishes a static reference to it, used for all XDR requests. + * @method transport + * @public + * @static + * @param {string} URI to connection.swf. + * @return {void} + */ + function _init(uri) { + _swf(uri); + YCM._transport = document.getElementById('YUIConnectionSwf'); + } + + function _xdrReady() { + YCM.xdrReadyEvent.fire(); + } + + /** + * @description This method fires the global and transaction start + * events. + * @method _xdrStart + * @private + * @static + * @param {object} The transaction object. + * @param {string} The transaction's callback object. + * @return {void} + */ + function _xdrStart(o, cb) { + if (o) { + // Fire global custom event -- startEvent + YCM.startEvent.fire(o, cb.argument); + + if(o.startEvent){ + // Fire transaction custom event -- startEvent + o.startEvent.fire(o, cb.argument); + } + } + } + + /** + * @description This method is the initial response handler + * for XDR transactions. The Flash transport calls this + * function and sends the response payload. + * @method handleXdrResponse + * @private + * @static + * @param {object} The response object sent from the Flash transport. + * @return {void} + */ + function _handleXdrResponse(r) { + var o = _fn[r.tId].o, + cb = _fn[r.tId].c; + + if (r.statusText === 'xdr:start') { + _xdrStart(o, cb); + return; + } + + r.responseText = decodeURI(r.responseText); + o.r = r; + if (cb.argument) { + o.r.argument = cb.argument; + } + + this.handleTransactionResponse(o, cb, r.statusText === 'xdr:abort' ? true : false); + delete _fn[r.tId]; + } + + // Bind the functions to Connection Manager as static fields. + YCM.xdr = _xdr; + YCM.swf = _swf; + YCM.transport = _init; + YCM.xdrReadyEvent = new YAHOO.util.CustomEvent('xdrReady'); + YCM.xdrReady = _xdrReady; + YCM.handleXdrResponse = _handleXdrResponse; +})(); + +/** + * @for Connect + */ +(function(){ + var YCM = YAHOO.util.Connect, + YE = YAHOO.util.Event; + /** + * @description Property modified by setForm() to determine if the data + * should be submitted as an HTML form. + * @property _isFormSubmit + * @private + * @static + * @type boolean + */ + YCM._isFormSubmit = false; + + /** + * @description Property modified by setForm() to determine if a file(s) + * upload is expected. + * @property _isFileUpload + * @private + * @static + * @type boolean + */ + YCM._isFileUpload = false; + + /** + * @description Property modified by setForm() to set a reference to the HTML + * form node if the desired action is file upload. + * @property _formNode + * @private + * @static + * @type object + */ + YCM._formNode = null; + + /** + * @description Property modified by setForm() to set the HTML form data + * for each transaction. + * @property _sFormData + * @private + * @static + * @type string + */ + YCM._sFormData = null; + + /** + * @description Tracks the name-value pair of the "clicked" submit button if multiple submit + * buttons are present in an HTML form; and, if YAHOO.util.Event is available. + * @property _submitElementValue + * @private + * @static + * @type string + */ + YCM._submitElementValue = null; + + /** + * @description Custom event that fires when handleTransactionResponse() determines a + * response in the HTTP 4xx/5xx range. + * @property failureEvent + * @private + * @static + * @type CustomEvent + */ + YCM.uploadEvent = new YAHOO.util.CustomEvent('upload'), + + /** + * @description Determines whether YAHOO.util.Event is available and returns true or false. + * If true, an event listener is bound at the document level to trap click events that + * resolve to a target type of "Submit". This listener will enable setForm() to determine + * the clicked "Submit" value in a multi-Submit button, HTML form. + * @property _hasSubmitListener + * @private + * @static + */ + YCM._hasSubmitListener = function() { + if(YE){ + YE.addListener( + document, + 'click', + function(e){ + var obj = YE.getTarget(e), + name = obj.nodeName.toLowerCase(); + + if((name === 'input' || name === 'button') && (obj.type && obj.type.toLowerCase() == 'submit')){ + YCM._submitElementValue = encodeURIComponent(obj.name) + "=" + encodeURIComponent(obj.value); + } + }); + return true; + } + return false; + }(); + + /** + * @description This method assembles the form label and value pairs and + * constructs an encoded string. + * asyncRequest() will automatically initialize the transaction with a + * a HTTP header Content-Type of application/x-www-form-urlencoded. + * @method setForm + * @public + * @static + * @param {string || object} form id or name attribute, or form object. + * @param {boolean} optional enable file upload. + * @param {boolean} optional enable file upload over SSL in IE only. + * @return {string} string of the HTML form field name and value pairs.. + */ + function _setForm(formId, isUpload, secureUri) + { + var oForm, oElement, oName, oValue, oDisabled, + hasSubmit = false, + data = [], item = 0, + i,len,j,jlen,opt; + + this.resetFormState(); + + if(typeof formId == 'string'){ + // Determine if the argument is a form id or a form name. + // Note form name usage is deprecated by supported + // here for legacy reasons. + oForm = (document.getElementById(formId) || document.forms[formId]); + } + else if(typeof formId == 'object'){ + // Treat argument as an HTML form object. + oForm = formId; + } + else{ + return; + } + + // If the isUpload argument is true, setForm will call createFrame to initialize + // an iframe as the form target. + // + // The argument secureURI is also required by IE in SSL environments + // where the secureURI string is a fully qualified HTTP path, used to set the source + // of the iframe, to a stub resource in the same domain. + if(isUpload){ + + // Create iframe in preparation for file upload. + this.createFrame(secureUri?secureUri:null); + + // Set form reference and file upload properties to true. + this._isFormSubmit = true; + this._isFileUpload = true; + this._formNode = oForm; + + return; + } + + // Iterate over the form elements collection to construct the + // label-value pairs. + for (i=0,len=oForm.elements.length; i -1) { + opt = oElement.options[oElement.selectedIndex]; + data[item++] = oName + encodeURIComponent( + (opt.attributes.value && opt.attributes.value.specified) ? opt.value : opt.text); + } + break; + case 'select-multiple': + if (oElement.selectedIndex > -1) { + for(j=oElement.selectedIndex, jlen=oElement.options.length; j'); + + // IE will throw a security exception in an SSL environment if the + // iframe source is undefined. + if(typeof secureUri == 'boolean'){ + io.src = 'javascript:false'; + } + } + else{ + io = document.createElement('iframe'); + io.id = frameId; + io.name = frameId; + } + + io.style.position = 'absolute'; + io.style.top = '-1000px'; + io.style.left = '-1000px'; + + document.body.appendChild(io); + } + + /** + * @description Parses the POST data and creates hidden form elements + * for each key-value, and appends them to the HTML form object. + * @method appendPostData + * @private + * @static + * @param {string} postData The HTTP POST data + * @return {array} formElements Collection of hidden fields. + */ + function _appendPostData(postData){ + var formElements = [], + postMessage = postData.split('&'), + i, delimitPos; + + for(i=0; i < postMessage.length; i++){ + delimitPos = postMessage[i].indexOf('='); + if(delimitPos != -1){ + formElements[i] = document.createElement('input'); + formElements[i].type = 'hidden'; + formElements[i].name = decodeURIComponent(postMessage[i].substring(0,delimitPos)); + formElements[i].value = decodeURIComponent(postMessage[i].substring(delimitPos+1)); + this._formNode.appendChild(formElements[i]); + } + } + + return formElements; + } + + /** + * @description Uploads HTML form, inclusive of files/attachments, using the + * iframe created in createFrame to facilitate the transaction. + * @method uploadFile + * @private + * @static + * @param {int} id The transaction id. + * @param {object} callback User-defined callback object. + * @param {string} uri Fully qualified path of resource. + * @param {string} postData POST data to be submitted in addition to HTML form. + * @return {void} + */ + function _uploadFile(o, callback, uri, postData){ + // Each iframe has an id prefix of "yuiIO" followed + // by the unique transaction id. + var frameId = 'yuiIO' + o.tId, + uploadEncoding = 'multipart/form-data', + io = document.getElementById(frameId), + ie8 = (document.documentMode && document.documentMode === 8) ? true : false, + oConn = this, + args = (callback && callback.argument)?callback.argument:null, + oElements,i,prop,obj, rawFormAttributes, uploadCallback; + + // Track original HTML form attribute values. + rawFormAttributes = { + action:this._formNode.getAttribute('action'), + method:this._formNode.getAttribute('method'), + target:this._formNode.getAttribute('target') + }; + + // Initialize the HTML form properties in case they are + // not defined in the HTML form. + this._formNode.setAttribute('action', uri); + this._formNode.setAttribute('method', 'POST'); + this._formNode.setAttribute('target', frameId); + + if(YAHOO.env.ua.ie && !ie8){ + // IE does not respect property enctype for HTML forms. + // Instead it uses the property - "encoding". + this._formNode.setAttribute('encoding', uploadEncoding); + } + else{ + this._formNode.setAttribute('enctype', uploadEncoding); + } + + if(postData){ + oElements = this.appendPostData(postData); + } + + // Start file upload. + this._formNode.submit(); + + // Fire global custom event -- startEvent + this.startEvent.fire(o, args); + + if(o.startEvent){ + // Fire transaction custom event -- startEvent + o.startEvent.fire(o, args); + } + + // Start polling if a callback is present and the timeout + // property has been defined. + if(callback && callback.timeout){ + this._timeOut[o.tId] = window.setTimeout(function(){ oConn.abort(o, callback, true); }, callback.timeout); + } + + // Remove HTML elements created by appendPostData + if(oElements && oElements.length > 0){ + for(i=0; i < oElements.length; i++){ + this._formNode.removeChild(oElements[i]); + } + } + + // Restore HTML form attributes to their original + // values prior to file upload. + for(prop in rawFormAttributes){ + if(YAHOO.lang.hasOwnProperty(rawFormAttributes, prop)){ + if(rawFormAttributes[prop]){ + this._formNode.setAttribute(prop, rawFormAttributes[prop]); + } + else{ + this._formNode.removeAttribute(prop); + } + } + } + + // Reset HTML form state properties. + this.resetFormState(); + + // Create the upload callback handler that fires when the iframe + // receives the load event. Subsequently, the event handler is detached + // and the iframe removed from the document. + uploadCallback = function() { + if(callback && callback.timeout){ + window.clearTimeout(oConn._timeOut[o.tId]); + delete oConn._timeOut[o.tId]; + } + + // Fire global custom event -- completeEvent + oConn.completeEvent.fire(o, args); + + if(o.completeEvent){ + // Fire transaction custom event -- completeEvent + o.completeEvent.fire(o, args); + } + + obj = { + tId : o.tId, + argument : callback.argument + }; + + try + { + // responseText and responseXML will be populated with the same data from the iframe. + // Since the HTTP headers cannot be read from the iframe + obj.responseText = io.contentWindow.document.body?io.contentWindow.document.body.innerHTML:io.contentWindow.document.documentElement.textContent; + obj.responseXML = io.contentWindow.document.XMLDocument?io.contentWindow.document.XMLDocument:io.contentWindow.document; + } + catch(e){} + + if(callback && callback.upload){ + if(!callback.scope){ + callback.upload(obj); + } + else{ + callback.upload.apply(callback.scope, [obj]); + } + } + + // Fire global custom event -- uploadEvent + oConn.uploadEvent.fire(obj); + + if(o.uploadEvent){ + // Fire transaction custom event -- uploadEvent + o.uploadEvent.fire(obj); + } + + YE.removeListener(io, "load", uploadCallback); + + setTimeout( + function(){ + document.body.removeChild(io); + oConn.releaseObject(o); + }, 100); + }; + + // Bind the onload handler to the iframe to detect the file upload response. + YE.addListener(io, "load", uploadCallback); + } + + YCM.setForm = _setForm; + YCM.resetFormState = _resetFormState; + YCM.createFrame = _createFrame; + YCM.appendPostData = _appendPostData; + YCM.uploadFile = _uploadFile; +})(); + +YAHOO.register("connection", YAHOO.util.Connect, {version: "2.8.0r4", build: "2449"}); diff --git a/include/javascript/yui/build/connection/connection_core-debug.js b/include/javascript/yui/build/connection/connection_core-debug.js new file mode 100755 index 00000000..3c0c61c5 --- /dev/null +++ b/include/javascript/yui/build/connection/connection_core-debug.js @@ -0,0 +1,980 @@ +/* +Copyright (c) 2009, Yahoo! Inc. All rights reserved. +Code licensed under the BSD License: +http://developer.yahoo.net/yui/license.txt +version: 2.8.0r4 +*/ +/** + * The Connection Manager provides a simplified interface to the XMLHttpRequest + * object. It handles cross-browser instantiantion of XMLHttpRequest, negotiates the + * interactive states and server response, returning the results to a pre-defined + * callback you create. + * + * @namespace YAHOO.util + * @module connection + * @requires yahoo + * @requires event + */ + +/** + * The Connection Manager singleton provides methods for creating and managing + * asynchronous transactions. + * + * @class Connect + */ + +YAHOO.util.Connect = +{ + /** + * @description Array of MSFT ActiveX ids for XMLHttpRequest. + * @property _msxml_progid + * @private + * @static + * @type array + */ + _msxml_progid:[ + 'Microsoft.XMLHTTP', + 'MSXML2.XMLHTTP.3.0', + 'MSXML2.XMLHTTP' + ], + + /** + * @description Object literal of HTTP header(s) + * @property _http_header + * @private + * @static + * @type object + */ + _http_headers:{}, + + /** + * @description Determines if HTTP headers are set. + * @property _has_http_headers + * @private + * @static + * @type boolean + */ + _has_http_headers:false, + + /** + * @description Determines if a default header of + * Content-Type of 'application/x-www-form-urlencoded' + * will be added to any client HTTP headers sent for POST + * transactions. + * @property _use_default_post_header + * @private + * @static + * @type boolean + */ + _use_default_post_header:true, + + /** + * @description The default header used for POST transactions. + * @property _default_post_header + * @private + * @static + * @type boolean + */ + _default_post_header:'application/x-www-form-urlencoded; charset=UTF-8', + + /** + * @description The default header used for transactions involving the + * use of HTML forms. + * @property _default_form_header + * @private + * @static + * @type boolean + */ + _default_form_header:'application/x-www-form-urlencoded', + + /** + * @description Determines if a default header of + * 'X-Requested-With: XMLHttpRequest' + * will be added to each transaction. + * @property _use_default_xhr_header + * @private + * @static + * @type boolean + */ + _use_default_xhr_header:true, + + /** + * @description The default header value for the label + * "X-Requested-With". This is sent with each + * transaction, by default, to identify the + * request as being made by YUI Connection Manager. + * @property _default_xhr_header + * @private + * @static + * @type boolean + */ + _default_xhr_header:'XMLHttpRequest', + + /** + * @description Determines if custom, default headers + * are set for each transaction. + * @property _has_default_header + * @private + * @static + * @type boolean + */ + _has_default_headers:true, + + /** + * @description Determines if custom, default headers + * are set for each transaction. + * @property _has_default_header + * @private + * @static + * @type boolean + */ + _default_headers:{}, + + /** + * @description Collection of polling references to the polling mechanism in handleReadyState. + * @property _poll + * @private + * @static + * @type object + */ + _poll:{}, + + /** + * @description Queue of timeout values for each transaction callback with a defined timeout value. + * @property _timeOut + * @private + * @static + * @type object + */ + _timeOut:{}, + + /** + * @description The polling frequency, in milliseconds, for HandleReadyState. + * when attempting to determine a transaction's XHR readyState. + * The default is 50 milliseconds. + * @property _polling_interval + * @private + * @static + * @type int + */ + _polling_interval:50, + + /** + * @description A transaction counter that increments the transaction id for each transaction. + * @property _transaction_id + * @private + * @static + * @type int + */ + _transaction_id:0, + + /** + * @description Custom event that fires at the start of a transaction + * @property startEvent + * @private + * @static + * @type CustomEvent + */ + startEvent: new YAHOO.util.CustomEvent('start'), + + /** + * @description Custom event that fires when a transaction response has completed. + * @property completeEvent + * @private + * @static + * @type CustomEvent + */ + completeEvent: new YAHOO.util.CustomEvent('complete'), + + /** + * @description Custom event that fires when handleTransactionResponse() determines a + * response in the HTTP 2xx range. + * @property successEvent + * @private + * @static + * @type CustomEvent + */ + successEvent: new YAHOO.util.CustomEvent('success'), + + /** + * @description Custom event that fires when handleTransactionResponse() determines a + * response in the HTTP 4xx/5xx range. + * @property failureEvent + * @private + * @static + * @type CustomEvent + */ + failureEvent: new YAHOO.util.CustomEvent('failure'), + + /** + * @description Custom event that fires when a transaction is successfully aborted. + * @property abortEvent + * @private + * @static + * @type CustomEvent + */ + abortEvent: new YAHOO.util.CustomEvent('abort'), + + /** + * @description A reference table that maps callback custom events members to its specific + * event name. + * @property _customEvents + * @private + * @static + * @type object + */ + _customEvents: + { + onStart:['startEvent', 'start'], + onComplete:['completeEvent', 'complete'], + onSuccess:['successEvent', 'success'], + onFailure:['failureEvent', 'failure'], + onUpload:['uploadEvent', 'upload'], + onAbort:['abortEvent', 'abort'] + }, + + /** + * @description Member to add an ActiveX id to the existing xml_progid array. + * In the event(unlikely) a new ActiveX id is introduced, it can be added + * without internal code modifications. + * @method setProgId + * @public + * @static + * @param {string} id The ActiveX id to be added to initialize the XHR object. + * @return void + */ + setProgId:function(id) + { + this._msxml_progid.unshift(id); + YAHOO.log('ActiveX Program Id ' + id + ' added to _msxml_progid.', 'info', 'Connection'); + }, + + /** + * @description Member to override the default POST header. + * @method setDefaultPostHeader + * @public + * @static + * @param {boolean} b Set and use default header - true or false . + * @return void + */ + setDefaultPostHeader:function(b) + { + if(typeof b == 'string'){ + this._default_post_header = b; + YAHOO.log('Default POST header set to ' + b, 'info', 'Connection'); + } + else if(typeof b == 'boolean'){ + this._use_default_post_header = b; + } + }, + + /** + * @description Member to override the default transaction header.. + * @method setDefaultXhrHeader + * @public + * @static + * @param {boolean} b Set and use default header - true or false . + * @return void + */ + setDefaultXhrHeader:function(b) + { + if(typeof b == 'string'){ + this._default_xhr_header = b; + YAHOO.log('Default XHR header set to ' + b, 'info', 'Connection'); + } + else{ + this._use_default_xhr_header = b; + } + }, + + /** + * @description Member to modify the default polling interval. + * @method setPollingInterval + * @public + * @static + * @param {int} i The polling interval in milliseconds. + * @return void + */ + setPollingInterval:function(i) + { + if(typeof i == 'number' && isFinite(i)){ + this._polling_interval = i; + YAHOO.log('Default polling interval set to ' + i +'ms', 'info', 'Connection'); + } + }, + + /** + * @description Instantiates a XMLHttpRequest object and returns an object with two properties: + * the XMLHttpRequest instance and the transaction id. + * @method createXhrObject + * @private + * @static + * @param {int} transactionId Property containing the transaction id for this transaction. + * @return object + */ + createXhrObject:function(transactionId) + { + var obj,http,i; + try + { + // Instantiates XMLHttpRequest in non-IE browsers and assigns to http. + http = new XMLHttpRequest(); + // Object literal with http and tId properties + obj = { conn:http, tId:transactionId, xhr: true }; + YAHOO.log('XHR object created for transaction ' + transactionId, 'info', 'Connection'); + } + catch(e) + { + for(i=0; i= 200 && httpStatus < 300) || httpStatus === 1223 || xdrS){ + responseObject = o.xdr ? o.r : this.createResponseObject(o, args); + if(callback && callback.success){ + if(!callback.scope){ + callback.success(responseObject); + YAHOO.log('Success callback. HTTP code is ' + httpStatus, 'info', 'Connection'); + } + else{ + // If a scope property is defined, the callback will be fired from + // the context of the object. + callback.success.apply(callback.scope, [responseObject]); + YAHOO.log('Success callback with scope. HTTP code is ' + httpStatus, 'info', 'Connection'); + } + } + + // Fire global custom event -- successEvent + this.successEvent.fire(responseObject); + + if(o.successEvent){ + // Fire transaction custom event -- successEvent + o.successEvent.fire(responseObject); + } + } + else{ + switch(httpStatus){ + // The following cases are wininet.dll error codes that may be encountered. + case 12002: // Server timeout + case 12029: // 12029 to 12031 correspond to dropped connections. + case 12030: + case 12031: + case 12152: // Connection closed by server. + case 13030: // See above comments for variable status. + // XDR transactions will not resolve to this case, since the + // response object is already built in the xdr response. + responseObject = this.createExceptionObject(o.tId, args, (isAbort?isAbort:false)); + if(callback && callback.failure){ + if(!callback.scope){ + callback.failure(responseObject); + YAHOO.log('Failure callback. Exception detected. Status code is ' + httpStatus, 'warn', 'Connection'); + } + else{ + callback.failure.apply(callback.scope, [responseObject]); + YAHOO.log('Failure callback with scope. Exception detected. Status code is ' + httpStatus, 'warn', 'Connection'); + } + } + + break; + default: + responseObject = (o.xdr) ? o.response : this.createResponseObject(o, args); + if(callback && callback.failure){ + if(!callback.scope){ + callback.failure(responseObject); + YAHOO.log('Failure callback. HTTP status code is ' + httpStatus, 'warn', 'Connection'); + } + else{ + callback.failure.apply(callback.scope, [responseObject]); + YAHOO.log('Failure callback with scope. HTTP status code is ' + httpStatus, 'warn', 'Connection'); + } + } + } + + // Fire global custom event -- failureEvent + this.failureEvent.fire(responseObject); + + if(o.failureEvent){ + // Fire transaction custom event -- failureEvent + o.failureEvent.fire(responseObject); + } + + } + + this.releaseObject(o); + responseObject = null; + }, + + /** + * @description This method evaluates the server response, creates and returns the results via + * its properties. Success and failure cases will differ in the response + * object's property values. + * @method createResponseObject + * @private + * @static + * @param {object} o The connection object + * @param {callbackArg} callbackArg The user-defined argument or arguments to be passed to the callback + * @return {object} + */ + createResponseObject:function(o, callbackArg) + { + var obj = {}, headerObj = {}, + i, headerStr, header, delimitPos; + + try + { + headerStr = o.conn.getAllResponseHeaders(); + header = headerStr.split('\n'); + for(i=0; i=200&&E<300)||E===1223||C){A=B.xdr?B.r:this.createResponseObject(B,G);if(I&&I.success){if(!I.scope){I.success(A);}else{I.success.apply(I.scope,[A]);}}this.successEvent.fire(A);if(B.successEvent){B.successEvent.fire(A);}}else{switch(E){case 12002:case 12029:case 12030:case 12031:case 12152:case 13030:A=this.createExceptionObject(B.tId,G,(D?D:false));if(I&&I.failure){if(!I.scope){I.failure(A);}else{I.failure.apply(I.scope,[A]);}}break;default:A=(B.xdr)?B.response:this.createResponseObject(B,G);if(I&&I.failure){if(!I.scope){I.failure(A);}else{I.failure.apply(I.scope,[A]);}}}this.failureEvent.fire(A);if(B.failureEvent){B.failureEvent.fire(A);}}this.releaseObject(B);A=null;},createResponseObject:function(A,G){var D={},I={},E,C,F,B;try{C=A.conn.getAllResponseHeaders();F=C.split("\n");for(E=0;E= 200 && httpStatus < 300) || httpStatus === 1223 || xdrS){ + responseObject = o.xdr ? o.r : this.createResponseObject(o, args); + if(callback && callback.success){ + if(!callback.scope){ + callback.success(responseObject); + } + else{ + // If a scope property is defined, the callback will be fired from + // the context of the object. + callback.success.apply(callback.scope, [responseObject]); + } + } + + // Fire global custom event -- successEvent + this.successEvent.fire(responseObject); + + if(o.successEvent){ + // Fire transaction custom event -- successEvent + o.successEvent.fire(responseObject); + } + } + else{ + switch(httpStatus){ + // The following cases are wininet.dll error codes that may be encountered. + case 12002: // Server timeout + case 12029: // 12029 to 12031 correspond to dropped connections. + case 12030: + case 12031: + case 12152: // Connection closed by server. + case 13030: // See above comments for variable status. + // XDR transactions will not resolve to this case, since the + // response object is already built in the xdr response. + responseObject = this.createExceptionObject(o.tId, args, (isAbort?isAbort:false)); + if(callback && callback.failure){ + if(!callback.scope){ + callback.failure(responseObject); + } + else{ + callback.failure.apply(callback.scope, [responseObject]); + } + } + + break; + default: + responseObject = (o.xdr) ? o.response : this.createResponseObject(o, args); + if(callback && callback.failure){ + if(!callback.scope){ + callback.failure(responseObject); + } + else{ + callback.failure.apply(callback.scope, [responseObject]); + } + } + } + + // Fire global custom event -- failureEvent + this.failureEvent.fire(responseObject); + + if(o.failureEvent){ + // Fire transaction custom event -- failureEvent + o.failureEvent.fire(responseObject); + } + + } + + this.releaseObject(o); + responseObject = null; + }, + + /** + * @description This method evaluates the server response, creates and returns the results via + * its properties. Success and failure cases will differ in the response + * object's property values. + * @method createResponseObject + * @private + * @static + * @param {object} o The connection object + * @param {callbackArg} callbackArg The user-defined argument or arguments to be passed to the callback + * @return {object} + */ + createResponseObject:function(o, callbackArg) + { + var obj = {}, headerObj = {}, + i, headerStr, header, delimitPos; + + try + { + headerStr = o.conn.getAllResponseHeaders(); + header = headerStr.split('\n'); + for(i=0; i0){G=F-1;do{D=E.subscribers[G];if(D&&D.obj==I&&D.fn==H){return true;}}while(G--);}return false;};YAHOO.lang.augmentProto(A,YAHOO.util.EventProvider);}());(function(){YAHOO.widget.Module=function(R,Q){if(R){this.init(R,Q);}else{}};var F=YAHOO.util.Dom,D=YAHOO.util.Config,N=YAHOO.util.Event,M=YAHOO.util.CustomEvent,G=YAHOO.widget.Module,I=YAHOO.env.ua,H,P,O,E,A={"BEFORE_INIT":"beforeInit","INIT":"init","APPEND":"append","BEFORE_RENDER":"beforeRender","RENDER":"render","CHANGE_HEADER":"changeHeader","CHANGE_BODY":"changeBody","CHANGE_FOOTER":"changeFooter","CHANGE_CONTENT":"changeContent","DESTROY":"destroy","BEFORE_SHOW":"beforeShow","SHOW":"show","BEFORE_HIDE":"beforeHide","HIDE":"hide"},J={"VISIBLE":{key:"visible",value:true,validator:YAHOO.lang.isBoolean},"EFFECT":{key:"effect",suppressEvent:true,supercedes:["visible"]},"MONITOR_RESIZE":{key:"monitorresize",value:true},"APPEND_TO_DOCUMENT_BODY":{key:"appendtodocumentbody",value:false}};G.IMG_ROOT=null;G.IMG_ROOT_SSL=null;G.CSS_MODULE="yui-module";G.CSS_HEADER="hd";G.CSS_BODY="bd";G.CSS_FOOTER="ft";G.RESIZE_MONITOR_SECURE_URL="javascript:false;";G.RESIZE_MONITOR_BUFFER=1;G.textResizeEvent=new M("textResize");G.forceDocumentRedraw=function(){var Q=document.documentElement;if(Q){Q.className+=" ";Q.className=YAHOO.lang.trim(Q.className);}};function L(){if(!H){H=document.createElement("div");H.innerHTML=('

    '+'
    ');P=H.firstChild;O=P.nextSibling;E=O.nextSibling;}return H;}function K(){if(!P){L();}return(P.cloneNode(false));}function B(){if(!O){L();}return(O.cloneNode(false));}function C(){if(!E){L();}return(E.cloneNode(false));}G.prototype={constructor:G,element:null,header:null,body:null,footer:null,id:null,imageRoot:G.IMG_ROOT,initEvents:function(){var Q=M.LIST; +this.beforeInitEvent=this.createEvent(A.BEFORE_INIT);this.beforeInitEvent.signature=Q;this.initEvent=this.createEvent(A.INIT);this.initEvent.signature=Q;this.appendEvent=this.createEvent(A.APPEND);this.appendEvent.signature=Q;this.beforeRenderEvent=this.createEvent(A.BEFORE_RENDER);this.beforeRenderEvent.signature=Q;this.renderEvent=this.createEvent(A.RENDER);this.renderEvent.signature=Q;this.changeHeaderEvent=this.createEvent(A.CHANGE_HEADER);this.changeHeaderEvent.signature=Q;this.changeBodyEvent=this.createEvent(A.CHANGE_BODY);this.changeBodyEvent.signature=Q;this.changeFooterEvent=this.createEvent(A.CHANGE_FOOTER);this.changeFooterEvent.signature=Q;this.changeContentEvent=this.createEvent(A.CHANGE_CONTENT);this.changeContentEvent.signature=Q;this.destroyEvent=this.createEvent(A.DESTROY);this.destroyEvent.signature=Q;this.beforeShowEvent=this.createEvent(A.BEFORE_SHOW);this.beforeShowEvent.signature=Q;this.showEvent=this.createEvent(A.SHOW);this.showEvent.signature=Q;this.beforeHideEvent=this.createEvent(A.BEFORE_HIDE);this.beforeHideEvent.signature=Q;this.hideEvent=this.createEvent(A.HIDE);this.hideEvent.signature=Q;},platform:function(){var Q=navigator.userAgent.toLowerCase();if(Q.indexOf("windows")!=-1||Q.indexOf("win32")!=-1){return"windows";}else{if(Q.indexOf("macintosh")!=-1){return"mac";}else{return false;}}}(),browser:function(){var Q=navigator.userAgent.toLowerCase();if(Q.indexOf("opera")!=-1){return"opera";}else{if(Q.indexOf("msie 7")!=-1){return"ie7";}else{if(Q.indexOf("msie")!=-1){return"ie";}else{if(Q.indexOf("safari")!=-1){return"safari";}else{if(Q.indexOf("gecko")!=-1){return"gecko";}else{return false;}}}}}}(),isSecure:function(){if(window.location.href.toLowerCase().indexOf("https")===0){return true;}else{return false;}}(),initDefaultConfig:function(){this.cfg.addProperty(J.VISIBLE.key,{handler:this.configVisible,value:J.VISIBLE.value,validator:J.VISIBLE.validator});this.cfg.addProperty(J.EFFECT.key,{suppressEvent:J.EFFECT.suppressEvent,supercedes:J.EFFECT.supercedes});this.cfg.addProperty(J.MONITOR_RESIZE.key,{handler:this.configMonitorResize,value:J.MONITOR_RESIZE.value});this.cfg.addProperty(J.APPEND_TO_DOCUMENT_BODY.key,{value:J.APPEND_TO_DOCUMENT_BODY.value});},init:function(V,U){var S,W;this.initEvents();this.beforeInitEvent.fire(G);this.cfg=new D(this);if(this.isSecure){this.imageRoot=G.IMG_ROOT_SSL;}if(typeof V=="string"){S=V;V=document.getElementById(V);if(!V){V=(L()).cloneNode(false);V.id=S;}}this.id=F.generateId(V);this.element=V;W=this.element.firstChild;if(W){var R=false,Q=false,T=false;do{if(1==W.nodeType){if(!R&&F.hasClass(W,G.CSS_HEADER)){this.header=W;R=true;}else{if(!Q&&F.hasClass(W,G.CSS_BODY)){this.body=W;Q=true;}else{if(!T&&F.hasClass(W,G.CSS_FOOTER)){this.footer=W;T=true;}}}}}while((W=W.nextSibling));}this.initDefaultConfig();F.addClass(this.element,G.CSS_MODULE);if(U){this.cfg.applyConfig(U,true);}if(!D.alreadySubscribed(this.renderEvent,this.cfg.fireQueue,this.cfg)){this.renderEvent.subscribe(this.cfg.fireQueue,this.cfg,true);}this.initEvent.fire(G);},initResizeMonitor:function(){var R=(I.gecko&&this.platform=="windows");if(R){var Q=this;setTimeout(function(){Q._initResizeMonitor();},0);}else{this._initResizeMonitor();}},_initResizeMonitor:function(){var Q,S,U;function W(){G.textResizeEvent.fire();}if(!I.opera){S=F.get("_yuiResizeMonitor");var V=this._supportsCWResize();if(!S){S=document.createElement("iframe");if(this.isSecure&&G.RESIZE_MONITOR_SECURE_URL&&I.ie){S.src=G.RESIZE_MONITOR_SECURE_URL;}if(!V){U=["' + data.responseText; // fill the div + subpanelContents[theDiv]['newDiv'].id = theDiv + '_newDiv'; + subpanelContents[theDiv]['newDiv'].className = 'quickcreate' ; + + theDivObj.style.display = 'none'; + theDivObj.parentNode.insertBefore(subpanelContents[theDiv]['newDiv'], theDivObj); + if (!dataToDOMAvail) { + SUGAR.util.evalScript(data.responseText); + } + subpanelLocked[theDiv] = false; + setTimeout("enableQS(false)",500); + ajaxStatus.hideStatus(); + + } + + if(typeof subpanelLocked[theDiv] != 'undefined' && subpanelLocked[theDiv]) return false; + subpanelLocked[theDiv] = true; + + if(typeof loadingStr == 'undefined') loadingStr = SUGAR.language.get('app_strings', 'LBL_LOADING'); + ajaxStatus.showStatus(loadingStr); + YAHOO.util.Connect.setForm(theForm); + var cObj = YAHOO.util.Connect.asyncRequest('POST', 'index.php', {success: success, failure: success}); + + return false; + }, + + cancelCreate: function(buttonName) { + var element = document.getElementById(buttonName); + do { + element = element.parentNode; + } while ( element.className != 'quickcreate' && element.parentNode ) ; + + var theDiv = element.id.substr(0,element.id.length-7); + + if (typeof(subpanelContents[theDiv]) == 'undefined') + return false; + + subpanelContents[theDiv]['newDiv'].parentNode.removeChild(subpanelContents[theDiv]['newDiv']); + subpanelContents[theDiv]['list'].style.display = ''; + + return false; + }, + + loadSubpanelGroupFromMore: function(group){ + SUGAR.subpanelUtils.updateSubpanelMoreTab(group); + SUGAR.subpanelUtils.loadSubpanelGroup(group); + }, + + updateSubpanelMoreTab: function(group){ + // Update Tab + var moreTab = document.getElementById(SUGAR.subpanelUtils.subpanelMoreTab + '_sp_tab'); + moreTab.id = group + '_sp_tab'; + moreTab.getElementsByTagName('a')[0].innerHTML = group; + moreTab.getElementsByTagName('a')[0].href = "javascript:SUGAR.subpanelUtils.loadSubpanelGroup('"+group+"');"; + + // Update Menu + var menuLink = document.getElementById(group+'_sp_mm'); + menuLink.id = SUGAR.subpanelUtils.subpanelMoreTab+'_sp_mm'; + menuLink.href = "javascript:SUGAR.subpanelUtils.loadSubpanelGroupFromMore('"+SUGAR.subpanelUtils.subpanelMoreTab+"');"; + menuLink.innerHTML = SUGAR.subpanelUtils.subpanelMoreTab; + + SUGAR.subpanelUtils.subpanelMoreTab = group; + }, + + /* loadSubpanels: + /* construct set of needed subpanels */ + /* if we have not yet loaded this subpanel group, */ + /* set loadedGroups[group] */ + /* for each subpanel in subpanelGroups[group] */ + /* if document.getElementById('whole_subpanel_'+subpanel) doesn't exist */ + /* then add subpanel to set of needed subpanels */ + /* if we need to load any subpanels, send a request for them */ + /* with updateSubpanels as the callback. */ + /* otherwise call updateSubpanels */ + /* call setGroupCookie */ + + loadSubpanelGroup: function(group){ + if(group == SUGAR.subpanelUtils.currentSubpanelGroup) return; + if(SUGAR.subpanelUtils.loadedGroups[group]){ + SUGAR.subpanelUtils.updateSubpanel(group); + }else{ + SUGAR.subpanelUtils.loadedGroups.push(group); + var needed = Array(); + for(group_sp in SUGAR.subpanelUtils.subpanelGroups[group]){ + if(typeof(SUGAR.subpanelUtils.subpanelGroups[group][group_sp]) == 'string' && !document.getElementById('whole_subpanel_'+SUGAR.subpanelUtils.subpanelGroups[group][group_sp])){ + needed.push(SUGAR.subpanelUtils.subpanelGroups[group][group_sp]); + } + } + var success = function(){ + SUGAR.subpanelUtils.updateSubpanelEventHandlers(needed); + SUGAR.subpanelUtils.updateSubpanels(group); + }; + /* needed to retrieve each of the specified subpanels and install them ...*/ + /* load them in bulk, insert via innerHTML, then sort nodes later. */ + if(needed.length){ + ajaxStatus.showStatus(SUGAR.language.get('app_strings', 'LBL_LOADING')); + SUGAR.util.retrieveAndFill(SUGAR.subpanelUtils.requestUrl + needed.join(','),'subpanel_list', null, success, null, true); + }else{ + SUGAR.subpanelUtils.updateSubpanels(group); + } + } + SUGAR.subpanelUtils.setGroupCookie(group); + }, + + /* updateSubpanels: + /* for each child node of subpanel_list */ + /* let subpanel name be id.match(/whole_subpanel_(\w*)/) */ + /* if the subpanel name is in the list of subpanels for the current group, show it */ + /* otherwise hide it */ + /* swap nodes to suit user's order */ + /* call updateSubpanelTabs */ + + updateSubpanels: function(group){ + var sp_list = document.getElementById('subpanel_list'); + for(sp in sp_list.childNodes){ + if(sp_list.childNodes[sp].id){ + sp_list.childNodes[sp].style.display = 'none'; + } + } + for(group_sp in SUGAR.subpanelUtils.subpanelGroups[group]){ + if ( typeof(SUGAR.subpanelUtils.subpanelGroups[group][group_sp]) != 'string' ) continue; + var cur = document.getElementById('whole_subpanel_'+SUGAR.subpanelUtils.subpanelGroups[group][group_sp]); + cur.style.display = 'block'; + /* use YDD swapNodes this and first, second, etc. */ + try{ + YAHOO.util.DDM.swapNode(cur, sp_list.getElementsByTagName('LI')[group_sp]); + }catch(e){ + + } + } + SUGAR.subpanelUtils.updateSubpanelTabs(group); + }, + + updateSubpanelTabs: function(group){ + if(SUGAR.subpanelUtils.showLinks){ + SUGAR.subpanelUtils.updateSubpanelSubtabs(group); + document.getElementById('subpanelSubTabs').innerHTML = SUGAR.subpanelUtils.subpanelSubTabs[group]; + } + + oldTab = document.getElementById(SUGAR.subpanelUtils.currentSubpanelGroup+'_sp_tab'); + if(oldTab){ + oldTab.className = ''; + oldTab.getElementsByTagName('a')[0].className = ''; + } + + mainTab = document.getElementById(group+'_sp_tab'); + mainTab.className = 'active'; + mainTab.getElementsByTagName('a')[0].className = 'current'; + + SUGAR.subpanelUtils.currentSubpanelGroup = group; + ajaxStatus.hideStatus(); + }, + + updateSubpanelEventHandlers: function(){ + if(SubpanelInitTabNames){ + SubpanelInitTabNames(SUGAR.subpanelUtils.getLayout(false)); + } + }, + + reorderSubpanelSubtabs: function(group, order){ + SUGAR.subpanelUtils.subpanelGroups[group] = order; + if(SUGAR.subpanelUtils.showLinks==1){ + SUGAR.subpanelUtils.updateSubpanelSubtabs(group); + if(SUGAR.subpanelUtils.currentSubpanelGroup == group){ + document.getElementById('subpanelSubTabs').innerHTML = SUGAR.subpanelUtils.subpanelSubTabs[group]; + } + } + }, + + // Re-renders the contents of subpanelSubTabs[group]. + // Does not immediately affect what's on the screen. + updateSubpanelSubtabs: function(group){ + var notFirst = 0; + var preMore = SUGAR.subpanelUtils.subpanelGroups[group].slice(0, SUGAR.subpanelUtils.subpanelMaxSubtabs); + + SUGAR.subpanelUtils.subpanelSubTabs[group] = ''; + + for(var sp_key = 0; sp_key < preMore.length; sp_key++){ + if(notFirst != 0){ + SUGAR.subpanelUtils.subpanelSubTabs[group] += ''; + }else{ + notFirst = 1; + } + SUGAR.subpanelUtils.subpanelSubTabs[group] += ''; + } + if(document.getElementById('MoreSub'+group+'PanelMenu')){ + SUGAR.subpanelUtils.subpanelSubTabs[group] += ''; + } + SUGAR.subpanelUtils.subpanelSubTabs[group] += '
    | '+SUGAR.subpanelUtils.subpanelTitles[preMore[sp_key]]+' |  >> 
    '; + + // Update the more menu for the current group + var postMore = SUGAR.subpanelUtils.subpanelGroups[group].slice(SUGAR.subpanelUtils.subpanelMaxSubtabs); + var subpanelMenu = document.getElementById('MoreSub'+group+'PanelMenu'); + + if(postMore && subpanelMenu){ + subpanelMenu.innerHTML = ''; + for(var sp_key = 0; sp_key < postMore.length; sp_key++){ + subpanelMenu.innerHTML += ''+SUGAR.subpanelUtils.subpanelTitles[postMore[sp_key]]+''; + } + subpanelMenu += '
    '; + } + }, + + setGroupCookie: function(group){ + Set_Cookie(SUGAR.subpanelUtils.tabCookieName, group, 3000, false, false,false); + } + }; +}(); + +SUGAR.subpanelUtils.menu = function(){ + return { + tbspButtonMouseOver : function(id,top,left,leftOffset){ //*// + closeMenusDelay = eraseTimeout(closeMenusDelay); + if (openMenusDelay == null){ + openMenusDelay = window.setTimeout("SUGAR.subpanelUtils.menu.spShowMenu('"+id+"','"+top+"','"+left+"','"+leftOffset+"')", delayTime); + } + }, + spShowMenu : function(id,top,left,leftOffset){ //*// + openMenusDelay = eraseTimeout(openMenusDelay); + var menuName = id.replace(/Handle/i,'Menu'); + var menu = getLayer(menuName); + //if (menu) menu.className = 'tbButtonMouseOverUp'; + if (currentMenu){ + closeAllMenus(); + } + SUGAR.subpanelUtils.menu.spPopupMenu(id, menu, top,left,leftOffset); + }, + spPopupMenu : function(handleID, menu, top, left, leftOffset){ //*// + var bw = checkBrowserWidth(); + var menuName = handleID.replace(/Handle/i,'Menu'); + var menuWidth = 120; + var imgWidth = document.getElementById(handleID).width; + if (menu){ + var menuHandle = getLayer(handleID); + var p=menuHandle; + if (left == "") { + var left = 0; + while(p&&p.tagName.toUpperCase()!='BODY'){ + left+=p.offsetLeft; + p=p.offsetParent; + } + left+=parseInt(leftOffset); + } + if (top == "") { + var top = 0; + p=menuHandle; + top+=p.offsetHeight; + while(p&&p.tagName.toUpperCase()!='BODY'){ + top+=p.offsetTop; + p=p.offsetParent; + } + } + if (left+menuWidth>bw) { + left = left-menuWidth+imgWidth; + } + setMenuVisible(menu, left, top, false); + } + } + }; +}(); diff --git a/jssource/src_files/include/SugarDependentDropdown/javascript/SugarDependentDropdown.js b/jssource/src_files/include/SugarDependentDropdown/javascript/SugarDependentDropdown.js new file mode 100755 index 00000000..cd283fe9 --- /dev/null +++ b/jssource/src_files/include/SugarDependentDropdown/javascript/SugarDependentDropdown.js @@ -0,0 +1,304 @@ +/********************************************************************************* + * SugarCRM is a customer relationship management program developed by + * SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc. + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU Affero General Public License version 3 as published by the + * Free Software Foundation with the addition of the following permission added + * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK + * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY + * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS. + * + * 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 Affero General Public License for more + * details. + * + * You should have received a copy of the GNU Affero General Public License along with + * this program; if not, see http://www.gnu.org/licenses or write to the Free + * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301 USA. + * + * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road, + * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com. + * + * The interactive user interfaces in modified source and object code versions + * of this program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU Affero General Public License version 3. + * + * In accordance with Section 7(b) of the GNU Affero General Public License version 3, + * these Appropriate Legal Notices must retain the display of the "Powered by + * SugarCRM" logo. If the display of the logo is not reasonably feasible for + * technical reasons, the Appropriate Legal Notices must display the words + * "Powered by SugarCRM". + ********************************************************************************/ +SUGAR.dependentDropdown = { + /* + * Container for "action" metadata - allows DD to parse saved choices and apply them at display time + */ + currentAction : null, + /* + * Flag to turn on debug mode. + * Current debug output: + * SUGAR.dependentDropdown._stack - simple list of this class' called methods + */ + debugMode : false +} + +/** + * Handle drop-down dependencies + * @param object HTML form element object + */ +SUGAR.dependentDropdown.handleDependentDropdown = function(el) { + /** + * + * + * PROTOTYPE THIS METHOD TO CUSTOMIZE RESPONSES FOR YOUR DEPENDENT DROPDOWNS + * + * + * + */ + /** + if(SUGAR.dependentDropdown.debugMode) SUGAR.dependentDropdown.utils.debugStack('handleDependentDropdown'); + + /* + * el.id example: + * "criteriaGroup::0:::0:-:crit0id" + * [grouping from metadata]::[index]:::[elementIndex]:-:[assignedID from metadata] + * index is row-number + * elementIndex is the index of the current element in this row + var index = el.id.slice(el.id.indexOf("::") + 2, el.id.indexOf(":::")); + var elementRow = el.boxObject.parentBox; + var elementIndex = el.id.slice(el.id.indexOf(":::") + 3, el.id.indexOf(":-:")); + + elementIndex++; + var elementKey = "element" + elementIndex; + var focusElement = SUGAR.dependentDropdown.dropdowns[focusDD].elements[elementKey]; + + if(focusElement) { + if(focusElement.handlers) { + try { + focusElement = focusElement.handlers[el.value]; + } catch(e) { + if(SUGAR.dependentDropdown.dropdowns.debugMode) { + debugger; + } + } + } + SUGAR.dependentDropdown.generateElement(focusElement, elementRow, index, elementIndex); + } else { + } + */ +} + + + + + + +SUGAR.dependentDropdown.generateElement = function(focusElement, elementRow, index, elementIndex) { + if(SUGAR.dependentDropdown.debugMode) SUGAR.dependentDropdown.utils.debugStack('generateElement'); + + var tmp = null; + + if(focusElement) { + /* get sandbox to play in */ + var sandbox = SUGAR.dependentDropdown.utils.generateElementContainer(focusElement, elementRow, index, elementIndex); + + /* handle labels that appear 'left' or 'top' */ + if(focusElement.label) { + focusLabel = { + tag : 'span', + cls : 'routingLabel', + html : " " + focusElement.label + " " + } + + switch(focusElement.label_pos) { + case "top": + focusLabel.html = focusElement.label + "
    "; + break; + + case "bottom": + focusLabel.html = "
    " + focusElement.label; + break; + } + + if(focusElement.label_pos == 'left' || focusElement.label_pos == 'top') { + YAHOO.ext.DomHelper.append(sandbox, focusLabel); + } + } + + /********************************************************************** + * FUN PART BELOW + */ + switch(focusElement.type) { + case 'input': + /* + * focusElement.values can be lazy-loaded via JS call + */ + if(typeof(focusElement.values) == 'string') { + focusElement.values = eval(focusElement.values); + } + + /* Define the key-value that is to be used to pre-select a value in the dropdown */ + var preselect = SUGAR.dependentDropdown.utils.getPreselectKey(focusElement.name); + + if(preselect.match(/::/)) + preselect = ''; + + tmp = YAHOO.ext.DomHelper.append(sandbox, { + tag : 'input', + id : focusElement.grouping + "::" + index + ":::" + elementIndex + ":-:" + focusElement.id, + name : focusElement.grouping + "::" + index + "::" + focusElement.name, + cls : 'input', + onchange : focusElement.onchange, + value : preselect + }, true); + var newElement = tmp.dom; + break; + + + case 'select': + tmp = YAHOO.ext.DomHelper.append(sandbox, { + tag : 'select', + id : focusElement.grouping + "::" + index + ":::" + elementIndex + ":-:" + focusElement.id, + name : focusElement.grouping + "::" + index + "::" + focusElement.name, + cls : 'input', + onchange : focusElement.onchange + }, true); + var newElement = tmp.dom; + + /* + * focusElement.values can be lazy-loaded via JS call + */ + if(typeof(focusElement.values) == 'string') { + focusElement.values = eval(focusElement.values); + } + + /* Define the key-value that is to be used to pre-select a value in the dropdown */ + var preselect = SUGAR.dependentDropdown.utils.getPreselectKey(focusElement.name); + + // Loop through the values (passed or generated) and preselect as needed + var i = 0; + for(var key in focusElement.values) { + var selected = (preselect == key) ? true : false; + newElement.options[i] = new Option(focusElement.values[key], key, selected); + + // ie6/7 workaround + if(selected) { + newElement.options[i].selected = true; + } + i++; + } + break; + + case 'none': + break; + + case 'checkbox': + alert('implement checkbox pls'); + break; + case 'multiple': + alert('implement multiple pls'); + break; + + default: + if(SUGAR.dependentDropdown.dropdowns.debugMode) { + alert("Improper type defined: [ " + focusElement.type + "]"); + } + return; + break; + } + + /* handle label placement *after* or *below* the drop-down */ + if(focusElement.label) { + if(focusElement.label_pos == 'right' || focusElement.label_pos == 'bottom') { + YAHOO.ext.DomHelper.append(sandbox, focusLabel); + } + } + + /* trigger dependent dropdown action to cascade dependencies */ + try { + newElement.onchange(); + //eval(focusElement.onchange); "this" has no reference + } catch(e) { + if(SUGAR.dependentDropdown.dropdowns.debugMode) { + debugger; + } + } + + } else { + } +} + + + +/////////////////////////////////////////////////////////////////////////////// +//// UTILS +SUGAR.dependentDropdown.utils = { + /** + * creates a DIV container for a given element + * @param object focusElement Element in focus' metadata + * @param object elementRow Parent DIV container's DOM object + * @param int index Index of current elementRow + * @param int elementIndex Index of the element in focus relative to others in the definition + * @return obj Reference DOM object generated + */ + generateElementContainer : function(focusElement, elementRow, index, elementIndex) { + /* clear out existing element if exists */ + var oldElement = document.getElementById('elementContainer' + focusElement.grouping + "::" + index + ":::" + elementIndex); + + if(oldElement) { + SUGAR.dependentDropdown.utils.removeChildren(oldElement); + } + + /* create sandbox to ease removal */ + var tmp = YAHOO.ext.DomHelper.append(elementRow, { + tag : 'span', + id : 'elementContainer' + focusElement.grouping + "::" + index + ":::" + elementIndex + }, true); + + return tmp.dom; + }, + /** + * Finds the preselect key from the User's saved (loaded into memory) metadata + * @param string elementName Name of form element - functions as key to user's saved value + */ + getPreselectKey : function(elementName) { + try { + if(SUGAR.dependentDropdown.currentAction.action[elementName]) { + return SUGAR.dependentDropdown.currentAction.action[elementName]; + } else { + return ''; + } + } catch(e) { + if(SUGAR.dependentDropdown.dropdowns.debugMode) { + //debugger; + } + return ''; + } + }, + + /** + * provides a list of methods called in order when debugging + * @param object + */ + debugStack : function(func) { + if(!SUGAR.dependentDropdown._stack) { + SUGAR.dependentDropdown._stack = new Array(); + } + + SUGAR.dependentDropdown._stack.push(func); + }, + + /** + * Removes all child nodes from the passed DOM element + */ + removeChildren : function(el) { + for(i=el.childNodes.length - 1; i >= 0; i--) { + if(el.childNodes[i]) { + el.removeChild(el.childNodes[i]); + } + } + } +} diff --git a/jssource/src_files/include/SugarEmailAddress/SugarEmailAddress.js b/jssource/src_files/include/SugarEmailAddress/SugarEmailAddress.js new file mode 100755 index 00000000..715de079 --- /dev/null +++ b/jssource/src_files/include/SugarEmailAddress/SugarEmailAddress.js @@ -0,0 +1,487 @@ +/********************************************************************************* + * SugarCRM is a customer relationship management program developed by + * SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc. + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU Affero General Public License version 3 as published by the + * Free Software Foundation with the addition of the following permission added + * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK + * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY + * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS. + * + * 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 Affero General Public License for more + * details. + * + * You should have received a copy of the GNU Affero General Public License along with + * this program; if not, see http://www.gnu.org/licenses or write to the Free + * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301 USA. + * + * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road, + * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com. + * + * The interactive user interfaces in modified source and object code versions + * of this program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU Affero General Public License version 3. + * + * In accordance with Section 7(b) of the GNU Affero General Public License version 3, + * these Appropriate Legal Notices must retain the display of the "Powered by + * SugarCRM" logo. If the display of the logo is not reasonably feasible for + * technical reasons, the Appropriate Legal Notices must display the words + * "Powered by SugarCRM". + ********************************************************************************/ +(function() { + //Do not double define + if (SUGAR.EmailAddressWidget) return; + + var Dom = YAHOO.util.Dom; + + SUGAR.EmailAddressWidget = function(module) { + if (!SUGAR.EmailAddressWidget.count[module]) SUGAR.EmailAddressWidget.count[module] = 0; + this.count = SUGAR.EmailAddressWidget.count[module]; + SUGAR.EmailAddressWidget.count[module]++; + this.module = module; + this.id = this.module + this.count; + if (document.getElementById(module+'_email_widget_id')) + document.getElementById(module+'_email_widget_id').value = this.id; + SUGAR.EmailAddressWidget.instances[this.id] = this; + } + + SUGAR.EmailAddressWidget.instances = {}; + SUGAR.EmailAddressWidget.count = {}; + + SUGAR.EmailAddressWidget.prototype = { + emailTemplate : '' + + '' + + ' ' + + '' + + '' + + '' + + '' + + '', + + numberEmailAddresses : 0, + replyToFlagObject : new Object(), + verifying : false, + enterPressed : false, + tabPressed : false, + emailView:"", + emailIsRequired: false, + + prefillEmailAddresses: function(tableId, o){ + for (i = 0; i < o.length; i++) { + o[i].email_address = o[i].email_address.replace(''', "'"); + this.addEmailAddress(tableId, o[i].email_address, o[i].primary_address, o[i].reply_to_address, o[i].opt_out, o[i].invalid_email); + } + }, + + retrieveEmailAddress: function (event) { + var callbackFunction = function success(data) { + var vals = YAHOO.lang.JSON.parse(data.responseText); + var target = vals.target; + event = this.getEvent(event); + + if(vals.email) { + var email = vals.email; + if(email != '' && /\d+$/.test(target)) { + var matches = target.match(/\d+$/); + var targetNumber = matches[0]; + var optOutEl = Dom.get(this.id + 'emailAddressOptOutFlag' + targetNumber); + if(optOutEl) { + optOutEl.checked = email['opt_out'] == 1 ? true : false; + } + var invalidEl = Dom.get(this.id + 'emailAddressInvalidFlag' + targetNumber); + if(invalidEl) { + invalidEl.checked = email['invalid_email'] == 1 ? true : false; + } + } + } + //Set the verified flag to true + var index = /[a-z]*\d?emailAddress(\d+)/i.exec(target)[1]; + + var verifyElementFlag = Dom.get(this.id + 'emailAddressVerifiedFlag' + index); + + if(verifyElementFlag.parentNode.childNodes.length > 1) { + verifyElementFlag.parentNode.removeChild(verifyElementFlag.parentNode.lastChild); + } + + var verifiedTextNode = document.createElement('span'); + verifiedTextNode.innerHTML = ''; + verifyElementFlag.parentNode.appendChild(verifiedTextNode); + verifyElementFlag.value = "true"; + this.verifyElementValue = Dom.get(this.id +'emailAddressVerifiedValue' + index); + this.verifyElementValue.value = Dom.get(this.id +'emailAddress' + index).value; + this.verifying = false; + + // If Enter key or Save button was pressed then we proceed to attempt a form submission + var savePressed = false; + if(event) { + var elm = document.activeElement || event.explicitOriginalTarget; + if(typeof elm.type != 'undefined' && /submit|button/.test(elm.type.toLowerCase())) { + savePressed = true; + } + } + + if(savePressed || this.enterPressed) { + setTimeout("SUGAR.EmailAddressWidget.instances." + this.id + ".forceSubmit()", 2100); + } else if(this.tabPressed) { + Dom.get(this.id + 'emailAddressPrimaryFlag' + index).focus(); + } + } + + var event = this.getEvent(event); + var targetEl = this.getEventElement(event); + var index = /[a-z]*\d?emailAddress(\d+)/i.exec(targetEl.id)[1]; + var verifyElementFlag = Dom.get(this.id + 'emailAddressVerifiedFlag' + index); + this.verifyElementValue = Dom.get(this.id + 'emailAddressVerifiedValue' + index); + verifyElementFlag.value = (trim(targetEl.value) == '' || targetEl.value == this.verifyElementValue.value) ? "true" : "false" + + //Remove the span element if it is present + if(verifyElementFlag.parentNode.childNodes.length > 1) { + verifyElementFlag.parentNode.removeChild(verifyElementFlag.parentNode.lastChild); + } + + if(/emailAddress\d+$/.test(targetEl.id) && isValidEmail(targetEl.value) && !this.verifying && verifyElementFlag.value == "false") { + verifiedTextNode = document.createElement('span'); + verifyElementFlag.parentNode.appendChild(verifiedTextNode); + verifiedTextNode.innerHTML = SUGAR.language.get('app_strings', 'LBL_VERIFY_EMAIL_ADDRESS'); + this.verifying = true; + var cObj = YAHOO.util.Connect.asyncRequest( + 'GET', + 'index.php?&module=Contacts&action=RetrieveEmail&target=' + targetEl.id + '&email=' + targetEl.value, + {success: callbackFunction, failure: callbackFunction, scope: this} + ); + } + }, + + handleKeyDown: function (event) { + var e = this.getEvent(event); + var eL = this.getEventElement(e); + if ((kc = e["keyCode"])) { + this.enterPressed = (kc == 13) ? true : false; + this.tabPressed = (kc == 9) ? true : false; + + if(this.enterPressed || this.tabPressed) { + this.retrieveEmailAddress(e); + if (this.enterPressed); + this.freezeEvent(e); + } + } + }, //handleKeyDown() + + getEvent :function (event) { + return (event ? event : window.event); + },//getEvent + + getEventElement : function (e) { + return (e.srcElement ? e.srcElement: (e.target ? e.target : e.currentTarget)); + },//getEventElement + + freezeEvent : function (e) { + if (e.preventDefault) e.preventDefault(); + e.returnValue = false; + e.cancelBubble = true; + if (e.stopPropagation) e.stopPropagation(); + return false; + },//freezeEvent + + addEmailAddress : function (tableId, address, primaryFlag, replyToFlag, optOutFlag, invalidFlag) { + if (this.addInProgress) + return; + this.addInProgress = true; + if (!address) + address = ""; + var insertInto = Dom.get(tableId); + var parentObj = insertInto.parentNode; + var newContent = document.createElement("input"); + var nav = new String(navigator.appVersion); + var newContentPrimaryFlag; + if(SUGAR.isIE){ + newContentPrimaryFlag = document.createElement(""); + }else{ + newContentPrimaryFlag = document.createElement("input"); + } + var newContentReplyToFlag = document.createElement("input"); + var newContentOptOutFlag = document.createElement("input"); + var newContentInvalidFlag = document.createElement("input"); + var newContentVerifiedFlag = document.createElement("input"); + var newContentVerifiedValue = document.createElement("input"); + var removeButton = document.createElement("img"); + var tbody = document.createElement("tbody"); + var tr = document.createElement("tr"); + var td1 = document.createElement("td"); + var td2 = document.createElement("td"); + var td3 = document.createElement("td"); + var td4 = document.createElement("td"); + var td5 = document.createElement("td"); + var td6 = document.createElement("td"); + var td7 = document.createElement("td"); + var td8 = document.createElement("td"); + + // set input field attributes + newContent.setAttribute("type", "text"); + newContent.setAttribute("name", this.id + "emailAddress" + this.numberEmailAddresses); + newContent.setAttribute("id", this.id + "emailAddress" + this.numberEmailAddresses); + newContent.setAttribute("size", "30"); + + if(address != '') { + newContent.setAttribute("value", address); + } + + // remove button + removeButton.setAttribute("id", this.id + "removeButton" + this.numberEmailAddresses); + removeButton.setAttribute("class", "id-ff-remove"); + removeButton.setAttribute("name", this.numberEmailAddresses); + removeButton.eaw = this; + removeButton.setAttribute("src", "index.php?entryPoint=getImage&themeName="+SUGAR.themes.theme_name+"&imageName=id-ff-remove.png"); + removeButton.onclick = function(){this.eaw.removeEmailAddress(this.name);}; + + // set primary flag + newContentPrimaryFlag.setAttribute("type", "radio"); + newContentPrimaryFlag.setAttribute("name", this.id + "emailAddressPrimaryFlag"); + newContentPrimaryFlag.setAttribute("id", this.id + "emailAddressPrimaryFlag" + this.numberEmailAddresses); + newContentPrimaryFlag.setAttribute("value", this.id + "emailAddress" + this.numberEmailAddresses); + newContentPrimaryFlag.setAttribute("enabled", "true"); + + // set reply-to flag + newContentReplyToFlag.setAttribute("type", "radio"); + newContentReplyToFlag.setAttribute("name", this.id + "emailAddressReplyToFlag"); + newContentReplyToFlag.setAttribute("id", this.id + "emailAddressReplyToFlag" + this.numberEmailAddresses); + newContentReplyToFlag.setAttribute("value", this.id + "emailAddress" + this.numberEmailAddresses); + newContentReplyToFlag.setAttribute("enabled", "true"); + newContentReplyToFlag.eaw = this; + newContentReplyToFlag['onclick']= function() { + var form = document.forms[this.eaw.emailView]; + if (!form) { + form = document.forms['editContactForm']; + } + var nav = new String(navigator.appVersion); + + if(nav.match(/MSIE/gim)) { + for(i=0; iinput into the DOM + parentObj.insertBefore(Dom.get('targetBody'), insertInto); + + // CL Fix for 17651 (added OR condition check to see if this is the first email added) + if(primaryFlag == '1' || (this.numberEmailAddresses == 0)) { + newContentPrimaryFlag.setAttribute("checked", 'true'); + } + + if(replyToFlag == '1') { + newContentReplyToFlag.setAttribute("checked", "true"); + } + + if (replyToFlag == '1') { + this.replyToFlagObject[newContentReplyToFlag.id] = true; + } else { + this.replyToFlagObject[newContentReplyToFlag.id] = false; + } + + if(optOutFlag == '1') { + newContentOptOutFlag.setAttribute("checked", 'true'); + } + + if(invalidFlag == '1') { + newContentInvalidFlag.setAttribute("checked", "true"); + } + newContent.eaw = this; + newContent.onblur = function(e){this.eaw.retrieveEmailAddress(e)}; + newContent.onkeydown = function(e){this.eaw.handleKeyDown(e)}; + + // Add validation to field + addToValidate(this.emailView, this.id + 'emailAddress' + this.numberEmailAddresses, 'email', this.emailIsRequired, SUGAR.language.get('app_strings', 'LBL_EMAIL_ADDRESS_BOOK_EMAIL_ADDR')); + this.numberEmailAddresses++; + this.addInProgress = false; + }, //addEmailAddress + + removeEmailAddress : function(index) { + removeFromValidate(this.emailView, this.id + 'emailAddress' + index); + var oNodeToRemove = Dom.get(this.id + 'emailAddressRow' + index); + oNodeToRemove.parentNode.removeChild(oNodeToRemove); + + var removedIndex = parseInt(index); + //If we are not deleting the last email address, we need to shift the numbering to fill the gap + if(this.numberEmailAddresses != removedIndex) { + for(var x = removedIndex + 1; x < this.numberEmailAddresses; x++) { + Dom.get(this.id + 'emailAddress' + x).setAttribute("name", this.id +"emailAddress" + (x-1)); + Dom.get(this.id + 'emailAddress' + x).setAttribute("id", this.id +"emailAddress" + (x-1)); + + if(Dom.get(this.id + 'emailAddressInvalidFlag' + x)) { + Dom.get(this.id + 'emailAddressInvalidFlag' + x).setAttribute("id", this.id + "emailAddressInvalidFlag" + (x-1)); + } + + if(Dom.get(this.id + 'emailAddressOptOutFlag' + x)){ + Dom.get(this.id + 'emailAddressOptOutFlag' + x).setAttribute("id", this.id + "emailAddressOptOutFlag" + (x-1)); + } + + if(Dom.get(this.id + 'emailAddressPrimaryFlag' + x)) { + Dom.get(this.id + 'emailAddressPrimaryFlag' + x).setAttribute("id", this.id + "emailAddressPrimaryFlag" + (x-1)); + } + + Dom.get(this.id + 'emailAddressVerifiedValue' + x).setAttribute("id", this.id + "emailAddressVerifiedValue" + (x-1)); + Dom.get(this.id + 'emailAddressVerifiedFlag' + x).setAttribute("id", this.id + "emailAddressVerifiedFlag" + (x-1)); + + var rButton = Dom.get(this.id + 'removeButton' + x); + rButton.setAttribute("name", (x-1)); + rButton.setAttribute("id", this.id + "removeButton" + (x-1)); + Dom.get(this.id + 'emailAddressRow' + x).setAttribute("id", this.id + 'emailAddressRow' + (x-1)); + } + } + + this.numberEmailAddresses--; + + + // CL Fix for 17651 + if(this.numberEmailAddresses == 0) { + return; + } + + var primaryFound = false; + for(x=0; x < this.numberEmailAddresses; x++) { + if(Dom.get(this.id + 'emailAddressPrimaryFlag' + x).checked) { + primaryFound = true; + } + } + + if(!primaryFound) { + Dom.get(this.id + 'emailAddressPrimaryFlag0').checked = true; + Dom.get(this.id + 'emailAddressPrimaryFlag0').value = this.id + 'emailAddress0'; + } + }, + + toggleCheckbox : function (el) + { + var form = document.forms[this.emailView]; + if (!form) { + form = document.forms['editContactForm']; + } + + if(SUGAR.isIE) { + for(i=0; i