├── relevation ├── __init__.py ├── urls.py ├── wsgi.py └── settings.py ├── judgementapp ├── __init__.py ├── admin.py ├── templates │ └── judgementapp │ │ ├── tabs.html │ │ ├── pagination.html │ │ ├── about.html │ │ ├── form_inline.html │ │ ├── form.html │ │ ├── index.html │ │ ├── form_using_template.html │ │ ├── query_list.html │ │ ├── upload.html │ │ ├── base.html │ │ ├── query.html │ │ └── document.html ├── tests.py ├── urls.py ├── models.py └── views.py ├── bootstrap_toolkit ├── __init__.py ├── templatetags │ ├── __init__.py │ └── bootstrap_toolkit.py ├── templates │ └── bootstrap_toolkit │ │ ├── non_field_error.html │ │ ├── field_search.html │ │ ├── pills.html │ │ ├── tabs.html │ │ ├── field_checkbox.html │ │ ├── field.html │ │ ├── non_field_errors.html │ │ ├── nav.html │ │ ├── messages.html │ │ ├── field_errors.html │ │ ├── field_help.html │ │ ├── field_default.html │ │ ├── form.html │ │ ├── field_prepend_append.html │ │ ├── field_visible.html │ │ ├── field_choices.html │ │ ├── pagination.html │ │ ├── field_inline.html │ │ ├── field_horizontal.html │ │ └── field_vertical.html ├── static │ ├── bootstrap_toolkit │ │ └── js │ │ │ ├── init_datepicker.js │ │ │ └── bootstrap.file-input.js │ └── datepicker │ │ ├── js │ │ ├── locales │ │ │ ├── bootstrap-datepicker.kr.js │ │ │ ├── bootstrap-datepicker.ja.js │ │ │ ├── bootstrap-datepicker.zh-TW.js │ │ │ ├── bootstrap-datepicker.zh-CN.js │ │ │ ├── bootstrap-datepicker.id.js │ │ │ ├── bootstrap-datepicker.cs.js │ │ │ ├── bootstrap-datepicker.sk.js │ │ │ ├── bootstrap-datepicker.ms.js │ │ │ ├── bootstrap-datepicker.de.js │ │ │ ├── bootstrap-datepicker.da.js │ │ │ ├── bootstrap-datepicker.fr.js │ │ │ ├── bootstrap-datepicker.rs.js │ │ │ ├── bootstrap-datepicker.sv.js │ │ │ ├── bootstrap-datepicker.th.js │ │ │ ├── bootstrap-datepicker.tr.js │ │ │ ├── bootstrap-datepicker.bg.js │ │ │ ├── bootstrap-datepicker.es.js │ │ │ ├── bootstrap-datepicker.nl.js │ │ │ ├── bootstrap-datepicker.pt-BR.js │ │ │ ├── bootstrap-datepicker.rs-latin.js │ │ │ ├── bootstrap-datepicker.ru.js │ │ │ ├── bootstrap-datepicker.sl.js │ │ │ ├── bootstrap-datepicker.it.js │ │ │ ├── bootstrap-datepicker.nb.js │ │ │ ├── bootstrap-datepicker.ro.js │ │ │ ├── bootstrap-datepicker.is.js │ │ │ ├── bootstrap-datepicker.pt.js │ │ │ ├── bootstrap-datepicker.fi.js │ │ │ ├── bootstrap-datepicker.lv.js │ │ │ ├── bootstrap-datepicker.pl.js │ │ │ └── bootstrap-datepicker.lt.js │ │ └── bootstrap-datepicker.js │ │ └── css │ │ └── datepicker.css └── widgets.py ├── db └── relevation.db ├── documents └── .gitignore ├── .gitignore ├── manage.py ├── export_judgements.sh ├── README.md └── License.txt /relevation/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /judgementapp/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /bootstrap_toolkit/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /bootstrap_toolkit/templatetags/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /bootstrap_toolkit/templates/bootstrap_toolkit/non_field_error.html: -------------------------------------------------------------------------------- 1 |

{{ error }}

-------------------------------------------------------------------------------- /db/relevation.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ielab/relevation/HEAD/db/relevation.db -------------------------------------------------------------------------------- /documents/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore everything in this directory 2 | * 3 | # Except this file 4 | !.gitignore -------------------------------------------------------------------------------- /bootstrap_toolkit/templates/bootstrap_toolkit/field_search.html: -------------------------------------------------------------------------------- 1 | {% include "bootstrap_toolkit/field_inline.html" %} 2 | -------------------------------------------------------------------------------- /bootstrap_toolkit/templates/bootstrap_toolkit/pills.html: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /bootstrap_toolkit/templates/bootstrap_toolkit/tabs.html: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /bootstrap_toolkit/templates/bootstrap_toolkit/field_checkbox.html: -------------------------------------------------------------------------------- 1 | 5 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.log 2 | *.pot 3 | *.pyc 4 | local_settings.py 5 | prefix.sh 6 | publish.sh 7 | relevation.db 8 | 9 | demovideo/relevation_demo.mov 10 | -------------------------------------------------------------------------------- /bootstrap_toolkit/templates/bootstrap_toolkit/field.html: -------------------------------------------------------------------------------- 1 | {% if field.is_hidden %} 2 | {{ field }} 3 | {% else %} 4 | {% include "bootstrap_toolkit/field_visible.html" %} 5 | {% endif %} 6 | -------------------------------------------------------------------------------- /judgementapp/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from judgementapp.models import * 3 | 4 | admin.site.register(Judgement) 5 | admin.site.register(Query) 6 | admin.site.register(Document) -------------------------------------------------------------------------------- /bootstrap_toolkit/static/bootstrap_toolkit/js/init_datepicker.js: -------------------------------------------------------------------------------- 1 | (function($){ 2 | $(function() { 3 | $('input[data-bootstrap-widget=datepicker]').datepicker(); 4 | }) 5 | })(jQuery); 6 | -------------------------------------------------------------------------------- /bootstrap_toolkit/templates/bootstrap_toolkit/non_field_errors.html: -------------------------------------------------------------------------------- 1 |
2 | {% for error in form.non_field_errors %} 3 | {% include "bootstrap_toolkit/non_field_error.html" %} 4 | {% endfor %} 5 |
6 | -------------------------------------------------------------------------------- /bootstrap_toolkit/templates/bootstrap_toolkit/nav.html: -------------------------------------------------------------------------------- 1 | {% spaceless %} 2 | {% for tab in tabs %} 3 | {{ tab.title }} 4 | {% endfor %} 5 | {% endspaceless %} -------------------------------------------------------------------------------- /manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import os 3 | import sys 4 | 5 | if __name__ == "__main__": 6 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "relevation.settings") 7 | 8 | from django.core.management import execute_from_command_line 9 | 10 | execute_from_command_line(sys.argv) 11 | -------------------------------------------------------------------------------- /bootstrap_toolkit/templates/bootstrap_toolkit/messages.html: -------------------------------------------------------------------------------- 1 | {% for message in messages %} 2 |
3 | × 4 | {{ message }} 5 |
6 | {% endfor %} 7 | -------------------------------------------------------------------------------- /bootstrap_toolkit/templates/bootstrap_toolkit/field_errors.html: -------------------------------------------------------------------------------- 1 | {% if field.errors %} 2 | {% for error in field.errors %} 3 | {% if display == "inline" %} 4 | {{ error }} 5 | {% else %} 6 |

{{ error }}

7 | {% endif %} 8 | {% endfor %} 9 | {% endif %} 10 | -------------------------------------------------------------------------------- /judgementapp/templates/judgementapp/tabs.html: -------------------------------------------------------------------------------- 1 | {% extends "judgementapp/base.html" %} 2 | 3 | {% load bootstrap_toolkit %} 4 | 5 | {% block content %} 6 | 7 |

Tabs and Pills

8 | 9 |

Tabs

10 | {% include "bootstrap_toolkit/tabs.html" %} 11 | 12 |

Pills

13 | {% include "bootstrap_toolkit/pills.html" %} 14 | 15 | {% endblock %} 16 | -------------------------------------------------------------------------------- /bootstrap_toolkit/templates/bootstrap_toolkit/field_help.html: -------------------------------------------------------------------------------- 1 | {% if field.help_text %} 2 | {% autoescape off %} 3 | {% if display == "inline" %} 4 | {{ field.help_text }} 5 | {% else %} 6 |

{{ field.help_text }}

7 | {% endif %} 8 | {% endautoescape %} 9 | {% endif %} 10 | -------------------------------------------------------------------------------- /export_judgements.sh: -------------------------------------------------------------------------------- 1 | sqlite3 db/relevation.db "select judgementapp_query.qId, judgementapp_document.docId, judgementapp_judgement.relevance from judgementapp_query, judgementapp_document, judgementapp_judgement where judgementapp_judgement.query_id = judgementapp_query.id and judgementapp_judgement.document_id = judgementapp_document.id and relevance <> -1;" | sed "s/|/ /g" | sed -E "s/^([0-9]+) /\1 0 corpus\//g" -------------------------------------------------------------------------------- /bootstrap_toolkit/templates/bootstrap_toolkit/field_default.html: -------------------------------------------------------------------------------- 1 | {% if field.field.widget.bootstrap %} 2 | {% with bootstrap=field.field.widget.bootstrap %} 3 | {% include "bootstrap_toolkit/field_prepend_append.html" with prepend=prepend|default:bootstrap.prepend|default:"" append=append|default:bootstrap.append|default:"" %} 4 | {% endwith %} 5 | {% else %} 6 | {% include "bootstrap_toolkit/field_prepend_append.html" %} 7 | {% endif %} 8 | -------------------------------------------------------------------------------- /judgementapp/templates/judgementapp/pagination.html: -------------------------------------------------------------------------------- 1 | {% extends "judgementapp/base.html" %} 2 | 3 | {% load bootstrap_toolkit %} 4 | 5 | {% block content %} 6 | 7 |

Pagination

8 | 9 | 10 | {% for line in lines %} 11 | 12 | 13 | 14 | {% endfor %} 15 |
{{ line }}
16 | 17 | {{ lines|pagination }} 18 | 19 | {% endblock %} 20 | -------------------------------------------------------------------------------- /judgementapp/templates/judgementapp/about.html: -------------------------------------------------------------------------------- 1 | {% extends "judgementapp/base.html" %} 2 | 3 | {% block content %} 4 | 5 |

Relevation was created by Bevan Koopman and Guido Zuccon, the system is designed to enable catpure relevance judgement for Information Retrieval system evaluation.

6 | 7 |

Find more on the Github Relevation! page. 8 | 9 | {% endblock %} 10 | -------------------------------------------------------------------------------- /judgementapp/tests.py: -------------------------------------------------------------------------------- 1 | """ 2 | This file demonstrates writing tests using the unittest module. These will pass 3 | when you run "manage.py test". 4 | 5 | Replace this with more appropriate tests for your application. 6 | """ 7 | 8 | from django.test import TestCase 9 | 10 | 11 | class SimpleTest(TestCase): 12 | def test_basic_addition(self): 13 | """ 14 | Tests that 1 + 1 always equals 2. 15 | """ 16 | self.assertEqual(1 + 1, 2) 17 | -------------------------------------------------------------------------------- /judgementapp/templates/judgementapp/form_inline.html: -------------------------------------------------------------------------------- 1 | {% extends "judgementapp/base.html" %} 2 | 3 | {% load bootstrap_toolkit %} 4 | 5 | {% block content %} 6 | 7 |

This is form layout is {{ layout }}

8 | 9 |

 

10 | 11 |
12 | 13 | {% csrf_token %} 14 | 15 | {{ form|as_bootstrap:layout }} 16 | 17 | 18 | 19 |
20 | 21 |

Submit the form to see error messages styled into it.

