From: Radek Czajka Date: Tue, 3 Aug 2010 11:07:29 +0000 (+0200) Subject: Merge branch 'production' X-Git-Url: https://git.mdrn.pl/redakcja.git/commitdiff_plain/1fbf854ce423d2d56723ff10608267403f4916b0?hp=f06b3e117258f7968b7df783064c2a4deb6e3879 Merge branch 'production' --- diff --git a/.gitignore b/.gitignore index a926b1ad..0d555842 100644 --- a/.gitignore +++ b/.gitignore @@ -2,10 +2,15 @@ localsettings.py dev.sqlite requirements.pybundle *~ +*.orig # Python garbage *.pyc .coverage +.coveragerc +coverage.xml +nosetests.xml +pip-log.txt # Mac OS X garbage .DS_Store diff --git a/apps/django_cas/backends.py b/apps/django_cas/backends.py index 328469a9..d55c9db3 100644 --- a/apps/django_cas/backends.py +++ b/apps/django_cas/backends.py @@ -53,7 +53,7 @@ def _verify_cas2(ticket, service): except: import traceback traceback.print_exc() - print "****" + print "****", url print response print "****" finally: diff --git a/apps/filebrowser/media/filebrowser/uploadify/example/css/default.css b/apps/filebrowser/media/filebrowser/uploadify/example/css/default.css index ec5902d4..2173d9ec 100644 --- a/apps/filebrowser/media/filebrowser/uploadify/example/css/default.css +++ b/apps/filebrowser/media/filebrowser/uploadify/example/css/default.css @@ -1,10 +1,10 @@ -body { - font: 12px/16px Arial, Helvetica, sans-serif; -} -#fileQueue { - width: 400px; - height: 300px; - overflow: auto; - border: 1px solid #E5E5E5; - margin-bottom: 10px; +body { + font: 12px/16px Arial, Helvetica, sans-serif; +} +#fileQueue { + width: 400px; + height: 300px; + overflow: auto; + border: 1px solid #E5E5E5; + margin-bottom: 10px; } \ No newline at end of file diff --git a/apps/filebrowser/media/filebrowser/uploadify/example/css/uploadify.css b/apps/filebrowser/media/filebrowser/uploadify/example/css/uploadify.css index 0cf8c0ea..754de060 100644 --- a/apps/filebrowser/media/filebrowser/uploadify/example/css/uploadify.css +++ b/apps/filebrowser/media/filebrowser/uploadify/example/css/uploadify.css @@ -1,53 +1,53 @@ -/* -Uploadify v2.1.0 -Release Date: August 24, 2009 - -Copyright (c) 2009 Ronnie Garcia, Travis Nickels - -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 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. -*/ -.uploadifyQueueItem { - font: 11px Verdana, Geneva, sans-serif; - border: 2px solid #E5E5E5; - background-color: #F5F5F5; - margin-top: 5px; - padding: 10px; - width: 350px; -} -.uploadifyError { - border: 2px solid #FBCBBC !important; - background-color: #FDE5DD !important; -} -.uploadifyQueueItem .cancel { - float: right; -} -.uploadifyProgress { - background-color: #FFFFFF; - border-top: 1px solid #808080; - border-left: 1px solid #808080; - border-right: 1px solid #C5C5C5; - border-bottom: 1px solid #C5C5C5; - margin-top: 10px; - width: 100%; -} -.uploadifyProgressBar { - background-color: #0099FF; - width: 1px; - height: 3px; +/* +Uploadify v2.1.0 +Release Date: August 24, 2009 + +Copyright (c) 2009 Ronnie Garcia, Travis Nickels + +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 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. +*/ +.uploadifyQueueItem { + font: 11px Verdana, Geneva, sans-serif; + border: 2px solid #E5E5E5; + background-color: #F5F5F5; + margin-top: 5px; + padding: 10px; + width: 350px; +} +.uploadifyError { + border: 2px solid #FBCBBC !important; + background-color: #FDE5DD !important; +} +.uploadifyQueueItem .cancel { + float: right; +} +.uploadifyProgress { + background-color: #FFFFFF; + border-top: 1px solid #808080; + border-left: 1px solid #808080; + border-right: 1px solid #C5C5C5; + border-bottom: 1px solid #C5C5C5; + margin-top: 10px; + width: 100%; +} +.uploadifyProgressBar { + background-color: #0099FF; + width: 1px; + height: 3px; } \ No newline at end of file diff --git a/apps/filebrowser/media/filebrowser/uploadify/uploadify.css b/apps/filebrowser/media/filebrowser/uploadify/uploadify.css index 0cf8c0ea..754de060 100644 --- a/apps/filebrowser/media/filebrowser/uploadify/uploadify.css +++ b/apps/filebrowser/media/filebrowser/uploadify/uploadify.css @@ -1,53 +1,53 @@ -/* -Uploadify v2.1.0 -Release Date: August 24, 2009 - -Copyright (c) 2009 Ronnie Garcia, Travis Nickels - -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 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. -*/ -.uploadifyQueueItem { - font: 11px Verdana, Geneva, sans-serif; - border: 2px solid #E5E5E5; - background-color: #F5F5F5; - margin-top: 5px; - padding: 10px; - width: 350px; -} -.uploadifyError { - border: 2px solid #FBCBBC !important; - background-color: #FDE5DD !important; -} -.uploadifyQueueItem .cancel { - float: right; -} -.uploadifyProgress { - background-color: #FFFFFF; - border-top: 1px solid #808080; - border-left: 1px solid #808080; - border-right: 1px solid #C5C5C5; - border-bottom: 1px solid #C5C5C5; - margin-top: 10px; - width: 100%; -} -.uploadifyProgressBar { - background-color: #0099FF; - width: 1px; - height: 3px; +/* +Uploadify v2.1.0 +Release Date: August 24, 2009 + +Copyright (c) 2009 Ronnie Garcia, Travis Nickels + +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 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. +*/ +.uploadifyQueueItem { + font: 11px Verdana, Geneva, sans-serif; + border: 2px solid #E5E5E5; + background-color: #F5F5F5; + margin-top: 5px; + padding: 10px; + width: 350px; +} +.uploadifyError { + border: 2px solid #FBCBBC !important; + background-color: #FDE5DD !important; +} +.uploadifyQueueItem .cancel { + float: right; +} +.uploadifyProgress { + background-color: #FFFFFF; + border-top: 1px solid #808080; + border-left: 1px solid #808080; + border-right: 1px solid #C5C5C5; + border-bottom: 1px solid #C5C5C5; + margin-top: 10px; + width: 100%; +} +.uploadifyProgressBar { + background-color: #0099FF; + width: 1px; + height: 3px; } \ No newline at end of file diff --git a/apps/toolbar/__init__.py b/apps/toolbar/__init__.py index e69de29b..c53f0e73 100644 --- a/apps/toolbar/__init__.py +++ b/apps/toolbar/__init__.py @@ -0,0 +1 @@ + # pragma: no cover diff --git a/apps/toolbar/admin.py b/apps/toolbar/admin.py index 6f69fb94..283ab782 100644 --- a/apps/toolbar/admin.py +++ b/apps/toolbar/admin.py @@ -22,7 +22,7 @@ class ButtonAdmin(admin.ModelAdmin): form = ButtonAdminForm list_display = ('slug', 'label', 'tooltip', 'accesskey') list_display_links = ('slug',) - list_editable = ('label', 'tooltip',) + list_editable = ('label', 'tooltip', 'accesskey') prepopulated_fields = {'slug': ('label',)} admin.site.register(models.Button, ButtonAdmin) diff --git a/apps/toolbar/fixtures/initial_data.yaml b/apps/toolbar/fixtures/initial_data.yaml index 723732d2..c7b5af60 100644 --- a/apps/toolbar/fixtures/initial_data.yaml +++ b/apps/toolbar/fixtures/initial_data.yaml @@ -38,8 +38,8 @@ model: toolbar.buttongroup pk: 17 - fields: - group: [14, 12] accesskey: a + group: [14, 12] label: akapit link: '' params: '{"tag": "akap"}' @@ -49,8 +49,8 @@ model: toolbar.button pk: 39 - fields: - group: [14] accesskey: '' + group: [14] label: akapit cd. link: '' params: '{"tag": "akap_cd"}' @@ -60,8 +60,8 @@ model: toolbar.button pk: 40 - fields: - group: [14] accesskey: d + group: [14] label: akapit dialogowy link: '' params: '{"tag": "akap_dialog"}' @@ -71,8 +71,8 @@ model: toolbar.button pk: 41 - fields: - group: [1] accesskey: '' + group: [1] label: akt link: '' params: '{"tag": "akt"}' @@ -82,8 +82,8 @@ model: toolbar.button pk: 14 - fields: - group: [13] accesskey: '' + group: [13] label: autor link: '' params: '{"tag": "autor_utworu"}' @@ -93,24 +93,25 @@ model: toolbar.button pk: 32 - fields: - group: [2] accesskey: '' + group: [2] label: Podstawowa link: '' params: '[["fulltextregexp", {"exprs": [["\ufeff", ""], ["$[\\s]*\\d+[\\s]*^", - ""], ["-\\s*^", ""], ["\\,\\.\\.|\\.\\,\\.|\\.\\.\\,", "..."]]}], ["lineregexp", - {"exprs": [["^\\s+|\\s+$", ""], ["\\s+", " "], ["(,,)\\s+|\\s+(\")", "$1"], - ["(\\d)[\u2014-](\\d)", "$1--$2"], ["[\u2014]", "---"], ["<(/?)P([aert])", - "<$1p$2"], ["([^\\.])(\\s*)\u2193" link: '' params: '[]' @@ -653,8 +664,8 @@ model: toolbar.button pk: 76 - fields: - group: [15] accesskey: '' + group: [15] label: "tytu\u0142 dzie\u0142a" link: '' params: '{"tag": "tytul_dziela"}' @@ -664,8 +675,8 @@ model: toolbar.button pk: 92 - fields: - group: [15] accesskey: '' + group: [15] label: "tytu\u0142 dzie\u0142a typ 1" link: '' params: '{"tag": "tytul_dziela", "attrs": {"typ": "1"}}' @@ -675,8 +686,8 @@ model: toolbar.button pk: 45 - fields: - group: [27] accesskey: '' + group: [27] label: uwaga link: '' params: '{"tag": "uwaga"}' @@ -686,8 +697,8 @@ model: toolbar.button pk: 51 - fields: - group: [14, 17] accesskey: '' + group: [14, 17] label: wers akap. link: '' params: '{"tag": "wers_akap"}' @@ -697,8 +708,8 @@ model: toolbar.button pk: 83 - fields: - group: [12, 17] accesskey: '' + group: [12, 17] label: wers cd. link: '' params: '{"tag": "wers_cd"}' @@ -708,8 +719,8 @@ model: toolbar.button pk: 85 - fields: - group: [12, 17] accesskey: w + group: [12, 17] label: "wers mocno wci\u0119ty" link: '' params: '{"tag": "wers_wciety", "attrs": {"typ": ""}}' @@ -719,8 +730,8 @@ model: toolbar.button pk: 84 - fields: - group: [12, 17] accesskey: q + group: [12, 17] label: "wers wci\u0119ty" link: '' params: '{"tag": "wers_wciety", "attrs": {"typ": "1"}}' @@ -730,8 +741,8 @@ model: toolbar.button pk: 91 - fields: - group: [15] accesskey: '' + group: [15] label: www link: '' params: '{"tag": "www"}' @@ -741,8 +752,8 @@ model: toolbar.button pk: 48 - fields: - group: [15] accesskey: '' + group: [15] label: "wyr\xF3\u017Cnienie" link: '' params: '{"tag": "wyroznienie"}' @@ -752,8 +763,8 @@ model: toolbar.button pk: 44 - fields: - group: [11] accesskey: '' + group: [11] label: wywiad link: '' params: '{"tag": "wywiad"}' @@ -763,8 +774,8 @@ model: toolbar.button pk: 25 - fields: - group: [21] accesskey: '' + group: [21] label: "wywiad odpowied\u017A" link: '' params: '{"tag": "wywiad_odp"}' @@ -774,8 +785,8 @@ model: toolbar.button pk: 73 - fields: - group: [21] accesskey: '' + group: [21] label: wywiad pytanie link: '' params: '{"tag": "wywiad_pyt"}' @@ -785,21 +796,8 @@ model: toolbar.button pk: 72 - fields: - group: [2] accesskey: '' - label: "Zamie\u0144 dywiz" - link: '' - params: '{"exprs": [["(\\s)-(\\s)", "$1---$2"], ["^(\\s*)-(\\s)", "$1---$2"], - ["(\\s)-(\\s*)$", "$1---$2"], ["(\\d)[\u2014\u2013\u2010-](\\d)", "$1--$2"], - ["\u2014\u2013\u2010", "---"]]}' - scriptlet: lineregexp - slug: zamien_dywiz - tooltip: "Zamienia '\u2014' na '---', oraz '1\u20142' na '1--2'." - model: toolbar.button - pk: 2 -- fields: group: [16] - accesskey: '' label: "zast\u0119pnik wersu" link: '' params: '{"tag": "zastepnik_wersu"}' @@ -892,4 +890,3 @@ \r\n\r\n\r\n\r\n\r\n\r\n\r\npanel.fireEvent('contentChanged');"} model: toolbar.scriptlet pk: insert_stanza - diff --git a/apps/toolbar/locale/pl/LC_MESSAGES/django.mo b/apps/toolbar/locale/pl/LC_MESSAGES/django.mo new file mode 100644 index 00000000..54dabdf9 Binary files /dev/null and b/apps/toolbar/locale/pl/LC_MESSAGES/django.mo differ diff --git a/apps/toolbar/locale/pl/LC_MESSAGES/django.po b/apps/toolbar/locale/pl/LC_MESSAGES/django.po new file mode 100644 index 00000000..8c7cfb16 --- /dev/null +++ b/apps/toolbar/locale/pl/LC_MESSAGES/django.po @@ -0,0 +1,37 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2010-08-03 12:14+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: models.py:17 +msgid "button group" +msgstr "grupa przycisków" + +#: models.py:17 +msgid "button groups" +msgstr "grupy przycisków" + +#: models.py:51 +msgid "button" +msgstr "przycisk" + +#: models.py:51 +msgid "buttons" +msgstr "przyciski" + +#: models.py:75 +msgid "javascript" +msgstr "" diff --git a/apps/toolbar/migrations/__init__.py b/apps/toolbar/migrations/__init__.py index e69de29b..9012566c 100644 --- a/apps/toolbar/migrations/__init__.py +++ b/apps/toolbar/migrations/__init__.py @@ -0,0 +1 @@ +# pragma: no cover diff --git a/apps/toolbar/templates/toolbar/button.html b/apps/toolbar/templates/toolbar/button.html index a43cb936..cdffcaf1 100644 --- a/apps/toolbar/templates/toolbar/button.html +++ b/apps/toolbar/templates/toolbar/button.html @@ -1,5 +1,5 @@ {% if button.link %} - + {% endif %} +
{% for group in toolbar_groups %} -
+
    {# buttons for this group #} {% for button in group.button_set.all %} - {% toolbar_button button %} +
  • {% toolbar_button button %}
  • {% endfor %} -
+ {% endfor %}
-
+ diff --git a/apps/wiki/__init__.py b/apps/wiki/__init__.py index e69de29b..c53f0e73 100644 --- a/apps/wiki/__init__.py +++ b/apps/wiki/__init__.py @@ -0,0 +1 @@ + # pragma: no cover diff --git a/apps/wiki/admin.py b/apps/wiki/admin.py new file mode 100644 index 00000000..1a61b660 --- /dev/null +++ b/apps/wiki/admin.py @@ -0,0 +1,5 @@ +from django.contrib import admin + +from wiki import models + +admin.site.register(models.Theme) diff --git a/apps/wiki/constants.py b/apps/wiki/constants.py index 472bbb60..de6d0e2d 100644 --- a/apps/wiki/constants.py +++ b/apps/wiki/constants.py @@ -1,24 +1,20 @@ # -*- coding: utf-8 -*- from django.utils.translation import ugettext_lazy as _ -DOCUMENT_TAGS = ( - ("source", _(u"Tekst źródłowy")), - ("first_correction", _(u"Po autokorekcie")), - ("tagged", _(u"Tekst otagowany")), - ("second_correction", _(u"Po korekcie")), - ("source_annotations", _(u"Sprawdzone przypisy źródła")), - ("language_updates", _(u"Uwspółcześnienia")), - ("ready_to_publish", _(u"Tekst do publikacji")), -) - -DOCUMENT_TAGS_DICT = dict(DOCUMENT_TAGS) - DOCUMENT_STAGES = ( - ("first_correction", _(u"Autokorekta")), - ("tagged", _(u"Tagowanie")), - ("second_correction", _(u"Korekta")), - ("source_annotations", _(u"Przypisy źródła")), - ("language_updates", _(u"Uwspółcześnienia")), + ("", u"-----"), + ("first_correction", _(u"First correction")), + ("tagging", _(u"Tagging")), + ("proofreading", _(u"Initial Proofreading")), + ("annotation-proofreading", _(u"Annotation Proofreading")), + ("modernisation", _(u"Modernisation")), + ("themes", _(u"Themes")), + ("editor-proofreading", _(u"Editor's Proofreading")), + ("technical-editor-proofreading", _(u"Technical Editor's Proofreading")), ) +DOCUMENT_TAGS = DOCUMENT_STAGES + \ + (("ready-to-publish", _(u"Ready to publish")),) + +DOCUMENT_TAGS_DICT = dict(DOCUMENT_TAGS) DOCUMENT_STAGES_DICT = dict(DOCUMENT_STAGES) diff --git a/apps/wiki/fixtures/initial_themes.yaml b/apps/wiki/fixtures/initial_themes.yaml new file mode 100644 index 00000000..fc0b773a --- /dev/null +++ b/apps/wiki/fixtures/initial_themes.yaml @@ -0,0 +1,1246 @@ +- fields: {name: Alkohol} + model: wiki.theme + pk: 1 +- fields: {name: Ambicja} + model: wiki.theme + pk: 2 +- fields: {name: "Anio\u0142"} + model: wiki.theme + pk: 3 +- fields: {name: Antysemityzm} + model: wiki.theme + pk: 4 +- fields: {name: Arkadia} + model: wiki.theme + pk: 5 +- fields: {name: Artysta} + model: wiki.theme + pk: 6 +- fields: {name: "Bezdomno\u015B\u0107"} + model: wiki.theme + pk: 7 +- fields: {name: "Bezpiecze\u0144stwo"} + model: wiki.theme + pk: 8 +- fields: {name: Bieda} + model: wiki.theme + pk: 9 +- fields: {name: Bijatyka} + model: wiki.theme + pk: 10 +- fields: {name: Bogactwo} + model: wiki.theme + pk: 14 +- fields: {name: Brat} + model: wiki.theme + pk: 16 +- fields: {name: Bunt} + model: wiki.theme + pk: 17 +- fields: {name: Buntownik} + model: wiki.theme + pk: 18 +- fields: {name: Burza} + model: wiki.theme + pk: 19 +- fields: {name: "B\xF3g"} + model: wiki.theme + pk: 15 +- fields: {name: "B\u0142azen"} + model: wiki.theme + pk: 11 +- fields: {name: "B\u0142oto"} + model: wiki.theme + pk: 13 +- fields: {name: "B\u0142\u0105dzenie"} + model: wiki.theme + pk: 12 +- fields: {name: Car} + model: wiki.theme + pk: 20 +- fields: {name: Carpe diem} + model: wiki.theme + pk: 21 +- fields: {name: "Chciwo\u015B\u0107"} + model: wiki.theme + pk: 25 +- fields: {name: Chleb} + model: wiki.theme + pk: 26 +- fields: {name: Choroba} + model: wiki.theme + pk: 28 +- fields: {name: Chrystus} + model: wiki.theme + pk: 29 +- fields: {name: Chrzest} + model: wiki.theme + pk: 30 +- fields: {name: "Ch\u0142op"} + model: wiki.theme + pk: 27 +- fields: {name: "Cia\u0142o"} + model: wiki.theme + pk: 31 +- fields: {name: "Ciemno\u015B\u0107"} + model: wiki.theme + pk: 22 +- fields: {name: Cierpienie} + model: wiki.theme + pk: 32 +- fields: {name: "Cie\u0144"} + model: wiki.theme + pk: 23 +- fields: {name: Cisza} + model: wiki.theme + pk: 24 +- fields: {name: Cmentarz} + model: wiki.theme + pk: 33 +- fields: {name: Cnota} + model: wiki.theme + pk: 34 +- fields: {name: Cud} + model: wiki.theme + pk: 36 +- fields: {name: Czarownica} + model: wiki.theme + pk: 37 +- fields: {name: Czary} + model: wiki.theme + pk: 38 +- fields: {name: Czas} + model: wiki.theme + pk: 39 +- fields: {name: Czyn} + model: wiki.theme + pk: 40 +- fields: {name: "Czy\u015Bciec"} + model: wiki.theme + pk: 41 +- fields: {name: "C\xF3rka"} + model: wiki.theme + pk: 35 +- fields: {name: Dama} + model: wiki.theme + pk: 42 +- fields: {name: Danse macabre} + model: wiki.theme + pk: 43 +- fields: {name: Deszcz} + model: wiki.theme + pk: 44 +- fields: {name: "Diabe\u0142"} + model: wiki.theme + pk: 45 +- fields: {name: Dobro} + model: wiki.theme + pk: 46 +- fields: {name: Dom} + model: wiki.theme + pk: 47 +- fields: {name: "Doros\u0142o\u015B\u0107"} + model: wiki.theme + pk: 48 +- fields: {name: Drzewo} + model: wiki.theme + pk: 49 +- fields: {name: Duch} + model: wiki.theme + pk: 50 +- fields: {name: Duma} + model: wiki.theme + pk: 52 +- fields: {name: Dusza} + model: wiki.theme + pk: 51 +- fields: {name: Dworek} + model: wiki.theme + pk: 53 +- fields: {name: Dworzanin} + model: wiki.theme + pk: 54 +- fields: {name: "Dw\xF3r"} + model: wiki.theme + pk: 55 +- fields: {name: "Dzieci\u0144stwo"} + model: wiki.theme + pk: 56 +- fields: {name: Dziecko} + model: wiki.theme + pk: 57 +- fields: {name: Dziedzictwo} + model: wiki.theme + pk: 58 +- fields: {name: Dziewictwo} + model: wiki.theme + pk: 59 +- fields: {name: "D\u017Awi\u0119k"} + model: wiki.theme + pk: 60 +- fields: {name: Egzorcyzm} + model: wiki.theme + pk: 61 +- fields: {name: Elita} + model: wiki.theme + pk: 62 +- fields: {name: Emigrant} + model: wiki.theme + pk: 63 +- fields: {name: "Fa\u0142sz"} + model: wiki.theme + pk: 64 +- fields: {name: Filozof} + model: wiki.theme + pk: 65 +- fields: {name: Fircyk} + model: wiki.theme + pk: 66 +- fields: {name: Flirt} + model: wiki.theme + pk: 67 +- fields: {name: Gospodarz} + model: wiki.theme + pk: 71 +- fields: {name: Gospodyni} + model: wiki.theme + pk: 72 +- fields: {name: Gotycyzm} + model: wiki.theme + pk: 74 +- fields: {name: "Go\u015B\u0107"} + model: wiki.theme + pk: 73 +- fields: {name: Gra} + model: wiki.theme + pk: 76 +- fields: {name: Grzech} + model: wiki.theme + pk: 78 +- fields: {name: "Grzeczno\u015B\u0107"} + model: wiki.theme + pk: 79 +- fields: {name: "Gr\xF3b"} + model: wiki.theme + pk: 77 +- fields: {name: Gwiazda} + model: wiki.theme + pk: 80 +- fields: {name: "G\xF3ra"} + model: wiki.theme + pk: 75 +- fields: {name: "G\u0142upiec"} + model: wiki.theme + pk: 68 +- fields: {name: "G\u0142upota"} + model: wiki.theme + pk: 69 +- fields: {name: "G\u0142\xF3d"} + model: wiki.theme + pk: 70 +- fields: {name: Handel} + model: wiki.theme + pk: 81 +- fields: {name: "Ha\u0144ba"} + model: wiki.theme + pk: 82 +- fields: {name: Historia} + model: wiki.theme + pk: 83 +- fields: {name: Honor} + model: wiki.theme + pk: 84 +- fields: {name: Idealista} + model: wiki.theme + pk: 85 +- fields: {name: "Imi\u0119"} + model: wiki.theme + pk: 86 +- fields: {name: Interes} + model: wiki.theme + pk: 87 +- fields: {name: "Jab\u0142ka"} + model: wiki.theme + pk: 88 +- fields: {name: Jedzenie} + model: wiki.theme + pk: 89 +- fields: {name: "Jesie\u0144"} + model: wiki.theme + pk: 90 +- fields: {name: Kaleka} + model: wiki.theme + pk: 91 +- fields: {name: Kara} + model: wiki.theme + pk: 92 +- fields: {name: Karczma} + model: wiki.theme + pk: 93 +- fields: {name: "Kl\u0119ska"} + model: wiki.theme + pk: 94 +- fields: {name: Kobieta} + model: wiki.theme + pk: 97 +- fields: {name: "Kobieta \"upad\u0142a\""} + model: wiki.theme + pk: 99 +- fields: {name: Kobieta demoniczna} + model: wiki.theme + pk: 98 +- fields: {name: Kochanek} + model: wiki.theme + pk: 100 +- fields: {name: Kochanek romantyczny} + model: wiki.theme + pk: 101 +- fields: {name: Kolonializm} + model: wiki.theme + pk: 102 +- fields: {name: Kondycja ludzka} + model: wiki.theme + pk: 103 +- fields: {name: Konflikt} + model: wiki.theme + pk: 104 +- fields: {name: "Konflikt wewn\u0119trzny"} + model: wiki.theme + pk: 105 +- fields: {name: "Koniec \u015Bwiata"} + model: wiki.theme + pk: 106 +- fields: {name: "Korzy\u015B\u0107"} + model: wiki.theme + pk: 108 +- fields: {name: Kot} + model: wiki.theme + pk: 109 +- fields: {name: "Ko\u0144"} + model: wiki.theme + pk: 107 +- fields: {name: "Kradzie\u017C"} + model: wiki.theme + pk: 110 +- fields: {name: Krew} + model: wiki.theme + pk: 111 +- fields: {name: Krzywda} + model: wiki.theme + pk: 113 +- fields: {name: "Kr\xF3l"} + model: wiki.theme + pk: 112 +- fields: {name: "Ksi\u0105dz"} + model: wiki.theme + pk: 114 +- fields: {name: "Ksi\u0105\u017Cka"} + model: wiki.theme + pk: 115 +- fields: {name: "Ksi\u0119\u017Cyc"} + model: wiki.theme + pk: 116 +- fields: {name: Kuchnia} + model: wiki.theme + pk: 117 +- fields: {name: Kuszenie} + model: wiki.theme + pk: 118 +- fields: {name: Kwiaty} + model: wiki.theme + pk: 119 +- fields: {name: "K\u0142amstwo"} + model: wiki.theme + pk: 95 +- fields: {name: "K\u0142\xF3tnia"} + model: wiki.theme + pk: 96 +- fields: {name: Labirynt} + model: wiki.theme + pk: 120 +- fields: {name: Las} + model: wiki.theme + pk: 121 +- fields: {name: Lato} + model: wiki.theme + pk: 122 +- fields: {name: Lekarz} + model: wiki.theme + pk: 123 +- fields: {name: Lenistwo} + model: wiki.theme + pk: 124 +- fields: {name: Liberat} + model: wiki.theme + pk: 126 +- fields: {name: List} + model: wiki.theme + pk: 125 +- fields: {name: Los} + model: wiki.theme + pk: 127 +- fields: {name: Lud} + model: wiki.theme + pk: 128 +- fields: {name: Lustro} + model: wiki.theme + pk: 129 +- fields: {name: Marzenie} + model: wiki.theme + pk: 132 +- fields: {name: Maska} + model: wiki.theme + pk: 133 +- fields: {name: Maszyna} + model: wiki.theme + pk: 134 +- fields: {name: Matka} + model: wiki.theme + pk: 135 +- fields: {name: Matka Boska} + model: wiki.theme + pk: 136 +- fields: {name: "Ma\u0142\u017Ce\u0144stwo"} + model: wiki.theme + pk: 131 +- fields: {name: Melancholia} + model: wiki.theme + pk: 139 +- fields: {name: Miasto} + model: wiki.theme + pk: 142 +- fields: {name: Mieszczanin} + model: wiki.theme + pk: 143 +- fields: {name: Mizoginia} + model: wiki.theme + pk: 152 +- fields: {name: "Mi\u0142osierdzie"} + model: wiki.theme + pk: 144 +- fields: {name: "Mi\u0142o\u015B\u0107"} + model: wiki.theme + pk: 145 +- fields: {name: "Mi\u0142o\u015B\u0107 niespe\u0142niona"} + model: wiki.theme + pk: 146 +- fields: {name: "Mi\u0142o\u015B\u0107 platoniczna"} + model: wiki.theme + pk: 147 +- fields: {name: "Mi\u0142o\u015B\u0107 romantyczna"} + model: wiki.theme + pk: 148 +- fields: {name: "Mi\u0142o\u015B\u0107 silniejsza ni\u017C \u015Bmier\u0107"} + model: wiki.theme + pk: 149 +- fields: {name: "Mi\u0142o\u015B\u0107 spe\u0142niona"} + model: wiki.theme + pk: 150 +- fields: {name: "Mi\u0142o\u015B\u0107 tragiczna"} + model: wiki.theme + pk: 151 +- fields: {name: Moda} + model: wiki.theme + pk: 154 +- fields: {name: Modlitwa} + model: wiki.theme + pk: 155 +- fields: {name: Morderstwo} + model: wiki.theme + pk: 156 +- fields: {name: Morze} + model: wiki.theme + pk: 157 +- fields: {name: Motyl} + model: wiki.theme + pk: 158 +- fields: {name: Mucha} + model: wiki.theme + pk: 159 +- fields: {name: Muzyka} + model: wiki.theme + pk: 160 +- fields: {name: "M\u0105dro\u015B\u0107"} + model: wiki.theme + pk: 137 +- fields: {name: "M\u0105\u017C"} + model: wiki.theme + pk: 138 +- fields: {name: "M\u0119drzec"} + model: wiki.theme + pk: 140 +- fields: {name: "M\u0119\u017Cczyzna"} + model: wiki.theme + pk: 141 +- fields: {name: "M\u0142odo\u015B\u0107"} + model: wiki.theme + pk: 153 +- fields: {name: Narodziny} + model: wiki.theme + pk: 161 +- fields: {name: "Nar\xF3d"} + model: wiki.theme + pk: 162 +- fields: {name: Natura} + model: wiki.theme + pk: 163 +- fields: {name: Nauczyciel} + model: wiki.theme + pk: 164 +- fields: {name: Nauczycielka} + model: wiki.theme + pk: 165 +- fields: {name: Nauka} + model: wiki.theme + pk: 166 +- fields: {name: "Niebezpiecze\u0144stwo"} + model: wiki.theme + pk: 167 +- fields: {name: Niedziela} + model: wiki.theme + pk: 168 +- fields: {name: Niemiec} + model: wiki.theme + pk: 169 +- fields: {name: "Nienawi\u015B\u0107"} + model: wiki.theme + pk: 170 +- fields: {name: Niewola} + model: wiki.theme + pk: 172 +- fields: {name: "Nie\u015Bmiertelno\u015B\u0107"} + model: wiki.theme + pk: 171 +- fields: {name: Noc} + model: wiki.theme + pk: 173 +- fields: {name: Nuda} + model: wiki.theme + pk: 174 +- fields: {name: Obcy} + model: wiki.theme + pk: 175 +- fields: {name: "Obowi\u0105zek"} + model: wiki.theme + pk: 177 +- fields: {name: "Obraz \u015Bwiata"} + model: wiki.theme + pk: 178 +- fields: {name: "Obrz\u0119dy"} + model: wiki.theme + pk: 179 +- fields: {name: Obyczaje} + model: wiki.theme + pk: 180 +- fields: {name: Obywatel} + model: wiki.theme + pk: 181 +- fields: {name: "Ob\u0142ok"} + model: wiki.theme + pk: 176 +- fields: {name: "Odrodzenie przez gr\xF3b"} + model: wiki.theme + pk: 182 +- fields: {name: Odwaga} + model: wiki.theme + pk: 183 +- fields: {name: Ofiara} + model: wiki.theme + pk: 184 +- fields: {name: "Ogie\u0144"} + model: wiki.theme + pk: 185 +- fields: {name: "Ogr\xF3d"} + model: wiki.theme + pk: 186 +- fields: {name: Ojciec} + model: wiki.theme + pk: 187 +- fields: {name: Ojczyzna} + model: wiki.theme + pk: 188 +- fields: {name: Oko} + model: wiki.theme + pk: 189 +- fields: {name: "Okrucie\u0144stwo"} + model: wiki.theme + pk: 191 +- fields: {name: "Okr\u0119t"} + model: wiki.theme + pk: 190 +- fields: {name: Omen} + model: wiki.theme + pk: 192 +- fields: {name: Opieka} + model: wiki.theme + pk: 193 +- fields: {name: Organizm} + model: wiki.theme + pk: 194 +- fields: {name: "Otch\u0142a\u0144"} + model: wiki.theme + pk: 195 +- fields: {name: "O\u015Bwiadczyny"} + model: wiki.theme + pk: 415 +- fields: {name: "Paj\u0105k"} + model: wiki.theme + pk: 196 +- fields: {name: "Pami\u0119\u0107"} + model: wiki.theme + pk: 197 +- fields: {name: Pan} + model: wiki.theme + pk: 198 +- fields: {name: "Panna m\u0142oda"} + model: wiki.theme + pk: 199 +- fields: {name: Patriota} + model: wiki.theme + pk: 201 +- fields: {name: "Pa\u0144stwo"} + model: wiki.theme + pk: 200 +- fields: {name: "Piek\u0142o"} + model: wiki.theme + pk: 202 +- fields: {name: Pielgrzym} + model: wiki.theme + pk: 203 +- fields: {name: "Pieni\u0105dz"} + model: wiki.theme + pk: 204 +- fields: {name: Pies} + model: wiki.theme + pk: 205 +- fields: {name: "Pija\u0144stwo"} + model: wiki.theme + pk: 207 +- fields: {name: Piwnica} + model: wiki.theme + pk: 208 +- fields: {name: "Pi\u0119tno"} + model: wiki.theme + pk: 206 +- fields: {name: Plotka} + model: wiki.theme + pk: 209 +- fields: {name: "Pobo\u017Cno\u015B\u0107"} + model: wiki.theme + pk: 210 +- fields: {name: "Poca\u0142unek"} + model: wiki.theme + pk: 211 +- fields: {name: Pochlebstwo} + model: wiki.theme + pk: 212 +- fields: {name: "Podr\xF3\u017C"} + model: wiki.theme + pk: 216 +- fields: {name: "Podst\u0119p"} + model: wiki.theme + pk: 217 +- fields: {name: Poeta} + model: wiki.theme + pk: 213 +- fields: {name: Poetka} + model: wiki.theme + pk: 214 +- fields: {name: Poezja} + model: wiki.theme + pk: 215 +- fields: {name: Pogrzeb} + model: wiki.theme + pk: 218 +- fields: {name: Pojedynek} + model: wiki.theme + pk: 219 +- fields: {name: Pokora} + model: wiki.theme + pk: 220 +- fields: {name: Pokusa} + model: wiki.theme + pk: 221 +- fields: {name: Polak} + model: wiki.theme + pk: 222 +- fields: {name: Polityka} + model: wiki.theme + pk: 223 +- fields: {name: Polowanie} + model: wiki.theme + pk: 224 +- fields: {name: Polska} + model: wiki.theme + pk: 225 +- fields: {name: Portret} + model: wiki.theme + pk: 226 +- fields: {name: Porwanie} + model: wiki.theme + pk: 227 +- fields: {name: "Potw\xF3r"} + model: wiki.theme + pk: 229 +- fields: {name: Powstanie} + model: wiki.theme + pk: 230 +- fields: {name: Powstaniec} + model: wiki.theme + pk: 231 +- fields: {name: Pozory} + model: wiki.theme + pk: 232 +- fields: {name: "Pozycja spo\u0142eczna"} + model: wiki.theme + pk: 233 +- fields: {name: "Po\u015Bwi\u0119cenie"} + model: wiki.theme + pk: 228 +- fields: {name: "Po\u017Car"} + model: wiki.theme + pk: 234 +- fields: {name: "Po\u017C\u0105danie"} + model: wiki.theme + pk: 235 +- fields: {name: Praca} + model: wiki.theme + pk: 236 +- fields: {name: Praca organiczna} + model: wiki.theme + pk: 238 +- fields: {name: Praca u podstaw} + model: wiki.theme + pk: 237 +- fields: {name: Prawda} + model: wiki.theme + pk: 239 +- fields: {name: Prawnik} + model: wiki.theme + pk: 240 +- fields: {name: Prometeusz} + model: wiki.theme + pk: 241 +- fields: {name: Proroctwo} + model: wiki.theme + pk: 242 +- fields: {name: Prorok} + model: wiki.theme + pk: 243 +- fields: {name: Przebranie} + model: wiki.theme + pk: 245 +- fields: {name: Przeczucie} + model: wiki.theme + pk: 246 +- fields: {name: "Przedmurze chrze\u015Bcija\u0144stwa"} + model: wiki.theme + pk: 247 +- fields: {name: "Przekle\u0144stwo"} + model: wiki.theme + pk: 248 +- fields: {name: Przekupstwo} + model: wiki.theme + pk: 249 +- fields: {name: Przemiana} + model: wiki.theme + pk: 250 +- fields: {name: Przemijanie} + model: wiki.theme + pk: 251 +- fields: {name: Przemoc} + model: wiki.theme + pk: 252 +- fields: {name: "Przestrze\u0144"} + model: wiki.theme + pk: 253 +- fields: {name: "Przyja\u017A\u0144"} + model: wiki.theme + pk: 254 +- fields: {name: "Przyroda nieo\u017Cywiona"} + model: wiki.theme + pk: 255 +- fields: {name: "Przysi\u0119ga"} + model: wiki.theme + pk: 256 +- fields: {name: "Przyw\xF3dca"} + model: wiki.theme + pk: 257 +- fields: {name: "Pr\xF3\u017Cno\u015B\u0107"} + model: wiki.theme + pk: 244 +- fields: {name: Ptak} + model: wiki.theme + pk: 258 +- fields: {name: Pustynia} + model: wiki.theme + pk: 259 +- fields: {name: Pycha} + model: wiki.theme + pk: 260 +- fields: {name: Raj} + model: wiki.theme + pk: 261 +- fields: {name: Realista} + model: wiki.theme + pk: 262 +- fields: {name: Religia} + model: wiki.theme + pk: 263 +- fields: {name: Rewolucja} + model: wiki.theme + pk: 264 +- fields: {name: Robak} + model: wiki.theme + pk: 265 +- fields: {name: Robotnik} + model: wiki.theme + pk: 266 +- fields: {name: Rodzina} + model: wiki.theme + pk: 267 +- fields: {name: Rosja} + model: wiki.theme + pk: 268 +- fields: {name: Rosjanin} + model: wiki.theme + pk: 269 +- fields: {name: Rozczarowanie} + model: wiki.theme + pk: 271 +- fields: {name: Rozpacz} + model: wiki.theme + pk: 272 +- fields: {name: Rozstanie} + model: wiki.theme + pk: 273 +- fields: {name: Rozum} + model: wiki.theme + pk: 274 +- fields: {name: "Ro\u015Bliny"} + model: wiki.theme + pk: 270 +- fields: {name: Ruiny} + model: wiki.theme + pk: 275 +- fields: {name: Rycerz} + model: wiki.theme + pk: 276 +- fields: {name: Rzeka} + model: wiki.theme + pk: 277 +- fields: {name: Salon} + model: wiki.theme + pk: 278 +- fields: {name: "Samob\xF3jstwo"} + model: wiki.theme + pk: 279 +- fields: {name: Samolubstwo} + model: wiki.theme + pk: 280 +- fields: {name: Samotnik} + model: wiki.theme + pk: 281 +- fields: {name: "Samotno\u015B\u0107"} + model: wiki.theme + pk: 282 +- fields: {name: Sarmata} + model: wiki.theme + pk: 283 +- fields: {name: Sen} + model: wiki.theme + pk: 287 +- fields: {name: Serce} + model: wiki.theme + pk: 288 +- fields: {name: Sielanka} + model: wiki.theme + pk: 290 +- fields: {name: Sierota} + model: wiki.theme + pk: 291 +- fields: {name: Siostra} + model: wiki.theme + pk: 293 +- fields: {name: "Si\u0142a"} + model: wiki.theme + pk: 292 +- fields: {name: "Sk\u0105piec"} + model: wiki.theme + pk: 299 +- fields: {name: "Sobowt\xF3r"} + model: wiki.theme + pk: 300 +- fields: {name: "Spowied\u017A"} + model: wiki.theme + pk: 302 +- fields: {name: "Spo\u0142ecznik"} + model: wiki.theme + pk: 301 +- fields: {name: "Sprawiedliwo\u015B\u0107"} + model: wiki.theme + pk: 303 +- fields: {name: "Staro\u015B\u0107"} + model: wiki.theme + pk: 304 +- fields: {name: Strach} + model: wiki.theme + pk: 305 +- fields: {name: "Str\xF3j"} + model: wiki.theme + pk: 306 +- fields: {name: Stworzenie} + model: wiki.theme + pk: 307 +- fields: {name: Sumienie} + model: wiki.theme + pk: 308 +- fields: {name: Swaty} + model: wiki.theme + pk: 309 +- fields: {name: Syberia} + model: wiki.theme + pk: 310 +- fields: {name: Syn} + model: wiki.theme + pk: 311 +- fields: {name: Syn marnotrawny} + model: wiki.theme + pk: 312 +- fields: {name: Syzyf} + model: wiki.theme + pk: 313 +- fields: {name: Szaleniec} + model: wiki.theme + pk: 314 +- fields: {name: "Szale\u0144stwo"} + model: wiki.theme + pk: 315 +- fields: {name: "Szanta\u017C"} + model: wiki.theme + pk: 316 +- fields: {name: Szatan} + model: wiki.theme + pk: 317 +- fields: {name: "Szcz\u0119\u015Bcie"} + model: wiki.theme + pk: 318 +- fields: {name: "Szko\u0142a"} + model: wiki.theme + pk: 319 +- fields: {name: Szlachcic} + model: wiki.theme + pk: 320 +- fields: {name: Szpieg} + model: wiki.theme + pk: 321 +- fields: {name: Sztuka} + model: wiki.theme + pk: 322 +- fields: {name: "S\u0105d"} + model: wiki.theme + pk: 285 +- fields: {name: "S\u0105d Ostateczny"} + model: wiki.theme + pk: 286 +- fields: {name: "S\u0105siad"} + model: wiki.theme + pk: 284 +- fields: {name: "S\u0119dzia"} + model: wiki.theme + pk: 289 +- fields: {name: "S\u0142awa"} + model: wiki.theme + pk: 294 +- fields: {name: "S\u0142owo"} + model: wiki.theme + pk: 296 +- fields: {name: "S\u0142o\u0144ce"} + model: wiki.theme + pk: 295 +- fields: {name: "S\u0142uga"} + model: wiki.theme + pk: 297 +- fields: {name: "S\u0142u\u017Calczo\u015B\u0107"} + model: wiki.theme + pk: 298 +- fields: {name: Tajemnica} + model: wiki.theme + pk: 332 +- fields: {name: Taniec} + model: wiki.theme + pk: 333 +- fields: {name: "Tch\xF3rzostwo"} + model: wiki.theme + pk: 334 +- fields: {name: Teatr} + model: wiki.theme + pk: 335 +- fields: {name: Testament} + model: wiki.theme + pk: 336 +- fields: {name: Theatrum mundi} + model: wiki.theme + pk: 338 +- fields: {name: Trucizna} + model: wiki.theme + pk: 340 +- fields: {name: Trup} + model: wiki.theme + pk: 341 +- fields: {name: "Tw\xF3rczo\u015B\u0107"} + model: wiki.theme + pk: 342 +- fields: {name: "T\u0119sknota"} + model: wiki.theme + pk: 337 +- fields: {name: "T\u0142um"} + model: wiki.theme + pk: 339 +- fields: {name: "Ucze\u0144"} + model: wiki.theme + pk: 343 +- fields: {name: Uczta} + model: wiki.theme + pk: 344 +- fields: {name: Umiarkowanie} + model: wiki.theme + pk: 346 +- fields: {name: Upadek} + model: wiki.theme + pk: 347 +- fields: {name: "Upi\xF3r"} + model: wiki.theme + pk: 348 +- fields: {name: Uroda} + model: wiki.theme + pk: 345 +- fields: {name: "Urz\u0119dnik"} + model: wiki.theme + pk: 349 +- fields: {name: Vanitas} + model: wiki.theme + pk: 350 +- fields: {name: Walka} + model: wiki.theme + pk: 351 +- fields: {name: Walka klas} + model: wiki.theme + pk: 352 +- fields: {name: Wampir} + model: wiki.theme + pk: 353 +- fields: {name: Warszawa} + model: wiki.theme + pk: 354 +- fields: {name: Wdowa} + model: wiki.theme + pk: 356 +- fields: {name: Wdowiec} + model: wiki.theme + pk: 357 +- fields: {name: Wesele} + model: wiki.theme + pk: 358 +- fields: {name: Wiatr} + model: wiki.theme + pk: 359 +- fields: {name: Wiedza} + model: wiki.theme + pk: 363 +- fields: {name: "Wierno\u015B\u0107"} + model: wiki.theme + pk: 360 +- fields: {name: Wierzenia} + model: wiki.theme + pk: 361 +- fields: {name: "Wie\u015B"} + model: wiki.theme + pk: 362 +- fields: {name: "Wie\u017Ca Babel"} + model: wiki.theme + pk: 364 +- fields: {name: Wina} + model: wiki.theme + pk: 367 +- fields: {name: Wino} + model: wiki.theme + pk: 368 +- fields: {name: Wiosna} + model: wiki.theme + pk: 369 +- fields: {name: Wizja} + model: wiki.theme + pk: 370 +- fields: {name: "Wi\u0119zienie"} + model: wiki.theme + pk: 365 +- fields: {name: "Wi\u0119zie\u0144"} + model: wiki.theme + pk: 366 +- fields: {name: Woda} + model: wiki.theme + pk: 373 +- fields: {name: Wojna} + model: wiki.theme + pk: 374 +- fields: {name: "Wojna pokole\u0144"} + model: wiki.theme + pk: 375 +- fields: {name: "Wolno\u015B\u0107"} + model: wiki.theme + pk: 376 +- fields: {name: "Wr\xF3g"} + model: wiki.theme + pk: 377 +- fields: {name: Wspomnienia} + model: wiki.theme + pk: 378 +- fields: {name: "Wsp\xF3\u0142praca"} + model: wiki.theme + pk: 379 +- fields: {name: Wygnanie} + model: wiki.theme + pk: 380 +- fields: {name: Wyrzuty sumienia} + model: wiki.theme + pk: 381 +- fields: {name: Wyspa} + model: wiki.theme + pk: 382 +- fields: {name: Wzrok} + model: wiki.theme + pk: 383 +- fields: {name: "W\u0105\u017C"} + model: wiki.theme + pk: 355 +- fields: {name: "W\u0142adza"} + model: wiki.theme + pk: 371 +- fields: {name: "W\u0142asno\u015B\u0107"} + model: wiki.theme + pk: 372 +- fields: {name: Zabawa} + model: wiki.theme + pk: 384 +- fields: {name: Zabobony} + model: wiki.theme + pk: 385 +- fields: {name: Zamek} + model: wiki.theme + pk: 386 +- fields: {name: "Zar\u0119czyny"} + model: wiki.theme + pk: 387 +- fields: {name: "Zazdro\u015B\u0107"} + model: wiki.theme + pk: 389 +- fields: {name: "Za\u015Bwiaty"} + model: wiki.theme + pk: 388 +- fields: {name: Zbawienie} + model: wiki.theme + pk: 390 +- fields: {name: Zbrodnia} + model: wiki.theme + pk: 391 +- fields: {name: Zbrodniarz} + model: wiki.theme + pk: 392 +- fields: {name: Zdrada} + model: wiki.theme + pk: 393 +- fields: {name: Zdrowie} + model: wiki.theme + pk: 394 +- fields: {name: Zemsta} + model: wiki.theme + pk: 395 +- fields: {name: "Zes\u0142aniec"} + model: wiki.theme + pk: 396 +- fields: {name: Ziarno} + model: wiki.theme + pk: 397 +- fields: {name: Ziemia} + model: wiki.theme + pk: 398 +- fields: {name: Zima} + model: wiki.theme + pk: 399 +- fields: {name: Zmartwychwstanie} + model: wiki.theme + pk: 403 +- fields: {name: "Zwierz\u0119ta"} + model: wiki.theme + pk: 405 +- fields: {name: "Zwyci\u0119stwo"} + model: wiki.theme + pk: 406 +- fields: {name: "Zw\u0105tpienie"} + model: wiki.theme + pk: 404 +- fields: {name: "Z\u0142o"} + model: wiki.theme + pk: 400 +- fields: {name: "Z\u0142odziej"} + model: wiki.theme + pk: 401 +- fields: {name: "Z\u0142oty wiek"} + model: wiki.theme + pk: 402 +- fields: {name: "\u0141zy"} + model: wiki.theme + pk: 130 +- fields: {name: "\u015Alub"} + model: wiki.theme + pk: 323 +- fields: {name: "\u015Amiech"} + model: wiki.theme + pk: 324 +- fields: {name: "\u015Amier\u0107"} + model: wiki.theme + pk: 325 +- fields: {name: "\u015Amier\u0107 bohaterska"} + model: wiki.theme + pk: 326 +- fields: {name: "\u015Apiew"} + model: wiki.theme + pk: 327 +- fields: {name: "\u015Awiat\u0142o"} + model: wiki.theme + pk: 328 +- fields: {name: "\u015Awit"} + model: wiki.theme + pk: 331 +- fields: {name: "\u015Awi\u0119toszek"} + model: wiki.theme + pk: 329 +- fields: {name: "\u015Awi\u0119ty"} + model: wiki.theme + pk: 330 +- fields: {name: "\u017Ba\u0142oba"} + model: wiki.theme + pk: 407 +- fields: {name: "\u017Bebrak"} + model: wiki.theme + pk: 408 +- fields: {name: "\u017Bona"} + model: wiki.theme + pk: 410 +- fields: {name: "\u017Bo\u0142nierz"} + model: wiki.theme + pk: 409 +- fields: {name: "\u017Bycie jako w\u0119dr\xF3wka"} + model: wiki.theme + pk: 411 +- fields: {name: "\u017Bycie snem"} + model: wiki.theme + pk: 412 +- fields: {name: "\u017Byd"} + model: wiki.theme + pk: 413 +- fields: {name: "\u017Bywio\u0142y"} + model: wiki.theme + pk: 414 + diff --git a/apps/wiki/forms.py b/apps/wiki/forms.py index f6e6f40e..e0c69fdd 100644 --- a/apps/wiki/forms.py +++ b/apps/wiki/forms.py @@ -57,22 +57,28 @@ class DocumentTextSaveForm(forms.Form): parent_revision = forms.IntegerField(widget=forms.HiddenInput) text = forms.CharField(widget=forms.HiddenInput) - author = forms.CharField( + author_name = forms.CharField( required=False, - label=_(u"Autor"), - help_text=_(u"Twoje imie i nazwisko lub email."), + label=_(u"Author"), + help_text=_(u"Your name/"), + ) + + author_email = forms.EmailField( + required=False, + label=_(u"Author's email"), + help_text=_(u"Your email address, so we can show a gravatar :)"), ) comment = forms.CharField( required=True, widget=forms.Textarea, - label=_(u"Twój komentarz"), - help_text=_(u"Opisz w miarę dokładnie swoje zmiany."), + label=_(u"Your comments"), + help_text=_(u"Describe changes you made."), ) stage_completed = forms.ChoiceField( choices=DOCUMENT_STAGES, required=False, - label=_(u"Skończyłem robić"), - help_text=_(u"Jeśli skończyłeś jeden z etapów utworu, wybierz go."), + label=_(u"Completed"), + help_text=_(u"If you completed a life cycle stage, select it."), ) diff --git a/apps/wiki/helpers.py b/apps/wiki/helpers.py index bc4b7602..f072ef91 100644 --- a/apps/wiki/helpers.py +++ b/apps/wiki/helpers.py @@ -58,3 +58,74 @@ def ajax_require_permission(permission): return view(request, *args, **kwargs) return authorized_view return decorator + +import collections + +def recursive_groupby(iterable): + """ +# >>> recursive_groupby([1,2,3,4,5]) +# [1, 2, 3, 4, 5] + + >>> recursive_groupby([[1]]) + [1] + + >>> recursive_groupby([('a', 1),('a', 2), 3, ('b', 4), 5]) + ['a', [1, 2], 3, 'b', [4], 5] + + >>> recursive_groupby([('a', 'x', 1),('a', 'x', 2), ('a', 'x', 3)]) + ['a', ['x', [1, 2, 3]]] + + """ + + def _generator(iterator): + group = None + grouper = None + + for item in iterator: + if not isinstance(item, collections.Sequence): + if grouper is not None: + yield grouper + if len(group): + yield recursive_groupby(group) + group = None + grouper = None + yield item + continue + elif len(item) == 1: + if grouper is not None: + yield grouper + if len(group): + yield recursive_groupby(group) + group = None + grouper = None + yield item[0] + continue + elif not len(item): + continue + + if grouper is None: + group = [item[1:]] + grouper = item[0] + continue + + if grouper != item[0]: + if grouper is not None: + yield grouper + if len(group): + yield recursive_groupby(group) + group = None + grouper = None + group = [item[1:]] + grouper = item[0] + continue + + group.append(item[1:]) + + if grouper is not None: + yield grouper + if len(group): + yield recursive_groupby(group) + group = None + grouper = None + + return list(_generator(iterable)) diff --git a/apps/wiki/locale/pl/LC_MESSAGES/django.mo b/apps/wiki/locale/pl/LC_MESSAGES/django.mo new file mode 100644 index 00000000..ffadebc8 Binary files /dev/null and b/apps/wiki/locale/pl/LC_MESSAGES/django.mo differ diff --git a/apps/wiki/locale/pl/LC_MESSAGES/django.po b/apps/wiki/locale/pl/LC_MESSAGES/django.po new file mode 100644 index 00000000..159aa853 --- /dev/null +++ b/apps/wiki/locale/pl/LC_MESSAGES/django.po @@ -0,0 +1,272 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2010-08-03 12:13+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: Radek Czajka \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: constants.py:6 +msgid "First correction" +msgstr "Autokorekta" + +#: constants.py:7 +msgid "Tagging" +msgstr "Tagowanie" + +#: constants.py:8 +msgid "Initial Proofreading" +msgstr "Korekta" + +#: constants.py:9 +msgid "Annotation Proofreading" +msgstr "Sprawdzenie przypisów źródła" + +#: constants.py:10 +msgid "Modernisation" +msgstr "Uwspółcześnienie" + +#: constants.py:11 +msgid "Themes" +msgstr "Motywy" + +#: constants.py:12 +msgid "Editor's Proofreading" +msgstr "Ostateczna redakcja literacka" + +#: constants.py:13 +msgid "Technical Editor's Proofreading" +msgstr "Ostateczna redakcja techniczna" + +#: constants.py:17 +msgid "Ready to publish" +msgstr "Gotowe do publikacji" + +#: forms.py:62 +msgid "Author" +msgstr "Autor" + +#: forms.py:63 +msgid "Your name/" +msgstr "Imię i nazwisko/" + +#: forms.py:68 +msgid "Author's email" +msgstr "E-mail autora" + +#: forms.py:69 +msgid "Your email address, so we can show a gravatar :)" +msgstr "Adres e-mail, żebyśmy mogli pokazać gravatar :)" + +#: forms.py:75 +msgid "Your comments" +msgstr "Twój komentarz" + +#: forms.py:76 +msgid "Describe changes you made." +msgstr "Opisz swoje zmiany" + +#: forms.py:82 +msgid "Completed" +msgstr "Ukończono" + +#: forms.py:83 +msgid "If you completed a life cycle stage, select it." +msgstr "Jeśli został ukończony etap prac, wskaż go." + +#: models.py:93 +#, python-format +msgid "Finished stage: %s" +msgstr "Ukończony etap: %s" + +#: models.py:149 +msgid "name" +msgstr "nazwa" + +#: models.py:153 +msgid "theme" +msgstr "motyw" + +#: models.py:154 +msgid "themes" +msgstr "motywy" + +#: views.py:279 +msgid "Tag added" +msgstr "Dodano tag" + +#: templates/wiki/base.html:15 +msgid "Platforma Redakcyjna" +msgstr "" + +#: templates/wiki/diff_table.html:5 +msgid "Old version" +msgstr "Stara wersja" + +#: templates/wiki/diff_table.html:6 +msgid "New version" +msgstr "Nowa wersja" + +#: templates/wiki/document_create_missing.html:8 +msgid "Create document" +msgstr "Utwórz dokument" + +#: templates/wiki/document_details.html:31 +msgid "Click to open/close gallery" +msgstr "Kliknij, aby (ro)zwinąć galerię" + +#: templates/wiki/document_details_base.html:36 +msgid "Help" +msgstr "Pomoc" + +#: templates/wiki/document_details_base.html:38 +msgid "Version" +msgstr "Wersja" + +#: templates/wiki/document_details_base.html:38 +msgid "Unknown" +msgstr "nieznana" + +#: templates/wiki/document_details_base.html:40 +#: templates/wiki/tag_dialog.html:15 +msgid "Save" +msgstr "Zapisz" + +#: templates/wiki/document_details_base.html:41 +msgid "Save attempt in progress" +msgstr "" + +#: templates/wiki/document_list.html:30 +msgid "Clear filter" +msgstr "Wyczyść filtr" + +#: templates/wiki/document_list.html:48 +msgid "Your last edited documents" +msgstr "Twoje ostatnie edycje" + +#: templates/wiki/tag_dialog.html:16 +msgid "Cancel" +msgstr "Anuluj" + +#: templates/wiki/tabs/gallery_view.html:7 +msgid "Previous" +msgstr "Poprzednie" + +#: templates/wiki/tabs/gallery_view.html:13 +msgid "Next" +msgstr "Następne" + +#: templates/wiki/tabs/gallery_view.html:15 +msgid "Zoom in" +msgstr "Powiększ" + +#: templates/wiki/tabs/gallery_view.html:16 +msgid "Zoom out" +msgstr "Zmniejsz" + +#: templates/wiki/tabs/gallery_view_item.html:3 +msgid "Gallery" +msgstr "Galeria" + +#: templates/wiki/tabs/history_view.html:5 +msgid "Compare versions" +msgstr "Porównaj wersje" + +#: templates/wiki/tabs/history_view.html:7 +msgid "Mark version" +msgstr "Oznacz wersję" + +#: templates/wiki/tabs/history_view.html:9 +msgid "Revert document" +msgstr "Przywróć wersję" + +#: templates/wiki/tabs/history_view.html:12 +msgid "View version" +msgstr "Zobacz wersję" + +#: templates/wiki/tabs/history_view_item.html:3 +msgid "History" +msgstr "Historia" + +#: templates/wiki/tabs/search_view.html:3 +#: templates/wiki/tabs/search_view.html:5 +msgid "Search" +msgstr "Szukaj" + +#: templates/wiki/tabs/search_view.html:8 +msgid "Replace with" +msgstr "Zamień na" + +#: templates/wiki/tabs/search_view.html:10 +msgid "Replace" +msgstr "Zamień" + +#: templates/wiki/tabs/search_view.html:13 +msgid "Options" +msgstr "Opcje" + +#: templates/wiki/tabs/search_view.html:15 +msgid "Case sensitive" +msgstr "Rozróżniaj wielkość liter" + +#: templates/wiki/tabs/search_view.html:17 +msgid "From cursor" +msgstr "Zacznij od kursora" + +#: templates/wiki/tabs/search_view_item.html:3 +msgid "Search and replace" +msgstr "Znajdź i zamień" + +#: templates/wiki/tabs/source_editor_item.html:5 +msgid "Source code" +msgstr "Kod źródłowy" + +#: templates/wiki/tabs/summary_view.html:10 +msgid "Title" +msgstr "Tytuł" + +#: templates/wiki/tabs/summary_view.html:15 +msgid "Document ID" +msgstr "ID dokumentu" + +#: templates/wiki/tabs/summary_view.html:19 +msgid "Current version" +msgstr "Aktualna wersja" + +#: templates/wiki/tabs/summary_view.html:22 +msgid "Last edited by" +msgstr "Ostatnio edytowane przez" + +#: templates/wiki/tabs/summary_view.html:26 +msgid "Link to gallery" +msgstr "Link do galerii" + +#: templates/wiki/tabs/summary_view.html:31 +msgid "Publish" +msgstr "Opublikuj" + +#: templates/wiki/tabs/summary_view_item.html:4 +msgid "Summary" +msgstr "Podsumowanie" + +#: templates/wiki/tabs/wysiwyg_editor.html:9 +msgid "Insert theme" +msgstr "Wstaw motyw" + +#: templates/wiki/tabs/wysiwyg_editor.html:12 +msgid "Insert annotation" +msgstr "Wstaw przypis" + +#: templates/wiki/tabs/wysiwyg_editor_item.html:3 +msgid "Visual editor" +msgstr "Edytor wizualny" diff --git a/apps/wiki/migrations/0001_initial.py b/apps/wiki/migrations/0001_initial.py new file mode 100644 index 00000000..4acf5ba5 --- /dev/null +++ b/apps/wiki/migrations/0001_initial.py @@ -0,0 +1,21 @@ +# encoding: utf-8 +import datetime +from south.db import db +from south.v2 import SchemaMigration +from django.db import models + +class Migration(SchemaMigration): + + def forwards(self, orm): + pass + + + def backwards(self, orm): + pass + + + models = { + + } + + complete_apps = ['wiki'] diff --git a/apps/wiki/migrations/0002_auto__add_theme.py b/apps/wiki/migrations/0002_auto__add_theme.py new file mode 100644 index 00000000..6688139d --- /dev/null +++ b/apps/wiki/migrations/0002_auto__add_theme.py @@ -0,0 +1,38 @@ +# encoding: utf-8 +import datetime +from south.db import db +from south.v2 import SchemaMigration +from django.db import models + +class Migration(SchemaMigration): + + def forwards(self, orm): + + # Adding model 'Theme' + db.create_table('wiki_theme', ( + ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + ('name', self.gf('django.db.models.fields.CharField')(unique=True, max_length=50)), + )) + db.send_create_signal('wiki', ['Theme']) + + if not db.dry_run: + from django.core.management import call_command + call_command("loaddata", "initial_themes.yaml") + + + + def backwards(self, orm): + + # Deleting model 'Theme' + db.delete_table('wiki_theme') + + + models = { + 'wiki.theme': { + 'Meta': {'object_name': 'Theme'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '50'}) + } + } + + complete_apps = ['wiki'] diff --git a/apps/wiki/migrations/__init__.py b/apps/wiki/migrations/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/apps/wiki/models.py b/apps/wiki/models.py index f8004813..5faf1d3b 100644 --- a/apps/wiki/models.py +++ b/apps/wiki/models.py @@ -3,11 +3,13 @@ # This file is part of FNP-Redakcja, licensed under GNU Affero GPLv3 or later. # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. # +from django.db import models import re import os import vstorage from vstorage import DocumentNotFound -from wiki import settings +from wiki import settings, constants +from django.utils.translation import ugettext_lazy as _ from django.http import Http404 @@ -15,6 +17,29 @@ import logging logger = logging.getLogger("fnp.wiki") +# _PCHARS_DICT = dict(zip((ord(x) for x in u"ĄĆĘŁŃÓŚŻŹąćęłńóśżź "), u"ACELNOSZZacelnoszz_")) +_PCHARS_DICT = dict(zip((ord(x) for x in u" "), u"_")) + +# I know this is barbaric, but I didn't find a better solution ;( +def split_name(name): + parts = name.translate(_PCHARS_DICT).split('__') + return parts + +def join_name(*parts, **kwargs): + name = u'__'.join(p.translate(_PCHARS_DICT) for p in parts) + logger.info("JOIN %r -> %r", parts, name) + return name + +def normalize_name(name): + """ + >>> normalize_name("gąska".decode('utf-8')) + u'g\u0105ska' + """ + return name.translate(_PCHARS_DICT).lower() + +STAGE_TAGS_RE = re.compile(r'^#stage-finished: (.*)$', re.MULTILINE) + + class DocumentStorage(object): def __init__(self, path): self.vstorage = vstorage.VersionedStorage(path) @@ -27,13 +52,17 @@ class DocumentStorage(object): text, rev = self.vstorage.page_text_by_tag(name, tag) return Document(self, name=name, text=text, revision=rev) + def revert(self, name, revision): + text, rev = self.vstorage.revert(name, revision) + return Document(self, name=name, text=text, revision=rev) + def get_or_404(self, *args, **kwargs): try: return self.get(*args, **kwargs) except DocumentNotFound: raise Http404 - def put(self, document, author, comment, parent): + def put(self, document, author, comment, parent=None): self.vstorage.save_text( title=document.name, text=document.text, @@ -43,15 +72,14 @@ class DocumentStorage(object): return document - def create_document(self, id, text, title=None): - if title is None: - title = id.title() + def create_document(self, text, name): + title = u', '.join(p.title for p in split_name(name)) if text is None: text = u'' - document = Document(self, name=id, text=text, title=title) - return self.put(document, u"", u"Document created.", None) + document = Document(self, name=name, text=text, title=title) + return self.put(document, u"", u"Document created.") def delete(self, name, author, comment): self.vstorage.delete_page(name, author, comment) @@ -60,7 +88,14 @@ class DocumentStorage(object): return list(self.vstorage.all_pages()) def history(self, title): - return list(self.vstorage.page_history(title)) + def stage_desc(match): + stage = match.group(1) + return _("Finished stage: %s") % constants.DOCUMENT_STAGES_DICT[stage] + + for changeset in self.vstorage.page_history(title): + changeset['description'] = STAGE_TAGS_RE.sub(stage_desc, changeset['description']) + yield changeset + class Document(object): @@ -98,15 +133,29 @@ class Document(object): gallery = os.path.basename(gallery) result['gallery'] = gallery - - if 'title' not in result: - result['title'] = self.name.title() - return result def info(self): return self.storage.vstorage.page_meta(self.name, self.revision) - def getstorage(): return DocumentStorage(settings.REPOSITORY_PATH) + +# +# Django models +# + +class Theme(models.Model): + name = models.CharField(_('name'), max_length=50, unique=True) + + class Meta: + ordering = ('name',) + verbose_name = _('theme') + verbose_name_plural = _('themes') + + def __unicode__(self): + return self.name + + def __repr__(self): + return "Theme(name=%r)" % self.name + diff --git a/apps/wiki/nice_diff.py b/apps/wiki/nice_diff.py old mode 100755 new mode 100644 diff --git a/apps/wiki/templates/wiki/base.html b/apps/wiki/templates/wiki/base.html index b6cfe60c..f88fac31 100644 --- a/apps/wiki/templates/wiki/base.html +++ b/apps/wiki/templates/wiki/base.html @@ -1,5 +1,5 @@ {% extends "base.html" %} -{% load compressed %} +{% load compressed i18n %} {% block title %}{{ document_name }} - {{ block.super }}{% endblock %} @@ -12,7 +12,7 @@ {% endblock %} {% block maincontent %} -

Platforma Redakcyjna

+

{% trans "Platforma Redakcyjna" %}

{% block leftcolumn %} {% endblock leftcolumn %} diff --git a/apps/wiki/templates/wiki/diff_table.html b/apps/wiki/templates/wiki/diff_table.html index 91ac55c0..818c38cc 100644 --- a/apps/wiki/templates/wiki/diff_table.html +++ b/apps/wiki/templates/wiki/diff_table.html @@ -1,8 +1,9 @@ +{% load i18n %} - - + + diff --git a/apps/wiki/templates/wiki/document_create_missing.html b/apps/wiki/templates/wiki/document_create_missing.html index 0dcf3780..351e87a2 100644 --- a/apps/wiki/templates/wiki/document_create_missing.html +++ b/apps/wiki/templates/wiki/document_create_missing.html @@ -1,13 +1,13 @@ {% extends "wiki/base.html" %} +{% load i18n %} {% block leftcolumn %} {{ form.as_p }} -

+

{% endblock leftcolumn %} {% block rightcolumn %} - {% endblock rightcolumn %} \ No newline at end of file diff --git a/apps/wiki/templates/wiki/document_details.html b/apps/wiki/templates/wiki/document_details.html index 81d76dd9..9657e0f6 100644 --- a/apps/wiki/templates/wiki/document_details.html +++ b/apps/wiki/templates/wiki/document_details.html @@ -1,10 +1,11 @@ {% extends "wiki/document_details_base.html" %} +{% load i18n %} {% block extrabody %} {{ block.super }} - - + {% endblock %} {% block tabs-menu %} @@ -21,8 +22,18 @@ {% include "wiki/tabs/source_editor.html" %} {% endblock %} +{% block tabs-right %} + {% include "wiki/tabs/gallery_view_item.html" %} + {% include "wiki/tabs/search_view_item.html" %} +{% endblock %} + {% block splitter-extra %} - {% include "wiki/tabs/gallery_view.html" %} +
+
+ {% endblock %} {% block dialogs %} diff --git a/apps/wiki/templates/wiki/document_details_base.html b/apps/wiki/templates/wiki/document_details_base.html index 576ee1e5..3c6843d7 100644 --- a/apps/wiki/templates/wiki/document_details_base.html +++ b/apps/wiki/templates/wiki/document_details_base.html @@ -1,5 +1,6 @@ {% extends "base.html" %} -{% load toolbar_tags %} +{% load toolbar_tags i18n %} + {% block title %}{{ document.name }} - {{ block.super }}{% endblock %} {% block extrahead %} {% load compressed %} @@ -14,13 +15,6 @@ {% endblock %} {% block maincontent %} -
-
- -

Ładowanie

-
-
-
diff --git a/apps/wiki/templates/wiki/document_details_readonly.html b/apps/wiki/templates/wiki/document_details_readonly.html index c0ed66ff..69d085b6 100644 --- a/apps/wiki/templates/wiki/document_details_readonly.html +++ b/apps/wiki/templates/wiki/document_details_readonly.html @@ -1,4 +1,5 @@ {% extends "wiki/document_details_base.html" %} +{% load i18n %} {% block editor-class %}readonly{% endblock %} diff --git a/apps/wiki/templates/wiki/document_list.html b/apps/wiki/templates/wiki/document_list.html index 2ab5ab9c..6853801f 100644 --- a/apps/wiki/templates/wiki/document_list.html +++ b/apps/wiki/templates/wiki/document_list.html @@ -1,5 +1,7 @@ {% extends "wiki/base.html" %} +{% load i18n %} +{% load wiki %} {% block extrabody %} {{ block.super }} @@ -9,7 +11,7 @@ $(function() { event.preventDefault(); var expr = new RegExp(slugify($('#file-list-filter').val()), 'i'); $('#file-list tbody tr').hide().filter(function(index) { - return expr.test(slugify($('a', this).text())); + return expr.test(slugify( $('a', this).attr('data-id') )); }).show(); } @@ -25,13 +27,14 @@ $(function() {
- + - {% for file in document_list %} + {% for doc in docs %} - + {% endfor %} @@ -42,11 +45,11 @@ $(function() { {% block rightcolumn %}
-

Twoje ostatnio otwierane dokumenty:

-
    - {% for name, date in last_docs %} -
  1. {{ name }}
    ({{ date|date:"H:i:s, d/m/Y" }})
  2. +

    {% trans "Your last edited documents" %}

    +
      + {% for name, date in last_docs %} +
    1. {{ name|wiki_title }}
      ({{ date|date:"H:i:s, d/m/Y" }})
    2. {% endfor %}
diff --git a/apps/wiki/templates/wiki/save_dialog.html b/apps/wiki/templates/wiki/save_dialog.html index 7155964e..71c999bf 100644 --- a/apps/wiki/templates/wiki/save_dialog.html +++ b/apps/wiki/templates/wiki/save_dialog.html @@ -1,3 +1,4 @@ +{% load i18n %}

{{ forms.text_save.comment.label }}

diff --git a/apps/wiki/templates/wiki/tabs/gallery_view.html b/apps/wiki/templates/wiki/tabs/gallery_view.html index ec5f6e4a..7bf6584a 100644 --- a/apps/wiki/templates/wiki/tabs/gallery_view.html +++ b/apps/wiki/templates/wiki/tabs/gallery_view.html @@ -1,26 +1,25 @@ -
-
+{% load i18n %} \ No newline at end of file +
diff --git a/apps/wiki/templates/wiki/tabs/gallery_view_item.html b/apps/wiki/templates/wiki/tabs/gallery_view_item.html new file mode 100644 index 00000000..7325c825 --- /dev/null +++ b/apps/wiki/templates/wiki/tabs/gallery_view_item.html @@ -0,0 +1,4 @@ +{% load i18n %} +
  • + {% trans "Gallery" %} +
  • diff --git a/apps/wiki/templates/wiki/tabs/history_view.html b/apps/wiki/templates/wiki/tabs/history_view.html index 6d82785b..d9b74dcb 100644 --- a/apps/wiki/templates/wiki/tabs/history_view.html +++ b/apps/wiki/templates/wiki/tabs/history_view.html @@ -1,9 +1,16 @@ +{% load i18n %}
    Stara wersjaNowa wersja{% trans "Old version" %}{% trans "New version" %}
    Filtr:
    {{ file }}{{ doc|wiki_title }}
    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/redakcja/static/js/jquery.autocomplete.js b/redakcja/static/js/jquery.autocomplete.js deleted file mode 100644 index 0d25ba66..00000000 --- a/redakcja/static/js/jquery.autocomplete.js +++ /dev/null @@ -1,808 +0,0 @@ -/* - * jQuery Autocomplete plugin 1.1 - * - * Copyright (c) 2009 Jörn Zaefferer - * - * 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: jquery.autocomplete.js 15 2009-08-22 10:30:27Z joern.zaefferer $ - */ - -;(function($) { - -$.fn.extend({ - autocomplete: function(urlOrData, options) { - var isUrl = typeof urlOrData == "string"; - options = $.extend({}, $.Autocompleter.defaults, { - url: isUrl ? urlOrData : null, - data: isUrl ? null : urlOrData, - delay: isUrl ? $.Autocompleter.defaults.delay : 10, - max: options && !options.scroll ? 10 : 150 - }, options); - - // if highlight is set to false, replace it with a do-nothing function - options.highlight = options.highlight || function(value) { return value; }; - - // if the formatMatch option is not specified, then use formatItem for backwards compatibility - options.formatMatch = options.formatMatch || options.formatItem; - - return this.each(function() { - new $.Autocompleter(this, options); - }); - }, - result: function(handler) { - return this.bind("result", handler); - }, - search: function(handler) { - return this.trigger("search", [handler]); - }, - flushCache: function() { - return this.trigger("flushCache"); - }, - setOptions: function(options){ - return this.trigger("setOptions", [options]); - }, - unautocomplete: function() { - return this.trigger("unautocomplete"); - } -}); - -$.Autocompleter = function(input, options) { - - var KEY = { - UP: 38, - DOWN: 40, - DEL: 46, - TAB: 9, - RETURN: 13, - ESC: 27, - COMMA: 188, - PAGEUP: 33, - PAGEDOWN: 34, - BACKSPACE: 8 - }; - - // Create $ object for input element - var $input = $(input).attr("autocomplete", "off").addClass(options.inputClass); - - var timeout; - var previousValue = ""; - var cache = $.Autocompleter.Cache(options); - var hasFocus = 0; - var lastKeyPressCode; - var config = { - mouseDownOnSelect: false - }; - var select = $.Autocompleter.Select(options, input, selectCurrent, config); - - var blockSubmit; - - // prevent form submit in opera when selecting with return key - $.browser.opera && $(input.form).bind("submit.autocomplete", function() { - if (blockSubmit) { - blockSubmit = false; - return false; - } - }); - - // only opera doesn't trigger keydown multiple times while pressed, others don't work with keypress at all - $input.bind(($.browser.opera ? "keypress" : "keydown") + ".autocomplete", function(event) { - // a keypress means the input has focus - // avoids issue where input had focus before the autocomplete was applied - hasFocus = 1; - // track last key pressed - lastKeyPressCode = event.keyCode; - switch(event.keyCode) { - - case KEY.UP: - event.preventDefault(); - if ( select.visible() ) { - select.prev(); - } else { - onChange(0, true); - } - break; - - case KEY.DOWN: - event.preventDefault(); - if ( select.visible() ) { - select.next(); - } else { - onChange(0, true); - } - break; - - case KEY.PAGEUP: - event.preventDefault(); - if ( select.visible() ) { - select.pageUp(); - } else { - onChange(0, true); - } - break; - - case KEY.PAGEDOWN: - event.preventDefault(); - if ( select.visible() ) { - select.pageDown(); - } else { - onChange(0, true); - } - break; - - // matches also semicolon - case options.multiple && $.trim(options.multipleSeparator) == "," && KEY.COMMA: - case KEY.TAB: - case KEY.RETURN: - if( selectCurrent() ) { - // stop default to prevent a form submit, Opera needs special handling - event.preventDefault(); - blockSubmit = true; - return false; - } - break; - - case KEY.ESC: - select.hide(); - break; - - default: - clearTimeout(timeout); - timeout = setTimeout(onChange, options.delay); - break; - } - }).focus(function(){ - // track whether the field has focus, we shouldn't process any - // results if the field no longer has focus - hasFocus++; - }).blur(function() { - hasFocus = 0; - if (!config.mouseDownOnSelect) { - hideResults(); - } - }).click(function() { - // show select when clicking in a focused field - if ( hasFocus++ > 1 && !select.visible() ) { - onChange(0, true); - } - }).bind("search", function() { - // TODO why not just specifying both arguments? - var fn = (arguments.length > 1) ? arguments[1] : null; - function findValueCallback(q, data) { - var result; - if( data && data.length ) { - for (var i=0; i < data.length; i++) { - if( data[i].result.toLowerCase() == q.toLowerCase() ) { - result = data[i]; - break; - } - } - } - if( typeof fn == "function" ) fn(result); - else $input.trigger("result", result && [result.data, result.value]); - } - $.each(trimWords($input.val()), function(i, value) { - request(value, findValueCallback, findValueCallback); - }); - }).bind("flushCache", function() { - cache.flush(); - }).bind("setOptions", function() { - $.extend(options, arguments[1]); - // if we've updated the data, repopulate - if ( "data" in arguments[1] ) - cache.populate(); - }).bind("unautocomplete", function() { - select.unbind(); - $input.unbind(); - $(input.form).unbind(".autocomplete"); - }); - - - function selectCurrent() { - var selected = select.selected(); - if( !selected ) - return false; - - var v = selected.result; - previousValue = v; - - if ( options.multiple ) { - var words = trimWords($input.val()); - if ( words.length > 1 ) { - var seperator = options.multipleSeparator.length; - var cursorAt = $(input).selection().start; - var wordAt, progress = 0; - $.each(words, function(i, word) { - progress += word.length; - if (cursorAt <= progress) { - wordAt = i; - return false; - } - progress += seperator; - }); - words[wordAt] = v; - // TODO this should set the cursor to the right position, but it gets overriden somewhere - //$.Autocompleter.Selection(input, progress + seperator, progress + seperator); - v = words.join( options.multipleSeparator ); - } - v += options.multipleSeparator; - } - - $input.val(v); - hideResultsNow(); - $input.trigger("result", [selected.data, selected.value]); - return true; - } - - function onChange(crap, skipPrevCheck) { - if( lastKeyPressCode == KEY.DEL ) { - select.hide(); - return; - } - - var currentValue = $input.val(); - - if ( !skipPrevCheck && currentValue == previousValue ) - return; - - previousValue = currentValue; - - currentValue = lastWord(currentValue); - if ( currentValue.length >= options.minChars) { - $input.addClass(options.loadingClass); - if (!options.matchCase) - currentValue = currentValue.toLowerCase(); - request(currentValue, receiveData, hideResultsNow); - } else { - stopLoading(); - select.hide(); - } - }; - - function trimWords(value) { - if (!value) - return [""]; - if (!options.multiple) - return [$.trim(value)]; - return $.map(value.split(options.multipleSeparator), function(word) { - return $.trim(value).length ? $.trim(word) : null; - }); - } - - function lastWord(value) { - if ( !options.multiple ) - return value; - var words = trimWords(value); - if (words.length == 1) - return words[0]; - var cursorAt = $(input).selection().start; - if (cursorAt == value.length) { - words = trimWords(value) - } else { - words = trimWords(value.replace(value.substring(cursorAt), "")); - } - return words[words.length - 1]; - } - - // fills in the input box w/the first match (assumed to be the best match) - // q: the term entered - // sValue: the first matching result - function autoFill(q, sValue){ - // autofill in the complete box w/the first match as long as the user hasn't entered in more data - // if the last user key pressed was backspace, don't autofill - if( options.autoFill && (lastWord($input.val()).toLowerCase() == q.toLowerCase()) && lastKeyPressCode != KEY.BACKSPACE ) { - // fill in the value (keep the case the user has typed) - $input.val($input.val() + sValue.substring(lastWord(previousValue).length)); - // select the portion of the value not typed by the user (so the next character will erase) - $(input).selection(previousValue.length, previousValue.length + sValue.length); - } - }; - - function hideResults() { - clearTimeout(timeout); - timeout = setTimeout(hideResultsNow, 200); - }; - - function hideResultsNow() { - var wasVisible = select.visible(); - select.hide(); - clearTimeout(timeout); - stopLoading(); - if (options.mustMatch) { - // call search and run callback - $input.search( - function (result){ - // if no value found, clear the input box - if( !result ) { - if (options.multiple) { - var words = trimWords($input.val()).slice(0, -1); - $input.val( words.join(options.multipleSeparator) + (words.length ? options.multipleSeparator : "") ); - } - else { - $input.val( "" ); - $input.trigger("result", null); - } - } - } - ); - } - }; - - function receiveData(q, data) { - if ( data && data.length && hasFocus ) { - stopLoading(); - select.display(data, q); - autoFill(q, data[0].value); - select.show(); - } else { - hideResultsNow(); - } - }; - - function request(term, success, failure) { - if (!options.matchCase) - term = term.toLowerCase(); - var data = cache.load(term); - // recieve the cached data - if (data && data.length) { - success(term, data); - // if an AJAX url has been supplied, try loading the data now - } else if( (typeof options.url == "string") && (options.url.length > 0) ){ - - var extraParams = { - timestamp: +new Date() - }; - $.each(options.extraParams, function(key, param) { - extraParams[key] = typeof param == "function" ? param() : param; - }); - - $.ajax({ - // try to leverage ajaxQueue plugin to abort previous requests - mode: "abort", - // limit abortion to this input - port: "autocomplete" + input.name, - dataType: options.dataType, - url: options.url, - data: $.extend({ - q: lastWord(term), - limit: options.max - }, extraParams), - success: function(data) { - var parsed = options.parse && options.parse(data) || parse(data); - cache.add(term, parsed); - success(term, parsed); - } - }); - } else { - // if we have a failure, we need to empty the list -- this prevents the the [TAB] key from selecting the last successful match - select.emptyList(); - failure(term); - } - }; - - function parse(data) { - var parsed = []; - var rows = data.split("\n"); - for (var i=0; i < rows.length; i++) { - var row = $.trim(rows[i]); - if (row) { - row = row.split("|"); - parsed[parsed.length] = { - data: row, - value: row[0], - result: options.formatResult && options.formatResult(row, row[0]) || row[0] - }; - } - } - return parsed; - }; - - function stopLoading() { - $input.removeClass(options.loadingClass); - }; - -}; - -$.Autocompleter.defaults = { - inputClass: "ac_input", - resultsClass: "ac_results", - loadingClass: "ac_loading", - minChars: 1, - delay: 400, - matchCase: false, - matchSubset: true, - matchContains: false, - cacheLength: 10, - max: 100, - mustMatch: false, - extraParams: {}, - selectFirst: true, - formatItem: function(row) { return row[0]; }, - formatMatch: null, - autoFill: false, - width: 0, - multiple: false, - multipleSeparator: ", ", - highlight: function(value, term) { - return value.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + term.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi, "\\$1") + ")(?![^<>]*>)(?![^&;]+;)", "gi"), "$1"); - }, - scroll: true, - scrollHeight: 180 -}; - -$.Autocompleter.Cache = function(options) { - - var data = {}; - var length = 0; - - function matchSubset(s, sub) { - if (!options.matchCase) - s = s.toLowerCase(); - var i = s.indexOf(sub); - if (options.matchContains == "word"){ - i = s.toLowerCase().search("\\b" + sub.toLowerCase()); - } - if (i == -1) return false; - return i == 0 || options.matchContains; - }; - - function add(q, value) { - if (length > options.cacheLength){ - flush(); - } - if (!data[q]){ - length++; - } - data[q] = value; - } - - function populate(){ - if( !options.data ) return false; - // track the matches - var stMatchSets = {}, - nullData = 0; - - // no url was specified, we need to adjust the cache length to make sure it fits the local data store - if( !options.url ) options.cacheLength = 1; - - // track all options for minChars = 0 - stMatchSets[""] = []; - - // loop through the array and create a lookup structure - for ( var i = 0, ol = options.data.length; i < ol; i++ ) { - var rawValue = options.data[i]; - // if rawValue is a string, make an array otherwise just reference the array - rawValue = (typeof rawValue == "string") ? [rawValue] : rawValue; - - var value = options.formatMatch(rawValue, i+1, options.data.length); - if ( value === false ) - continue; - - var firstChar = value.charAt(0).toLowerCase(); - // if no lookup array for this character exists, look it up now - if( !stMatchSets[firstChar] ) - stMatchSets[firstChar] = []; - - // if the match is a string - var row = { - value: value, - data: rawValue, - result: options.formatResult && options.formatResult(rawValue) || value - }; - - // push the current match into the set list - stMatchSets[firstChar].push(row); - - // keep track of minChars zero items - if ( nullData++ < options.max ) { - stMatchSets[""].push(row); - } - }; - - // add the data items to the cache - $.each(stMatchSets, function(i, value) { - // increase the cache size - options.cacheLength++; - // add to the cache - add(i, value); - }); - } - - // populate any existing data - setTimeout(populate, 25); - - function flush(){ - data = {}; - length = 0; - } - - return { - flush: flush, - add: add, - populate: populate, - load: function(q) { - if (!options.cacheLength || !length) - return null; - /* - * if dealing w/local data and matchContains than we must make sure - * to loop through all the data collections looking for matches - */ - if( !options.url && options.matchContains ){ - // track all matches - var csub = []; - // loop through all the data grids for matches - for( var k in data ){ - // don't search through the stMatchSets[""] (minChars: 0) cache - // this prevents duplicates - if( k.length > 0 ){ - var c = data[k]; - $.each(c, function(i, x) { - // if we've got a match, add it to the array - if (matchSubset(x.value, q)) { - csub.push(x); - } - }); - } - } - return csub; - } else - // if the exact item exists, use it - if (data[q]){ - return data[q]; - } else - if (options.matchSubset) { - for (var i = q.length - 1; i >= options.minChars; i--) { - var c = data[q.substr(0, i)]; - if (c) { - var csub = []; - $.each(c, function(i, x) { - if (matchSubset(x.value, q)) { - csub[csub.length] = x; - } - }); - return csub; - } - } - } - return null; - } - }; -}; - -$.Autocompleter.Select = function (options, input, select, config) { - var CLASSES = { - ACTIVE: "ac_over" - }; - - var listItems, - active = -1, - data, - term = "", - needsInit = true, - element, - list; - - // Create results - function init() { - if (!needsInit) - return; - element = $("
    ") - .hide() - .addClass(options.resultsClass) - .css("position", "absolute") - .appendTo(document.body); - - list = $("
      ").appendTo(element).mouseover( function(event) { - if(target(event).nodeName && target(event).nodeName.toUpperCase() == 'LI') { - active = $("li", list).removeClass(CLASSES.ACTIVE).index(target(event)); - $(target(event)).addClass(CLASSES.ACTIVE); - } - }).click(function(event) { - $(target(event)).addClass(CLASSES.ACTIVE); - select(); - // TODO provide option to avoid setting focus again after selection? useful for cleanup-on-focus - input.focus(); - return false; - }).mousedown(function() { - config.mouseDownOnSelect = true; - }).mouseup(function() { - config.mouseDownOnSelect = false; - }); - - if( options.width > 0 ) - element.css("width", options.width); - - needsInit = false; - } - - function target(event) { - var element = event.target; - while(element && element.tagName != "LI") - element = element.parentNode; - // more fun with IE, sometimes event.target is empty, just ignore it then - if(!element) - return []; - return element; - } - - function moveSelect(step) { - listItems.slice(active, active + 1).removeClass(CLASSES.ACTIVE); - movePosition(step); - var activeItem = listItems.slice(active, active + 1).addClass(CLASSES.ACTIVE); - if(options.scroll) { - var offset = 0; - listItems.slice(0, active).each(function() { - offset += this.offsetHeight; - }); - if((offset + activeItem[0].offsetHeight - list.scrollTop()) > list[0].clientHeight) { - list.scrollTop(offset + activeItem[0].offsetHeight - list.innerHeight()); - } else if(offset < list.scrollTop()) { - list.scrollTop(offset); - } - } - }; - - function movePosition(step) { - active += step; - if (active < 0) { - active = listItems.size() - 1; - } else if (active >= listItems.size()) { - active = 0; - } - } - - function limitNumberOfItems(available) { - return options.max && options.max < available - ? options.max - : available; - } - - function fillList() { - list.empty(); - var max = limitNumberOfItems(data.length); - for (var i=0; i < max; i++) { - if (!data[i]) - continue; - var formatted = options.formatItem(data[i].data, i+1, max, data[i].value, term); - if ( formatted === false ) - continue; - var li = $("
    • ").html( options.highlight(formatted, term) ).addClass(i%2 == 0 ? "ac_even" : "ac_odd").appendTo(list)[0]; - $.data(li, "ac_data", data[i]); - } - listItems = list.find("li"); - if ( options.selectFirst ) { - listItems.slice(0, 1).addClass(CLASSES.ACTIVE); - active = 0; - } - // apply bgiframe if available - if ( $.fn.bgiframe ) - list.bgiframe(); - } - - return { - display: function(d, q) { - init(); - data = d; - term = q; - fillList(); - }, - next: function() { - moveSelect(1); - }, - prev: function() { - moveSelect(-1); - }, - pageUp: function() { - if (active != 0 && active - 8 < 0) { - moveSelect( -active ); - } else { - moveSelect(-8); - } - }, - pageDown: function() { - if (active != listItems.size() - 1 && active + 8 > listItems.size()) { - moveSelect( listItems.size() - 1 - active ); - } else { - moveSelect(8); - } - }, - hide: function() { - element && element.hide(); - listItems && listItems.removeClass(CLASSES.ACTIVE); - active = -1; - }, - visible : function() { - return element && element.is(":visible"); - }, - current: function() { - return this.visible() && (listItems.filter("." + CLASSES.ACTIVE)[0] || options.selectFirst && listItems[0]); - }, - show: function() { - var offset = $(input).offset(); - element.css({ - width: typeof options.width == "string" || options.width > 0 ? options.width : $(input).width(), - top: offset.top + input.offsetHeight, - left: offset.left - }).show(); - if(options.scroll) { - list.scrollTop(0); - list.css({ - maxHeight: options.scrollHeight, - overflow: 'auto' - }); - - if($.browser.msie && typeof document.body.style.maxHeight === "undefined") { - var listHeight = 0; - listItems.each(function() { - listHeight += this.offsetHeight; - }); - var scrollbarsVisible = listHeight > options.scrollHeight; - list.css('height', scrollbarsVisible ? options.scrollHeight : listHeight ); - if (!scrollbarsVisible) { - // IE doesn't recalculate width when scrollbar disappears - listItems.width( list.width() - parseInt(listItems.css("padding-left")) - parseInt(listItems.css("padding-right")) ); - } - } - - } - }, - selected: function() { - var selected = listItems && listItems.filter("." + CLASSES.ACTIVE).removeClass(CLASSES.ACTIVE); - return selected && selected.length && $.data(selected[0], "ac_data"); - }, - emptyList: function (){ - list && list.empty(); - }, - unbind: function() { - element && element.remove(); - } - }; -}; - -$.fn.selection = function(start, end) { - if (start !== undefined) { - return this.each(function() { - if( this.createTextRange ){ - var selRange = this.createTextRange(); - if (end === undefined || start == end) { - selRange.move("character", start); - selRange.select(); - } else { - selRange.collapse(true); - selRange.moveStart("character", start); - selRange.moveEnd("character", end); - selRange.select(); - } - } else if( this.setSelectionRange ){ - this.setSelectionRange(start, end); - } else if( this.selectionStart ){ - this.selectionStart = start; - this.selectionEnd = end; - } - }); - } - var field = this[0]; - if ( field.createTextRange ) { - var range = document.selection.createRange(), - orig = field.value, - teststring = "<->", - textLength = range.text.length; - range.text = teststring; - var caretAt = field.value.indexOf(teststring); - field.value = orig; - this.selection(caretAt, caretAt + textLength); - return { - start: caretAt, - end: caretAt + textLength - } - } else if( field.selectionStart !== undefined ){ - return { - start: field.selectionStart, - end: field.selectionEnd - } - } -}; - -})(jQuery); \ No newline at end of file diff --git a/redakcja/static/js/jquery.blockui.js b/redakcja/static/js/jquery.blockui.js deleted file mode 100644 index 54916670..00000000 --- a/redakcja/static/js/jquery.blockui.js +++ /dev/null @@ -1,477 +0,0 @@ -/*! - * jQuery blockUI plugin - * Version 2.31 (06-JAN-2010) - * @requires jQuery v1.2.3 or later - * - * Examples at: http://malsup.com/jquery/block/ - * Copyright (c) 2007-2008 M. Alsup - * Dual licensed under the MIT and GPL licenses: - * http://www.opensource.org/licenses/mit-license.php - * http://www.gnu.org/licenses/gpl.html - * - * Thanks to Amir-Hossein Sobhi for some excellent contributions! - */ - -;(function($) { - -if (/1\.(0|1|2)\.(0|1|2)/.test($.fn.jquery) || /^1.1/.test($.fn.jquery)) { - alert('blockUI requires jQuery v1.2.3 or later! You are using v' + $.fn.jquery); - return; -} - -$.fn._fadeIn = $.fn.fadeIn; - -var noOp = function() {}; - -// this bit is to ensure we don't call setExpression when we shouldn't (with extra muscle to handle -// retarded userAgent strings on Vista) -var mode = document.documentMode || 0; -var setExpr = $.browser.msie && (($.browser.version < 8 && !mode) || mode < 8); -var ie6 = $.browser.msie && /MSIE 6.0/.test(navigator.userAgent) && !mode; - -// global $ methods for blocking/unblocking the entire page -$.blockUI = function(opts) { install(window, opts); }; -$.unblockUI = function(opts) { remove(window, opts); }; - -// convenience method for quick growl-like notifications (http://www.google.com/search?q=growl) -$.growlUI = function(title, message, timeout, onClose) { - var $m = $('
      '); - if (title) $m.append('

      '+title+'

      '); - if (message) $m.append('

      '+message+'

      '); - if (timeout == undefined) timeout = 3000; - $.blockUI({ - message: $m, fadeIn: 700, fadeOut: 1000, centerY: false, - timeout: timeout, showOverlay: false, - onUnblock: onClose, - css: $.blockUI.defaults.growlCSS - }); -}; - -// plugin method for blocking element content -$.fn.block = function(opts) { - return this.unblock({ fadeOut: 0 }).each(function() { - if ($.css(this,'position') == 'static') - this.style.position = 'relative'; - if ($.browser.msie) - this.style.zoom = 1; // force 'hasLayout' - install(this, opts); - }); -}; - -// plugin method for unblocking element content -$.fn.unblock = function(opts) { - return this.each(function() { - remove(this, opts); - }); -}; - -$.blockUI.version = 2.31; // 2nd generation blocking at no extra cost! - -// override these in your code to change the default behavior and style -$.blockUI.defaults = { - // message displayed when blocking (use null for no message) - message: '

      Please wait...

      ', - - title: null, // title string; only used when theme == true - draggable: true, // only used when theme == true (requires jquery-ui.js to be loaded) - - theme: false, // set to true to use with jQuery UI themes - - // styles for the message when blocking; if you wish to disable - // these and use an external stylesheet then do this in your code: - // $.blockUI.defaults.css = {}; - css: { - padding: 0, - margin: 0, - width: '30%', - top: '40%', - left: '35%', - textAlign: 'center', - color: '#000', - border: '3px solid #aaa', - backgroundColor:'#fff', - cursor: 'wait' - }, - - // minimal style set used when themes are used - themedCSS: { - width: '30%', - top: '40%', - left: '35%' - }, - - // styles for the overlay - overlayCSS: { - backgroundColor: '#000', - opacity: 0.6, - cursor: 'wait' - }, - - // styles applied when using $.growlUI - growlCSS: { - width: '350px', - top: '10px', - left: '', - right: '10px', - border: 'none', - padding: '5px', - opacity: 0.6, - cursor: 'default', - color: '#fff', - backgroundColor: '#000', - '-webkit-border-radius': '10px', - '-moz-border-radius': '10px' - }, - - // IE issues: 'about:blank' fails on HTTPS and javascript:false is s-l-o-w - // (hat tip to Jorge H. N. de Vasconcelos) - iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank', - - // force usage of iframe in non-IE browsers (handy for blocking applets) - forceIframe: false, - - // z-index for the blocking overlay - baseZ: 1000, - - // set these to true to have the message automatically centered - centerX: true, // <-- only effects element blocking (page block controlled via css above) - centerY: true, - - // allow body element to be stetched in ie6; this makes blocking look better - // on "short" pages. disable if you wish to prevent changes to the body height - allowBodyStretch: true, - - // enable if you want key and mouse events to be disabled for content that is blocked - bindEvents: true, - - // be default blockUI will supress tab navigation from leaving blocking content - // (if bindEvents is true) - constrainTabKey: true, - - // fadeIn time in millis; set to 0 to disable fadeIn on block - fadeIn: 200, - - // fadeOut time in millis; set to 0 to disable fadeOut on unblock - fadeOut: 400, - - // time in millis to wait before auto-unblocking; set to 0 to disable auto-unblock - timeout: 0, - - // disable if you don't want to show the overlay - showOverlay: true, - - // if true, focus will be placed in the first available input field when - // page blocking - focusInput: true, - - // suppresses the use of overlay styles on FF/Linux (due to performance issues with opacity) - applyPlatformOpacityRules: true, - - // callback method invoked when fadeIn has completed and blocking message is visible - onBlock: null, - - // callback method invoked when unblocking has completed; the callback is - // passed the element that has been unblocked (which is the window object for page - // blocks) and the options that were passed to the unblock call: - // onUnblock(element, options) - onUnblock: null, - - // don't ask; if you really must know: http://groups.google.com/group/jquery-en/browse_thread/thread/36640a8730503595/2f6a79a77a78e493#2f6a79a77a78e493 - quirksmodeOffsetHack: 4 -}; - -// private data and functions follow... - -var pageBlock = null; -var pageBlockEls = []; - -function install(el, opts) { - var full = (el == window); - var msg = opts && opts.message !== undefined ? opts.message : undefined; - opts = $.extend({}, $.blockUI.defaults, opts || {}); - opts.overlayCSS = $.extend({}, $.blockUI.defaults.overlayCSS, opts.overlayCSS || {}); - var css = $.extend({}, $.blockUI.defaults.css, opts.css || {}); - var themedCSS = $.extend({}, $.blockUI.defaults.themedCSS, opts.themedCSS || {}); - msg = msg === undefined ? opts.message : msg; - - // remove the current block (if there is one) - if (full && pageBlock) - remove(window, {fadeOut:0}); - - // if an existing element is being used as the blocking content then we capture - // its current place in the DOM (and current display style) so we can restore - // it when we unblock - if (msg && typeof msg != 'string' && (msg.parentNode || msg.jquery)) { - var node = msg.jquery ? msg[0] : msg; - var data = {}; - $(el).data('blockUI.history', data); - data.el = node; - data.parent = node.parentNode; - data.display = node.style.display; - data.position = node.style.position; - if (data.parent) - data.parent.removeChild(node); - } - - var z = opts.baseZ; - - // blockUI uses 3 layers for blocking, for simplicity they are all used on every platform; - // layer1 is the iframe layer which is used to supress bleed through of underlying content - // layer2 is the overlay layer which has opacity and a wait cursor (by default) - // layer3 is the message content that is displayed while blocking - - var lyr1 = ($.browser.msie || opts.forceIframe) - ? $('') - : $(''); - var lyr2 = $(''); - - var lyr3; - if (opts.theme && full) { - var s = ''; - lyr3 = $(s); - } - else { - lyr3 = full ? $('') - : $(''); - } - - // 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.applyPlatformOpacityRules || !($.browser.mozilla && /Linux/.test(navigator.platform))) - lyr2.css(opts.overlayCSS); - lyr2.css('position', full ? 'fixed' : 'absolute'); - - // make iframe layer transparent in IE - if ($.browser.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 && (!$.boxModel || $('object,embed', full ? null : el).length > 0); - if (ie6 || expr) { - // give body 100% height - if (full && opts.allowBodyStretch && $.boxModel) - $('html,body').css('height','100%'); - - // fix ie6 issue when blocked element has a border width - if ((ie6 || !$.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([lyr1,lyr2,lyr3], function(i,o) { - var s = o[0].style; - s.position = 'absolute'; - if (i < 2) { - full ? s.setExpression('height','Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.boxModel?0:'+opts.quirksmodeOffsetHack+') + "px"') - : s.setExpression('height','this.parentNode.offsetHeight + "px"'); - full ? s.setExpression('width','jQuery.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"') - : 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) : 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 (($.browser.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 = $(':input:enabled:visible',pageBlock); - if (opts.focusInput) - setTimeout(focus, 20); - } - else - center(lyr3[0], opts.centerX, opts.centerY); - - if (opts.timeout) { - // auto-unblock - var to = setTimeout(function() { - full ? $.unblockUI(opts) : $(el).unblock(opts); - }, opts.timeout); - $(el).data('blockUI.timeout', to); - } -}; - -// remove the block -function remove(el, opts) { - 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 - - var els; - if (full) // crazy selector to handle odd field errors in ie6/7 - els = $('body').children().filter('.blockUI').add('body > .blockUI'); - else - els = $('.blockUI', el); - - if (full) - pageBlock = pageBlockEls = null; - - if (opts.fadeOut) { - els.fadeOut(opts.fadeOut); - setTimeout(function() { reset(els,data,opts,el); }, opts.fadeOut); - } - else - reset(els, data, opts, el); -}; - -// move blocking element back into the DOM where it started -function reset(els,data,opts,el) { - 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 (typeof opts.onUnblock == 'function') - opts.onUnblock(el,opts); -}; - -// 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; - if (!full) - $el.data('blockUI.isBlocked', b); - - // don't bind events when overlay is not in use or if bindEvents is false - if (!opts.bindEvents || (b && !opts.showOverlay)) - return; - - // bind anchors and inputs for mouse and key events - var events = 'mousedown mouseup keydown keypress'; - b ? $(document).bind(events, opts, handler) : $(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.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; - } - } - } - // allow events within the message content - if ($(e.target).parents('div.blockMsg').length > 0) - return true; - - // allow events for content that is not being blocked - return $(e.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))||0; -}; - -})(jQuery); \ No newline at end of file diff --git a/redakcja/static/js/jquery.elastic.js b/redakcja/static/js/jquery.elastic.js deleted file mode 100644 index 24e16f44..00000000 --- a/redakcja/static/js/jquery.elastic.js +++ /dev/null @@ -1,6 +0,0 @@ -(function(jQuery){jQuery.fn.extend({elastic:function(){var mimics=['paddingTop','paddingRight','paddingBottom','paddingLeft','fontSize','lineHeight','fontFamily','width','fontWeight'];return this.each(function(){if(this.type!='textarea'){return false;} -var $textarea=jQuery(this),$twin=jQuery('
      ').css({'position':'absolute','display':'none','word-wrap':'break-word'}),lineHeight=parseInt($textarea.css('line-height'),10)||parseInt($textarea.css('font-size'),'10'),minheight=parseInt($textarea.css('height'),10)||lineHeight*3,maxheight=parseInt($textarea.css('max-height'),10)||Number.MAX_VALUE,goalheight=0,i=0;if(maxheight<0){maxheight=Number.MAX_VALUE;} -$twin.appendTo($textarea.parent());var i=mimics.length;while(i--){$twin.css(mimics[i].toString(),$textarea.css(mimics[i].toString()));} -function setHeightAndOverflow(height,overflow){curratedHeight=Math.floor(parseInt(height,10));if($textarea.height()!=curratedHeight){$textarea.css({'height':curratedHeight+'px','overflow':overflow});}} -function update(){var textareaContent=$textarea.val().replace(/&/g,'&').replace(/ /g,' ').replace(/<|>/g,'>').replace(/\n/g,'
      ');var twinContent=$twin.html();if(textareaContent+' '!=twinContent){$twin.html(textareaContent+' ');if(Math.abs($twin.height()+lineHeight-$textarea.height())>3){var goalheight=$twin.height()+lineHeight;if(goalheight>=maxheight){setHeightAndOverflow(maxheight,'auto');}else if(goalheight<=minheight){setHeightAndOverflow(minheight,'hidden');}else{setHeightAndOverflow(goalheight,'hidden');}}}} -$textarea.css({'overflow':'hidden'});$textarea.keyup(function(){update();});$textarea.live('input paste',function(e){setTimeout(update,250);});update();});}});})(jQuery); \ No newline at end of file diff --git a/redakcja/static/js/lib/codemirror/codemirror.js b/redakcja/static/js/lib/codemirror/codemirror.js index 8c62dab9..8475989c 100644 --- a/redakcja/static/js/lib/codemirror/codemirror.js +++ b/redakcja/static/js/lib/codemirror/codemirror.js @@ -177,8 +177,8 @@ var CodeMirror = (function(){ replaceChars: function(text, start, end) { this.editor.replaceChars(text, start, end); }, - getSearchCursor: function(string, fromCursor) { - return this.editor.getSearchCursor(string, fromCursor); + getSearchCursor: function(string, fromCursor, regexp, case_sensitive) { + return this.editor.getSearchCursor(string, fromCursor, regexp, case_sensitive); }, undo: function() {this.editor.history.undo();}, diff --git a/redakcja/static/js/lib/codemirror/editor.js b/redakcja/static/js/lib/codemirror/editor.js index f5fe8417..4eb6d099 100644 --- a/redakcja/static/js/lib/codemirror/editor.js +++ b/redakcja/static/js/lib/codemirror/editor.js @@ -223,7 +223,29 @@ var Editor = (function(){ // indicating whether anything was found, and can be called again to // skip to the next find. Use the select and replace methods to // actually do something with the found locations. - function SearchCursor(editor, string, fromCursor) { + function SearchCursor(editor, string, fromCursor, regexp, case_sensitive) { + + function casedIndexOf(hay, needle, case_sensitive) { + if (case_sensitive) + return hay.indexOf(needle); + else + return hay.toLowerCase().indexOf(needle.toLowerCase()) + } + + function casedLastIndexOf(hay, needle, case_sensitive) { + if (case_sensitive) + return hay.lastIndexOf(needle); + else + return hay.toLowerCase().lastIndexOf(needle.toLowerCase()); + } + + function casedEqual(a, b, case_sensitive) { + if (case_sensitive) + return a == b; + else + return a.toLowerCase() == b.toLowerCase(); + } + this.editor = editor; this.history = editor.history; this.history.commit(); @@ -252,7 +274,8 @@ var Editor = (function(){ // For one-line strings, searching can be done simply by calling // indexOf on the current line. function() { - var match = cleanText(self.history.textAfter(self.line).slice(self.offset)).indexOf(string); + var match = casedIndexOf(cleanText(self.history.textAfter(self.line).slice(self.offset)), + string, case_sensitive); if (match > -1) return {from: {node: self.line, offset: self.offset + match}, to: {node: self.line, offset: self.offset + match + string.length}}; @@ -262,19 +285,19 @@ var Editor = (function(){ // end of the line and the last match starts at the start. function() { var firstLine = cleanText(self.history.textAfter(self.line).slice(self.offset)); - var match = firstLine.lastIndexOf(target[0]); + var match = casedLastIndexOf(firstLine, target[0], case_sensitive); if (match == -1 || match != firstLine.length - target[0].length) return false; var startOffset = self.offset + match; var line = self.history.nodeAfter(self.line); for (var i = 1; i < target.length - 1; i++) { - if (cleanText(self.history.textAfter(line)) != target[i]) + if (!casedEqual(cleanText(self.history.textAfter(line)), target[i], case_sensitive)) return false; line = self.history.nodeAfter(line); } - if (cleanText(self.history.textAfter(line)).indexOf(target[target.length - 1]) != 0) + if (casedIndexOf(cleanText(self.history.textAfter(line)), target[target.length - 1], case_sensitive) != 0) return false; return {from: {node: self.line, offset: startOffset}, @@ -619,8 +642,8 @@ var Editor = (function(){ offset: lastLine.length}; }, - getSearchCursor: function(string, fromCursor) { - return new SearchCursor(this, string, fromCursor); + getSearchCursor: function(string, fromCursor, regexp, case_sensitive) { + return new SearchCursor(this, string, fromCursor, regexp, case_sensitive); }, // Re-indent the whole buffer diff --git a/redakcja/static/js/lib/jquery-1.4.2.min.js b/redakcja/static/js/lib/jquery-1.4.2.min.js new file mode 100644 index 00000000..7c243080 --- /dev/null +++ b/redakcja/static/js/lib/jquery-1.4.2.min.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/redakcja/static/js/lib/jquery/jquery.autocomplete.js b/redakcja/static/js/lib/jquery/jquery.autocomplete.js new file mode 100644 index 00000000..0d25ba66 --- /dev/null +++ b/redakcja/static/js/lib/jquery/jquery.autocomplete.js @@ -0,0 +1,808 @@ +/* + * jQuery Autocomplete plugin 1.1 + * + * Copyright (c) 2009 Jörn Zaefferer + * + * 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: jquery.autocomplete.js 15 2009-08-22 10:30:27Z joern.zaefferer $ + */ + +;(function($) { + +$.fn.extend({ + autocomplete: function(urlOrData, options) { + var isUrl = typeof urlOrData == "string"; + options = $.extend({}, $.Autocompleter.defaults, { + url: isUrl ? urlOrData : null, + data: isUrl ? null : urlOrData, + delay: isUrl ? $.Autocompleter.defaults.delay : 10, + max: options && !options.scroll ? 10 : 150 + }, options); + + // if highlight is set to false, replace it with a do-nothing function + options.highlight = options.highlight || function(value) { return value; }; + + // if the formatMatch option is not specified, then use formatItem for backwards compatibility + options.formatMatch = options.formatMatch || options.formatItem; + + return this.each(function() { + new $.Autocompleter(this, options); + }); + }, + result: function(handler) { + return this.bind("result", handler); + }, + search: function(handler) { + return this.trigger("search", [handler]); + }, + flushCache: function() { + return this.trigger("flushCache"); + }, + setOptions: function(options){ + return this.trigger("setOptions", [options]); + }, + unautocomplete: function() { + return this.trigger("unautocomplete"); + } +}); + +$.Autocompleter = function(input, options) { + + var KEY = { + UP: 38, + DOWN: 40, + DEL: 46, + TAB: 9, + RETURN: 13, + ESC: 27, + COMMA: 188, + PAGEUP: 33, + PAGEDOWN: 34, + BACKSPACE: 8 + }; + + // Create $ object for input element + var $input = $(input).attr("autocomplete", "off").addClass(options.inputClass); + + var timeout; + var previousValue = ""; + var cache = $.Autocompleter.Cache(options); + var hasFocus = 0; + var lastKeyPressCode; + var config = { + mouseDownOnSelect: false + }; + var select = $.Autocompleter.Select(options, input, selectCurrent, config); + + var blockSubmit; + + // prevent form submit in opera when selecting with return key + $.browser.opera && $(input.form).bind("submit.autocomplete", function() { + if (blockSubmit) { + blockSubmit = false; + return false; + } + }); + + // only opera doesn't trigger keydown multiple times while pressed, others don't work with keypress at all + $input.bind(($.browser.opera ? "keypress" : "keydown") + ".autocomplete", function(event) { + // a keypress means the input has focus + // avoids issue where input had focus before the autocomplete was applied + hasFocus = 1; + // track last key pressed + lastKeyPressCode = event.keyCode; + switch(event.keyCode) { + + case KEY.UP: + event.preventDefault(); + if ( select.visible() ) { + select.prev(); + } else { + onChange(0, true); + } + break; + + case KEY.DOWN: + event.preventDefault(); + if ( select.visible() ) { + select.next(); + } else { + onChange(0, true); + } + break; + + case KEY.PAGEUP: + event.preventDefault(); + if ( select.visible() ) { + select.pageUp(); + } else { + onChange(0, true); + } + break; + + case KEY.PAGEDOWN: + event.preventDefault(); + if ( select.visible() ) { + select.pageDown(); + } else { + onChange(0, true); + } + break; + + // matches also semicolon + case options.multiple && $.trim(options.multipleSeparator) == "," && KEY.COMMA: + case KEY.TAB: + case KEY.RETURN: + if( selectCurrent() ) { + // stop default to prevent a form submit, Opera needs special handling + event.preventDefault(); + blockSubmit = true; + return false; + } + break; + + case KEY.ESC: + select.hide(); + break; + + default: + clearTimeout(timeout); + timeout = setTimeout(onChange, options.delay); + break; + } + }).focus(function(){ + // track whether the field has focus, we shouldn't process any + // results if the field no longer has focus + hasFocus++; + }).blur(function() { + hasFocus = 0; + if (!config.mouseDownOnSelect) { + hideResults(); + } + }).click(function() { + // show select when clicking in a focused field + if ( hasFocus++ > 1 && !select.visible() ) { + onChange(0, true); + } + }).bind("search", function() { + // TODO why not just specifying both arguments? + var fn = (arguments.length > 1) ? arguments[1] : null; + function findValueCallback(q, data) { + var result; + if( data && data.length ) { + for (var i=0; i < data.length; i++) { + if( data[i].result.toLowerCase() == q.toLowerCase() ) { + result = data[i]; + break; + } + } + } + if( typeof fn == "function" ) fn(result); + else $input.trigger("result", result && [result.data, result.value]); + } + $.each(trimWords($input.val()), function(i, value) { + request(value, findValueCallback, findValueCallback); + }); + }).bind("flushCache", function() { + cache.flush(); + }).bind("setOptions", function() { + $.extend(options, arguments[1]); + // if we've updated the data, repopulate + if ( "data" in arguments[1] ) + cache.populate(); + }).bind("unautocomplete", function() { + select.unbind(); + $input.unbind(); + $(input.form).unbind(".autocomplete"); + }); + + + function selectCurrent() { + var selected = select.selected(); + if( !selected ) + return false; + + var v = selected.result; + previousValue = v; + + if ( options.multiple ) { + var words = trimWords($input.val()); + if ( words.length > 1 ) { + var seperator = options.multipleSeparator.length; + var cursorAt = $(input).selection().start; + var wordAt, progress = 0; + $.each(words, function(i, word) { + progress += word.length; + if (cursorAt <= progress) { + wordAt = i; + return false; + } + progress += seperator; + }); + words[wordAt] = v; + // TODO this should set the cursor to the right position, but it gets overriden somewhere + //$.Autocompleter.Selection(input, progress + seperator, progress + seperator); + v = words.join( options.multipleSeparator ); + } + v += options.multipleSeparator; + } + + $input.val(v); + hideResultsNow(); + $input.trigger("result", [selected.data, selected.value]); + return true; + } + + function onChange(crap, skipPrevCheck) { + if( lastKeyPressCode == KEY.DEL ) { + select.hide(); + return; + } + + var currentValue = $input.val(); + + if ( !skipPrevCheck && currentValue == previousValue ) + return; + + previousValue = currentValue; + + currentValue = lastWord(currentValue); + if ( currentValue.length >= options.minChars) { + $input.addClass(options.loadingClass); + if (!options.matchCase) + currentValue = currentValue.toLowerCase(); + request(currentValue, receiveData, hideResultsNow); + } else { + stopLoading(); + select.hide(); + } + }; + + function trimWords(value) { + if (!value) + return [""]; + if (!options.multiple) + return [$.trim(value)]; + return $.map(value.split(options.multipleSeparator), function(word) { + return $.trim(value).length ? $.trim(word) : null; + }); + } + + function lastWord(value) { + if ( !options.multiple ) + return value; + var words = trimWords(value); + if (words.length == 1) + return words[0]; + var cursorAt = $(input).selection().start; + if (cursorAt == value.length) { + words = trimWords(value) + } else { + words = trimWords(value.replace(value.substring(cursorAt), "")); + } + return words[words.length - 1]; + } + + // fills in the input box w/the first match (assumed to be the best match) + // q: the term entered + // sValue: the first matching result + function autoFill(q, sValue){ + // autofill in the complete box w/the first match as long as the user hasn't entered in more data + // if the last user key pressed was backspace, don't autofill + if( options.autoFill && (lastWord($input.val()).toLowerCase() == q.toLowerCase()) && lastKeyPressCode != KEY.BACKSPACE ) { + // fill in the value (keep the case the user has typed) + $input.val($input.val() + sValue.substring(lastWord(previousValue).length)); + // select the portion of the value not typed by the user (so the next character will erase) + $(input).selection(previousValue.length, previousValue.length + sValue.length); + } + }; + + function hideResults() { + clearTimeout(timeout); + timeout = setTimeout(hideResultsNow, 200); + }; + + function hideResultsNow() { + var wasVisible = select.visible(); + select.hide(); + clearTimeout(timeout); + stopLoading(); + if (options.mustMatch) { + // call search and run callback + $input.search( + function (result){ + // if no value found, clear the input box + if( !result ) { + if (options.multiple) { + var words = trimWords($input.val()).slice(0, -1); + $input.val( words.join(options.multipleSeparator) + (words.length ? options.multipleSeparator : "") ); + } + else { + $input.val( "" ); + $input.trigger("result", null); + } + } + } + ); + } + }; + + function receiveData(q, data) { + if ( data && data.length && hasFocus ) { + stopLoading(); + select.display(data, q); + autoFill(q, data[0].value); + select.show(); + } else { + hideResultsNow(); + } + }; + + function request(term, success, failure) { + if (!options.matchCase) + term = term.toLowerCase(); + var data = cache.load(term); + // recieve the cached data + if (data && data.length) { + success(term, data); + // if an AJAX url has been supplied, try loading the data now + } else if( (typeof options.url == "string") && (options.url.length > 0) ){ + + var extraParams = { + timestamp: +new Date() + }; + $.each(options.extraParams, function(key, param) { + extraParams[key] = typeof param == "function" ? param() : param; + }); + + $.ajax({ + // try to leverage ajaxQueue plugin to abort previous requests + mode: "abort", + // limit abortion to this input + port: "autocomplete" + input.name, + dataType: options.dataType, + url: options.url, + data: $.extend({ + q: lastWord(term), + limit: options.max + }, extraParams), + success: function(data) { + var parsed = options.parse && options.parse(data) || parse(data); + cache.add(term, parsed); + success(term, parsed); + } + }); + } else { + // if we have a failure, we need to empty the list -- this prevents the the [TAB] key from selecting the last successful match + select.emptyList(); + failure(term); + } + }; + + function parse(data) { + var parsed = []; + var rows = data.split("\n"); + for (var i=0; i < rows.length; i++) { + var row = $.trim(rows[i]); + if (row) { + row = row.split("|"); + parsed[parsed.length] = { + data: row, + value: row[0], + result: options.formatResult && options.formatResult(row, row[0]) || row[0] + }; + } + } + return parsed; + }; + + function stopLoading() { + $input.removeClass(options.loadingClass); + }; + +}; + +$.Autocompleter.defaults = { + inputClass: "ac_input", + resultsClass: "ac_results", + loadingClass: "ac_loading", + minChars: 1, + delay: 400, + matchCase: false, + matchSubset: true, + matchContains: false, + cacheLength: 10, + max: 100, + mustMatch: false, + extraParams: {}, + selectFirst: true, + formatItem: function(row) { return row[0]; }, + formatMatch: null, + autoFill: false, + width: 0, + multiple: false, + multipleSeparator: ", ", + highlight: function(value, term) { + return value.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + term.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi, "\\$1") + ")(?![^<>]*>)(?![^&;]+;)", "gi"), "$1"); + }, + scroll: true, + scrollHeight: 180 +}; + +$.Autocompleter.Cache = function(options) { + + var data = {}; + var length = 0; + + function matchSubset(s, sub) { + if (!options.matchCase) + s = s.toLowerCase(); + var i = s.indexOf(sub); + if (options.matchContains == "word"){ + i = s.toLowerCase().search("\\b" + sub.toLowerCase()); + } + if (i == -1) return false; + return i == 0 || options.matchContains; + }; + + function add(q, value) { + if (length > options.cacheLength){ + flush(); + } + if (!data[q]){ + length++; + } + data[q] = value; + } + + function populate(){ + if( !options.data ) return false; + // track the matches + var stMatchSets = {}, + nullData = 0; + + // no url was specified, we need to adjust the cache length to make sure it fits the local data store + if( !options.url ) options.cacheLength = 1; + + // track all options for minChars = 0 + stMatchSets[""] = []; + + // loop through the array and create a lookup structure + for ( var i = 0, ol = options.data.length; i < ol; i++ ) { + var rawValue = options.data[i]; + // if rawValue is a string, make an array otherwise just reference the array + rawValue = (typeof rawValue == "string") ? [rawValue] : rawValue; + + var value = options.formatMatch(rawValue, i+1, options.data.length); + if ( value === false ) + continue; + + var firstChar = value.charAt(0).toLowerCase(); + // if no lookup array for this character exists, look it up now + if( !stMatchSets[firstChar] ) + stMatchSets[firstChar] = []; + + // if the match is a string + var row = { + value: value, + data: rawValue, + result: options.formatResult && options.formatResult(rawValue) || value + }; + + // push the current match into the set list + stMatchSets[firstChar].push(row); + + // keep track of minChars zero items + if ( nullData++ < options.max ) { + stMatchSets[""].push(row); + } + }; + + // add the data items to the cache + $.each(stMatchSets, function(i, value) { + // increase the cache size + options.cacheLength++; + // add to the cache + add(i, value); + }); + } + + // populate any existing data + setTimeout(populate, 25); + + function flush(){ + data = {}; + length = 0; + } + + return { + flush: flush, + add: add, + populate: populate, + load: function(q) { + if (!options.cacheLength || !length) + return null; + /* + * if dealing w/local data and matchContains than we must make sure + * to loop through all the data collections looking for matches + */ + if( !options.url && options.matchContains ){ + // track all matches + var csub = []; + // loop through all the data grids for matches + for( var k in data ){ + // don't search through the stMatchSets[""] (minChars: 0) cache + // this prevents duplicates + if( k.length > 0 ){ + var c = data[k]; + $.each(c, function(i, x) { + // if we've got a match, add it to the array + if (matchSubset(x.value, q)) { + csub.push(x); + } + }); + } + } + return csub; + } else + // if the exact item exists, use it + if (data[q]){ + return data[q]; + } else + if (options.matchSubset) { + for (var i = q.length - 1; i >= options.minChars; i--) { + var c = data[q.substr(0, i)]; + if (c) { + var csub = []; + $.each(c, function(i, x) { + if (matchSubset(x.value, q)) { + csub[csub.length] = x; + } + }); + return csub; + } + } + } + return null; + } + }; +}; + +$.Autocompleter.Select = function (options, input, select, config) { + var CLASSES = { + ACTIVE: "ac_over" + }; + + var listItems, + active = -1, + data, + term = "", + needsInit = true, + element, + list; + + // Create results + function init() { + if (!needsInit) + return; + element = $("
      ") + .hide() + .addClass(options.resultsClass) + .css("position", "absolute") + .appendTo(document.body); + + list = $("
        ").appendTo(element).mouseover( function(event) { + if(target(event).nodeName && target(event).nodeName.toUpperCase() == 'LI') { + active = $("li", list).removeClass(CLASSES.ACTIVE).index(target(event)); + $(target(event)).addClass(CLASSES.ACTIVE); + } + }).click(function(event) { + $(target(event)).addClass(CLASSES.ACTIVE); + select(); + // TODO provide option to avoid setting focus again after selection? useful for cleanup-on-focus + input.focus(); + return false; + }).mousedown(function() { + config.mouseDownOnSelect = true; + }).mouseup(function() { + config.mouseDownOnSelect = false; + }); + + if( options.width > 0 ) + element.css("width", options.width); + + needsInit = false; + } + + function target(event) { + var element = event.target; + while(element && element.tagName != "LI") + element = element.parentNode; + // more fun with IE, sometimes event.target is empty, just ignore it then + if(!element) + return []; + return element; + } + + function moveSelect(step) { + listItems.slice(active, active + 1).removeClass(CLASSES.ACTIVE); + movePosition(step); + var activeItem = listItems.slice(active, active + 1).addClass(CLASSES.ACTIVE); + if(options.scroll) { + var offset = 0; + listItems.slice(0, active).each(function() { + offset += this.offsetHeight; + }); + if((offset + activeItem[0].offsetHeight - list.scrollTop()) > list[0].clientHeight) { + list.scrollTop(offset + activeItem[0].offsetHeight - list.innerHeight()); + } else if(offset < list.scrollTop()) { + list.scrollTop(offset); + } + } + }; + + function movePosition(step) { + active += step; + if (active < 0) { + active = listItems.size() - 1; + } else if (active >= listItems.size()) { + active = 0; + } + } + + function limitNumberOfItems(available) { + return options.max && options.max < available + ? options.max + : available; + } + + function fillList() { + list.empty(); + var max = limitNumberOfItems(data.length); + for (var i=0; i < max; i++) { + if (!data[i]) + continue; + var formatted = options.formatItem(data[i].data, i+1, max, data[i].value, term); + if ( formatted === false ) + continue; + var li = $("
      • ").html( options.highlight(formatted, term) ).addClass(i%2 == 0 ? "ac_even" : "ac_odd").appendTo(list)[0]; + $.data(li, "ac_data", data[i]); + } + listItems = list.find("li"); + if ( options.selectFirst ) { + listItems.slice(0, 1).addClass(CLASSES.ACTIVE); + active = 0; + } + // apply bgiframe if available + if ( $.fn.bgiframe ) + list.bgiframe(); + } + + return { + display: function(d, q) { + init(); + data = d; + term = q; + fillList(); + }, + next: function() { + moveSelect(1); + }, + prev: function() { + moveSelect(-1); + }, + pageUp: function() { + if (active != 0 && active - 8 < 0) { + moveSelect( -active ); + } else { + moveSelect(-8); + } + }, + pageDown: function() { + if (active != listItems.size() - 1 && active + 8 > listItems.size()) { + moveSelect( listItems.size() - 1 - active ); + } else { + moveSelect(8); + } + }, + hide: function() { + element && element.hide(); + listItems && listItems.removeClass(CLASSES.ACTIVE); + active = -1; + }, + visible : function() { + return element && element.is(":visible"); + }, + current: function() { + return this.visible() && (listItems.filter("." + CLASSES.ACTIVE)[0] || options.selectFirst && listItems[0]); + }, + show: function() { + var offset = $(input).offset(); + element.css({ + width: typeof options.width == "string" || options.width > 0 ? options.width : $(input).width(), + top: offset.top + input.offsetHeight, + left: offset.left + }).show(); + if(options.scroll) { + list.scrollTop(0); + list.css({ + maxHeight: options.scrollHeight, + overflow: 'auto' + }); + + if($.browser.msie && typeof document.body.style.maxHeight === "undefined") { + var listHeight = 0; + listItems.each(function() { + listHeight += this.offsetHeight; + }); + var scrollbarsVisible = listHeight > options.scrollHeight; + list.css('height', scrollbarsVisible ? options.scrollHeight : listHeight ); + if (!scrollbarsVisible) { + // IE doesn't recalculate width when scrollbar disappears + listItems.width( list.width() - parseInt(listItems.css("padding-left")) - parseInt(listItems.css("padding-right")) ); + } + } + + } + }, + selected: function() { + var selected = listItems && listItems.filter("." + CLASSES.ACTIVE).removeClass(CLASSES.ACTIVE); + return selected && selected.length && $.data(selected[0], "ac_data"); + }, + emptyList: function (){ + list && list.empty(); + }, + unbind: function() { + element && element.remove(); + } + }; +}; + +$.fn.selection = function(start, end) { + if (start !== undefined) { + return this.each(function() { + if( this.createTextRange ){ + var selRange = this.createTextRange(); + if (end === undefined || start == end) { + selRange.move("character", start); + selRange.select(); + } else { + selRange.collapse(true); + selRange.moveStart("character", start); + selRange.moveEnd("character", end); + selRange.select(); + } + } else if( this.setSelectionRange ){ + this.setSelectionRange(start, end); + } else if( this.selectionStart ){ + this.selectionStart = start; + this.selectionEnd = end; + } + }); + } + var field = this[0]; + if ( field.createTextRange ) { + var range = document.selection.createRange(), + orig = field.value, + teststring = "<->", + textLength = range.text.length; + range.text = teststring; + var caretAt = field.value.indexOf(teststring); + field.value = orig; + this.selection(caretAt, caretAt + textLength); + return { + start: caretAt, + end: caretAt + textLength + } + } else if( field.selectionStart !== undefined ){ + return { + start: field.selectionStart, + end: field.selectionEnd + } + } +}; + +})(jQuery); \ No newline at end of file diff --git a/redakcja/static/js/lib/jquery/jquery.blockui.js b/redakcja/static/js/lib/jquery/jquery.blockui.js new file mode 100644 index 00000000..54916670 --- /dev/null +++ b/redakcja/static/js/lib/jquery/jquery.blockui.js @@ -0,0 +1,477 @@ +/*! + * jQuery blockUI plugin + * Version 2.31 (06-JAN-2010) + * @requires jQuery v1.2.3 or later + * + * Examples at: http://malsup.com/jquery/block/ + * Copyright (c) 2007-2008 M. Alsup + * Dual licensed under the MIT and GPL licenses: + * http://www.opensource.org/licenses/mit-license.php + * http://www.gnu.org/licenses/gpl.html + * + * Thanks to Amir-Hossein Sobhi for some excellent contributions! + */ + +;(function($) { + +if (/1\.(0|1|2)\.(0|1|2)/.test($.fn.jquery) || /^1.1/.test($.fn.jquery)) { + alert('blockUI requires jQuery v1.2.3 or later! You are using v' + $.fn.jquery); + return; +} + +$.fn._fadeIn = $.fn.fadeIn; + +var noOp = function() {}; + +// this bit is to ensure we don't call setExpression when we shouldn't (with extra muscle to handle +// retarded userAgent strings on Vista) +var mode = document.documentMode || 0; +var setExpr = $.browser.msie && (($.browser.version < 8 && !mode) || mode < 8); +var ie6 = $.browser.msie && /MSIE 6.0/.test(navigator.userAgent) && !mode; + +// global $ methods for blocking/unblocking the entire page +$.blockUI = function(opts) { install(window, opts); }; +$.unblockUI = function(opts) { remove(window, opts); }; + +// convenience method for quick growl-like notifications (http://www.google.com/search?q=growl) +$.growlUI = function(title, message, timeout, onClose) { + var $m = $('
        '); + if (title) $m.append('

        '+title+'

        '); + if (message) $m.append('

        '+message+'

        '); + if (timeout == undefined) timeout = 3000; + $.blockUI({ + message: $m, fadeIn: 700, fadeOut: 1000, centerY: false, + timeout: timeout, showOverlay: false, + onUnblock: onClose, + css: $.blockUI.defaults.growlCSS + }); +}; + +// plugin method for blocking element content +$.fn.block = function(opts) { + return this.unblock({ fadeOut: 0 }).each(function() { + if ($.css(this,'position') == 'static') + this.style.position = 'relative'; + if ($.browser.msie) + this.style.zoom = 1; // force 'hasLayout' + install(this, opts); + }); +}; + +// plugin method for unblocking element content +$.fn.unblock = function(opts) { + return this.each(function() { + remove(this, opts); + }); +}; + +$.blockUI.version = 2.31; // 2nd generation blocking at no extra cost! + +// override these in your code to change the default behavior and style +$.blockUI.defaults = { + // message displayed when blocking (use null for no message) + message: '

        Please wait...

        ', + + title: null, // title string; only used when theme == true + draggable: true, // only used when theme == true (requires jquery-ui.js to be loaded) + + theme: false, // set to true to use with jQuery UI themes + + // styles for the message when blocking; if you wish to disable + // these and use an external stylesheet then do this in your code: + // $.blockUI.defaults.css = {}; + css: { + padding: 0, + margin: 0, + width: '30%', + top: '40%', + left: '35%', + textAlign: 'center', + color: '#000', + border: '3px solid #aaa', + backgroundColor:'#fff', + cursor: 'wait' + }, + + // minimal style set used when themes are used + themedCSS: { + width: '30%', + top: '40%', + left: '35%' + }, + + // styles for the overlay + overlayCSS: { + backgroundColor: '#000', + opacity: 0.6, + cursor: 'wait' + }, + + // styles applied when using $.growlUI + growlCSS: { + width: '350px', + top: '10px', + left: '', + right: '10px', + border: 'none', + padding: '5px', + opacity: 0.6, + cursor: 'default', + color: '#fff', + backgroundColor: '#000', + '-webkit-border-radius': '10px', + '-moz-border-radius': '10px' + }, + + // IE issues: 'about:blank' fails on HTTPS and javascript:false is s-l-o-w + // (hat tip to Jorge H. N. de Vasconcelos) + iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank', + + // force usage of iframe in non-IE browsers (handy for blocking applets) + forceIframe: false, + + // z-index for the blocking overlay + baseZ: 1000, + + // set these to true to have the message automatically centered + centerX: true, // <-- only effects element blocking (page block controlled via css above) + centerY: true, + + // allow body element to be stetched in ie6; this makes blocking look better + // on "short" pages. disable if you wish to prevent changes to the body height + allowBodyStretch: true, + + // enable if you want key and mouse events to be disabled for content that is blocked + bindEvents: true, + + // be default blockUI will supress tab navigation from leaving blocking content + // (if bindEvents is true) + constrainTabKey: true, + + // fadeIn time in millis; set to 0 to disable fadeIn on block + fadeIn: 200, + + // fadeOut time in millis; set to 0 to disable fadeOut on unblock + fadeOut: 400, + + // time in millis to wait before auto-unblocking; set to 0 to disable auto-unblock + timeout: 0, + + // disable if you don't want to show the overlay + showOverlay: true, + + // if true, focus will be placed in the first available input field when + // page blocking + focusInput: true, + + // suppresses the use of overlay styles on FF/Linux (due to performance issues with opacity) + applyPlatformOpacityRules: true, + + // callback method invoked when fadeIn has completed and blocking message is visible + onBlock: null, + + // callback method invoked when unblocking has completed; the callback is + // passed the element that has been unblocked (which is the window object for page + // blocks) and the options that were passed to the unblock call: + // onUnblock(element, options) + onUnblock: null, + + // don't ask; if you really must know: http://groups.google.com/group/jquery-en/browse_thread/thread/36640a8730503595/2f6a79a77a78e493#2f6a79a77a78e493 + quirksmodeOffsetHack: 4 +}; + +// private data and functions follow... + +var pageBlock = null; +var pageBlockEls = []; + +function install(el, opts) { + var full = (el == window); + var msg = opts && opts.message !== undefined ? opts.message : undefined; + opts = $.extend({}, $.blockUI.defaults, opts || {}); + opts.overlayCSS = $.extend({}, $.blockUI.defaults.overlayCSS, opts.overlayCSS || {}); + var css = $.extend({}, $.blockUI.defaults.css, opts.css || {}); + var themedCSS = $.extend({}, $.blockUI.defaults.themedCSS, opts.themedCSS || {}); + msg = msg === undefined ? opts.message : msg; + + // remove the current block (if there is one) + if (full && pageBlock) + remove(window, {fadeOut:0}); + + // if an existing element is being used as the blocking content then we capture + // its current place in the DOM (and current display style) so we can restore + // it when we unblock + if (msg && typeof msg != 'string' && (msg.parentNode || msg.jquery)) { + var node = msg.jquery ? msg[0] : msg; + var data = {}; + $(el).data('blockUI.history', data); + data.el = node; + data.parent = node.parentNode; + data.display = node.style.display; + data.position = node.style.position; + if (data.parent) + data.parent.removeChild(node); + } + + var z = opts.baseZ; + + // blockUI uses 3 layers for blocking, for simplicity they are all used on every platform; + // layer1 is the iframe layer which is used to supress bleed through of underlying content + // layer2 is the overlay layer which has opacity and a wait cursor (by default) + // layer3 is the message content that is displayed while blocking + + var lyr1 = ($.browser.msie || opts.forceIframe) + ? $('') + : $(''); + var lyr2 = $(''); + + var lyr3; + if (opts.theme && full) { + var s = ''; + lyr3 = $(s); + } + else { + lyr3 = full ? $('') + : $(''); + } + + // 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.applyPlatformOpacityRules || !($.browser.mozilla && /Linux/.test(navigator.platform))) + lyr2.css(opts.overlayCSS); + lyr2.css('position', full ? 'fixed' : 'absolute'); + + // make iframe layer transparent in IE + if ($.browser.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 && (!$.boxModel || $('object,embed', full ? null : el).length > 0); + if (ie6 || expr) { + // give body 100% height + if (full && opts.allowBodyStretch && $.boxModel) + $('html,body').css('height','100%'); + + // fix ie6 issue when blocked element has a border width + if ((ie6 || !$.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([lyr1,lyr2,lyr3], function(i,o) { + var s = o[0].style; + s.position = 'absolute'; + if (i < 2) { + full ? s.setExpression('height','Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.boxModel?0:'+opts.quirksmodeOffsetHack+') + "px"') + : s.setExpression('height','this.parentNode.offsetHeight + "px"'); + full ? s.setExpression('width','jQuery.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"') + : 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) : 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 (($.browser.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 = $(':input:enabled:visible',pageBlock); + if (opts.focusInput) + setTimeout(focus, 20); + } + else + center(lyr3[0], opts.centerX, opts.centerY); + + if (opts.timeout) { + // auto-unblock + var to = setTimeout(function() { + full ? $.unblockUI(opts) : $(el).unblock(opts); + }, opts.timeout); + $(el).data('blockUI.timeout', to); + } +}; + +// remove the block +function remove(el, opts) { + 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 + + var els; + if (full) // crazy selector to handle odd field errors in ie6/7 + els = $('body').children().filter('.blockUI').add('body > .blockUI'); + else + els = $('.blockUI', el); + + if (full) + pageBlock = pageBlockEls = null; + + if (opts.fadeOut) { + els.fadeOut(opts.fadeOut); + setTimeout(function() { reset(els,data,opts,el); }, opts.fadeOut); + } + else + reset(els, data, opts, el); +}; + +// move blocking element back into the DOM where it started +function reset(els,data,opts,el) { + 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 (typeof opts.onUnblock == 'function') + opts.onUnblock(el,opts); +}; + +// 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; + if (!full) + $el.data('blockUI.isBlocked', b); + + // don't bind events when overlay is not in use or if bindEvents is false + if (!opts.bindEvents || (b && !opts.showOverlay)) + return; + + // bind anchors and inputs for mouse and key events + var events = 'mousedown mouseup keydown keypress'; + b ? $(document).bind(events, opts, handler) : $(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.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; + } + } + } + // allow events within the message content + if ($(e.target).parents('div.blockMsg').length > 0) + return true; + + // allow events for content that is not being blocked + return $(e.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))||0; +}; + +})(jQuery); \ No newline at end of file diff --git a/redakcja/static/js/lib/jquery/jquery.elastic.js b/redakcja/static/js/lib/jquery/jquery.elastic.js new file mode 100644 index 00000000..24e16f44 --- /dev/null +++ b/redakcja/static/js/lib/jquery/jquery.elastic.js @@ -0,0 +1,6 @@ +(function(jQuery){jQuery.fn.extend({elastic:function(){var mimics=['paddingTop','paddingRight','paddingBottom','paddingLeft','fontSize','lineHeight','fontFamily','width','fontWeight'];return this.each(function(){if(this.type!='textarea'){return false;} +var $textarea=jQuery(this),$twin=jQuery('
        ').css({'position':'absolute','display':'none','word-wrap':'break-word'}),lineHeight=parseInt($textarea.css('line-height'),10)||parseInt($textarea.css('font-size'),'10'),minheight=parseInt($textarea.css('height'),10)||lineHeight*3,maxheight=parseInt($textarea.css('max-height'),10)||Number.MAX_VALUE,goalheight=0,i=0;if(maxheight<0){maxheight=Number.MAX_VALUE;} +$twin.appendTo($textarea.parent());var i=mimics.length;while(i--){$twin.css(mimics[i].toString(),$textarea.css(mimics[i].toString()));} +function setHeightAndOverflow(height,overflow){curratedHeight=Math.floor(parseInt(height,10));if($textarea.height()!=curratedHeight){$textarea.css({'height':curratedHeight+'px','overflow':overflow});}} +function update(){var textareaContent=$textarea.val().replace(/&/g,'&').replace(/ /g,' ').replace(/<|>/g,'>').replace(/\n/g,'
        ');var twinContent=$twin.html();if(textareaContent+' '!=twinContent){$twin.html(textareaContent+' ');if(Math.abs($twin.height()+lineHeight-$textarea.height())>3){var goalheight=$twin.height()+lineHeight;if(goalheight>=maxheight){setHeightAndOverflow(maxheight,'auto');}else if(goalheight<=minheight){setHeightAndOverflow(minheight,'hidden');}else{setHeightAndOverflow(goalheight,'hidden');}}}} +$textarea.css({'overflow':'hidden'});$textarea.keyup(function(){update();});$textarea.live('input paste',function(e){setTimeout(update,250);});update();});}});})(jQuery); \ No newline at end of file diff --git a/redakcja/static/js/wiki/base.js b/redakcja/static/js/wiki/base.js index 61a3949b..de1d8e5d 100644 --- a/redakcja/static/js/wiki/base.js +++ b/redakcja/static/js/wiki/base.js @@ -111,7 +111,7 @@ if($tab.length != 1) $tab = $(DEFAULT_PERSPECTIVE); - var $old = $('#tabs li').filter('.active'); + var $old = $tab.closest('.tabs').find('.active'); $old.each(function(){ $(this).removeClass('active'); diff --git a/redakcja/static/js/wiki/dialog_save.js b/redakcja/static/js/wiki/dialog_save.js index 916f3260..aa9258d5 100644 --- a/redakcja/static/js/wiki/dialog_save.js +++ b/redakcja/static/js/wiki/dialog_save.js @@ -28,9 +28,10 @@ var self = this; self.$elem.block({ - message: "Zapisywanie...", + message: "Zapisywanie...
        ", fadeIn: 0, }); + $.wiki.blocking = self.$elem; try { diff --git a/redakcja/static/js/wiki/loader.js b/redakcja/static/js/wiki/loader.js index a4414027..58a12e1c 100644 --- a/redakcja/static/js/wiki/loader.js +++ b/redakcja/static/js/wiki/loader.js @@ -7,10 +7,6 @@ if (!window.console) { var DEFAULT_PERSPECTIVE = "#SummaryPerspective"; -THEMES = [ - 'Alkohol', 'Ambicja', 'Anioł', 'Antysemityzm', 'Arkadia', 'Artysta', 'Bezdomność', 'Bezpieczeństwo', 'Bieda', 'Bijatyka', 'Błazen', 'Błądzenie', 'Błoto', 'Bogactwo', 'Bóg', 'Brat', 'Bunt', 'Buntownik', 'Burza', 'Car', 'Carpe diem', 'Ciemność', 'Cień', 'Cisza', 'Chciwość', 'Chleb', 'Chłop', 'Choroba', 'Chrystus', 'Chrzest', 'Ciało', 'Cierpienie', 'Cmentarz', 'Cnota', 'Córka', 'Cud', 'Czarownika', 'Czary', 'Czas', 'Czyn', 'Czyściec', 'Dama', 'Danse macabre', 'Deszcz', 'Diabeł', 'Dobro', 'Dom', 'Dorosłość', 'Drzewo', 'Duch', 'Dusza', 'Duma', 'Dworek', 'Dworzanin', 'Dwór', 'Dzieciństwo', 'Dziecko', 'Dziedzictwo', 'Dziewictwo', 'Dźwięk', 'Egzorcyzm', 'Elita', 'Emigrant', 'Fałsz', 'Filozof', 'Fircyk', 'Flirt', 'Głupiec', 'Głupota', 'Głód', 'Gospodarz', 'Gospodyni', 'Gość', 'Gotycyzm', 'Góra', 'Gra', 'Grób', 'Grzech', 'Grzeczność', 'Gwiazda', 'Handel', 'Hańba', 'Historia', 'Honor', 'Idealista', 'Imię', 'Interes', 'Jabłka', 'Jedzenie', 'Jesień', 'Kaleka', 'Kara', 'Karczma', 'Klęska', 'Kłamstwo', 'Kłótnia', 'Kobieta', 'Kobieta demoniczna', 'Kobieta "upadła"', 'Kochanek', 'Kochanek romantyczny', 'Kolonializm', 'Kondycja ludzka', 'Konflikt', 'Konflikt wewnętrzny', 'Koniec świata', 'Koń', 'Korzyść', 'Kot', 'Kradzież', 'Krew', 'Król', 'Krzywda', 'Ksiądz', 'Książka', 'Księżyc', 'Kuchnia', 'Kuszenie', 'Kwiaty', 'Labirynt', 'Las', 'Lato', 'Lekarz', 'Lenistwo', 'List', 'Liberat', 'Los', 'Lud', 'Lustro', 'Łzy', 'Małżeństwo', 'Marzenie', 'Maska', 'Maszyna', 'Matka', 'Matka Boska', 'Mądrość', 'Mąż', 'Melancholia', 'Mędrzec', 'Mężczyzna', 'Miasto', 'Mieszczanin', 'Miłosierdzie', 'Miłość', 'Miłość niespełniona', 'Miłość platoniczna', 'Miłość romantyczna', 'Miłość silniejsza niż śmierć', 'Miłość spełniona', 'Miłość tragiczna', 'Mizoginia', 'Młodość', 'Moda', 'Modlitwa', 'Morderstwo', 'Morze', 'Motyl', 'Mucha', 'Muzyka', 'Narodziny', 'Naród', 'Natura', 'Nauczyciel', 'Nauczycielka', 'Nauka', 'Niebezpieczeństwo', 'Niedziela', 'Niemiec', 'Nienawiść', 'Nieśmiertelność', 'Niewola', 'Noc', 'Nuda', 'Obcy', 'Obłok', 'Obowiązek', 'Obraz świata', 'Obrzędy', 'Obyczaje', 'Obywatel', 'Odrodzenie przez grób', 'Odwaga', 'Ofiara', 'Ogień', 'Ogród', 'Ojciec', 'Ojczyzna', 'Oko', 'Okręt', 'Okrucieństwo', 'Omen', 'Opieka', 'Organizm', 'Otchłań', 'Pająk', 'Pamięć', 'Pan', 'Panna młoda', 'Państwo', 'Patriota', 'Piekło', 'Pielgrzym', 'Pieniądz', 'Pies', 'Piętno', 'Pijaństwo', 'Piwnica', 'Plotka', 'Pobożność', 'Pocałunek', 'Pochlebstwo', 'Poeta', 'Poetka', 'Poezja', 'Podróż', 'Podstęp', 'Pogrzeb', 'Pojedynek', 'Pokora', 'Pokusa', 'Polak', 'Polityka', 'Polowanie', 'Polska', 'Portret', 'Porwanie', 'Poświęcenie', 'Potwór', 'Powstanie', 'Powstaniec', 'Pozory', 'Pozycja społeczna', 'Pożar', 'Pożądanie', 'Praca', 'Praca u podstaw', 'Praca organiczna', 'Prawda', 'Prawnik', 'Prometeusz', 'Proroctwo', 'Prorok', 'Próżność', 'Przebranie', 'Przeczucie', 'Przedmurze chrześcijaństwa', 'Przekleństwo', 'Przekupstwo', 'Przemiana', 'Przemijanie', 'Przemoc', 'Przestrzeń', 'Przyjaźń', 'Przyroda nieożywiona', 'Przysięga', 'Przywódca', 'Ptak', 'Pustynia', 'Pycha', 'Raj', 'Realista', 'Religia', 'Rewolucja', 'Robak', 'Robotnik', 'Rodzina', 'Rosja', 'Rosjanin', 'Rośliny', 'Rozczarowanie', 'Rozpacz', 'Rozstanie', 'Rozum', 'Ruiny', 'Rycerz', 'Rzeka', 'Salon', 'Samobójstwo', 'Samolubstwo', 'Samotnik', 'Samotność', 'Sarmata', 'Sąsiad', 'Sąd', 'Sąd Ostateczny', 'Sen', 'Serce', 'Sędzia', 'Sielanka', 'Sierota', 'Siła', 'Siostra', 'Sława', 'Słońce', 'Słowo', 'Sługa', 'Służalczość', 'Skąpiec', 'Sobowtór', 'Społecznik', 'Spowiedź', 'Sprawiedliwość', 'Starość', 'Strach', 'Strój', 'Stworzenie', 'Sumienie', 'Swaty', 'Syberia', 'Syn', 'Syn marnotrawny', 'Syzyf', 'Szaleniec', 'Szaleństwo', 'Szantaż', 'Szatan', 'Szczęście', 'Szkoła', 'Szlachcic', 'Szpieg', 'Sztuka', 'Ślub', 'Śmiech', 'Śmierć', 'Śmierć bohaterska', 'Śpiew', 'Światło', 'Świętoszek', 'Święty', 'Świt', 'Tajemnica', 'Taniec', 'Tchórzostwo', 'Teatr', 'Testament', 'Tęsknota', 'Theatrum mundi', 'Tłum', 'Trucizna', 'Trup', 'Twórczość', 'Uczeń', 'Uczta', 'Uroda', 'Umiarkowanie', 'Upadek', 'Upiór', 'Urzędnik', 'Vanitas', 'Walka', 'Walka klas', 'Wampir', 'Warszawa', 'Wąż', 'Wdowa', 'Wdowiec', 'Wesele', 'Wiatr', 'Wierność', 'Wierzenia', 'Wieś', 'Wiedza', 'Wieża Babel', 'Więzienie', 'Więzień', 'Wina', 'Wino', 'Wiosna', 'Wizja', 'Władza', 'Własność', 'Woda', 'Wojna', 'Wojna pokoleń', 'Wolność', 'Wróg', 'Wspomnienia', 'Współpraca', 'Wygnanie', 'Wyrzuty sumienia', 'Wyspa', 'Wzrok', 'Zabawa', 'Zabobony', 'Zamek', 'Zaręczyny', 'Zaświaty', 'Zazdrość', 'Zbawienie', 'Zbrodnia', 'Zbrodniarz', 'Zdrada', 'Zdrowie', 'Zemsta', 'Zesłaniec', 'Ziarno', 'Ziemia', 'Zima', 'Zło', 'Złodziej', 'Złoty wiek', 'Zmartwychwstanie', 'Zwątpienie', 'Zwierzęta', 'Zwycięstwo', 'Żałoba', 'Żebrak', 'Żołnierz', 'Żona', 'Życie jako wędrówka', 'Życie snem', 'Żyd', 'Żywioły', 'Oświadczyny' -]; - $(function() { var tabs = $('ol#tabs li'); @@ -40,7 +36,7 @@ $(function() /* * TABS */ - $('#tabs li').live('click', function(event, callback) { + $('.tabs li').live('click', function(event, callback) { $.wiki.switchToTab(this); }); @@ -66,19 +62,19 @@ $(function() $('.vsplitbar').toggle( function() { $.wiki.state.perspectives.ScanGalleryPerspective.show = true; - $('#side-gallery').show(); - $('.vsplitbar').css('right', 480).addClass('.active'); + $('#sidebar').show(); + $('.vsplitbar').css('right', 480).addClass('active'); $('#editor .editor').css('right', 510); $(window).resize(); - gallery.onEnter(); + $.wiki.perspectiveForTab('#tabs-right .active').onEnter(); }, function() { $.wiki.state.perspectives.ScanGalleryPerspective.show = false; - $('#side-gallery').hide(); + $('#sidebar').hide(); $('.vsplitbar').css('right', 0).removeClass('active'); $('#editor .editor').css('right', 30); $(window).resize(); - gallery.onExit(); + $.wiki.perspectiveForTab('#tabs-right .active').onExit(); } ); @@ -141,6 +137,6 @@ $(function() /* * Initialize all perspectives */ - initAll( $.makeArray($('ol#tabs li')), initialize); + initAll( $.makeArray($('.tabs li')), initialize); console.log(location.hash); }); diff --git a/redakcja/static/js/wiki/toolbar.js b/redakcja/static/js/wiki/toolbar.js new file mode 100644 index 00000000..3eafdae6 --- /dev/null +++ b/redakcja/static/js/wiki/toolbar.js @@ -0,0 +1,60 @@ +/* + * Toolbar plugin. + */ +(function($) { + + $.fn.toolbarize = function(options) { + var $toolbar = $(this); + var $container = $('.button_group_container', $toolbar); + + $('.button_group button', $toolbar).click(function(event){ + event.preventDefault(); + + var params = eval("(" + $(this).attr('data-ui-action-params') + ")"); + + scriptletCenter.callInteractive({ + action: $(this).attr('data-ui-action'), + context: options.actionContext, + extra: params + }); + }); + + $toolbar.children().filter('select').change(function(event){ + var slug = $(this).val(); + $container.scrollLeft(0); + $('*[data-group]').hide().filter('[data-group=' + slug + ']').show(); + }).change(); + + $('button.next', $toolbar).click(function() { + var $current_group = $('.button_group:visible', $toolbar); + var scroll = $container.scrollLeft(); + + var $hidden = $("li", $current_group).filter(function() { + return ($(this).position().left + $(this).outerWidth()) > $container.width(); + }).first(); + + if($hidden.length > 0) { + scroll = $hidden.position().left + scroll + $hidden.outerWidth() - $container.width() + 1; + $container.scrollLeft(scroll); + }; + }); + + $('button.prev', $toolbar).click(function() { + var $current_group = $('.button_group:visible', $toolbar); + var scroll = $container.scrollLeft(); + + /* first not visible element is: */ + var $hidden = $("li", $current_group).filter(function() { + return $(this).position().left < 0; + }).last(); + + if( $hidden.length > 0) + { + scroll = scroll + $hidden.position().left; + $container.scrollLeft(scroll); + }; + }); + + }; + +})(jQuery); \ No newline at end of file diff --git a/redakcja/static/js/wiki/view_editor_source.js b/redakcja/static/js/wiki/view_editor_source.js index a0a2e69a..0597140d 100644 --- a/redakcja/static/js/wiki/view_editor_source.js +++ b/redakcja/static/js/wiki/view_editor_source.js @@ -46,26 +46,10 @@ return true; }); - $('#source-editor .toolbar button').click(function(event){ - event.preventDefault(); - var params = eval("(" + $(this).attr('data-ui-action-params') + ")"); - scriptletCenter.callInteractive({ - action: $(this).attr('data-ui-action'), - context: self.codemirror, - extra: params - }); + $('#source-editor .toolbar').toolbarize({ + actionContext: self.codemirror }); - $('.toolbar select').change(function(event){ - var slug = $(this).val(); - - $('.toolbar-buttons-container').hide().filter('[data-group=' + slug + ']').show(); - $(window).resize(); - }); - - $('.toolbar-buttons-container').hide(); - $('.toolbar select').change(); - console.log("Initialized CodeMirror"); // textarea is no longer needed @@ -116,6 +100,10 @@ console.log('Exiting', this.doc); this.doc.setText(this.codemirror.getCode()); + if ($('.vsplitbar').hasClass('active') && $('#SearchPerspective').hasClass('active')) { + $.wiki.switchToTab('#ScanGalleryPerspective'); + } + if(success) success(); } diff --git a/redakcja/static/js/wiki/view_editor_wysiwyg.js b/redakcja/static/js/wiki/view_editor_wysiwyg.js index 2ae1a8dd..34618c4f 100644 --- a/redakcja/static/js/wiki/view_editor_wysiwyg.js +++ b/redakcja/static/js/wiki/view_editor_wysiwyg.js @@ -43,8 +43,8 @@ return true; } - /* Convert HTML frament to plaintext */ - var ANNOT_ALLOWED = ['wyroznienie', 'slowo_obce', 'osoba']; + /* Convert HTML fragment to plaintext */ + var ANNOT_FORBIDDEN = ['pt', 'pa', 'pr', 'pe', 'begin', 'end', 'theme']; function html2plainText(fragment){ var text = ""; @@ -52,11 +52,12 @@ $(fragment.childNodes).each(function(){ if (this.nodeType == 3) // textNode text += this.nodeValue; - else + else { if (this.nodeType == 1 && - $.inArray($(this).attr('x-node'), ANNOT_ALLOWED) != -1) { + $.inArray($(this).attr('x-node'), ANNOT_FORBIDDEN) == -1) { text += html2plainText(this); } + }; }); return text; @@ -87,7 +88,7 @@ return false; } - // BUG #273 - selected text can contain themes, which should be omited from + // BUG #273 - selected text can contain themes, which should be omitted from // defining term var text = html2plainText(range.cloneContents()); @@ -96,7 +97,7 @@ range.insertNode(tag[0]); xml2html({ - xml: '' + text + ' --- ', + xml: '' + text + ' --- ', success: function(text){ var t = $(text); tag.replaceWith(t); @@ -225,14 +226,15 @@ }).appendTo($box[0].offsetParent || $box.parent()).show(); if ($origin.is('.motyw')) { - $('textarea', $overlay).autocomplete(THEMES, { + $('textarea', $overlay).autocomplete('/themes', { autoFill: true, multiple: true, - selectFirst: true + selectFirst: true, + highlight: false }); } - if ($origin.is('.motyw')) { + if ($origin.is('.motyw')){ $('.delete-button', $overlay).click(function(){ if (window.confirm("Czy jesteś pewien, że chcesz usunąć ten motyw ?")) { $('[theme-class=' + $origin.attr('theme-class') + ']').remove(); @@ -240,7 +242,17 @@ $(document).unbind('click.blur-overlay'); return false; }; - }); + }); + } + else if($box.is('*[x-annotation-box]')) { + $('.delete-button', $overlay).click(function(){ + if (window.confirm("Czy jesteś pewien, że chcesz usunąć ten przypis?")) { + $origin.remove(); + $overlay.remove(); + $(document).unbind('click.blur-overlay'); + return false; + }; + }); } else { $('.delete-button', $overlay).hide(); diff --git a/redakcja/static/js/wiki/view_gallery.js b/redakcja/static/js/wiki/view_gallery.js index aa39e15f..1be30bf6 100644 --- a/redakcja/static/js/wiki/view_gallery.js +++ b/redakcja/static/js/wiki/view_gallery.js @@ -65,7 +65,7 @@ event.preventDefault(); self.setPage($(this).val()); }); - + $('.previous-page', this.$element).click(function(){ self.setPage(parseInt(self.$numberInput.val(),10) - 1); }); @@ -139,6 +139,7 @@ ScanGalleryPerspective.prototype.setPage = function(newPage){ newPage = normalizeNumber(newPage, this.doc.galleryImages.length); + $('#imagesCount').val(this.doc.galleryImages.length); this.$numberInput.val(newPage); this.config().page = newPage; $('.gallery-image img', this.$element).attr('src', this.doc.galleryImages[newPage - 1]); @@ -224,6 +225,8 @@ $.wiki.Perspective.prototype.onEnter.call(this); + $('.vsplitbar').not('.active').trigger('click'); + this.doc.refreshGallery({ success: function(doc, data){ self.$image.show(); @@ -248,4 +251,4 @@ $.wiki.ScanGalleryPerspective = ScanGalleryPerspective; -})(jQuery); \ No newline at end of file +})(jQuery); diff --git a/redakcja/static/js/wiki/view_history.js b/redakcja/static/js/wiki/view_history.js index b4a9dd8a..d35a8da0 100644 --- a/redakcja/static/js/wiki/view_history.js +++ b/redakcja/static/js/wiki/view_history.js @@ -15,6 +15,10 @@ self.showTagForm(); }); + $('#doc-revert-button').click(function() { + self.revertDocumentToVersion(); + }); + $('#open-preview-button').click(function(event) { var selected = $('#changes-list .entry.selected'); @@ -31,11 +35,23 @@ $('#changes-list .entry').live('click', function(){ var $this = $(this); - if ($this.hasClass('selected')) - return $this.removeClass('selected'); - if ($("#changes-list .entry.selected").length < 2) - return $this.addClass('selected'); + var selected_count = $("#changes-list .entry.selected").length; + + if ($this.hasClass('selected')) { + $this.removeClass('selected'); + selected_count -= 1; + } + else { + if (selected_count < 2) { + $this.addClass('selected'); + selected_count += 1; + }; + }; + + $('#history-view-editor .toolbar button').attr('disabled', 'disabled'). + filter('*[data-enabled-when~=' + selected_count + '], *[data-enabled-when~=*]'). + attr('disabled', null); }); $('#changes-list span.tag').live('click', function(event){ @@ -96,6 +112,9 @@ tag: function(value) { return tags.filter("*[value='"+value+"']").text(); } +// description: function(value) { +// return value.replace('\n', '); +// } } }); }); @@ -153,6 +172,18 @@ }); }; + HistoryPerspective.prototype.revertDocumentToVersion = function(){ + var selected = $('#changes-list .entry.selected'); + + if (selected.length != 1) { + window.alert("Musisz zaznaczyć dokładnie jedną wersję."); + return; + } + + var version = parseInt($("*[data-stub-value='version']", selected[0]).text()); + this.doc.revertToVersion({'revision': version}); + }; + $.wiki.HistoryPerspective = HistoryPerspective; })(jQuery); diff --git a/redakcja/static/js/wiki/view_search.js b/redakcja/static/js/wiki/view_search.js new file mode 100644 index 00000000..34393dc4 --- /dev/null +++ b/redakcja/static/js/wiki/view_search.js @@ -0,0 +1,113 @@ +(function($){ + + /* + * Perspective + */ + function SearchPerspective(options){ + var old_callback = options.callback || function() { }; + + this.noupdate_hash_onenter = true; + + options.callback = function(){ + var self = this; + + this.editor = null; + this.$element = $("#side-search"); + this.$searchInput = $('#search-input', this.$element); + this.$replaceInput = $('#replace-input', this.$element); + this.$searchButton = $('#search-button', this.$element); + this.$replaceButton = $('#replace-button', this.$element); + + this.$replaceButton.attr("disabled","disabled"); + this.options = Array(); + + // handlers + this.$searchInput.change(function(event){ + self.searchCursor = null; + }); + this.$replaceInput.change(function(event){ + self.searchCursor = null; + }); + + $("#side-search input:checkbox").each(function() { + self.options[this.id] = this.checked; + }).change(function(){ + self.options[this.id] = this.checked; + self.searchCursor = null; + }); + + this.$searchButton.click(function(){ + if (!self.search()) + alert('Brak wyników.'); + }); + + this.$replaceButton.click(function(){ + self.replace(); + }); + + old_callback.call(this); + }; + + $.wiki.Perspective.call(this, options); + }; + + SearchPerspective.prototype = new $.wiki.Perspective(); + + SearchPerspective.prototype.search = function(){ + var self = this; + var query = self.$searchInput.val(); + + if (!self.editor) + self.editor = $.wiki.perspectiveForTab('#CodeMirrorPerspective').codemirror + + if (!self.searchCursor) { + self.searchCursor = self.editor.getSearchCursor( + self.$searchInput.val(), + self.options['search-from-cursor'], + self.options['search-regexp'], + self.options['search-case-sensitive'] + ); + } + if (self.searchCursor.findNext()) { + self.searchCursor.select(); + self.$replaceButton.removeAttr("disabled"); + return true; + } + else { + self.searchCursor = null; + this.$replaceButton.attr("disabled","disabled"); + return false; + } + }; + + SearchPerspective.prototype.replace = function(){ + var self = this; + var query = self.$replaceInput.val(); + + if (!self.searchCursor) { + self.search(); + } + else {} + self.searchCursor.select(); + self.searchCursor.replace(query); + self.search(); + }; + + SearchPerspective.prototype.onEnter = function(success, failure){ + var self = this; + + $.wiki.Perspective.prototype.onEnter.call(this); + self.$searchCursor = null; + + $('.vsplitbar').not('.active').trigger('click'); + if ($.wiki.activePerspective() != 'CodeMirrorPerspective') + $.wiki.switchToTab('#CodeMirrorPerspective'); + }; + + SearchPerspective.prototype.onExit = function(success, failure) { + + }; + + $.wiki.SearchPerspective = SearchPerspective; + +})(jQuery); \ No newline at end of file diff --git a/redakcja/static/js/wiki/wikiapi.js b/redakcja/static/js/wiki/wikiapi.js index 27ab97e2..b6388f11 100644 --- a/redakcja/static/js/wiki/wikiapi.js +++ b/redakcja/static/js/wiki/wikiapi.js @@ -7,8 +7,8 @@ failure: noop }; /* - * Return absolute reverse path of given named view. - * (at least he have it hard-coded in one place) + * Return absolute reverse path of given named view. (at least he have it + * hard-coded in one place) * * TODO: think of a way, not to hard-code it here ;) * @@ -33,7 +33,7 @@ if (vname == "ajax_document_gallery") { - return base_path + "/gallery/" + arguments[1]; + return base_path + "/" + arguments[1] + "/gallery"; } if (vname == "ajax_document_diff") @@ -104,8 +104,8 @@ /* * Fetch history of this document. * - * from - First revision to fetch (default = 0) - * upto - Last revision to fetch (default = tip) + * from - First revision to fetch (default = 0) upto - Last revision to + * fetch (default = tip) * */ WikiDocument.prototype.fetchHistory = function(params) { @@ -222,6 +222,8 @@ success: function(data) { var changed = false; + $('#header').removeClass('saving'); + if (data.text) { self.text = data.text; self.revision = data.revision; @@ -233,17 +235,31 @@ params['success'](self, changed, ((changed && "Udało się zapisać :)") || "Twoja wersja i serwera jest identyczna")); }, error: function(xhr) { - try { - params['failure'](self, $.parseJSON(xhr.responseText)); - } - catch (e) { - params['failure'](self, { - "__message": "

        Nie udało się zapisać - błąd serwera.

        " - }); - }; + if ($('#header').hasClass('saving')) { + $('#header').removeClass('saving'); + $.blockUI({ + message: "

        Nie udało się zapisać zmian.

        " + }) + } + else { + try { + params['failure'](self, $.parseJSON(xhr.responseText)); + } + catch (e) { + params['failure'](self, { + "__message": "

        Nie udało się zapisać - błąd serwera.

        " + }); + }; + } } }); + + $('#save-hide').click(function(){ + $('#header').addClass('saving'); + $.unblockUI(); + $.wiki.blocking.unblock(); + }); }; /* end of save() */ WikiDocument.prototype.publish = function(params) { diff --git a/redakcja/static/js/wiki/xslt.js b/redakcja/static/js/wiki/xslt.js index 532b452b..2bab378d 100644 --- a/redakcja/static/js/wiki/xslt.js +++ b/redakcja/static/js/wiki/xslt.js @@ -33,32 +33,71 @@ function withStylesheets(code_block, onError) } } +var canonThemes = null; -function xml2html(options) { - withStylesheets(function() { - var xml = options.xml.replace(/\/\s+/g, '
        '); - var parser = new DOMParser(); - var serializer = new XMLSerializer(); - var doc = parser.parseFromString(xml, 'text/xml'); - var error = $('parsererror', doc); - - if (error.length == 0) { - doc = xml2htmlStylesheet.transformToFragment(doc, document); - console.log(doc.firstChild); - - if(doc.firstChild === null) { - options.error("Błąd w przetwarzaniu XML."); - return; - } +// Wykonuje block z załadowanymi kanonicznymi motywami +function withThemes(code_block, onError) +{ + if (!canonThemes) { + $.blockUI({message: 'Ładowanie motywów...'}); + $.ajax({ + url: '/themes', + dataType: 'text', + success: function(data) { + canonThemes = {}; + themes = data.split('\n'); + for (i in themes) { + canonThemes[themes[i]] = 1; + } + $.unblockUI(); + code_block(); + }, + error: onError + }) + } + else { + code_block(); + } +} - error = $('parsererror', doc); - } - if (error.length > 0 && options.error) { - options.error(error.text()); - } else { - options.success(doc.firstChild); - } + +function xml2html(options) { + withStylesheets(function() { + withThemes(function() { + var xml = options.xml.replace(/\/\s+/g, '
        '); + var parser = new DOMParser(); + var serializer = new XMLSerializer(); + var doc = parser.parseFromString(xml, 'text/xml'); + var error = $('parsererror', doc); + + if (error.length == 0) { + doc = xml2htmlStylesheet.transformToFragment(doc, document); + console.log(doc.firstChild); + + if(doc.firstChild === null) { + options.error("Błąd w przetwarzaniu XML."); + return; + } + + error = $('parsererror', doc); + } + + if (error.length > 0 && options.error) { + options.error(error.text()); + } else { + $('.theme-text-list', doc.firstChild).each(function(){ + var themes = $(this).html().split(','); + for (i in themes) { + themes[i] = $.trim(themes[i]); + if (!(themes[i] in canonThemes)) + themes[i] = '' + themes[i] + "" + } + $(this).html(themes.join(', ')); + }); + options.success(doc.firstChild); + } + }, function() { options.error && options.error('Nie udało się załadować motywów'); }); }, function() { options.error && options.error('Nie udało się załadować XSLT'); }); } diff --git a/redakcja/templates/base.html b/redakcja/templates/base.html index ac728d06..749fd2a6 100644 --- a/redakcja/templates/base.html +++ b/redakcja/templates/base.html @@ -1,14 +1,24 @@ +{% load i18n %} - {% block title %}Platforma Redakcyjna{% block subtitle %}{% endblock subtitle %}{% endblock title%} + {% block title %}{% trans "Platforma Redakcyjna" %}{% block subtitle %}{% endblock subtitle %}{% endblock title%} {% block extrahead %} {% endblock %} + + +
        +
        {% block maincontent %} {% endblock %}
        diff --git a/redakcja/urls.py b/redakcja/urls.py index f8538fa8..dd7f884d 100644 --- a/redakcja/urls.py +++ b/redakcja/urls.py @@ -4,6 +4,8 @@ from django.conf.urls.defaults import * from django.contrib import admin from django.conf import settings +import wiki.urls + admin.autodiscover() urlpatterns = patterns('', @@ -26,4 +28,8 @@ urlpatterns = patterns('', {'document_root': settings.MEDIA_ROOT, 'show_indexes': True}), url(r'^%s(?P.+)$' % settings.STATIC_URL[1:], 'django.views.static.serve', {'document_root': settings.STATIC_ROOT, 'show_indexes': True}), + (r'^documents/', include(wiki.urls)), + url(r'^themes$', 'wiki.views.themes', name="themes"), + url(r'^$', 'django.views.generic.simple.redirect_to', {'url': '/documents/'}), + ) diff --git a/redmine/redmine_publications/README.rdoc b/redmine/redmine_publications/README.rdoc deleted file mode 100644 index 2bcee99b..00000000 --- a/redmine/redmine_publications/README.rdoc +++ /dev/null @@ -1,3 +0,0 @@ -= publications - -Description goes here diff --git a/redmine/redmine_publications/app/controllers/publications_controller.rb b/redmine/redmine_publications/app/controllers/publications_controller.rb deleted file mode 100644 index c7a11948..00000000 --- a/redmine/redmine_publications/app/controllers/publications_controller.rb +++ /dev/null @@ -1,60 +0,0 @@ -class PublicationsController < ApplicationController - unloadable - - # before_filter :authorize, :only => [:issues] - - def index - @publications = Publication.all - respond_to do |format| - format.html - format.xml { render :xml => @publications } - format.json { render :json => @publications } - end - end - - def refresh - regexp = Regexp.new(Setting.plugin_redmine_publications[:pattern]) - repo = Repository.find(:first, :conditions => ['project_id = ?', Setting.plugin_redmine_publications[:project]] ) - - Rails.logger.info('[INFO] Importing changes from ' << repo.url) - Rails.logger.info('[INFO] Change list: ' << repo.changes.find(:all).inspect ) - - @repo_status = [] - repo.changes.find(:all).each do |change| - Rails.logger.info('[INFO] Importing change ' << change.path) - match = change.path.match(regexp) - if match - Publication.find_or_create_by_name(:name => match[1], - :source_file => change.path, :repository_id => repo.id) - @repo_status += [{:path => change.path, :match => match[1], :matched => true}] - else - @repo_status += [{:path => change.path, :match => nil, :matched => false}] - end - end - - respond_to do |format| - format.html - format.xml { render :xml => @repo_status} - format.json { render :json => @repo_status } - end - end - - def issues - @publication = Publication.find_by_name(params[:pub]) - - joins = "JOIN issue_publications ON (issues.id = issue_publications.issue_id)" - conditions = ['issue_publications.publication_id = ? ', @publication.id ] - @issues = Issue.all(:joins => joins, :conditions => conditions) - - respond_to do |fmt| - fmt.json { render :json => @issues, :callback => params[:callback] } - end - end - - private - - def find_project - @project = Project.find(params[:project_id]) - end - -end diff --git a/redmine/redmine_publications/app/helpers/publications_helper.rb b/redmine/redmine_publications/app/helpers/publications_helper.rb deleted file mode 100644 index 50f110e8..00000000 --- a/redmine/redmine_publications/app/helpers/publications_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module PublicationsHelper -end diff --git a/redmine/redmine_publications/app/models/issue_publication.rb b/redmine/redmine_publications/app/models/issue_publication.rb deleted file mode 100644 index ef7bf92a..00000000 --- a/redmine/redmine_publications/app/models/issue_publication.rb +++ /dev/null @@ -1,4 +0,0 @@ -class IssuePublication < ActiveRecord::Base - belongs_to :publication - belongs_to :issue -end diff --git a/redmine/redmine_publications/app/models/publication.rb b/redmine/redmine_publications/app/models/publication.rb deleted file mode 100644 index 15444023..00000000 --- a/redmine/redmine_publications/app/models/publication.rb +++ /dev/null @@ -1,4 +0,0 @@ -class Publication < ActiveRecord::Base - has_many :issues, :through => :issuepublications - belongs_to :repository -end diff --git a/redmine/redmine_publications/app/views/issues/_issue_form_pub.html.erb b/redmine/redmine_publications/app/views/issues/_issue_form_pub.html.erb deleted file mode 100644 index ebb903c0..00000000 --- a/redmine/redmine_publications/app/views/issues/_issue_form_pub.html.erb +++ /dev/null @@ -1,5 +0,0 @@ -
        -

        -' /> -

        diff --git a/redmine/redmine_publications/app/views/issues/_issue_view_pub.erb b/redmine/redmine_publications/app/views/issues/_issue_view_pub.erb deleted file mode 100644 index a22c78be..00000000 --- a/redmine/redmine_publications/app/views/issues/_issue_view_pub.erb +++ /dev/null @@ -1,8 +0,0 @@ - - <%= l(:field_publications) %>: - -<% @issue.publication_names.each do |pub| %> - <%= pub %>
        -<% end %> - - diff --git a/redmine/redmine_publications/app/views/publications/index.html.erb b/redmine/redmine_publications/app/views/publications/index.html.erb deleted file mode 100644 index 3fa02993..00000000 --- a/redmine/redmine_publications/app/views/publications/index.html.erb +++ /dev/null @@ -1,7 +0,0 @@ -

        Publikacje

        -

        Odśwież listę publikacji

        -
          -<% @publications.each do |pub| %> -
        1. <%= pub.name %>
        2. -<% end %> -
        diff --git a/redmine/redmine_publications/app/views/publications/issues.html.erb b/redmine/redmine_publications/app/views/publications/issues.html.erb deleted file mode 100644 index f36a875d..00000000 --- a/redmine/redmine_publications/app/views/publications/issues.html.erb +++ /dev/null @@ -1,4 +0,0 @@ -

        Issues for publication: <%= @publication.name %>

        -<% @issues.each do |issue| %> -

        <%= issue.subject %>

        -<% end %> diff --git a/redmine/redmine_publications/app/views/publications/refresh.erb b/redmine/redmine_publications/app/views/publications/refresh.erb deleted file mode 100644 index 311ed33e..00000000 --- a/redmine/redmine_publications/app/views/publications/refresh.erb +++ /dev/null @@ -1,10 +0,0 @@ - - -<% @repo_status.each do |status| %> - - - - - -<% end %> -
        Ścieżka zasobuRozpoznanoID zasobu
        <%= status[:path] %><%= (status[:matched] && 'Tak') || 'Nie' %><%= status[:match] || '' %>
        diff --git a/redmine/redmine_publications/app/views/settings/_publications_settings.html.erb b/redmine/redmine_publications/app/views/settings/_publications_settings.html.erb deleted file mode 100644 index 255460e9..00000000 --- a/redmine/redmine_publications/app/views/settings/_publications_settings.html.erb +++ /dev/null @@ -1,18 +0,0 @@ -<% @project = Project.find(:first, :conditions => ["id = ?", @settings[:project]]) %> -
        -

        - - <%= collection_select(:project, :id, Project.all, :id, :name, {}, {:name => "settings[project]"}) %> -

        - -

        - - <%= text_field_tag 'settings[pattern]', @settings[:pattern] || '' %> -

        - -

        - - <%= text_field_tag 'settings[editorurl]', @settings[:editorurl] || '' %> -

        - -
        diff --git a/redmine/redmine_publications/db/migrate/001_create_publications.rb b/redmine/redmine_publications/db/migrate/001_create_publications.rb deleted file mode 100644 index f9d93ef2..00000000 --- a/redmine/redmine_publications/db/migrate/001_create_publications.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreatePublications < ActiveRecord::Migration - def self.up - create_table :publications do |t| - t.column :source_file, :string, :null => false - end - end - - def self.down - drop_table :publications - end -end diff --git a/redmine/redmine_publications/db/migrate/002_create_issue_publications.rb b/redmine/redmine_publications/db/migrate/002_create_issue_publications.rb deleted file mode 100644 index 07b64bd3..00000000 --- a/redmine/redmine_publications/db/migrate/002_create_issue_publications.rb +++ /dev/null @@ -1,12 +0,0 @@ -class CreateIssuePublications < ActiveRecord::Migration - def self.up - create_table :issue_publications do |t| - t.column :publication_id, :integer, :null => false - t.column :issue_id, :integer, :null => false - end - end - - def self.down - drop_table :issue_publications - end -end diff --git a/redmine/redmine_publications/db/migrate/003_publications_add_repo_id.rb b/redmine/redmine_publications/db/migrate/003_publications_add_repo_id.rb deleted file mode 100644 index 8f232c92..00000000 --- a/redmine/redmine_publications/db/migrate/003_publications_add_repo_id.rb +++ /dev/null @@ -1,8 +0,0 @@ -class PublicationsAddRepoId < ActiveRecord::Migration - def self.up - add_column :publications, :repository_id, :integer, :null => false, :default => 0 - end - - def self.down - end -end diff --git a/redmine/redmine_publications/db/migrate/004_publications_add_name.rb b/redmine/redmine_publications/db/migrate/004_publications_add_name.rb deleted file mode 100644 index 6b5bac61..00000000 --- a/redmine/redmine_publications/db/migrate/004_publications_add_name.rb +++ /dev/null @@ -1,8 +0,0 @@ -class PublicationsAddName < ActiveRecord::Migration - def self.up - add_column :publications, :name, :string - end - - def self.down - end -end diff --git a/redmine/redmine_publications/init.rb b/redmine/redmine_publications/init.rb deleted file mode 100644 index 01afeab6..00000000 --- a/redmine/redmine_publications/init.rb +++ /dev/null @@ -1,38 +0,0 @@ -require 'redmine' - -# Patches to the Redmine core. -require 'dispatcher' - -Dispatcher.to_prepare :redmine_publications do - require_dependency 'issue' - - #Guards against including the module multiple time (like in tests) - # and registering multiple callbacks - unless Issue.included_modules.include? RedminePublications::IssuePatch - Issue.send(:include, RedminePublications::IssuePatch) - end - - unless Change.included_modules.include? RedminePublications::ChangePatch - Change.send(:include, RedminePublications::ChangePatch) - end -end - -require_dependency 'issue_publication_hook' - -Redmine::Plugin.register :redmine_publications do - name 'Publications managment plugin' - author 'Łukasz Rekucki' - description 'This plugn helps manage issues related to a publication.' - version '0.0.9' - - # permission :view_issues_for_publication, :publications => :issues - - settings :partial => 'settings/publications_settings', - :default => { :project => '0', :pattern => '[^\$].xml', :editorurl => 'http://localhost/:pubid'} - - menu :application_menu, :publications, { :controller => 'publications', :action => 'index' }, :caption => 'Publikacje' - -# requires_redmine :version_or_higher => '0.8.0' - -end - diff --git a/redmine/redmine_publications/lang/en.yml b/redmine/redmine_publications/lang/en.yml deleted file mode 100644 index e338591e..00000000 --- a/redmine/redmine_publications/lang/en.yml +++ /dev/null @@ -1,2 +0,0 @@ -# English strings go here -my_label: "My label" diff --git a/redmine/redmine_publications/lib/issue_publication_hook.rb b/redmine/redmine_publications/lib/issue_publication_hook.rb deleted file mode 100644 index 788a72f4..00000000 --- a/redmine/redmine_publications/lib/issue_publication_hook.rb +++ /dev/null @@ -1,55 +0,0 @@ -# Provides a link to the document on the platform -class IssuesPublicationHook < Redmine::Hook::ViewListener - - def self.render_on(hook, options={}) - define_method hook do |context| - if !options.include?(:if) || evaluate_if_option(options[:if], context) - context[:controller].send(:render_to_string, {:locals => context}.merge(options)) - end - end - end - - private - - def evaluate_if_option(if_option, context) - case if_option - when Symbol - send(if_option, context) - when Method, Proc - if_option.call(context) - end - end - - def is_pticket?(context) - context[:issue].project_id == Setting.plugin_redmine_publications[:project].to_i - end - - public - - render_on :view_issues_show_details_bottom, :partial => 'issue_view_pub', :if => :is_pticket? - render_on :view_issues_form_details_bottom, :partial => 'issue_form_pub', :if => :is_pticket? - - # names = context[:issue].publication_names {|name| "" + name + ""} - # result << names.join(', ') - - def controller_issues_edit_before_save(context) - if is_pticket?context - old_value = context[:issue].publication_names - new_value = context[:params][:publications].split(',').map { |n| n.strip } - context[:journal].details << JournalDetail.new( - :property => 'attr', :prop_key => "publications", - :old_value => old_value.join(', '), - :value => new_value.join(', ') ) unless new_value==old_value - context[:issue].publication_names = new_value - end - end - - - def controller_issues_new_after_save(context) - if is_pticket?context - value = context[:params][:publications].split(',').map { |n| n.strip } - context[:issue].publication_names = value - context[:issue].save - end - end -end diff --git a/redmine/redmine_publications/lib/redmine_publications/change_patch.rb b/redmine/redmine_publications/lib/redmine_publications/change_patch.rb deleted file mode 100644 index b8e5c4b6..00000000 --- a/redmine/redmine_publications/lib/redmine_publications/change_patch.rb +++ /dev/null @@ -1,40 +0,0 @@ -module RedminePublications - # Patches Redmine's Issues dynamically. Adds a +after_save+ filter. - - module ChangePatch - def self.included(base) # :nodoc: - base.extend(ClassMethods) - - base.send(:include, InstanceMethods) - - # Same as typing in the class - base.class_eval do - unloadable # Send unloadable so it will not be unloaded in development - after_save :update_publication - end - - end - - module ClassMethods - end - - module InstanceMethods - - def update_publication - if (self.action == 'A') and (self.changeset.repository.project_id == Setting.plugin_redmine_publications[:project].to_i) - regexp = Regexp.new(Setting.plugin_redmine_publications[:pattern]) - match = self.path.match(regexp) - if match - Rails.logger.info('[INFO] Adding publication: "' << match[1]) - Publication.find_or_create_by_name(:name => match[1], - :source_file => self.path, :repository_id => self.changeset.repository.id ) - end - end - end - - end - - end - - -end diff --git a/redmine/redmine_publications/lib/redmine_publications/issue_patch.rb b/redmine/redmine_publications/lib/redmine_publications/issue_patch.rb deleted file mode 100644 index bd1f73eb..00000000 --- a/redmine/redmine_publications/lib/redmine_publications/issue_patch.rb +++ /dev/null @@ -1,78 +0,0 @@ -module RedminePublications - # Patches Redmine's Issues dynamically. Adds a +after_save+ filter. - - module IssuePatch - def self.included(base) # :nodoc: - base.extend(ClassMethods) - - base.send(:include, InstanceMethods) - - # Same as typing in the class - base.class_eval do - unloadable # Send unloadable so it will not be unloaded in development - - validate :check_relations - after_save :update_relations - end - - end - - module ClassMethods - end - - module InstanceMethods - - def publication_names - if not @pubnames - self.publications.map { |pub| pub.name } - else - @pubnames - end - end - - def publication_names=(value) - @pubnames = value.sort! - end - - def publications - Publication.all( - :joins => - "JOIN issue_publications ON (issue_publications.publication_id = publications.id)", - :conditions => - ["issue_publications.issue_id = ? ", self.id] ) - end - - def check_relations - current_names = self.publication_names - non_existant = [] - - pubs = Publication.find_all_by_name(current_names).map {|i| i.name} - missing = current_names.select {|name| not pubs.include?name } - - if not missing.empty? - errors.add("publications", "Missing publication(s): " + missing.join(', ')) - end - end - - def update_relations - old = self.publications - current_names = self.publication_names - Rails.logger.info('[INFO] Updating relations: old= ' << old.inspect << ' current=' << current_names.inspect) - - # delete unused relations - deleted = old.select { |v| not (current_names.include?(v.name)) } - deleted.each do |pub| - IssuePublication.delete_all(["issue_publications.issue_id = ? AND issue_publications.publication_id = ?", self.id, pub.id]) - end - - current_names.each do |name| - pub = Publication.find_by_name(name) - IssuePublication.find_or_create_by_publication_id_and_issue_id(pub.id, self.id) - end - - return true - end - - end - end -end diff --git a/redmine/redmine_publications/locales/en.yml b/redmine/redmine_publications/locales/en.yml deleted file mode 100644 index 3932ef20..00000000 --- a/redmine/redmine_publications/locales/en.yml +++ /dev/null @@ -1,3 +0,0 @@ -## YAML Template. -en: - field_publications: Publications diff --git a/redmine/redmine_publications/locales/pl.yml b/redmine/redmine_publications/locales/pl.yml deleted file mode 100644 index 2bf07833..00000000 --- a/redmine/redmine_publications/locales/pl.yml +++ /dev/null @@ -1,3 +0,0 @@ -## YAML Template. -pl: - field_publications: Publikacje diff --git a/redmine/redmine_publications/routes.rb b/redmine/redmine_publications/routes.rb deleted file mode 100644 index 8752c692..00000000 --- a/redmine/redmine_publications/routes.rb +++ /dev/null @@ -1,10 +0,0 @@ -connect 'publications/:action', - :controller => 'publications', - :format => 'html' - -connect 'publications/:action.:format', - :controller => 'publications' - -connect 'publications/:action/:pub', - :controller => 'publications', :format => 'json', - :pub => /[^\/?]+/ diff --git a/redmine/redmine_publications/test/fixtures/publications.yml b/redmine/redmine_publications/test/fixtures/publications.yml deleted file mode 100644 index 9d7d1132..00000000 --- a/redmine/redmine_publications/test/fixtures/publications.yml +++ /dev/null @@ -1,7 +0,0 @@ -# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html -one: - id: 1 - source_file: One -two: - id: 2 - source_file: Two diff --git a/redmine/redmine_publications/test/functional/publications_controller_test.rb b/redmine/redmine_publications/test/functional/publications_controller_test.rb deleted file mode 100644 index 62b35f68..00000000 --- a/redmine/redmine_publications/test/functional/publications_controller_test.rb +++ /dev/null @@ -1,8 +0,0 @@ -require File.dirname(__FILE__) + '/../test_helper' - -class MicrorestControllerTest < ActionController::TestCase - # Replace this with your real tests. - def test_truth - assert true - end -end diff --git a/redmine/redmine_publications/test/test_helper.rb b/redmine/redmine_publications/test/test_helper.rb deleted file mode 100644 index bd1ed0c5..00000000 --- a/redmine/redmine_publications/test/test_helper.rb +++ /dev/null @@ -1,5 +0,0 @@ -# Load the normal Rails helper -require File.expand_path(File.dirname(__FILE__) + '/../../../../test/test_helper') - -# Ensure that we are using the temporary fixture path -Engines::Testing.set_fixture_path diff --git a/redmine/redmine_publications/test/unit/publication_test.rb b/redmine/redmine_publications/test/unit/publication_test.rb deleted file mode 100644 index ccf8aa40..00000000 --- a/redmine/redmine_publications/test/unit/publication_test.rb +++ /dev/null @@ -1,10 +0,0 @@ -require File.dirname(__FILE__) + '/../test_helper' - -class PublicationTest < Test::Unit::TestCase - fixtures :publications - - # Replace this with your real tests. - def test_truth - assert true - end -end diff --git a/requirements-test.txt b/requirements-test.txt new file mode 100644 index 00000000..fe7944cf --- /dev/null +++ b/requirements-test.txt @@ -0,0 +1,3 @@ +django-nose==0.0.3 +nose +nosexcover diff --git a/requirements.txt b/requirements.txt index d247c761..70cbcae5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,14 +7,10 @@ PIL>=1.1 ## Book conversion library git+git://github.com/fnp/librarian.git@master#egg=librarian -## Django +## Django Django>=1.1.1,<1.2 sorl-thumbnail>=3.2 django-maintenancemode>=0.9 # migrations south>=0.6 - -## Debugging utils, uncomment this if you want tests -# django-nose>=0.0.3 -# django-debug-toolbar>=0.8 \ No newline at end of file diff --git a/scripts/crop.py b/scripts/crop.py old mode 100644 new mode 100755 diff --git a/scripts/imgconv.py b/scripts/imgconv.py old mode 100644 new mode 100755 diff --git a/scripts/rip-themes-from-redmine.py b/scripts/rip-themes-from-redmine.py old mode 100644 new mode 100755