22 | 23 | {% endblock %} 24 | 25 | -------------------------------------------------------------------------------- /bootstrap_toolkit/static/datepicker/js/locales/bootstrap-datepicker.kr.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Korean translation for bootstrap-datepicker 3 | * Gu Youn 4 | */ 5 | ;(function($){ 6 | $.fn.datepicker.dates['kr'] = { 7 | days: ["일요일", "월요일", "화요일", "수요일", "목요일", "금요일", "토요일", "일요일"], 8 | daysShort: ["일", "월", "화", "수", "목", "금", "토", "일"], 9 | daysMin: ["일", "월", "화", "수", "목", "금", "토", "일"], 10 | months: ["1월", "2월", "3월", "4월", "5월", "6월", "7월", "8월", "9월", "10월", "11월", "12월"], 11 | monthsShort: ["1월", "2월", "3월", "4월", "5월", "6월", "7월", "8월", "9월", "10월", "11월", "12월"] 12 | }; 13 | }(jQuery)); 14 | -------------------------------------------------------------------------------- /bootstrap_toolkit/static/datepicker/js/locales/bootstrap-datepicker.ja.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Japanese translation for bootstrap-datepicker 3 | * Norio Suzuki 4 | */ 5 | ;(function($){ 6 | $.fn.datepicker.dates['ja'] = { 7 | days: ["日曜", "月曜", "火曜", "水曜", "木曜", "金曜", "土曜", "日曜"], 8 | daysShort: ["日", "月", "火", "水", "木", "金", "土", "日"], 9 | daysMin: ["日", "月", "火", "水", "木", "金", "土", "日"], 10 | months: ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"], 11 | monthsShort: ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"] 12 | }; 13 | }(jQuery)); 14 | -------------------------------------------------------------------------------- /bootstrap_toolkit/static/datepicker/js/locales/bootstrap-datepicker.zh-TW.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Traditional Chinese translation for bootstrap-datepicker 3 | * Rung-Sheng Jang 4 | */ 5 | ;(function($){ 6 | $.fn.datepicker.dates['zh-TW'] = { 7 | days: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日"], 8 | daysShort: ["周日", "周一", "周二", "周三", "周四", "周五", "周六", "周日"], 9 | daysMin: ["日", "一", "二", "三", "四", "五", "六", "日"], 10 | months: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"], 11 | monthsShort: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"] 12 | }; 13 | }(jQuery)); 14 | -------------------------------------------------------------------------------- /bootstrap_toolkit/static/datepicker/js/locales/bootstrap-datepicker.zh-CN.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Simplified Chinese translation for bootstrap-datepicker 3 | * Yuan Cheung 4 | */ 5 | ;(function($){ 6 | $.fn.datepicker.dates['zh-CN'] = { 7 | days: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日"], 8 | daysShort: ["周日", "周一", "周二", "周三", "周四", "周五", "周六", "周日"], 9 | daysMin: ["日", "一", "二", "三", "四", "五", "六", "日"], 10 | months: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"], 11 | monthsShort: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"], 12 | today: "今日" 13 | }; 14 | }(jQuery)); 15 | -------------------------------------------------------------------------------- /bootstrap_toolkit/templates/bootstrap_toolkit/form.html: -------------------------------------------------------------------------------- 1 | {% load bootstrap_toolkit %} 2 | 3 | {% if form.non_field_errors %} 4 | {% include "bootstrap_toolkit/non_field_errors.html" %} 5 | {% endif %} 6 | 7 | {% for field in form.hidden_fields %} 8 | {% for error in field.errors %} 9 | {% include "bootstrap_toolkit/non_field_error.html" %} 10 | {% endfor %} 11 | {% endfor %} 12 | 13 | {% for field in form %} 14 | {% if not field.name|lower in exclude|lower|split:',' %} 15 | {% if not fields or field.name|lower in fields|lower|split:',' %} 16 | {% include "bootstrap_toolkit/field.html" %} 17 | {% endif %} 18 | {% endif %} 19 | {% endfor %} 20 | -------------------------------------------------------------------------------- /bootstrap_toolkit/templates/bootstrap_toolkit/field_prepend_append.html: -------------------------------------------------------------------------------- 1 | {% if prepend %} 2 | {% if append %} 3 |
4 | {{ prepend }}{{ field }}{{ append }} 5 |
6 | {% else %} 7 |
8 | {{ prepend }}{{ field }} 9 |
10 | {% endif %} 11 | {% else %} 12 | {% if append %} 13 |
14 | {{ field }}{{ append }} 15 |
16 | {% else %} 17 | {{ field }} 18 | {% endif %} 19 | {% endif %} 20 | -------------------------------------------------------------------------------- /bootstrap_toolkit/templates/bootstrap_toolkit/field_visible.html: -------------------------------------------------------------------------------- 1 | {% load bootstrap_toolkit %} 2 | {% with field|bootstrap_input_type as input_type %} 3 | {% if layout == "horizontal" %} 4 | {% include "bootstrap_toolkit/field_horizontal.html" %} 5 | {% else %} 6 | {% if layout == "inline" %} 7 | {% include "bootstrap_toolkit/field_inline.html" %} 8 | {% else %} 9 | {% if layout == "search" %} 10 | {% include "bootstrap_toolkit/field_search.html" %} 11 | {% else %} 12 | {% include "bootstrap_toolkit/field_vertical.html" %} 13 | {% endif %} 14 | {% endif %} 15 | {% endif %} 16 | {% endwith %} 17 | -------------------------------------------------------------------------------- /bootstrap_toolkit/static/datepicker/js/locales/bootstrap-datepicker.id.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Bahasa translation for bootstrap-datepicker 3 | * Azwar Akbar 4 | */ 5 | ;(function($){ 6 | $.fn.datepicker.dates['id'] = { 7 | days: ["Minggu", "Senin", "Selasa", "Rabu", "Kamis", "Jumat", "Sabtu", "Minggu"], 8 | daysShort: ["Mgu", "Sen", "Sel", "Rab", "Kam", "Jum", "Sab", "Mgu"], 9 | daysMin: ["Mg", "Sn", "Sl", "Ra", "Ka", "Ju", "Sa", "Mg"], 10 | months: ["Januari", "Februari", "Maret", "April", "Mei", "Juni", "Juli", "Agustus", "September", "Oktober", "November", "Desember"], 11 | monthsShort: ["Jan", "Feb", "Mar", "Apr", "Mei", "Jun", "Jul", "Ags", "Sep", "Okt", "Nov", "Des"] 12 | }; 13 | }(jQuery)); 14 | -------------------------------------------------------------------------------- /bootstrap_toolkit/static/datepicker/js/locales/bootstrap-datepicker.cs.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Czech translation for bootstrap-datepicker 3 | * Matěj Koubík 4 | */ 5 | ;(function($){ 6 | $.fn.datepicker.dates['cs'] = { 7 | days: ["Neděle", "Pondělí", "Úterý", "Středa", "Čtvrtek", "Pátek", "Sobota", "Neděle"], 8 | daysShort: ["Ne", "Po", "Út", "St", "Čt", "Pá", "So", "Ne"], 9 | daysMin: ["N", "P", "Ú", "St", "Č", "P", "So", "N"], 10 | months: ["Leden", "Únor", "Březen", "Duben", "Květen", "Červen", "Červenec", "Srpen", "Září", "Říjen", "Listopad", "Prosinec"], 11 | monthsShort: ["Led", "Úno", "Bře", "Dub", "Kvě", "Čer", "Čnc", "Srp", "Zář", "Říj", "Lis", "Pro"], 12 | today: "Dnes" 13 | }; 14 | }(jQuery)); 15 | -------------------------------------------------------------------------------- /bootstrap_toolkit/static/datepicker/js/locales/bootstrap-datepicker.sk.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Slovak translation for bootstrap-datepicker 3 | * Marek Lichtner 4 | */ 5 | ;(function($){ 6 | $.fn.datepicker.dates["sk"] = { 7 | days: ["Nedeľa", "Pondelok", "Utorok", "Streda", "Štvrtok", "Piatok", "Sobota", "Nedeľa"], 8 | daysShort: ["Ne", "Po", "Ut", "St", "Št", "Pi", "So", "Ne"], 9 | daysMin: ["Ne", "Po", "Ut", "St", "Št", "Pi", "So", "Ne"], 10 | months: ["Január", "Február", "Marec", "Apríl", "Máj", "Jún", "Júl", "August", "September", "Október", "November", "December"], 11 | monthsShort: ["Jan", "Feb", "Mar", "Apr", "Máj", "Jún", "Júl", "Aug", "Sep", "Okt", "Nov", "Dec"], 12 | today: "Dnes" 13 | }; 14 | }(jQuery)); 15 | -------------------------------------------------------------------------------- /bootstrap_toolkit/static/datepicker/js/locales/bootstrap-datepicker.ms.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Malay translation for bootstrap-datepicker 3 | * Ateman Faiz 4 | */ 5 | ;(function($){ 6 | $.fn.datepicker.dates['ms'] = { 7 | days: ["Ahad", "Isnin", "Selasa", "Rabu", "Khamis", "Jumaat", "Sabtu", "Ahad"], 8 | daysShort: ["Aha", "Isn", "Sel", "Rab", "Kha", "Jum", "Sab", "Aha"], 9 | daysMin: ["Ah", "Is", "Se", "Ra", "Kh", "Ju", "Sa", "Ah"], 10 | months: ["Januari", "Februari", "Mac", "April", "Mei", "Jun", "Julai", "Ogos", "September", "Oktober", "November", "Disember"], 11 | monthsShort: ["Jan", "Feb", "Mar", "Apr", "Mei", "Jun", "Jul", "Ogo", "Sep", "Okt", "Nov", "Dis"], 12 | today: "Hari Ini" 13 | }; 14 | }(jQuery)); 15 | -------------------------------------------------------------------------------- /bootstrap_toolkit/static/datepicker/js/locales/bootstrap-datepicker.de.js: -------------------------------------------------------------------------------- 1 | /** 2 | * German translation for bootstrap-datepicker 3 | * Sam Zurcher 4 | */ 5 | ;(function($){ 6 | $.fn.datepicker.dates['de'] = { 7 | days: ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag", "Sonntag"], 8 | daysShort: ["Son", "Mon", "Die", "Mit", "Don", "Fre", "Sam", "Son"], 9 | daysMin: ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa", "So"], 10 | months: ["Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"], 11 | monthsShort: ["Jan", "Feb", "Mär", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez"], 12 | today: "Heute" 13 | }; 14 | }(jQuery)); 15 | -------------------------------------------------------------------------------- /bootstrap_toolkit/static/datepicker/js/locales/bootstrap-datepicker.da.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Danish translation for bootstrap-datepicker 3 | * Christian Pedersen 4 | */ 5 | ;(function($){ 6 | $.fn.datepicker.dates['da'] = { 7 | days: ["Søndag", "Mandag", "Tirsdag", "Onsdag", "Torsdag", "Fredag", "Lørdag", "Søndag"], 8 | daysShort: ["Søn", "Man", "Tir", "Ons", "Tor", "Fre", "Lør", "Søn"], 9 | daysMin: ["Sø", "Ma", "Ti", "On", "To", "Fr", "Lø", "Sø"], 10 | months: ["Januar", "Februar", "Marts", "April", "Maj", "Juni", "Juli", "August", "September", "Oktober", "November", "December"], 11 | monthsShort: ["Jan", "Feb", "Mar", "Apr", "Maj", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dec"], 12 | today: "I Dag" 13 | }; 14 | }(jQuery)); -------------------------------------------------------------------------------- /bootstrap_toolkit/static/datepicker/js/locales/bootstrap-datepicker.fr.js: -------------------------------------------------------------------------------- 1 | /** 2 | * French translation for bootstrap-datepicker 3 | * Nico Mollet 4 | */ 5 | ;(function($){ 6 | $.fn.datepicker.dates['fr'] = { 7 | days: ["Dimanche", "Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi", "Dimanche"], 8 | daysShort: ["Dim", "Lun", "Mar", "Mer", "Jeu", "Ven", "Sam", "Dim"], 9 | daysMin: ["D", "L", "Ma", "Me", "J", "V", "S", "D"], 10 | months: ["Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre"], 11 | monthsShort: ["Jan", "Fev", "Mar", "Avr", "Mai", "Jui", "Jul", "Aou", "Sep", "Oct", "Nov", "Dec"], 12 | today: "Aujourd'hui" 13 | }; 14 | }(jQuery)); 15 | -------------------------------------------------------------------------------- /bootstrap_toolkit/static/datepicker/js/locales/bootstrap-datepicker.rs.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Serbian cyrillic translation for bootstrap-datepicker 3 | * Bojan Milosavlević 4 | */ 5 | ;(function($){ 6 | $.fn.datepicker.dates['rs'] = { 7 | days: ["Недеља","Понедељак", "Уторак", "Среда", "Четвртак", "Петак", "Субота", "Недеља"], 8 | daysShort: ["Нед", "Пон", "Уто", "Сре", "Чет", "Пет", "Суб", "Нед"], 9 | daysMin: ["Н", "По", "У", "Ср", "Ч", "Пе", "Су", "Н"], 10 | months: ["Јануар", "Фебруар", "Март", "Април", "Мај", "Јун", "Јул", "Август", "Септембар", "Октобар", "Новембар", "Децембар"], 11 | monthsShort: ["Јан", "Феб", "Мар", "Апр", "Мај", "Јун", "Јул", "Авг", "Сеп", "Окт", "Нов", "Дец"], 12 | today: "Данас" 13 | }; 14 | }(jQuery)); 15 | -------------------------------------------------------------------------------- /bootstrap_toolkit/static/datepicker/js/locales/bootstrap-datepicker.sv.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Swedish translation for bootstrap-datepicker 3 | * Patrik Ragnarsson 4 | */ 5 | ;(function($){ 6 | $.fn.datepicker.dates['sv'] = { 7 | days: ["Söndag", "Måndag", "Tisdag", "Onsdag", "Torsdag", "Fredag", "Lördag", "Söndag"], 8 | daysShort: ["Sön", "Mån", "Tis", "Ons", "Tor", "Fre", "Lör", "Sön"], 9 | daysMin: ["Sö", "Må", "Ti", "On", "To", "Fr", "Lö", "Sö"], 10 | months: ["Januari", "Februari", "Mars", "April", "Maj", "Juni", "Juli", "Augusti", "September", "Oktober", "November", "December"], 11 | monthsShort: ["Jan", "Feb", "Mar", "Apr", "Maj", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dec"], 12 | today: "I Dag" 13 | }; 14 | }(jQuery)); 15 | -------------------------------------------------------------------------------- /bootstrap_toolkit/static/datepicker/js/locales/bootstrap-datepicker.th.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Thai translation for bootstrap-datepicker 3 | * Suchau Jiraprapot 4 | */ 5 | ;(function($){ 6 | $.fn.datepicker.dates['th'] = { 7 | days: ["อาทิตย์", "จันทร์", "อังคาร", "พุธ", "พฤหัส", "ศุกร์", "เสาร์", "อาทิตย์"], 8 | daysShort: ["อา", "จ", "อ", "พ", "พฤ", "ศ", "ส", "อา"], 9 | daysMin: ["อา", "จ", "อ", "พ", "พฤ", "ศ", "ส", "อา"], 10 | months: ["มกราคม", "กุมภาพันธ์", "มีนาคม", "เมษายน", "พฤษภาคม", "มิถุนายน", "กรกฎาคม", "สิงหาคม", "กันยายน", "ตุลาคม", "พฤศจิกายน", "ธันวาคม"], 11 | monthsShort: ["ม.ค.", "ก.พ.", "มี.ค.", "เม.ย.", "พ.ค.", "มิ.ย.", "ก.ค.", "ส.ค.", "ก.ย.", "ต.ค.", "พ.ย.", "ธ.ค."], 12 | today: "วันนี้" 13 | }; 14 | }(jQuery)); 15 | -------------------------------------------------------------------------------- /bootstrap_toolkit/static/datepicker/js/locales/bootstrap-datepicker.tr.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Turkish translation for bootstrap-datepicker 3 | * Serkan Algur 4 | */ 5 | ;(function($){ 6 | $.fn.datepicker.dates['tr'] = { 7 | days: ["Pazar", "Pazartesi", "Salı", "Çarşamba", "Perşembe", "Cuma", "Cumartesi", "Pazar"], 8 | daysShort: ["Pz", "Pzt", "Sal", "Çrş", "Prş", "Cu", "Cts", "Pz"], 9 | daysMin: ["Pz", "Pzt", "Sa", "Çr", "Pr", "Cu", "Ct", "Pz"], 10 | months: ["Ocak", "Şubat", "Mart", "Nisan", "Mayıs", "Haziran", "Temmuz", "Ağustos", "Eylül", "Ekim", "Kasım", "Aralık"], 11 | monthsShort: ["Oca", "Şub", "Mar", "Nis", "May", "Haz", "Tem", "Ağu", "Eyl", "Eki", "Kas", "Ara"], 12 | today: "Bugün" 13 | }; 14 | }(jQuery)); 15 | 16 | -------------------------------------------------------------------------------- /bootstrap_toolkit/static/datepicker/js/locales/bootstrap-datepicker.bg.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Bulgarian translation for bootstrap-datepicker 3 | * Apostol Apostolov 4 | */ 5 | ;(function($){ 6 | $.fn.datepicker.dates['bg'] = { 7 | days: ["Неделя", "Понеделник", "Вторник", "Сряда", "Четвъртък", "Петък", "Събота", "Неделя"], 8 | daysShort: ["Нед", "Пон", "Вто", "Сря", "Чет", "Пет", "Съб", "Нед"], 9 | daysMin: ["Н", "П", "В", "С", "Ч", "П", "С", "Н"], 10 | months: ["Януари", "Февруари", "Март", "Април", "Май", "Юни", "Юли", "Август", "Септември", "Октомври", "Ноември", "Декември"], 11 | monthsShort: ["Ян", "Фев", "Мар", "Апр", "Май", "Юни", "Юли", "Авг", "Сеп", "Окт", "Ное", "Дек"], 12 | today: "днес" 13 | }; 14 | }(jQuery)); 15 | -------------------------------------------------------------------------------- /bootstrap_toolkit/static/datepicker/js/locales/bootstrap-datepicker.es.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Spanish translation for bootstrap-datepicker 3 | * Bruno Bonamin 4 | */ 5 | ;(function($){ 6 | $.fn.datepicker.dates['es'] = { 7 | days: ["Domingo", "Lunes", "Martes", "Miércoles", "Jueves", "Viernes", "Sábado", "Domingo"], 8 | daysShort: ["Dom", "Lun", "Mar", "Mié", "Jue", "Vie", "Sáb", "Dom"], 9 | daysMin: ["Do", "Lu", "Ma", "Mi", "Ju", "Vi", "Sa", "Do"], 10 | months: ["Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"], 11 | monthsShort: ["Ene", "Feb", "Mar", "Abr", "May", "Jun", "Jul", "Ago", "Sep", "Oct", "Nov", "Dic"], 12 | today: "Hoy" 13 | }; 14 | }(jQuery)); 15 | -------------------------------------------------------------------------------- /bootstrap_toolkit/static/datepicker/js/locales/bootstrap-datepicker.nl.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Dutch translation for bootstrap-datepicker 3 | * Reinier Goltstein 4 | */ 5 | ;(function($){ 6 | $.fn.datepicker.dates['nl'] = { 7 | days: ["Zondag", "Maandag", "Dinsdag", "Woensdag", "Donderdag", "Vrijdag", "Zaterdag", "Zondag"], 8 | daysShort: ["Zo", "Ma", "Di", "Wo", "Do", "Vr", "Za", "Zo"], 9 | daysMin: ["Zo", "Ma", "Di", "Wo", "Do", "Vr", "Za", "Zo"], 10 | months: ["Januari", "Februari", "Maart", "April", "Mei", "Juni", "Juli", "Augustus", "September", "Oktober", "November", "December"], 11 | monthsShort: ["Jan", "Feb", "Mrt", "Apr", "Mei", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dec"], 12 | today: "Vandaag" 13 | }; 14 | }(jQuery)); 15 | -------------------------------------------------------------------------------- /bootstrap_toolkit/static/datepicker/js/locales/bootstrap-datepicker.pt-BR.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Brazilian translation for bootstrap-datepicker 3 | * Cauan Cabral 4 | */ 5 | ;(function($){ 6 | $.fn.datepicker.dates['pt-BR'] = { 7 | days: ["Domingo", "Segunda", "Terça", "Quarta", "Quinta", "Sexta", "Sábado", "Domingo"], 8 | daysShort: ["Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sáb", "Dom"], 9 | daysMin: ["Do", "Se", "Te", "Qu", "Qu", "Se", "Sa", "Do"], 10 | months: ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"], 11 | monthsShort: ["Jan", "Fev", "Mar", "Abr", "Mai", "Jun", "Jul", "Ago", "Set", "Out", "Nov", "Dez"], 12 | today: "Hoje" 13 | }; 14 | }(jQuery)); 15 | -------------------------------------------------------------------------------- /bootstrap_toolkit/static/datepicker/js/locales/bootstrap-datepicker.rs-latin.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Serbian latin translation for bootstrap-datepicker 3 | * Bojan Milosavlević 4 | */ 5 | ;(function($){ 6 | $.fn.datepicker.dates['rs'] = { 7 | days: ["Nedelja","Ponedeljak", "Utorak", "Sreda", "Četvrtak", "Petak", "Subota", "Nedelja"], 8 | daysShort: ["Ned", "Pon", "Uto", "Sre", "Čet", "Pet", "Sub", "Ned"], 9 | daysMin: ["N", "Po", "U", "Sr", "Č", "Pe", "Su", "N"], 10 | months: ["Januar", "Februar", "Mart", "April", "Maj", "Jun", "Jul", "Avgust", "Septembar", "Oktobar", "Novembar", "Decembar"], 11 | monthsShort: ["Jan", "Feb", "Mar", "Apr", "Maj", "Jun", "Jul", "Avg", "Sep", "Okt", "Nov", "Dec"], 12 | today: "Danas" 13 | }; 14 | }(jQuery)); 15 | -------------------------------------------------------------------------------- /bootstrap_toolkit/static/datepicker/js/locales/bootstrap-datepicker.ru.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Russian translation for bootstrap-datepicker 3 | * Victor Taranenko 4 | */ 5 | ;(function($){ 6 | $.fn.datepicker.dates['ru'] = { 7 | days: ["Воскресенье", "Понедельник", "Вторник", "Среда", "Четверг", "Пятница", "Суббота", "Воскресенье"], 8 | daysShort: ["Вск", "Пнд", "Втр", "Срд", "Чтв", "Птн", "Суб", "Вск"], 9 | daysMin: ["Вс", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб", "Вс"], 10 | months: ["Январь", "Февраль", "Март", "Апрель", "Май", "Июнь", "Июль", "Август", "Сентябрь", "Октябрь", "Ноябрь", "Декабрь"], 11 | monthsShort: ["Янв", "Фев", "Мар", "Апр", "Май", "Июн", "Июл", "Авг", "Сен", "Окт", "Ноя", "Дек"], 12 | today: "Сегодня" 13 | }; 14 | }(jQuery)); -------------------------------------------------------------------------------- /bootstrap_toolkit/static/datepicker/js/locales/bootstrap-datepicker.sl.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Slovene translation for bootstrap-datepicker 3 | * Gregor Rudolf 4 | */ 5 | ;(function($){ 6 | $.fn.datepicker.dates['sl'] = { 7 | days: ["Nedelja", "Ponedeljek", "Torek", "Sreda", "Četrtek", "Petek", "Sobota", "Nedelja"], 8 | daysShort: ["Ned", "Pon", "Tor", "Sre", "Čet", "Pet", "Sob", "Ned"], 9 | daysMin: ["Ne", "Po", "To", "Sr", "Če", "Pe", "So", "Ne"], 10 | months: ["Januar", "Februar", "Marec", "April", "Maj", "Junij", "Julij", "Avgust", "September", "Oktober", "November", "December"], 11 | monthsShort: ["Jan", "Feb", "Mar", "Apr", "Maj", "Jun", "Jul", "Avg", "Sep", "Okt", "Nov", "Dec"], 12 | today: "Danes" 13 | }; 14 | }(jQuery)); 15 | -------------------------------------------------------------------------------- /bootstrap_toolkit/static/datepicker/js/locales/bootstrap-datepicker.it.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Italian translation for bootstrap-datepicker 3 | * Enrico Rubboli 4 | */ 5 | ;(function($){ 6 | $.fn.datepicker.dates['it'] = { 7 | days: ["Domenica", "Lunedi", "Martedi", "Mercoledi", "Giovedi", "Venerdi", "Sabato", "Domenica"], 8 | daysShort: ["Dom", "Lun", "Mar", "Mer", "Gio", "Ven", "Sab", "Dom"], 9 | daysMin: ["Do", "Lu", "Ma", "Me", "Gi", "Ve", "Sa", "Do"], 10 | months: ["Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto", "Settembre", "Ottobre", "Novembre", "Dicembre"], 11 | monthsShort: ["Gen", "Feb", "Mar", "Apr", "Mag", "Giu", "Lug", "Ago", "Set", "Ott", "Nov", "Dic"], 12 | today: "Oggi" 13 | }; 14 | }(jQuery)); 15 | -------------------------------------------------------------------------------- /bootstrap_toolkit/static/datepicker/js/locales/bootstrap-datepicker.nb.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Norwegian (bokmål) translation for bootstrap-datepicker 3 | * Fredrik Sundmyhr 4 | */ 5 | ;(function($){ 6 | $.fn.datepicker.dates['nb'] = { 7 | days: ["Søndag", "Mandag", "Tirsdag", "Onsdag", "Torsdag", "Fredag", "Lørdag", "Søndag"], 8 | daysShort: ["Søn", "Man", "Tir", "Ons", "Tor", "Fre", "Lør", "Søn"], 9 | daysMin: ["Sø", "Ma", "Ti", "On", "To", "Fr", "Lø", "Sø"], 10 | months: ["Januar", "Februar", "Mars", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Desember"], 11 | monthsShort: ["Jan", "Feb", "Mar", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Des"], 12 | today: "I Dag" 13 | }; 14 | }(jQuery)); -------------------------------------------------------------------------------- /relevation/urls.py: -------------------------------------------------------------------------------- 1 | from django.conf.urls import patterns, include, url 2 | 3 | # Uncomment the next two lines to enable the admin: 4 | from django.contrib import admin 5 | 6 | from relevation import settings 7 | 8 | admin.autodiscover() 9 | 10 | urlpatterns = patterns('', 11 | # Examples: 12 | # url(r'^$', 'relevation.views.home', name='home'), 13 | # url(r'^relevation/', include('relevation.foo.urls')), 14 | 15 | # Uncomment the admin/doc line below to enable admin documentation: 16 | # url(r'^admin/doc/', include('django.contrib.admindocs.urls')), 17 | 18 | # Uncomment the next line to enable the admin: 19 | url(r'^admin/', include(admin.site.urls)), 20 | 21 | url(r'^%s' % settings.URL_PREFIX, include('judgementapp.urls')), 22 | ) 23 | -------------------------------------------------------------------------------- /bootstrap_toolkit/static/datepicker/js/locales/bootstrap-datepicker.ro.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Romanian translation for bootstrap-datepicker 3 | * Cristian Vasile 4 | */ 5 | ;(function($){ 6 | $.fn.datepicker.dates['ro'] = { 7 | days: ["Duminică", "Luni", "Marţi", "Miercuri", "Joi", "Vineri", "Sâmbătă", "Duminică"], 8 | daysShort: ["Dum", "Lun", "Mar", "Mie", "Joi", "Vin", "Sâm", "Dum"], 9 | daysMin: ["Du", "Lu", "Ma", "Mi", "Jo", "Vi", "Sâ", "Du"], 10 | months: ["Ianuarie", "Februarie", "Martie", "Aprilie", "Mai", "Iunie", "Iulie", "August", "Septembrie", "Octombrie", "Noiembrie", "Decembrie"], 11 | monthsShort: ["Ian", "Feb", "Mar", "Apr", "Mai", "Iun", "Iul", "Aug", "Sep", "Oct", "Nov", "Dec"], 12 | today: "Astăzi", 13 | weekStart: 1 14 | }; 15 | }(jQuery)); 16 | -------------------------------------------------------------------------------- /bootstrap_toolkit/static/datepicker/js/locales/bootstrap-datepicker.is.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Icelandic translation for bootstrap-datepicker 3 | * Hinrik Örn Sigurðsson 4 | */ 5 | ;(function($){ 6 | $.fn.datepicker.dates['is'] = { 7 | days: ["Sunnudagur", "Mánudagur", "Þriðjudagur", "Miðvikudagur", "Fimmtudagur", "Föstudagur", "Laugardagur", "Sunnudagur"], 8 | daysShort: ["Sun", "Mán", "Þri", "Mið", "Fim", "Fös", "Lau", "Sun"], 9 | daysMin: ["Su", "Má", "Þr", "Mi", "Fi", "Fö", "La", "Su"], 10 | months: ["Janúar", "Febrúar", "Mars", "Apríl", "Maí", "Júní", "Júlí", "Ágúst", "September", "Október", "Nóvember", "Desember"], 11 | monthsShort: ["Jan", "Feb", "Mar", "Apr", "Maí", "Jún", "Júl", "Ágú", "Sep", "Okt", "Nóv", "Des"], 12 | today: "Í Dag" 13 | }; 14 | }(jQuery)); 15 | -------------------------------------------------------------------------------- /bootstrap_toolkit/static/datepicker/js/locales/bootstrap-datepicker.pt.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Portuguese translation for bootstrap-datepicker 3 | * Original code: Cauan Cabral 4 | * Tiago Melo 5 | */ 6 | ;(function($){ 7 | $.fn.datepicker.dates['pt'] = { 8 | days: ["Domingo", "Segunda", "Terça", "Quarta", "Quinta", "Sexta", "Sábado", "Domingo"], 9 | daysShort: ["Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sáb", "Dom"], 10 | daysMin: ["Do", "Se", "Te", "Qu", "Qu", "Se", "Sa", "Do"], 11 | months: ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"], 12 | monthsShort: ["Jan", "Fev", "Mar", "Abr", "Mai", "Jun", "Jul", "Ago", "Set", "Out", "Nov", "Dez"] 13 | }; 14 | }(jQuery)); 15 | -------------------------------------------------------------------------------- /bootstrap_toolkit/static/datepicker/js/locales/bootstrap-datepicker.fi.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Finnish translation for bootstrap-datepicker 3 | * Jaakko Salonen 4 | */ 5 | ;(function($){ 6 | $.fn.datepicker.dates['fi'] = { 7 | days: ["sunnuntai", "maanantai", "tiistai", "keskiviikko", "torstai", "perjantai", "lauantai", "sunnuntai"], 8 | daysShort: ["sun", "maa", "tii", "kes", "tor", "per", "lau", "sun"], 9 | daysMin: ["su", "ma", "ti", "ke", "to", "pe", "la", "su"], 10 | months: ["tammikuu", "helmikuu", "maaliskuu", "huhtikuu", "toukokuu", "kesäkuu", "heinäkuu", "elokuu", "syyskuu", "lokakuu", "marraskuu", "joulukuu"], 11 | monthsShort: ["tam", "hel", "maa", "huh", "tou", "kes", "hei", "elo", "syy", "lok", "mar", "jou"], 12 | today: "tänään" 13 | }; 14 | }(jQuery)); 15 | -------------------------------------------------------------------------------- /bootstrap_toolkit/static/datepicker/js/locales/bootstrap-datepicker.lv.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Latvian translation for bootstrap-datepicker 3 | * Artis Avotins 4 | */ 5 | 6 | ;(function($){ 7 | $.fn.datepicker.dates['lv'] = { 8 | days: ["Svētdiena", "Pirmdiena", "Otrdiena", "Trešdiena", "Ceturtdiena", "Piektdiena", "Sestdiena", "Svētdiena"], 9 | daysShort: ["Sv", "P", "O", "T", "C", "Pk", "S", "Sv"], 10 | daysMin: ["Sv", "Pr", "Ot", "Tr", "Ce", "Pk", "St", "Sv"], 11 | months: ["Janvāris", "Februāris", "Marts", "Aprīlis", "Maijs", "Jūnijs", "Jūlijs", "Augusts", "Septembris", "Oktobris", "Novembris", "Decembris"], 12 | monthsShort: ["Jan", "Feb", "Mar", "Apr", "Mai", "Jūn", "Jūl", "Aug", "Sep", "Okt", "Nov", "Dec."], 13 | today: "Šodien", 14 | weekStart: 1 15 | }; 16 | }(jQuery)); -------------------------------------------------------------------------------- /bootstrap_toolkit/static/datepicker/js/locales/bootstrap-datepicker.pl.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Polish translation for bootstrap-datepicker 3 | * Robert 4 | */ 5 | ;(function($){ 6 | $.fn.datepicker.dates['pl'] = { 7 | days: ["Niedziela", "Poniedziałek", "Wtorek", "Środa", "Czwartek", "Piątek", "Sobota", "Niedziela"], 8 | daysShort: ["Nie", "Pn", "Wt", "Śr", "Czw", "Pt", "So", "Nie"], 9 | daysMin: ["N", "Pn", "Wt", "Śr", "Cz", "Pt", "So", "N"], 10 | months: ["Styczeń", "Luty", "Marzec", "Kwiecień", "Maj", "Czerwiec", "Lipiec", "Sierpień", "Wrzesień", "Październik", "Listopad", "Grudzień"], 11 | monthsShort: ["Sty", "Lu", "Mar", "Kw", "Maj", "Cze", "Lip", "Sie", "Wrz", "Pa", "Lis", "Gru"], 12 | today: "Dzisiaj" 13 | }; 14 | }(jQuery)); 15 | -------------------------------------------------------------------------------- /bootstrap_toolkit/static/datepicker/js/locales/bootstrap-datepicker.lt.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Lithuanian translation for bootstrap-datepicker 3 | * Šarūnas Gliebus 4 | */ 5 | 6 | ;(function($){ 7 | $.fn.datepicker.dates['lt'] = { 8 | days: ["Sekmadienis", "Pirmadienis", "Antradienis", "Trečiadienis", "Ketvirtadienis", "Penktadienis", "Šeštadienis", "Sekmadienis"], 9 | daysShort: ["S", "Pr", "A", "T", "K", "Pn", "Š", "S"], 10 | daysMin: ["Sk", "Pr", "An", "Tr", "Ke", "Pn", "Št", "Sk"], 11 | months: ["Sausis", "Vasaris", "Kovas", "Balandis", "Gegužė", "Birželis", "Liepa", "Rugpjūtis", "Rugsėjis", "Spalis", "Lapkritis", "Gruodis"], 12 | monthsShort: ["Sau", "Vas", "Kov", "Bal", "Geg", "Bir", "Lie", "Rugp", "Rugs", "Spa", "Lap", "Gru"], 13 | today: "Šiandien", 14 | weekStart: 1 15 | }; 16 | }(jQuery)); 17 | -------------------------------------------------------------------------------- /judgementapp/urls.py: -------------------------------------------------------------------------------- 1 | from django.conf.urls import patterns, url 2 | from django.views.generic import TemplateView 3 | 4 | from judgementapp import views 5 | 6 | urlpatterns = patterns('', 7 | url(r'^$', views.index, name='index'), 8 | 9 | url(r'^query$', views.query_list, name='query_list'), 10 | url(r'^query/qrels$', views.qrels, name='query_list'), 11 | url(r'^query/(?P\d+)/$', views.query, name='query'), 12 | url(r'^query/(?P\d+)/doc/(?P[A-Za-z0-9_\-\+\.]+)/$', views.document, name='document'), 13 | url(r'^query/(?P\d+)/doc/(?P[+A-Za-z0-9_\-\+\.]+)/judge/$', views.judge, name='judge'), 14 | 15 | (r'^about/$', TemplateView.as_view(template_name='judgementapp/about.html')), 16 | (r'^upload/$', TemplateView.as_view(template_name='judgementapp/upload.html')), 17 | url(r'^upload/save$', views.upload, name='upload'), 18 | ) -------------------------------------------------------------------------------- /judgementapp/templates/judgementapp/form.html: -------------------------------------------------------------------------------- 1 | {% extends "judgementapp/base.html" %} 2 | 3 | {% load bootstrap_toolkit %} 4 | 5 | {% block extra_head %} 6 | {{ form.media }} 7 | {% endblock %} 8 | 9 | {% block content %} 10 | 11 |

This is a {{ layout }} Django form, bootstrapped

12 | 13 |

 

14 | 15 |
16 | {% csrf_token %} 17 | {{ form|as_bootstrap:layout }} 18 | {% if layout == "horizontal" %} 19 |

20 | 21 |

22 | {% else %} 23 | 24 | {% endif %} 25 |
26 | 27 |

Submit the form to see error messages styled into it.

28 | 29 | {% endblock %} 30 | -------------------------------------------------------------------------------- /bootstrap_toolkit/templates/bootstrap_toolkit/field_choices.html: -------------------------------------------------------------------------------- 1 | {{ choices_start }} 2 | {% for choice_id, choice_label in field.field.choices %} 3 | 17 | {% if not forloop.last and choices_separator > "" and forloop.counter|divisibleby:choices_group %} 18 | {{ choices_separator }} 19 | {% endif %} 20 | {% endfor %} 21 | {{ choices_end }} 22 | -------------------------------------------------------------------------------- /judgementapp/templates/judgementapp/index.html: -------------------------------------------------------------------------------- 1 | {% extends "judgementapp/base.html" %} 2 | 3 | {% block content %} 4 | 5 |
6 |

Relevation!

7 |

Relevation is a system for creating relevance judgement for Information Retrieval evaluations.

8 |

Check it out on GitHub »

9 |
10 | 11 |
12 | 13 |
14 |

Setup

15 | 16 |

Setup a new relevance judging project by upload your queries and ranked list of document results.

17 | 18 |

Start setup »

19 |
20 |
21 |

Queries

22 | 23 |

Take a look at the current queries in the systems and begin judging.

24 | 25 |

View queries »

26 |
27 |
28 | 29 | 30 | {% endblock %} 31 | -------------------------------------------------------------------------------- /bootstrap_toolkit/templates/bootstrap_toolkit/pagination.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /bootstrap_toolkit/templates/bootstrap_toolkit/field_inline.html: -------------------------------------------------------------------------------- 1 | {% if input_type == "checkbox" %} 2 | {% include "bootstrap_toolkit/field_checkbox.html" %} 3 | {% include "bootstrap_toolkit/field_help.html" with display="inline" %} 4 | {% else %} 5 | {% if input_type == "multicheckbox" %} 6 | {% include "bootstrap_toolkit/field_choices.html" with type="checkbox" %} 7 | {% include "bootstrap_toolkit/field_help.html" with display="block" %} 8 | {% else %} 9 | {% if field.label %} 10 | {{ field.label }} 11 | {% endif %} 12 | {% if input_type == "radioset" %} 13 | {% include "bootstrap_toolkit/field_choices.html" with type="radio" %} 14 | {% include "bootstrap_toolkit/field_help.html" with display="block" %} 15 | {% else %} 16 | {% include "bootstrap_toolkit/field_default.html" with display="inline"%} 17 | {% include "bootstrap_toolkit/field_help.html" with display="inline" %} 18 | {% endif %} 19 | {% endif %} 20 | {% endif %} 21 | {% include "bootstrap_toolkit/field_errors.html" with display="block" %} 22 | -------------------------------------------------------------------------------- /judgementapp/templates/judgementapp/form_using_template.html: -------------------------------------------------------------------------------- 1 | {% extends "judgementapp/base.html" %} 2 | 3 | {% load bootstrap_toolkit %} 4 | 5 | {% block content %} 6 | 7 |

This form uses templates

8 | 9 |

The disabled field gets a $ appended using a template.

10 | 11 |

 

12 | 13 |
14 | {% csrf_token %} 15 | 16 | {% for field in form %} 17 | {% if field.name == 'disabled' %} 18 | {% include "bootstrap_toolkit/field.html" with append='$' %} 19 | {% else %} 20 | {% if field.name != 'color' %} 21 | {% include "bootstrap_toolkit/field.html" %} 22 | {% endif %} 23 | {% endif %} 24 | {% endfor %} 25 | 26 | {% bootstrap_field form.color layout=layout %} 27 | 28 | {% if layout == "horizontal" %} 29 |

30 | 31 |

32 | {% else %} 33 | 34 | {% endif %} 35 | 36 |
37 | 38 |

Submit the form to see error messages styled into it.

39 | 40 | {% endblock %} 41 | -------------------------------------------------------------------------------- /judgementapp/templates/judgementapp/query_list.html: -------------------------------------------------------------------------------- 1 | {% extends "judgementapp/base.html" %} 2 | 3 | {% block content %} 4 | 5 |
6 |

Queries

7 |

8 |
9 | 10 |
11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | {% for query in queries %} 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | {% endfor %} 33 | 34 | 35 | 36 |
QueryIdTextNumber of documentsNumber unjudged
{{ query.qId }} {{ query.text }}{{ query.num_judgements }} 0 %} style="color: red" {% endif %}>{{ query.num_unjudged_docs }}
37 | 38 | {% if queries %} 39 | Download Relevance Assessments (qrels) 40 | {% endif %} 41 |
42 | 43 |
44 | 45 | 46 | {% endblock %} 47 | -------------------------------------------------------------------------------- /relevation/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for relevation project. 3 | 4 | This module contains the WSGI application used by Django's development server 5 | and any production WSGI deployments. It should expose a module-level variable 6 | named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover 7 | this application via the ``WSGI_APPLICATION`` setting. 8 | 9 | Usually you will have the standard Django WSGI application here, but it also 10 | might make sense to replace the whole Django WSGI application with a custom one 11 | that later delegates to the Django one. For example, you could introduce WSGI 12 | middleware here, or combine a Django application with an application of another 13 | framework. 14 | 15 | """ 16 | import os 17 | 18 | # We defer to a DJANGO_SETTINGS_MODULE already in the environment. This breaks 19 | # if running multiple sites in the same mod_wsgi process. To fix this, use 20 | # mod_wsgi daemon mode with each site in its own daemon process, or use 21 | # os.environ["DJANGO_SETTINGS_MODULE"] = "relevation.settings" 22 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "relevation.settings") 23 | 24 | # This application object is used by any WSGI server configured to use this 25 | # file. This includes Django's development server, if the WSGI_APPLICATION 26 | # setting points here. 27 | from django.core.wsgi import get_wsgi_application 28 | application = get_wsgi_application() 29 | 30 | # Apply WSGI middleware here. 31 | # from helloworld.wsgi import HelloWorldApplication 32 | # application = HelloWorldApplication(application) 33 | -------------------------------------------------------------------------------- /bootstrap_toolkit/templates/bootstrap_toolkit/field_horizontal.html: -------------------------------------------------------------------------------- 1 |
2 | {% if input_type != "checkbox" %} 3 | 4 | {% endif %} 5 |
6 | {% if input_type == "checkbox" %} 7 | {% include "bootstrap_toolkit/field_checkbox.html" %} 8 | {% include "bootstrap_toolkit/field_errors.html" with display="inline" %} 9 | {% else %} 10 | {% if input_type == "multicheckbox" %} 11 | {% include "bootstrap_toolkit/field_choices.html" with type="checkbox" %} 12 | {% include "bootstrap_toolkit/field_errors.html" with display="block" %} 13 | {% else %} 14 | {% if input_type == "radioset" %} 15 | {% include "bootstrap_toolkit/field_choices.html" with type="radio" %} 16 | {% include "bootstrap_toolkit/field_errors.html" with display="block" %} 17 | {% else %} 18 | {% include "bootstrap_toolkit/field_default.html" %} 19 | {% include "bootstrap_toolkit/field_errors.html" with display="inline" %} 20 | {% endif %} 21 | {% endif %} 22 | {% endif %} 23 | {% include "bootstrap_toolkit/field_help.html" with display="block" %} 24 |
25 |
26 | -------------------------------------------------------------------------------- /judgementapp/models.py: -------------------------------------------------------------------------------- 1 | from django.conf import settings 2 | from django.db import models 3 | 4 | # Create your models here. 5 | 6 | 7 | class Document(models.Model): 8 | docId = models.CharField(max_length=250) 9 | text = models.TextField() 10 | 11 | def __unicode__(self): 12 | return self.docId 13 | 14 | def get_content(self): 15 | content = "" 16 | try: 17 | with open(settings.DATA_DIR+"/"+self.docId) as f: 18 | content = f.read() 19 | except Exception: 20 | content = "Could not read file %s" % settings.DATA_DIR+"/"+self.docId 21 | return content 22 | 23 | class Query(models.Model): 24 | qId = models.IntegerField() 25 | text = models.CharField(max_length=250) 26 | difficulty = models.IntegerField(blank=True, null=True) 27 | comment = models.TextField(blank=True, null=True) 28 | 29 | instructions = models.TextField(blank=True, null=True) 30 | criteria = models.TextField(blank=True, null=True) 31 | example = models.TextField(blank=True, null=True) 32 | 33 | def __unicode__(self): 34 | return '%s: %s' % (self.qId, self.text) 35 | 36 | def num_unjudged_docs(self): 37 | unjugded = [judgement for judgement in self.judgements() if judgement.relevance < 0] 38 | return len(unjugded) 39 | 40 | def num_judgements(self): 41 | return len(self.judgements()) 42 | 43 | def judgements(self): 44 | return Judgement.objects.filter(query=self.id) 45 | 46 | class Judgement(models.Model): 47 | 48 | labels = {-1: 'Unjudged', 0: 'Not relvant', 1: 'Somewhat relevant', 2:'Highly relevant'} 49 | 50 | query = models.ForeignKey(Query) 51 | document = models.ForeignKey(Document) 52 | comment = models.TextField(blank=True, null=True) 53 | 54 | relevance = models.IntegerField() 55 | 56 | def __unicode__(self): 57 | return '%s Q0 %s %s\n' % (self.query.qId, self.document.docId, self.relevance) 58 | 59 | 60 | def label(self): 61 | return self.labels[self.relevance] 62 | -------------------------------------------------------------------------------- /bootstrap_toolkit/templates/bootstrap_toolkit/field_vertical.html: -------------------------------------------------------------------------------- 1 |
2 | {% if input_type == "checkbox" %} 3 |
4 | {% include "bootstrap_toolkit/field_checkbox.html" %} 5 | {% include "bootstrap_toolkit/field_help.html" with display="inline" %} 6 | {% include "bootstrap_toolkit/field_errors.html" with display="block" %} 7 |
8 | {% else %} 9 | {% if input_type == "multicheckbox" %} 10 | 11 |
12 | {% include "bootstrap_toolkit/field_choices.html" with type="checkbox" %} 13 | {% include "bootstrap_toolkit/field_help.html" with display="block" %} 14 | {% include "bootstrap_toolkit/field_errors.html" with display="block" %} 15 |
16 | {% else %} 17 | {% if input_type == "radioset" %} 18 | 19 |
20 | {% include "bootstrap_toolkit/field_choices.html" with type="radio" %} 21 | {% include "bootstrap_toolkit/field_help.html" with display="block" %} 22 | {% include "bootstrap_toolkit/field_errors.html" with display="block" %} 23 |
24 | {% else %} 25 | 26 |
27 | {% include "bootstrap_toolkit/field_default.html" %} 28 | {% include "bootstrap_toolkit/field_help.html" with display="inline" %} 29 | {% include "bootstrap_toolkit/field_errors.html" with display="block" %} 30 |
31 | {% endif %} 32 | {% endif %} 33 | {% endif %} 34 |
35 | -------------------------------------------------------------------------------- /judgementapp/templates/judgementapp/upload.html: -------------------------------------------------------------------------------- 1 | {% extends "judgementapp/base.html" %} 2 | 3 | {% block content %} 4 | 5 |
6 |

Setup

7 |
8 | 9 |
10 | 11 | {% if queries %} 12 |
13 | {{ queries }} queries processed succesfully. 14 |
15 | {% endif %} 16 | {% if results %} 17 |
18 | {{ results }} document results processed succesfully. 19 |
20 | {% endif %} 21 | {% if not queries and not results %} 22 | 23 |
24 | 25 | 26 | 27 | 28 |
29 | {% csrf_token %} 30 | Upload Queries and Results List 31 |

Query file in the format "QueryId [tab] QueryText". Results file using standard TREC format results file

32 |
33 | 34 |
35 | 36 |
37 | 38 | Browse 39 | 40 | 45 |
46 |
47 |
48 |
49 | 50 |
51 | 52 |
53 | 54 | Browse 55 | 56 | 61 |
62 | 63 |
64 |
65 | 66 |
67 | 68 | 69 |
70 | 71 |
72 | 73 |
74 | {% endif %} 75 |
76 | 77 | 78 | {% endblock %} 79 | -------------------------------------------------------------------------------- /judgementapp/templates/judgementapp/base.html: -------------------------------------------------------------------------------- 1 | 2 | {% load bootstrap_toolkit %} 3 | 4 | 5 | 6 | relevation - Information Retrieval Relevance Judging System 7 | 8 | 9 | {% bootstrap_stylesheet_tag %} 10 | 24 | 27 | 28 | {% bootstrap_javascript_tag %} 29 | {% block extra_head %}{% endblock %} 30 | 31 | 32 | 33 | 34 | 56 | 57 |
58 | 59 | {% bootstrap_messages %} 60 | 61 | {% block content %}Empty page{% endblock %} 62 | 63 |


64 | 65 |
66 |
67 |

relevation - Information Retrieval Relevance Judging System

68 |
69 |
70 |

71 | Bevan Koopman 72 |

73 |
74 |
75 | 76 |
77 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /judgementapp/templates/judgementapp/query.html: -------------------------------------------------------------------------------- 1 | {% extends "judgementapp/base.html" %} 2 | 3 | {% block content %} 4 | 5 |
6 |

200 %} class="long" {% endif %}>{{ query.qId }} - {{ query.text }} Back to Queries

7 |

8 |
9 | 10 |
11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | {% for judgement in judgements %} 24 | 25 | 26 | 27 | 28 | 34 | 35 | {% endfor %} 36 | 37 |
QueryNumberDocument#Status
{{ query.qId }}{{ forloop.counter }}{{ judgement.document }}{{ judgement.label }}
38 | 39 |
40 | 41 |
42 | {% csrf_token %} 43 | How hard was this query to judge? 44 |
45 | 49 | 53 | 57 |
58 |
74 | 75 | 76 | {% endblock %} 77 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Relevation! 2 | 3 | 4 | _Relevation: A raising or lifting up._ - Wiktionary 5 | 6 | 7 | Relevation is a system for performing relevance judgements for Information Retrieval system evaluation. Documents and queries can be uploaded to the system via the web interface. Judges can browse the uploaded documents and queries and provide their relevance assessments. 8 | 9 | ## Who is Relevation! aimed at? 10 | 11 | Relevation! is aimed at anyone wishing to collection relevance assessment for information retrieval evaluation evaluation. 12 | 13 | If you do use Relevation! we would appreciated it if you cited us: 14 | 15 | B. Koopman and G. Zuccon. Relevation!: *An open source system for information retrieval relevance assessment*. In Proceedings of the 37th annual international ACM SIGIR conference on research and development in information retrieval, Gold Coast, Australia, July 2014. 16 | 17 | ## Feautures 18 | 19 | Relevation! is build using Python's (version 2.7) Django (version 1.6) web framework and Twitter's Bootstrap. 20 | 21 | ## Setup Steps 22 | 23 | 1. Checkout relevation from github with: `git clone https://github.com/ielab/relevation.git` 24 | 2. Copy your documents into the `relevation/documents` folder. 25 | 3. Start Relevation! by running `./manage.py runserver`. Relevation! will be running at [http://127.0.0.1:8000](http://127.0.0.1:8000) 26 | 4. Go to Setup page and upload your queries and document pool. (Queries are in the form queryId[tab]queryText; the pool is in standard TREC results format.) 27 | 28 | You can also look at a demo that shows how to setup Relevation! from scratch; the demo is available at [https://vimeo.com/ielab/relevation](https://vimeo.com/ielab/relevation). 29 | 30 | ### Input format for Queries and Rankings 31 | 32 | #### Queries File Format 33 | 34 | The query file has the format `queryId[tab]queryText`; e.g., 35 | 36 | ``` 37 | 20149 43-year-old woman with soft, flesh-colored, pedunculated lesions on her neck. 38 | 201410 67-year-old woman status post cardiac catheterization via right femoral artery, now with a cool, pulseless right foot and right femoral bruit. 39 | 201411 40-year-old woman with severe right arm pain and hypotension. She has no history of trauma and right arm exam reveals no significant findings. 40 | 201412 25-year-old woman with fatigue, hair loss, weight gain, and cold intolerance for 6 months. 41 | 201413 30-year-old woman who is 3 weeks post-partum, presents with shortness of breath, tachypnea, and hypoxia. 42 | ``` 43 | 44 | ### Judgements File Format 45 | 46 | The judement file in just a standard TREC results file, which is: 47 | 48 | `queryId[tab]Q0[tab]docId[tab]score[tab]runDescription` 49 | 50 | For example: 51 | 52 | ``` 53 | 201410 Q0 NCT02371057 1 0.82393600 bm25 54 | 201410 Q0 NCT01102998 2 0.80546773 bm25 55 | 201410 Q0 NCT00494468 3 0.78496643 bm25 56 | 201410 Q0 NCT02517346 4 0.74522880 bm25 57 | 201410 Q0 NCT00881985 5 0.61913227 bm25 58 | ``` 59 | 60 | The judgement file is in the form 61 | 62 | ## Use cases 63 | 64 | Relevation has been used in anger for: 65 | 66 | * CLEF eHealth Evaluation Lab: 2013-2016 67 | * [ECIR diagnose me paper](http://zuccon.net/diagnose-this.html) 68 | * Relevance assessment collection for [Bevan Koopman's](http://koopman.id.au) PhD thesis 69 | * [SIGIR Clinical Trials Collection paper](http://dl.acm.org/citation.cfm?id=2914672) 70 | 71 | ## Authors and Support 72 | 73 | Relevation was designed by [Bevan Koopman](http://koopman.id.au) and [Guido Zuccon](http://zuccon.net). Relevation is an open source project still in development. 74 | -------------------------------------------------------------------------------- /bootstrap_toolkit/widgets.py: -------------------------------------------------------------------------------- 1 | from django import forms 2 | from django.conf import settings 3 | from django.utils import translation 4 | from django.utils.safestring import mark_safe 5 | from django.utils.html import conditional_escape 6 | 7 | default_date_format = getattr(settings, 'DATE_INPUT_FORMATS', None) 8 | if default_date_format: 9 | default_date_format = str(default_date_format[0]) 10 | 11 | 12 | def javascript_date_format(python_date_format): 13 | format = python_date_format.replace(r'%Y', 'yyyy') 14 | format = format.replace(r'%m', 'mm') 15 | format = format.replace(r'%d', 'dd') 16 | if '%' in format: 17 | format = '' 18 | if not format: 19 | format = 'yyyy-mm-dd' 20 | return format 21 | 22 | 23 | def add_to_css_class(classes, new_class): 24 | new_class = new_class.strip() 25 | if new_class: 26 | # Turn string into list of classes 27 | classes = classes.split(" ") 28 | # Strip whitespace 29 | classes = [c.strip() for c in classes] 30 | # Remove empty elements 31 | classes = filter(None, classes) 32 | # Test for existing 33 | if not new_class in classes: 34 | classes.append(new_class) 35 | # Convert to string 36 | classes = u" ".join(classes) 37 | return classes 38 | 39 | 40 | def create_prepend_append(**kwargs): 41 | bootstrap = {} 42 | bootstrap['append'] = kwargs.pop('append', None) 43 | bootstrap['prepend'] = kwargs.pop('prepend', None) 44 | return bootstrap, kwargs 45 | 46 | 47 | class BootstrapUneditableInput(forms.TextInput): 48 | 49 | def render(self, name, value, attrs=None): 50 | if attrs is None: 51 | attrs = {} 52 | attrs['type'] = 'hidden' 53 | klass = add_to_css_class(self.attrs.pop('class', ''), 'uneditable-input') 54 | klass = add_to_css_class(klass, attrs.pop('class', '')) 55 | base = super(BootstrapUneditableInput, self).render(name, value, attrs) 56 | return mark_safe(base + u'%s' % (klass, conditional_escape(value))) 57 | 58 | 59 | class BootstrapTextInput(forms.TextInput): 60 | 61 | def __init__(self, *args, **kwargs): 62 | self.bootstrap, kwargs = create_prepend_append(**kwargs) 63 | super(BootstrapTextInput, self).__init__(*args, **kwargs) 64 | 65 | 66 | class BootstrapPasswordInput(forms.PasswordInput): 67 | 68 | def __init__(self, *args, **kwargs): 69 | self.bootstrap, kwargs = create_prepend_append(**kwargs) 70 | super(BootstrapPasswordInput, self).__init__(*args, **kwargs) 71 | 72 | 73 | class BootstrapDateInput(forms.DateInput): 74 | 75 | bootstrap = { 76 | 'append': mark_safe(''), 77 | 'prepend': None, 78 | } 79 | 80 | class Media: 81 | js = ( 82 | settings.STATIC_URL + 'datepicker/js/bootstrap-datepicker.js', 83 | ) 84 | lang = translation.get_language().split('-')[0].lower() 85 | if lang != 'en': 86 | js = js + ( 87 | settings.STATIC_URL + 'datepicker/js/locales/bootstrap-datepicker.%s.js' % lang, 88 | ) 89 | js = js + ( 90 | settings.STATIC_URL + 'bootstrap_toolkit/js/init_datepicker.js', 91 | ) 92 | css = { 93 | 'screen': ( 94 | settings.STATIC_URL + 'datepicker/css/datepicker.css', 95 | ) 96 | } 97 | 98 | def render(self, name, value, attrs=None): 99 | if attrs is None: 100 | attrs = {} 101 | format = self.format 102 | if not format: 103 | format = default_date_format 104 | attrs['data-date-format'] = javascript_date_format(format) 105 | attrs['data-date-language'] = translation.get_language().split('-')[0].lower() 106 | attrs['data-bootstrap-widget'] = 'datepicker' 107 | return super(BootstrapDateInput, self).render(name, value, attrs) 108 | -------------------------------------------------------------------------------- /bootstrap_toolkit/static/bootstrap_toolkit/js/bootstrap.file-input.js: -------------------------------------------------------------------------------- 1 | /* 2 | Bootstrap - File Input 3 | ====================== 4 | 5 | This is meant to convert all file input tags into a set of elements that displays consistently in all browsers. 6 | 7 | Converts all 8 | 9 | into Bootstrap buttons 10 | Browse 11 | 12 | */ 13 | $(function() { 14 | 15 | $('input[type=file]').each(function(i,elem){ 16 | 17 | // Maybe some fields don't need to be standardized. 18 | if (typeof $(this).attr('data-bfi-disabled') != 'undefined') { 19 | return; 20 | } 21 | 22 | // Set the word to be displayed on the button 23 | var buttonWord = 'Browse'; 24 | 25 | if (typeof $(this).attr('title') != 'undefined') { 26 | buttonWord = $(this).attr('title'); 27 | } 28 | 29 | // Start by getting the HTML of the input element. 30 | // Thanks for the tip http://stackoverflow.com/a/1299069 31 | var input = $('
').append( $(elem).eq(0).clone() ).html(); 32 | 33 | // Now we're going to replace that input field with a Bootstrap button. 34 | // The input will actually still be there, it will just be float above and transparent (done with the CSS). 35 | $(elem).replaceWith(''+buttonWord+input+''); 36 | }) 37 | // After we have found all of the file inputs let's apply a listener for tracking the mouse movement. 38 | // This is important because the in order to give the illusion that this is a button in FF we actually need to move the button from the file input under the cursor. Ugh. 39 | .promise().done( function(){ 40 | 41 | // As the cursor moves over our new Bootstrap button we need to adjust the position of the invisible file input Browse button to be under the cursor. 42 | // This gives us the pointer cursor that FF denies us 43 | $('.file-input-wrapper').mousemove(function(cursor) { 44 | 45 | var input, wrapper, 46 | wrapperX, wrapperY, 47 | inputWidth, inputHeight, 48 | cursorX, cursorY; 49 | 50 | // This wrapper element (the button surround this file input) 51 | wrapper = $(this); 52 | // The invisible file input element 53 | input = wrapper.find("input"); 54 | // The left-most position of the wrapper 55 | wrapperX = wrapper.offset().left; 56 | // The top-most position of the wrapper 57 | wrapperY = wrapper.offset().top; 58 | // The with of the browsers input field 59 | inputWidth= input.width(); 60 | // The height of the browsers input field 61 | inputHeight= input.height(); 62 | //The position of the cursor in the wrapper 63 | cursorX = cursor.pageX; 64 | cursorY = cursor.pageY; 65 | 66 | //The positions we are to move the invisible file input 67 | // The 20 at the end is an arbitrary number of pixels that we can shift the input such that cursor is not pointing at the end of the Browse button but somewhere nearer the middle 68 | moveInputX = cursorX - wrapperX - inputWidth + 20; 69 | // Slides the invisible input Browse button to be positioned middle under the cursor 70 | moveInputY = cursorY- wrapperY - (inputHeight/2); 71 | 72 | // Apply the positioning styles to actually move the invisible file input 73 | input.css({ 74 | left:moveInputX, 75 | top:moveInputY 76 | }); 77 | }); 78 | 79 | $('.file-input-wrapper input[type=file]').change(function(){ 80 | 81 | // Remove any previous file names 82 | $(this).parent().next().has('file-input-name').remove(); 83 | $(this).parent().after(''+$(this).val()+''); 84 | 85 | }); 86 | 87 | 88 | 89 | }); 90 | 91 | // Add the styles before the first stylesheet 92 | // This ensures they can be easily overridden with developer styles 93 | var cssHtml = ''; 98 | $('link[rel=stylesheet]').eq(0).before(cssHtml); 99 | 100 | }); -------------------------------------------------------------------------------- /judgementapp/templates/judgementapp/document.html: -------------------------------------------------------------------------------- 1 | {% extends "judgementapp/base.html" %} 2 | 3 | {% block content %} 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 |

200 %} class="long" {% endif %}>{{ query.qId }} - {{ query.text }} Back to Query

12 | 13 | 14 |
15 | 16 |
17 | 18 |
19 | {% if prev %} 20 | Prev Document 21 | {% endif %} 22 |
23 | 24 |

Document "{{ document.docId }}" ({{ rank }} / {{total_rank}})

25 | 26 |
27 | {% if next %} 28 | Next Document 29 | {% endif %} 30 |
31 | 32 |
33 | 34 | 35 |
36 | 37 |
38 |
{{ content }}
39 |
40 | 41 | 42 | 84 | 85 |
86 |
87 | {% csrf_token %} 88 | 89 | {% if query.criteria %} 90 | Query Description 91 | Criteria: {{ query.criteria }} 92 | {% endif %} 93 | 94 | Judgement 95 |
96 |
100 |
104 |
108 | 112 |
113 |
114 | 115 |
116 | 117 | 118 |
119 |
120 | 121 | 122 |
123 | 124 | {% if next %} {% endif %} 125 | 126 |
127 | 128 |
129 | 130 | 131 | 132 |
133 | 134 | 135 |
136 | 137 | 138 | {% endblock %} 139 | -------------------------------------------------------------------------------- /judgementapp/views.py: -------------------------------------------------------------------------------- 1 | # Create your views here. 2 | import cStringIO as StringIO 3 | from django.http import HttpResponse, HttpResponseRedirect 4 | from django.core.urlresolvers import reverse 5 | from django.template import Context, loader, RequestContext 6 | from django.shortcuts import render_to_response, get_object_or_404 7 | from django.core.servers.basehttp import FileWrapper 8 | 9 | from judgementapp.models import * 10 | 11 | def index(request): 12 | queries = Query.objects.order_by('qId') 13 | output = ', '.join([q.text for q in queries]) 14 | 15 | template = loader.get_template('judgementapp/index.html') 16 | context = Context({ 17 | 'queries': queries, 18 | }) 19 | return HttpResponse(template.render(context)) 20 | 21 | def qrels(request): 22 | judgements = Judgement.objects.exclude(relevance=-1) 23 | 24 | 25 | response = HttpResponse(judgements, mimetype='application/force-download') 26 | response['Content-Disposition'] = 'attachment; filename=qrels.txt' 27 | #response['X-Sendfile'] = myfile 28 | # It's usually a good idea to set the 'Content-Length' header too. 29 | # You can also set any other required headers: Cache-Control, etc. 30 | return response 31 | 32 | def query_list(request): 33 | queries = Query.objects.order_by('qId') 34 | 35 | return render_to_response('judgementapp/query_list.html', { 'queries': queries}, context_instance=RequestContext(request)) 36 | 37 | def query(request, qId): 38 | query = Query.objects.get(qId=qId) 39 | judgements = Judgement.objects.filter(query=query.id) 40 | 41 | if "difficulty" in request.POST: 42 | query.difficulty = int(request.POST['difficulty']) 43 | if "comment" in request.POST: 44 | query.comment = request.POST['comment'] 45 | query.save() 46 | 47 | query.length = len(query.text) 48 | 49 | return render_to_response('judgementapp/query.html', {'query': query, 'judgements': judgements}, 50 | context_instance=RequestContext(request)) 51 | 52 | 53 | def document(request, qId, docId): 54 | document = Document.objects.get(docId=docId) 55 | query = Query.objects.get(qId=qId) 56 | 57 | judgements = Judgement.objects.filter(query=query.id) 58 | judgement = Judgement.objects.filter(query=query.id, document=document.id)[0] 59 | rank = -1 60 | for (count, j) in enumerate(judgements): 61 | if j.id == judgement.id: 62 | rank = count+1 63 | break 64 | 65 | 66 | prev = None 67 | try: 68 | prev = Judgement.objects.filter(query=query.id).get(id=judgement.id-1) 69 | except: 70 | pass 71 | 72 | next = None 73 | try: 74 | next = Judgement.objects.filter(query=query.id).get(id=judgement.id+1) 75 | except: 76 | pass 77 | 78 | content = document.get_content() 79 | 80 | return render_to_response('judgementapp/document.html', {'document': document, 'query': query, 'judgement': judgement, 81 | 'next': next, 'prev': prev, 'rank': rank, 'total_rank': judgements.count(), 'content': content.strip()}, context_instance=RequestContext(request)) 82 | 83 | def judge(request, qId, docId): 84 | query = get_object_or_404(Query, qId=qId) 85 | document = get_object_or_404(Document, docId=docId) 86 | relevance = request.POST['relevance'] 87 | comment = request.POST['comment'] 88 | 89 | judgements = Judgement.objects.filter(query=query.id) 90 | judgement, created = Judgement.objects.get_or_create(query=query.id, document=document.id) 91 | judgement.relevance = int(relevance) 92 | if comment != 'Comment': 93 | judgement.comment = comment 94 | judgement.save() 95 | 96 | 97 | 98 | next = None 99 | try: 100 | next = Judgement.objects.filter(query=query.id).get(id=judgement.id+1) 101 | if 'next' in request.POST: 102 | document = next.document 103 | judgement = next 104 | next = Judgement.objects.filter(query=query.id).get(id=judgement.id+1) 105 | except: 106 | pass 107 | 108 | prev = None 109 | try: 110 | prev = Judgement.objects.filter(query=query.id).get(id=judgement.id-1) 111 | except: 112 | pass 113 | 114 | rank = -1 115 | for (count, j) in enumerate(judgements): 116 | if j.id == judgement.id: 117 | rank = count+1 118 | break 119 | 120 | 121 | content = document.get_content() 122 | 123 | return render_to_response('judgementapp/document.html', {'document': document, 'query': query, 'judgement': judgement, 124 | 'next': next, 'prev': prev, 'rank': rank, 'total_rank': judgements.count(), 'content': content.strip()}, context_instance=RequestContext(request)) 125 | 126 | 127 | def upload(request): 128 | context = {} 129 | if 'queryFile' in request.FILES: 130 | f = request.FILES['queryFile'] 131 | 132 | qryCount = 0 133 | for query in f: 134 | qid, txt = query.split("\t", 1) 135 | qryCount = qryCount + 1 136 | query = Query(qId=qid,text=txt) 137 | query.save() 138 | context['queries'] = qryCount 139 | 140 | if 'resultsFile' in request.FILES: 141 | f = request.FILES['resultsFile'] 142 | 143 | docCount = 0 144 | for result in f: 145 | qid, z, doc, rank, score, desc = result.split() 146 | docCount = docCount + 1 147 | doc = doc.replace('corpus/', '') 148 | 149 | document, created = Document.objects.get_or_create(docId=doc) 150 | document.text = "TBA" 151 | 152 | query = Query.objects.get(qId=qid) 153 | document.save() 154 | 155 | judgement = Judgement() 156 | judgement.query = query 157 | judgement.document = document 158 | judgement.relevance = -1 159 | 160 | judgement.save() 161 | 162 | context['results'] = docCount 163 | 164 | return render_to_response('judgementapp/upload.html', context) 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | -------------------------------------------------------------------------------- /relevation/settings.py: -------------------------------------------------------------------------------- 1 | # Django settings for relevation project. 2 | 3 | import os 4 | 5 | DEBUG = True 6 | TEMPLATE_DEBUG = DEBUG 7 | 8 | DATA_DIR=os.getcwd()+'/documents' 9 | URL_PREFIX='' 10 | 11 | ADMINS = ( 12 | # ('Your Name', 'your_email@example.com'), 13 | ) 14 | 15 | MANAGERS = ADMINS 16 | 17 | DATABASES = { 18 | 'default': { 19 | 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. 20 | 'NAME': os.getcwd()+'/db/relevation.db', # Or path to database file if using sqlite3. 21 | # The following settings are not used with sqlite3: 22 | 'USER': '', 23 | 'PASSWORD': '', 24 | 'HOST': '', # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP. 25 | 'PORT': '', # Set to empty string for default. 26 | } 27 | } 28 | 29 | # Hosts/domain names that are valid for this site; required if DEBUG is False 30 | # See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts 31 | ALLOWED_HOSTS = ['0.0.0.0'] 32 | 33 | # Local time zone for this installation. Choices can be found here: 34 | # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name 35 | # although not all choices may be available on all operating systems. 36 | # In a Windows environment this must be set to your system time zone. 37 | TIME_ZONE = 'Australia/Brisbane' 38 | 39 | # Language code for this installation. All choices can be found here: 40 | # http://www.i18nguy.com/unicode/language-identifiers.html 41 | LANGUAGE_CODE = 'en-us' 42 | 43 | SITE_ID = 1 44 | 45 | # If you set this to False, Django will make some optimizations so as not 46 | # to load the internationalization machinery. 47 | USE_I18N = True 48 | 49 | # If you set this to False, Django will not format dates, numbers and 50 | # calendars according to the current locale. 51 | USE_L10N = True 52 | 53 | # If you set this to False, Django will not use timezone-aware datetimes. 54 | USE_TZ = True 55 | 56 | # Absolute filesystem path to the directory that will hold user-uploaded files. 57 | # Example: "/var/www/example.com/media/" 58 | MEDIA_ROOT = '' 59 | 60 | # URL that handles the media served from MEDIA_ROOT. Make sure to use a 61 | # trailing slash. 62 | # Examples: "http://example.com/media/", "http://media.example.com/" 63 | MEDIA_URL = '' 64 | 65 | # Absolute path to the directory static files should be collected to. 66 | # Don't put anything in this directory yourself; store your static files 67 | # in apps' "static/" subdirectories and in STATICFILES_DIRS. 68 | # Example: "/var/www/example.com/static/" 69 | STATIC_ROOT = '' 70 | 71 | # URL prefix for static files. 72 | # Example: "http://example.com/static/", "http://static.example.com/" 73 | STATIC_URL = '/static/' 74 | 75 | # Additional locations of static files 76 | STATICFILES_DIRS = ( 77 | # Put strings here, like "/home/html/static" or "C:/www/django/static". 78 | # Always use forward slashes, even on Windows. 79 | # Don't forget to use absolute paths, not relative paths. 80 | ) 81 | 82 | # List of finder classes that know how to find static files in 83 | # various locations. 84 | STATICFILES_FINDERS = ( 85 | 'django.contrib.staticfiles.finders.FileSystemFinder', 86 | 'django.contrib.staticfiles.finders.AppDirectoriesFinder', 87 | # 'django.contrib.staticfiles.finders.DefaultStorageFinder', 88 | ) 89 | 90 | # Make this unique, and don't share it with anybody. 91 | SECRET_KEY = 'kr%-&h^xaq0p)p8xpw0%y))7xww&x-tzpf_ndb2&qw=ix@ms58' 92 | 93 | # List of callables that know how to import templates from various sources. 94 | TEMPLATE_LOADERS = ( 95 | 'django.template.loaders.filesystem.Loader', 96 | 'django.template.loaders.app_directories.Loader', 97 | # 'django.template.loaders.eggs.Loader', 98 | ) 99 | 100 | MIDDLEWARE_CLASSES = ( 101 | 'django.middleware.common.CommonMiddleware', 102 | 'django.contrib.sessions.middleware.SessionMiddleware', 103 | 'django.middleware.csrf.CsrfViewMiddleware', 104 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 105 | 'django.contrib.messages.middleware.MessageMiddleware', 106 | # Uncomment the next line for simple clickjacking protection: 107 | # 'django.middleware.clickjacking.XFrameOptionsMiddleware', 108 | ) 109 | 110 | ROOT_URLCONF = 'relevation.urls' 111 | 112 | # Python dotted path to the WSGI application used by Django's runserver. 113 | WSGI_APPLICATION = 'relevation.wsgi.application' 114 | 115 | TEMPLATE_DIRS = ( 116 | # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". 117 | # Always use forward slashes, even on Windows. 118 | # Don't forget to use absolute paths, not relative paths. 119 | ) 120 | 121 | INSTALLED_APPS = ( 122 | 'django.contrib.auth', 123 | 'django.contrib.contenttypes', 124 | 'django.contrib.sessions', 125 | 'django.contrib.sites', 126 | 'django.contrib.messages', 127 | 'django.contrib.staticfiles', 128 | # Uncomment the next line to enable the admin: 129 | 'django.contrib.admin', 130 | # Uncomment the next line to enable admin documentation: 131 | # 'django.contrib.admindocs', 132 | 'bootstrap_toolkit', 133 | 'judgementapp' 134 | ) 135 | 136 | # A sample logging configuration. The only tangible logging 137 | # performed by this configuration is to send an email to 138 | # the site admins on every HTTP 500 error when DEBUG=False. 139 | # See http://docs.djangoproject.com/en/dev/topics/logging for 140 | # more details on how to customize your logging configuration. 141 | LOGGING = { 142 | 'version': 1, 143 | 'disable_existing_loggers': False, 144 | 'filters': { 145 | 'require_debug_false': { 146 | '()': 'django.utils.log.RequireDebugFalse' 147 | } 148 | }, 149 | 'handlers': { 150 | 'mail_admins': { 151 | 'level': 'ERROR', 152 | 'filters': ['require_debug_false'], 153 | 'class': 'django.utils.log.AdminEmailHandler' 154 | } 155 | }, 156 | 'loggers': { 157 | 'django.request': { 158 | 'handlers': ['mail_admins'], 159 | 'level': 'ERROR', 160 | 'propagate': True, 161 | }, 162 | } 163 | } 164 | 165 | BOOTSTRAP_BASE_URL = 'http://getbootstrap.com/2.3.2/assets/' 166 | BOOTSTRAP_CSS_BASE_URL = BOOTSTRAP_BASE_URL + 'css/' 167 | BOOTSTRAP_CSS_URL = BOOTSTRAP_CSS_BASE_URL + 'bootstrap.css' 168 | BOOTSTRAP_JS_BASE_URL = BOOTSTRAP_BASE_URL + 'js/' 169 | # Enable for single bootstrap.js file 170 | #BOOTSTRAP_JS_URL = BOOTSTRAP_JS_BASE_URL + 'bootstrap.js' 171 | 172 | 173 | try: 174 | from local_settings import * 175 | except ImportError: 176 | pass -------------------------------------------------------------------------------- /bootstrap_toolkit/templatetags/bootstrap_toolkit.py: -------------------------------------------------------------------------------- 1 | from math import floor 2 | from django.forms import BaseForm 3 | from django.forms.forms import BoundField 4 | from django.forms.widgets import TextInput, CheckboxInput, CheckboxSelectMultiple, RadioSelect 5 | from django.template import Context 6 | from django.template.loader import get_template 7 | from django import template 8 | from django.conf import settings 9 | 10 | BOOTSTRAP_BASE_URL = getattr(settings, 'BOOTSTRAP_BASE_URL', 11 | 'http://twitter.github.io/bootstrap/assets/' 12 | ) 13 | 14 | BOOTSTRAP_JS_BASE_URL = getattr(settings, 'BOOTSTRAP_JS_BASE_URL', 15 | BOOTSTRAP_BASE_URL + 'js/' 16 | ) 17 | 18 | BOOTSTRAP_JS_URL = getattr(settings, 'BOOTSTRAP_JS_URL', 19 | None 20 | ) 21 | 22 | BOOTSTRAP_CSS_BASE_URL = getattr(settings, 'BOOTSTRAP_CSS_BASE_URL', 23 | BOOTSTRAP_BASE_URL + 'css/' 24 | ) 25 | 26 | BOOTSTRAP_CSS_URL = getattr(settings, 'BOOTSTRAP_CSS_URL', 27 | BOOTSTRAP_CSS_BASE_URL + 'bootstrap.css' 28 | ) 29 | 30 | register = template.Library() 31 | 32 | @register.simple_tag 33 | def bootstrap_stylesheet_url(): 34 | """ 35 | URL to Bootstrap Stylesheet (CSS) 36 | """ 37 | return BOOTSTRAP_CSS_URL 38 | 39 | @register.simple_tag 40 | def bootstrap_stylesheet_tag(): 41 | """ 42 | HTML tag to insert Bootstrap stylesheet 43 | """ 44 | return u'' % bootstrap_stylesheet_url() 45 | 46 | @register.simple_tag 47 | def bootstrap_javascript_url(name=None): 48 | """ 49 | URL to Bootstrap javascript file 50 | """ 51 | if BOOTSTRAP_JS_URL: 52 | return BOOTSTRAP_JS_URL 53 | if name: 54 | return BOOTSTRAP_JS_BASE_URL + 'bootstrap-' + name + '.js' 55 | else: 56 | return BOOTSTRAP_JS_BASE_URL + 'bootstrap.min.js' 57 | 58 | @register.simple_tag 59 | def bootstrap_javascript_tag(name=None): 60 | """ 61 | HTML tag to insert bootstrap_toolkit javascript file 62 | """ 63 | url = bootstrap_javascript_url(name) 64 | if url: 65 | return u'' % url 66 | return u'' 67 | 68 | @register.filter 69 | def as_bootstrap(form_or_field, layout='vertical,false'): 70 | """ 71 | Render a field or a form according to Bootstrap guidelines 72 | """ 73 | params = split(layout, ",") 74 | layout = str(params[0]).lower() 75 | 76 | try: 77 | float = str(params[1]).lower() == "float" 78 | except IndexError: 79 | float = False 80 | 81 | if isinstance(form_or_field, BaseForm): 82 | return get_template("bootstrap_toolkit/form.html").render( 83 | Context({ 84 | 'form': form_or_field, 85 | 'layout': layout, 86 | 'float': float, 87 | }) 88 | ) 89 | elif isinstance(form_or_field, BoundField): 90 | return get_template("bootstrap_toolkit/field.html").render( 91 | Context({ 92 | 'field': form_or_field, 93 | 'layout': layout, 94 | 'float': float, 95 | }) 96 | ) 97 | else: 98 | # Display the default 99 | return settings.TEMPLATE_STRING_IF_INVALID 100 | 101 | @register.filter 102 | def is_disabled(field): 103 | """ 104 | Returns True if fields is disabled, readonly or not marked as editable, False otherwise 105 | """ 106 | if not getattr(field.field, 'editable', True): 107 | return True 108 | if getattr(field.field.widget.attrs, 'readonly', False): 109 | return True 110 | if getattr(field.field.widget.attrs, 'disabled', False): 111 | return True 112 | return False 113 | 114 | @register.filter 115 | def is_enabled(field): 116 | """ 117 | Shortcut to return the logical negative of is_disabled 118 | """ 119 | return not is_disabled(field) 120 | 121 | @register.filter 122 | def bootstrap_input_type(field): 123 | """ 124 | Return input type to use for field 125 | """ 126 | try: 127 | widget = field.field.widget 128 | except: 129 | raise ValueError("Expected a Field, got a %s" % type(field)) 130 | input_type = getattr(widget, 'bootstrap_input_type', None) 131 | if input_type: 132 | return unicode(input_type) 133 | if isinstance(widget, TextInput): 134 | return u'text' 135 | if isinstance(widget, CheckboxInput): 136 | return u'checkbox' 137 | if isinstance(widget, CheckboxSelectMultiple): 138 | return u'multicheckbox' 139 | if isinstance(widget, RadioSelect): 140 | return u'radioset' 141 | return u'default' 142 | 143 | @register.simple_tag 144 | def active_url(request, url, output=u'active'): 145 | # Tag that outputs text if the given url is active for the request 146 | if url == request.path: 147 | return output 148 | return '' 149 | 150 | @register.filter 151 | def pagination(page, pages_to_show=11): 152 | """ 153 | Generate Bootstrap pagination links from a page object 154 | """ 155 | pages_to_show = int(pages_to_show) 156 | if pages_to_show < 1: 157 | raise ValueError("Pagination pages_to_show should be a positive integer, you specified %s" % pages_to_show) 158 | num_pages = page.paginator.num_pages 159 | current_page = page.number 160 | half_page_num = int(floor(pages_to_show / 2)) - 1 161 | if half_page_num < 0: 162 | half_page_num = 0 163 | first_page = current_page - half_page_num 164 | if first_page <= 1: 165 | first_page = 1 166 | if first_page > 1: 167 | pages_back = first_page - half_page_num 168 | if pages_back < 1: 169 | pages_back = 1 170 | else: 171 | pages_back = None 172 | last_page = first_page + pages_to_show - 1 173 | if pages_back is None: 174 | last_page += 1 175 | if last_page > num_pages: 176 | last_page = num_pages 177 | if last_page < num_pages: 178 | pages_forward = last_page + half_page_num 179 | if pages_forward > num_pages: 180 | pages_forward = num_pages 181 | else: 182 | pages_forward = None 183 | if first_page > 1: 184 | first_page -= 1 185 | if pages_back > 1: 186 | pages_back -= 1 187 | else: 188 | pages_back = None 189 | pages_shown = [] 190 | for i in range(first_page, last_page + 1): 191 | pages_shown.append(i) 192 | return get_template("bootstrap_toolkit/pagination.html").render( 193 | Context({ 194 | 'num_pages': num_pages, 195 | 'current_page': current_page, 196 | 'first_page': first_page, 197 | 'last_page': last_page, 198 | 'pages_shown': pages_shown, 199 | 'pages_back': pages_back, 200 | 'pages_forward': pages_forward, 201 | }) 202 | ) 203 | 204 | @register.filter 205 | def split(str, splitter): 206 | """ 207 | Split a string 208 | """ 209 | return str.split(splitter) 210 | 211 | @register.simple_tag(takes_context=True) 212 | def bootstrap_messages(context, *args, **kwargs): 213 | """ 214 | Show request messages in Bootstrap style 215 | """ 216 | return get_template("bootstrap_toolkit/messages.html").render(context) 217 | 218 | @register.inclusion_tag("bootstrap_toolkit/form.html") 219 | def bootstrap_form(form, **kwargs): 220 | """ 221 | Render a form 222 | """ 223 | context = kwargs.copy() 224 | context['form'] = form 225 | return context 226 | 227 | @register.inclusion_tag("bootstrap_toolkit/field.html") 228 | def bootstrap_field(field, **kwargs): 229 | """ 230 | Render a field 231 | """ 232 | context = kwargs.copy() 233 | context['field'] = field 234 | return context 235 | -------------------------------------------------------------------------------- /bootstrap_toolkit/static/datepicker/css/datepicker.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Datepicker for Bootstrap 3 | * 4 | * Copyright 2012 Stefan Petre 5 | * Improvements by Andrew Rowls 6 | * Licensed under the Apache License v2.0 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | */ 10 | .datepicker { 11 | top: 0; 12 | left: 0; 13 | padding: 4px; 14 | margin-top: 1px; 15 | -webkit-border-radius: 4px; 16 | -moz-border-radius: 4px; 17 | border-radius: 4px; 18 | /*.dow { 19 | border-top: 1px solid #ddd !important; 20 | }*/ 21 | 22 | } 23 | .datepicker:before { 24 | content: ''; 25 | display: inline-block; 26 | border-left: 7px solid transparent; 27 | border-right: 7px solid transparent; 28 | border-bottom: 7px solid #ccc; 29 | border-bottom-color: rgba(0, 0, 0, 0.2); 30 | position: absolute; 31 | top: -7px; 32 | left: 6px; 33 | } 34 | .datepicker:after { 35 | content: ''; 36 | display: inline-block; 37 | border-left: 6px solid transparent; 38 | border-right: 6px solid transparent; 39 | border-bottom: 6px solid #ffffff; 40 | position: absolute; 41 | top: -6px; 42 | left: 7px; 43 | } 44 | .datepicker > div { 45 | display: none; 46 | } 47 | .datepicker.days div.datepicker-days { 48 | display: block; 49 | } 50 | .datepicker.months div.datepicker-months { 51 | display: block; 52 | } 53 | .datepicker.years div.datepicker-years { 54 | display: block; 55 | } 56 | .datepicker table { 57 | margin: 0; 58 | } 59 | .datepicker td, 60 | .datepicker th { 61 | text-align: center; 62 | width: 20px; 63 | height: 20px; 64 | -webkit-border-radius: 4px; 65 | -moz-border-radius: 4px; 66 | border-radius: 4px; 67 | } 68 | .datepicker td.day:hover { 69 | background: #eeeeee; 70 | cursor: pointer; 71 | } 72 | .datepicker td.old, 73 | .datepicker td.new { 74 | color: #999999; 75 | } 76 | .datepicker td.disabled, 77 | .datepicker td.disabled:hover { 78 | background: none; 79 | color: #999999; 80 | cursor: default; 81 | } 82 | .datepicker td.today, 83 | .datepicker td.today:hover, 84 | .datepicker td.today.disabled, 85 | .datepicker td.today.disabled:hover { 86 | background-color: #fde19a; 87 | background-image: -moz-linear-gradient(top, #fdd49a, #fdf59a); 88 | background-image: -ms-linear-gradient(top, #fdd49a, #fdf59a); 89 | background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#fdd49a), to(#fdf59a)); 90 | background-image: -webkit-linear-gradient(top, #fdd49a, #fdf59a); 91 | background-image: -o-linear-gradient(top, #fdd49a, #fdf59a); 92 | background-image: linear-gradient(top, #fdd49a, #fdf59a); 93 | background-repeat: repeat-x; 94 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fdd49a', endColorstr='#fdf59a', GradientType=0); 95 | border-color: #fdf59a #fdf59a #fbed50; 96 | border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); 97 | filter: progid:dximagetransform.microsoft.gradient(enabled=false); 98 | } 99 | .datepicker td.today:hover, 100 | .datepicker td.today:hover:hover, 101 | .datepicker td.today.disabled:hover, 102 | .datepicker td.today.disabled:hover:hover, 103 | .datepicker td.today:active, 104 | .datepicker td.today:hover:active, 105 | .datepicker td.today.disabled:active, 106 | .datepicker td.today.disabled:hover:active, 107 | .datepicker td.today.active, 108 | .datepicker td.today:hover.active, 109 | .datepicker td.today.disabled.active, 110 | .datepicker td.today.disabled:hover.active, 111 | .datepicker td.today.disabled, 112 | .datepicker td.today:hover.disabled, 113 | .datepicker td.today.disabled.disabled, 114 | .datepicker td.today.disabled:hover.disabled, 115 | .datepicker td.today[disabled], 116 | .datepicker td.today:hover[disabled], 117 | .datepicker td.today.disabled[disabled], 118 | .datepicker td.today.disabled:hover[disabled] { 119 | background-color: #fdf59a; 120 | } 121 | .datepicker td.today:active, 122 | .datepicker td.today:hover:active, 123 | .datepicker td.today.disabled:active, 124 | .datepicker td.today.disabled:hover:active, 125 | .datepicker td.today.active, 126 | .datepicker td.today:hover.active, 127 | .datepicker td.today.disabled.active, 128 | .datepicker td.today.disabled:hover.active { 129 | background-color: #fbf069 \9; 130 | } 131 | .datepicker td.active, 132 | .datepicker td.active:hover, 133 | .datepicker td.active.disabled, 134 | .datepicker td.active.disabled:hover { 135 | background-color: #006dcc; 136 | background-image: -moz-linear-gradient(top, #0088cc, #0044cc); 137 | background-image: -ms-linear-gradient(top, #0088cc, #0044cc); 138 | background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc)); 139 | background-image: -webkit-linear-gradient(top, #0088cc, #0044cc); 140 | background-image: -o-linear-gradient(top, #0088cc, #0044cc); 141 | background-image: linear-gradient(top, #0088cc, #0044cc); 142 | background-repeat: repeat-x; 143 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc', endColorstr='#0044cc', GradientType=0); 144 | border-color: #0044cc #0044cc #002a80; 145 | border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); 146 | filter: progid:dximagetransform.microsoft.gradient(enabled=false); 147 | color: #fff; 148 | text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); 149 | } 150 | .datepicker td.active:hover, 151 | .datepicker td.active:hover:hover, 152 | .datepicker td.active.disabled:hover, 153 | .datepicker td.active.disabled:hover:hover, 154 | .datepicker td.active:active, 155 | .datepicker td.active:hover:active, 156 | .datepicker td.active.disabled:active, 157 | .datepicker td.active.disabled:hover:active, 158 | .datepicker td.active.active, 159 | .datepicker td.active:hover.active, 160 | .datepicker td.active.disabled.active, 161 | .datepicker td.active.disabled:hover.active, 162 | .datepicker td.active.disabled, 163 | .datepicker td.active:hover.disabled, 164 | .datepicker td.active.disabled.disabled, 165 | .datepicker td.active.disabled:hover.disabled, 166 | .datepicker td.active[disabled], 167 | .datepicker td.active:hover[disabled], 168 | .datepicker td.active.disabled[disabled], 169 | .datepicker td.active.disabled:hover[disabled] { 170 | background-color: #0044cc; 171 | } 172 | .datepicker td.active:active, 173 | .datepicker td.active:hover:active, 174 | .datepicker td.active.disabled:active, 175 | .datepicker td.active.disabled:hover:active, 176 | .datepicker td.active.active, 177 | .datepicker td.active:hover.active, 178 | .datepicker td.active.disabled.active, 179 | .datepicker td.active.disabled:hover.active { 180 | background-color: #003399 \9; 181 | } 182 | .datepicker td span { 183 | display: block; 184 | width: 23%; 185 | height: 54px; 186 | line-height: 54px; 187 | float: left; 188 | margin: 1%; 189 | cursor: pointer; 190 | -webkit-border-radius: 4px; 191 | -moz-border-radius: 4px; 192 | border-radius: 4px; 193 | } 194 | .datepicker td span:hover { 195 | background: #eeeeee; 196 | } 197 | .datepicker td span.disabled, 198 | .datepicker td span.disabled:hover { 199 | background: none; 200 | color: #999999; 201 | cursor: default; 202 | } 203 | .datepicker td span.active, 204 | .datepicker td span.active:hover, 205 | .datepicker td span.active.disabled, 206 | .datepicker td span.active.disabled:hover { 207 | background-color: #006dcc; 208 | background-image: -moz-linear-gradient(top, #0088cc, #0044cc); 209 | background-image: -ms-linear-gradient(top, #0088cc, #0044cc); 210 | background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc)); 211 | background-image: -webkit-linear-gradient(top, #0088cc, #0044cc); 212 | background-image: -o-linear-gradient(top, #0088cc, #0044cc); 213 | background-image: linear-gradient(top, #0088cc, #0044cc); 214 | background-repeat: repeat-x; 215 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc', endColorstr='#0044cc', GradientType=0); 216 | border-color: #0044cc #0044cc #002a80; 217 | border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); 218 | filter: progid:dximagetransform.microsoft.gradient(enabled=false); 219 | color: #fff; 220 | text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); 221 | } 222 | .datepicker td span.active:hover, 223 | .datepicker td span.active:hover:hover, 224 | .datepicker td span.active.disabled:hover, 225 | .datepicker td span.active.disabled:hover:hover, 226 | .datepicker td span.active:active, 227 | .datepicker td span.active:hover:active, 228 | .datepicker td span.active.disabled:active, 229 | .datepicker td span.active.disabled:hover:active, 230 | .datepicker td span.active.active, 231 | .datepicker td span.active:hover.active, 232 | .datepicker td span.active.disabled.active, 233 | .datepicker td span.active.disabled:hover.active, 234 | .datepicker td span.active.disabled, 235 | .datepicker td span.active:hover.disabled, 236 | .datepicker td span.active.disabled.disabled, 237 | .datepicker td span.active.disabled:hover.disabled, 238 | .datepicker td span.active[disabled], 239 | .datepicker td span.active:hover[disabled], 240 | .datepicker td span.active.disabled[disabled], 241 | .datepicker td span.active.disabled:hover[disabled] { 242 | background-color: #0044cc; 243 | } 244 | .datepicker td span.active:active, 245 | .datepicker td span.active:hover:active, 246 | .datepicker td span.active.disabled:active, 247 | .datepicker td span.active.disabled:hover:active, 248 | .datepicker td span.active.active, 249 | .datepicker td span.active:hover.active, 250 | .datepicker td span.active.disabled.active, 251 | .datepicker td span.active.disabled:hover.active { 252 | background-color: #003399 \9; 253 | } 254 | .datepicker td span.old { 255 | color: #999999; 256 | } 257 | .datepicker th.switch { 258 | width: 145px; 259 | } 260 | .datepicker thead tr:first-child th, 261 | .datepicker tfoot tr:first-child th { 262 | cursor: pointer; 263 | } 264 | .datepicker thead tr:first-child th:hover, 265 | .datepicker tfoot tr:first-child th:hover { 266 | background: #eeeeee; 267 | } 268 | .input-append.date .add-on i, 269 | .input-prepend.date .add-on i { 270 | display: block; 271 | cursor: pointer; 272 | width: 16px; 273 | height: 16px; 274 | } 275 | -------------------------------------------------------------------------------- /bootstrap_toolkit/static/datepicker/js/bootstrap-datepicker.js: -------------------------------------------------------------------------------- 1 | /* ========================================================= 2 | * bootstrap-datepicker.js 3 | * http://www.eyecon.ro/bootstrap-datepicker 4 | * ========================================================= 5 | * Copyright 2012 Stefan Petre 6 | * Improvements by Andrew Rowls 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | * ========================================================= */ 20 | 21 | !function( $ ) { 22 | 23 | function UTCDate(){ 24 | return new Date(Date.UTC.apply(Date, arguments)); 25 | } 26 | function UTCToday(){ 27 | var today = new Date(); 28 | return UTCDate(today.getUTCFullYear(), today.getUTCMonth(), today.getUTCDate()); 29 | } 30 | 31 | // Picker object 32 | 33 | var Datepicker = function(element, options) { 34 | var that = this; 35 | 36 | this.element = $(element); 37 | this.language = options.language||this.element.data('date-language')||"en"; 38 | this.language = this.language in dates ? this.language : "en"; 39 | this.format = DPGlobal.parseFormat(options.format||this.element.data('date-format')||'mm/dd/yyyy'); 40 | this.picker = $(DPGlobal.template) 41 | .appendTo('body') 42 | .on({ 43 | click: $.proxy(this.click, this) 44 | }); 45 | this.isInput = this.element.is('input'); 46 | this.component = this.element.is('.date') ? this.element.find('.add-on') : false; 47 | this.hasInput = this.component && this.element.find('input').length; 48 | if(this.component && this.component.length === 0) 49 | this.component = false; 50 | 51 | this._attachEvents(); 52 | 53 | this.forceParse = true; 54 | if ('forceParse' in options) { 55 | this.forceParse = options.forceParse; 56 | } else if ('dateForceParse' in this.element.data()) { 57 | this.forceParse = this.element.data('date-force-parse'); 58 | } 59 | 60 | $(document).on('mousedown', function (e) { 61 | // Clicked outside the datepicker, hide it 62 | if ($(e.target).closest('.datepicker').length === 0) { 63 | that.hide(); 64 | } 65 | }); 66 | 67 | this.autoclose = false; 68 | if ('autoclose' in options) { 69 | this.autoclose = options.autoclose; 70 | } else if ('dateAutoclose' in this.element.data()) { 71 | this.autoclose = this.element.data('date-autoclose'); 72 | } 73 | 74 | this.keyboardNavigation = true; 75 | if ('keyboardNavigation' in options) { 76 | this.keyboardNavigation = options.keyboardNavigation; 77 | } else if ('dateKeyboardNavigation' in this.element.data()) { 78 | this.keyboardNavigation = this.element.data('date-keyboard-navigation'); 79 | } 80 | 81 | this.viewMode = this.startViewMode = 0; 82 | switch(options.startView || this.element.data('date-start-view')){ 83 | case 2: 84 | case 'decade': 85 | this.viewMode = this.startViewMode = 2; 86 | break; 87 | case 1: 88 | case 'year': 89 | this.viewMode = this.startViewMode = 1; 90 | break; 91 | } 92 | 93 | this.todayBtn = (options.todayBtn||this.element.data('date-today-btn')||false); 94 | this.todayHighlight = (options.todayHighlight||this.element.data('date-today-highlight')||false); 95 | 96 | this.weekStart = ((options.weekStart||this.element.data('date-weekstart')||dates[this.language].weekStart||0) % 7); 97 | this.weekEnd = ((this.weekStart + 6) % 7); 98 | this.startDate = -Infinity; 99 | this.endDate = Infinity; 100 | this.daysOfWeekDisabled = []; 101 | this.setStartDate(options.startDate||this.element.data('date-startdate')); 102 | this.setEndDate(options.endDate||this.element.data('date-enddate')); 103 | this.setDaysOfWeekDisabled(options.daysOfWeekDisabled||this.element.data('date-days-of-week-disabled')); 104 | this.fillDow(); 105 | this.fillMonths(); 106 | this.update(); 107 | this.showMode(); 108 | }; 109 | 110 | Datepicker.prototype = { 111 | constructor: Datepicker, 112 | 113 | _events: [], 114 | _attachEvents: function(){ 115 | this._detachEvents(); 116 | if (this.isInput) { 117 | this._events = [ 118 | [this.element, { 119 | focus: $.proxy(this.show, this), 120 | keyup: $.proxy(this.update, this), 121 | keydown: $.proxy(this.keydown, this) 122 | }] 123 | ]; 124 | } 125 | else if (this.component && this.hasInput){ 126 | this._events = [ 127 | // For components that are not readonly, allow keyboard nav 128 | [this.element.find('input'), { 129 | focus: $.proxy(this.show, this), 130 | keyup: $.proxy(this.update, this), 131 | keydown: $.proxy(this.keydown, this) 132 | }], 133 | [this.component, { 134 | click: $.proxy(this.show, this) 135 | }] 136 | ]; 137 | } 138 | else { 139 | this._events = [ 140 | [this.element, { 141 | click: $.proxy(this.show, this) 142 | }] 143 | ]; 144 | } 145 | for (var i=0, el, ev; i this.endDate) { 285 | this.viewDate = new Date(this.endDate); 286 | } else { 287 | this.viewDate = new Date(this.date); 288 | } 289 | this.fill(); 290 | }, 291 | 292 | fillDow: function(){ 293 | var dowCnt = this.weekStart, 294 | html = ''; 295 | while (dowCnt < this.weekStart + 7) { 296 | html += ''+dates[this.language].daysMin[(dowCnt++)%7]+''; 297 | } 298 | html += ''; 299 | this.picker.find('.datepicker-days thead').append(html); 300 | }, 301 | 302 | fillMonths: function(){ 303 | var html = '', 304 | i = 0; 305 | while (i < 12) { 306 | html += ''+dates[this.language].monthsShort[i++]+''; 307 | } 308 | this.picker.find('.datepicker-months td').html(html); 309 | }, 310 | 311 | fill: function() { 312 | var d = new Date(this.viewDate), 313 | year = d.getUTCFullYear(), 314 | month = d.getUTCMonth(), 315 | startYear = this.startDate !== -Infinity ? this.startDate.getUTCFullYear() : -Infinity, 316 | startMonth = this.startDate !== -Infinity ? this.startDate.getUTCMonth() : -Infinity, 317 | endYear = this.endDate !== Infinity ? this.endDate.getUTCFullYear() : Infinity, 318 | endMonth = this.endDate !== Infinity ? this.endDate.getUTCMonth() : Infinity, 319 | currentDate = this.date.valueOf(), 320 | today = new Date(); 321 | this.picker.find('.datepicker-days thead th:eq(1)') 322 | .text(dates[this.language].months[month]+' '+year); 323 | this.picker.find('tfoot th.today') 324 | .text(dates[this.language].today) 325 | .toggle(this.todayBtn !== false); 326 | this.updateNavArrows(); 327 | this.fillMonths(); 328 | var prevMonth = UTCDate(year, month-1, 28,0,0,0,0), 329 | day = DPGlobal.getDaysInMonth(prevMonth.getUTCFullYear(), prevMonth.getUTCMonth()); 330 | prevMonth.setUTCDate(day); 331 | prevMonth.setUTCDate(day - (prevMonth.getUTCDay() - this.weekStart + 7)%7); 332 | var nextMonth = new Date(prevMonth); 333 | nextMonth.setUTCDate(nextMonth.getUTCDate() + 42); 334 | nextMonth = nextMonth.valueOf(); 335 | var html = []; 336 | var clsName; 337 | while(prevMonth.valueOf() < nextMonth) { 338 | if (prevMonth.getUTCDay() == this.weekStart) { 339 | html.push(''); 340 | } 341 | clsName = ''; 342 | if (prevMonth.getUTCFullYear() < year || (prevMonth.getUTCFullYear() == year && prevMonth.getUTCMonth() < month)) { 343 | clsName += ' old'; 344 | } else if (prevMonth.getUTCFullYear() > year || (prevMonth.getUTCFullYear() == year && prevMonth.getUTCMonth() > month)) { 345 | clsName += ' new'; 346 | } 347 | // Compare internal UTC date with local today, not UTC today 348 | if (this.todayHighlight && 349 | prevMonth.getUTCFullYear() == today.getFullYear() && 350 | prevMonth.getUTCMonth() == today.getMonth() && 351 | prevMonth.getUTCDate() == today.getDate()) { 352 | clsName += ' today'; 353 | } 354 | if (prevMonth.valueOf() == currentDate) { 355 | clsName += ' active'; 356 | } 357 | if (prevMonth.valueOf() < this.startDate || prevMonth.valueOf() > this.endDate || 358 | $.inArray(prevMonth.getUTCDay(), this.daysOfWeekDisabled) !== -1) { 359 | clsName += ' disabled'; 360 | } 361 | html.push(''+prevMonth.getUTCDate() + ''); 362 | if (prevMonth.getUTCDay() == this.weekEnd) { 363 | html.push(''); 364 | } 365 | prevMonth.setUTCDate(prevMonth.getUTCDate()+1); 366 | } 367 | this.picker.find('.datepicker-days tbody').empty().append(html.join('')); 368 | var currentYear = this.date.getUTCFullYear(); 369 | 370 | var months = this.picker.find('.datepicker-months') 371 | .find('th:eq(1)') 372 | .text(year) 373 | .end() 374 | .find('span').removeClass('active'); 375 | if (currentYear == year) { 376 | months.eq(this.date.getUTCMonth()).addClass('active'); 377 | } 378 | if (year < startYear || year > endYear) { 379 | months.addClass('disabled'); 380 | } 381 | if (year == startYear) { 382 | months.slice(0, startMonth).addClass('disabled'); 383 | } 384 | if (year == endYear) { 385 | months.slice(endMonth+1).addClass('disabled'); 386 | } 387 | 388 | html = ''; 389 | year = parseInt(year/10, 10) * 10; 390 | var yearCont = this.picker.find('.datepicker-years') 391 | .find('th:eq(1)') 392 | .text(year + '-' + (year + 9)) 393 | .end() 394 | .find('td'); 395 | year -= 1; 396 | for (var i = -1; i < 11; i++) { 397 | html += ''+year+''; 398 | year += 1; 399 | } 400 | yearCont.html(html); 401 | }, 402 | 403 | updateNavArrows: function() { 404 | var d = new Date(this.viewDate), 405 | year = d.getUTCFullYear(), 406 | month = d.getUTCMonth(); 407 | switch (this.viewMode) { 408 | case 0: 409 | if (this.startDate !== -Infinity && year <= this.startDate.getUTCFullYear() && month <= this.startDate.getUTCMonth()) { 410 | this.picker.find('.prev').css({visibility: 'hidden'}); 411 | } else { 412 | this.picker.find('.prev').css({visibility: 'visible'}); 413 | } 414 | if (this.endDate !== Infinity && year >= this.endDate.getUTCFullYear() && month >= this.endDate.getUTCMonth()) { 415 | this.picker.find('.next').css({visibility: 'hidden'}); 416 | } else { 417 | this.picker.find('.next').css({visibility: 'visible'}); 418 | } 419 | break; 420 | case 1: 421 | case 2: 422 | if (this.startDate !== -Infinity && year <= this.startDate.getUTCFullYear()) { 423 | this.picker.find('.prev').css({visibility: 'hidden'}); 424 | } else { 425 | this.picker.find('.prev').css({visibility: 'visible'}); 426 | } 427 | if (this.endDate !== Infinity && year >= this.endDate.getUTCFullYear()) { 428 | this.picker.find('.next').css({visibility: 'hidden'}); 429 | } else { 430 | this.picker.find('.next').css({visibility: 'visible'}); 431 | } 432 | break; 433 | } 434 | }, 435 | 436 | click: function(e) { 437 | e.stopPropagation(); 438 | e.preventDefault(); 439 | var target = $(e.target).closest('span, td, th'); 440 | if (target.length == 1) { 441 | switch(target[0].nodeName.toLowerCase()) { 442 | case 'th': 443 | switch(target[0].className) { 444 | case 'switch': 445 | this.showMode(1); 446 | break; 447 | case 'prev': 448 | case 'next': 449 | var dir = DPGlobal.modes[this.viewMode].navStep * (target[0].className == 'prev' ? -1 : 1); 450 | switch(this.viewMode){ 451 | case 0: 452 | this.viewDate = this.moveMonth(this.viewDate, dir); 453 | break; 454 | case 1: 455 | case 2: 456 | this.viewDate = this.moveYear(this.viewDate, dir); 457 | break; 458 | } 459 | this.fill(); 460 | break; 461 | case 'today': 462 | var date = new Date(); 463 | date = UTCDate(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0); 464 | 465 | this.showMode(-2); 466 | var which = this.todayBtn == 'linked' ? null : 'view'; 467 | this._setDate(date, which); 468 | break; 469 | } 470 | break; 471 | case 'span': 472 | if (!target.is('.disabled')) { 473 | this.viewDate.setUTCDate(1); 474 | if (target.is('.month')) { 475 | var month = target.parent().find('span').index(target); 476 | this.viewDate.setUTCMonth(month); 477 | this.element.trigger({ 478 | type: 'changeMonth', 479 | date: this.viewDate 480 | }); 481 | } else { 482 | var year = parseInt(target.text(), 10)||0; 483 | this.viewDate.setUTCFullYear(year); 484 | this.element.trigger({ 485 | type: 'changeYear', 486 | date: this.viewDate 487 | }); 488 | } 489 | this.showMode(-1); 490 | this.fill(); 491 | } 492 | break; 493 | case 'td': 494 | if (target.is('.day') && !target.is('.disabled')){ 495 | var day = parseInt(target.text(), 10)||1; 496 | var year = this.viewDate.getUTCFullYear(), 497 | month = this.viewDate.getUTCMonth(); 498 | if (target.is('.old')) { 499 | if (month === 0) { 500 | month = 11; 501 | year -= 1; 502 | } else { 503 | month -= 1; 504 | } 505 | } else if (target.is('.new')) { 506 | if (month == 11) { 507 | month = 0; 508 | year += 1; 509 | } else { 510 | month += 1; 511 | } 512 | } 513 | this._setDate(UTCDate(year, month, day,0,0,0,0)); 514 | } 515 | break; 516 | } 517 | } 518 | }, 519 | 520 | _setDate: function(date, which){ 521 | if (!which || which == 'date') 522 | this.date = date; 523 | if (!which || which == 'view') 524 | this.viewDate = date; 525 | this.fill(); 526 | this.setValue(); 527 | this.element.trigger({ 528 | type: 'changeDate', 529 | date: this.date 530 | }); 531 | var element; 532 | if (this.isInput) { 533 | element = this.element; 534 | } else if (this.component){ 535 | element = this.element.find('input'); 536 | } 537 | if (element) { 538 | element.change(); 539 | if (this.autoclose && (!which || which == 'date')) { 540 | this.hide(); 541 | } 542 | } 543 | }, 544 | 545 | moveMonth: function(date, dir){ 546 | if (!dir) return date; 547 | var new_date = new Date(date.valueOf()), 548 | day = new_date.getUTCDate(), 549 | month = new_date.getUTCMonth(), 550 | mag = Math.abs(dir), 551 | new_month, test; 552 | dir = dir > 0 ? 1 : -1; 553 | if (mag == 1){ 554 | test = dir == -1 555 | // If going back one month, make sure month is not current month 556 | // (eg, Mar 31 -> Feb 31 == Feb 28, not Mar 02) 557 | ? function(){ return new_date.getUTCMonth() == month; } 558 | // If going forward one month, make sure month is as expected 559 | // (eg, Jan 31 -> Feb 31 == Feb 28, not Mar 02) 560 | : function(){ return new_date.getUTCMonth() != new_month; }; 561 | new_month = month + dir; 562 | new_date.setUTCMonth(new_month); 563 | // Dec -> Jan (12) or Jan -> Dec (-1) -- limit expected date to 0-11 564 | if (new_month < 0 || new_month > 11) 565 | new_month = (new_month + 12) % 12; 566 | } else { 567 | // For magnitudes >1, move one month at a time... 568 | for (var i=0; i= this.startDate && date <= this.endDate; 591 | }, 592 | 593 | keydown: function(e){ 594 | if (this.picker.is(':not(:visible)')){ 595 | if (e.keyCode == 27) // allow escape to hide and re-show picker 596 | this.show(); 597 | return; 598 | } 599 | var dateChanged = false, 600 | dir, day, month, 601 | newDate, newViewDate; 602 | switch(e.keyCode){ 603 | case 27: // escape 604 | this.hide(); 605 | e.preventDefault(); 606 | break; 607 | case 37: // left 608 | case 39: // right 609 | if (!this.keyboardNavigation) break; 610 | dir = e.keyCode == 37 ? -1 : 1; 611 | if (e.ctrlKey){ 612 | newDate = this.moveYear(this.date, dir); 613 | newViewDate = this.moveYear(this.viewDate, dir); 614 | } else if (e.shiftKey){ 615 | newDate = this.moveMonth(this.date, dir); 616 | newViewDate = this.moveMonth(this.viewDate, dir); 617 | } else { 618 | newDate = new Date(this.date); 619 | newDate.setUTCDate(this.date.getUTCDate() + dir); 620 | newViewDate = new Date(this.viewDate); 621 | newViewDate.setUTCDate(this.viewDate.getUTCDate() + dir); 622 | } 623 | if (this.dateWithinRange(newDate)){ 624 | this.date = newDate; 625 | this.viewDate = newViewDate; 626 | this.setValue(); 627 | this.update(); 628 | e.preventDefault(); 629 | dateChanged = true; 630 | } 631 | break; 632 | case 38: // up 633 | case 40: // down 634 | if (!this.keyboardNavigation) break; 635 | dir = e.keyCode == 38 ? -1 : 1; 636 | if (e.ctrlKey){ 637 | newDate = this.moveYear(this.date, dir); 638 | newViewDate = this.moveYear(this.viewDate, dir); 639 | } else if (e.shiftKey){ 640 | newDate = this.moveMonth(this.date, dir); 641 | newViewDate = this.moveMonth(this.viewDate, dir); 642 | } else { 643 | newDate = new Date(this.date); 644 | newDate.setUTCDate(this.date.getUTCDate() + dir * 7); 645 | newViewDate = new Date(this.viewDate); 646 | newViewDate.setUTCDate(this.viewDate.getUTCDate() + dir * 7); 647 | } 648 | if (this.dateWithinRange(newDate)){ 649 | this.date = newDate; 650 | this.viewDate = newViewDate; 651 | this.setValue(); 652 | this.update(); 653 | e.preventDefault(); 654 | dateChanged = true; 655 | } 656 | break; 657 | case 13: // enter 658 | this.hide(); 659 | e.preventDefault(); 660 | break; 661 | case 9: // tab 662 | this.hide(); 663 | break; 664 | } 665 | if (dateChanged){ 666 | this.element.trigger({ 667 | type: 'changeDate', 668 | date: this.date 669 | }); 670 | var element; 671 | if (this.isInput) { 672 | element = this.element; 673 | } else if (this.component){ 674 | element = this.element.find('input'); 675 | } 676 | if (element) { 677 | element.change(); 678 | } 679 | } 680 | }, 681 | 682 | showMode: function(dir) { 683 | if (dir) { 684 | this.viewMode = Math.max(0, Math.min(2, this.viewMode + dir)); 685 | } 686 | this.picker.find('>div').hide().filter('.datepicker-'+DPGlobal.modes[this.viewMode].clsName).show(); 687 | this.updateNavArrows(); 688 | } 689 | }; 690 | 691 | $.fn.datepicker = function ( option ) { 692 | var args = Array.apply(null, arguments); 693 | args.shift(); 694 | return this.each(function () { 695 | var $this = $(this), 696 | data = $this.data('datepicker'), 697 | options = typeof option == 'object' && option; 698 | if (!data) { 699 | $this.data('datepicker', (data = new Datepicker(this, $.extend({}, $.fn.datepicker.defaults,options)))); 700 | } 701 | if (typeof option == 'string' && typeof data[option] == 'function') { 702 | data[option].apply(data, args); 703 | } 704 | }); 705 | }; 706 | 707 | $.fn.datepicker.defaults = { 708 | }; 709 | $.fn.datepicker.Constructor = Datepicker; 710 | var dates = $.fn.datepicker.dates = { 711 | en: { 712 | days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"], 713 | daysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], 714 | daysMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"], 715 | months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], 716 | monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], 717 | today: "Today" 718 | } 719 | }; 720 | 721 | var DPGlobal = { 722 | modes: [ 723 | { 724 | clsName: 'days', 725 | navFnc: 'Month', 726 | navStep: 1 727 | }, 728 | { 729 | clsName: 'months', 730 | navFnc: 'FullYear', 731 | navStep: 1 732 | }, 733 | { 734 | clsName: 'years', 735 | navFnc: 'FullYear', 736 | navStep: 10 737 | }], 738 | isLeapYear: function (year) { 739 | return (((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0)) 740 | }, 741 | getDaysInMonth: function (year, month) { 742 | return [31, (DPGlobal.isLeapYear(year) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month] 743 | }, 744 | validParts: /dd?|mm?|MM?|yy(?:yy)?/g, 745 | nonpunctuation: /[^ -\/:-@\[-`{-~\t\n\r]+/g, 746 | parseFormat: function(format){ 747 | // IE treats \0 as a string end in inputs (truncating the value), 748 | // so it's a bad format delimiter, anyway 749 | var separators = format.replace(this.validParts, '\0').split('\0'), 750 | parts = format.match(this.validParts); 751 | if (!separators || !separators.length || !parts || parts.length == 0){ 752 | throw new Error("Invalid date format."); 753 | } 754 | return {separators: separators, parts: parts}; 755 | }, 756 | parseDate: function(date, format, language) { 757 | if (date instanceof Date) return date; 758 | if (/^[-+]\d+[dmwy]([\s,]+[-+]\d+[dmwy])*$/.test(date)) { 759 | var part_re = /([-+]\d+)([dmwy])/, 760 | parts = date.match(/([-+]\d+)([dmwy])/g), 761 | part, dir; 762 | date = new Date(); 763 | for (var i=0; i'+ 860 | ''+ 861 | ''+ 862 | ''+ 863 | ''+ 864 | ''+ 865 | '', 866 | contTemplate: '', 867 | footTemplate: '' 868 | }; 869 | DPGlobal.template = ''; 892 | }( window.jQuery ); 893 | -------------------------------------------------------------------------------- /License.txt: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | {one line to give the program's name and a brief idea of what it does.} 635 | Copyright (C) {year} {name of author} 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | {project} Copyright (C) {year} {fullname} 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | --------------------------------------------------------------------------------