pax_global_header00006660000000000000000000000064126652524060014522gustar00rootroot0000000000000052 comment=1b06a38423274f8747dfb9fa04f2fe694a1497fd python-django-adminsortable-2.0.10/000077500000000000000000000000001266525240600172055ustar00rootroot00000000000000python-django-adminsortable-2.0.10/MANIFEST.in000066400000000000000000000002251266525240600207420ustar00rootroot00000000000000recursive-include adminsortable/static * recursive-include adminsortable/templates * recursive-include adminsortable/locale * prune sample_projectpython-django-adminsortable-2.0.10/PKG-INFO000066400000000000000000000013351266525240600203040ustar00rootroot00000000000000Metadata-Version: 1.1 Name: django-admin-sortable Version: 2.0.10 Summary: Drag and drop sorting for models and inline models in Django admin. Home-page: https://github.com/iambrandontaylor/django-admin-sortable Author: Brandon Taylor Author-email: alsoicode@gmail.com License: APL Description: UNKNOWN Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Environment :: Web Environment Classifier: Framework :: Django Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: Apache Software License Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 3 Classifier: Topic :: Utilities python-django-adminsortable-2.0.10/README.rst000066400000000000000000000453741266525240600207110ustar00rootroot00000000000000Django Admin Sortable ===================== |Build Status| Current version: 2.0.10 This project makes it easy to add drag-and-drop ordering to any model in Django admin. Inlines for a sortable model may also be made sortable, enabling individual items or groups of items to be sortable. Sorting model instances with a sortable parent: .. figure:: http://res.cloudinary.com/alsoicode/image/upload/v1451237555/django-admin-sortable/sortable-models.jpg :alt: sortable-models sortable-models Sorting inlines: .. figure:: http://res.cloudinary.com/alsoicode/image/upload/v1451237555/django-admin-sortable/sortable-inlines.jpg :alt: sortable-inlines sortable-inlines Supported Django Versions ------------------------- If you're using Django 1.4.x, use django-admin-sortable 1.4.9 or below. For Django 1.5.x or higher, use the latest version of django-admin-sortable. django-admin-sortable 1.5.2 introduced backward-incompatible changes for Django 1.4.x django-admin-sortable 1.6.6 introduced a backward-incompatible change for the ``sorting_filters`` attribute. Please convert your attributes to the new tuple-based format. django-admin-sortable 1.7.1 and higher are compatible with Python 3. Installation ------------ 1. ``$ pip install django-admin-sortable`` --or-- Download django-admin-sortable from `source `__ 1. Unzip the directory and cd into the uncompressed project directory 2. - Optional: Enable your virtualenv 3. Run ``$ python setup.py install`` or add ``adminsortable`` to your PYTHONPATH. Configuration ------------- 1. Add ``adminsortable`` to your ``INSTALLED_APPS``. 2. Ensure ``django.core.context_processors.static`` is in your ``TEMPLATE_CONTEXT_PROCESSORS``. Static Media ~~~~~~~~~~~~ Preferred: Use the `staticfiles app `__ Alternate: Copy the ``adminsortable`` folder from the ``static`` folder to the location you serve static files from. Testing ~~~~~~~ Have a look at the included sample\_project to see working examples. The login credentials for admin are: admin/admin When a model is sortable, a tool-area link will be added that says "Change Order". Click this link, and you will be taken to the custom view where you can drag-and-drop the records into order. Inlines may be drag-and-dropped into any order directly from the change form. Usage ----- Models ~~~~~~ To add "sortability" to a model, you need to inherit ``SortableMixin`` and at minimum, define: - The field which should be used for ``Meta.ordering``, which must resolve to one of the integer fields defined in Django's ORM: - ``PositiveIntegerField`` - ``IntegerField`` - ``PositiveSmallIntegerField`` - ``SmallIntegerField`` - ``BigIntegerField`` - ``Meta.ordering`` **must only contain one value**, otherwise, your objects will not be sorted correctly. - It is recommended that you set ``editable=False`` and ``db_index=True`` on the field defined in ``Meta.ordering`` for a seamless Django admin experience and faster lookups on the objects. Sample Model: :: # models.py from adminsortable.models import SortableMixin class MySortableClass(SortableMixin): class Meta: verbose_name = 'My Sortable Class' verbose_name_plural = 'My Sortable Classes' ordering = ['the_order'] title = models.CharField(max_length=50) # define the field the model should be ordered by the_order = models.PositiveIntegerField(default=0, editable=False, db_index=True) def __unicode__(self): return self.title Common Use Case ^^^^^^^^^^^^^^^ A common use case is to have child objects that are sortable relative to a parent. If your parent object is also sortable, here's how you would set up your models and admin options: :: # models.py from adminsortable.fields import SortableForeignKey class Category(SortableMixin): class Meta: ordering = ['category_order'] verbose_name_plural = 'Categories' title = models.CharField(max_length=50) # ordering field category_order = models.PositiveIntegerField(default=0, editable=False, db_index=True) class Project(SortableMixin): class Meta: ordering = ['project_order'] category = SortableForeignKey(Category) title = models.CharField(max_length=50) # ordering field project_order = models.PositiveIntegerField(default=0, editable=False, db_index=True) def __unicode__(self): return self.title # admin.py from adminsortable.admin import SortableAdmin from your_app.models import Category, Project admin.site.register(Category, SortableAdmin) admin.site.register(Project, SortableAdmin) Sometimes you might have a parent model that is not sortable, but has child models that are. In that case define your models and admin options as such: :: from adminsortable.fields import SortableForeignKey # models.py class Category(models.Model): class Meta: verbose_name_plural = 'Categories' title = models.CharField(max_length=50) ... class Project(SortableMixin): class Meta: ordering = ['project_order'] category = SortableForeignKey(Category) title = models.CharField(max_length=50) # ordering field project_order = models.PositiveIntegerField(default=0, editable=False, db_index=True) def __unicode__(self): return self.title # admin from adminsortable.admin import NonSortableParentAdmin, SortableStackedInline from your_app.models import Category, Project class ProjectInline(SortableStackedInline): model = Project extra = 1 class CategoryAdmin(NonSortableParentAdmin): inlines = [ProjectInline] admin.site.register(Category, CategoryAdmin) The ``NonSortableParentAdmin`` class is necessary to wire up the additional URL patterns and JavaScript that Django Admin Sortable needs to make your models sortable. The child model does not have to be an inline model, it can be wired directly to Django admin and the objects will be grouped by the non-sortable foreign key when sorting. Backwards Compatibility ~~~~~~~~~~~~~~~~~~~~~~~ If you previously used Django Admin Sortable, **DON'T PANIC** - everything will still work exactly as before ***without any changes to your code***. Going forward, it is recommended that you use the new ``SortableMixin`` on your models, as pre-2.0 compatibility might not be a permanent thing. Please note however that the ``Sortable`` class still contains the hard-coded ``order`` field, and meta inheritance requirements: :: # legacy model definition from adminsortable.models import Sortable class Project(Sortable): class Meta(Sortable.Meta): pass title = models.CharField(max_length=50) def __unicode__(self): return self.title Model Instance Methods ^^^^^^^^^^^^^^^^^^^^^^ Each instance of a sortable model has two convenience methods to get the next or previous instance: :: .get_next() .get_previous() By default, these methods will respect their order in relation to a ``SortableForeignKey`` field, if present. Meaning, that given the following data: :: | Parent Model 1 | | | | Child Model 1 | | | Child Model 2 | | Parent Model 2 | | | | Child Model 3 | | | Child Model 4 | | | Child Model 5 | "Child Model 2" ``get_next()`` would return ``None`` "Child Model 3" ``get_previous`` would return ``None`` If you wish to override this behavior, pass in: ``filter_on_sortable_fk=False``: :: your_instance.get_next(filter_on_sortable_fk=False) You may also pass in additional ORM "extra\_filters" as a dictionary, should you need to: :: your_instance.get_next(extra_filters={'title__icontains': 'blue'}) Adding Sorting to an existing model ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Django 1.6.x or below ^^^^^^^^^^^^^^^^^^^^^ If you're adding Sorting to an existing model, it is recommended that you use `django-south `__ to create a schema migration to add the "order" field to your model. You will also need to create a data migration in order to add the appropriate values for the "order" column. Example assuming a model named "Category": :: def forwards(self, orm): for index, category in enumerate(orm.Category.objects.all()): category.order = index + 1 category.save() See: `this link `__ for more information on South Data Migrations. Django 1.7.x or higher ^^^^^^^^^^^^^^^^^^^^^^ Since schema migrations are built into Django 1.7, you don't have to use south, but the process of adding and running migrations is nearly identical. Take a look at the `Migrations `__ documentation to get started. Django Admin Integration ~~~~~~~~~~~~~~~~~~~~~~~~ To enable sorting in the admin, you need to inherit from ``SortableAdmin``: :: from django.contrib import admin from myapp.models import MySortableClass from adminsortable.admin import SortableAdmin class MySortableAdminClass(SortableAdmin): """Any admin options you need go here""" admin.site.register(MySortableClass, MySortableAdminClass) To enable sorting on TabularInline models, you need to inherit from SortableTabularInline: :: from adminsortable.admin import SortableTabularInline class MySortableTabularInline(SortableTabularInline): """Your inline options go here""" To enable sorting on StackedInline models, you need to inherit from SortableStackedInline: :: from adminsortable.admin import SortableStackedInline class MySortableStackedInline(SortableStackedInline): """Your inline options go here""" There are also generic equivalents that you can inherit from: :: from adminsortable.admin import (SortableGenericTabularInline, SortableGenericStackedInline) """Your generic inline options go here""" If your parent model is *not* sortable, but has child inlines that are, your parent model needs to inherit from ``NonSortableParentAdmin``: :: from adminsortable.admin import (NonSortableParentAdmin, SortableTabularInline) class ChildTabularInline(SortableTabularInline): model = YourModel class ParentAdmin(NonSortableParentAdmin): inlines = [ChildTabularInline] Overriding ``queryset()`` ^^^^^^^^^^^^^^^^^^^^^^^^^ django-admin-sortable supports custom queryset overrides on admin models and inline models in Django admin! If you're providing an override of a SortableAdmin or Sortable inline model, you don't need to do anything extra. django-admin-sortable will automatically honor your queryset. Have a look at the WidgetAdmin class in the sample project for an example of an admin class with a custom ``queryset()`` override. Overriding ``queryset()`` for an inline model ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This is a special case, which requires a few lines of extra code to properly determine the sortability of your model. Example: :: # add this import to your admin.py from adminsortable.utils import get_is_sortable class ComponentInline(SortableStackedInline): model = Component def queryset(self, request): qs = super(ComponentInline, self).queryset(request).filter( title__icontains='foo') # You'll need to add these lines to determine if your model # is sortable once we hit the change_form() for the parent model. if get_is_sortable(qs): self.model.is_sortable = True else: self.model.is_sortable = False return qs If you override the queryset of an inline, the number of objects present may change, and adminsortable won't be able to automatically determine if the inline model is sortable from here, which is why we have to set the ``is_sortable`` property of the model in this method. Sorting subsets of objects ^^^^^^^^^^^^^^^^^^^^^^^^^^ It is also possible to sort a subset of objects in your model by adding a ``sorting_filters`` tuple. This works exactly the same as ``.filter()`` on a QuerySet, and is applied *after* ``get_queryset()`` on the admin class, allowing you to override the queryset as you would normally in admin but apply additional filters for sorting. The text "Change Order of" will appear before each filter in the Change List template, and the filter groups are displayed from left to right in the order listed. If no ``sorting_filters`` are specified, the text "Change Order" will be displayed for the link. Self-Referential SortableForeignKey ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ You can specify a self-referential SortableForeignKey field, however the admin interface will currently show a model that is a grandchild at the same level as a child. I'm working to resolve this issue. Important! '''''''''' django-admin-sortable 1.6.6 introduced a backwards-incompatible change for ``sorting_filters``. Previously this attribute was defined as a dictionary, so you'll need to change your values over to the new tuple-based format. An example of sorting subsets would be a "Board of Directors". In this use case, you have a list of "People" objects. Some of these people are on the Board of Directors and some not, and you need to sort them independently. :: class Person(Sortable): class Meta(Sortable.Meta): verbose_name_plural = 'People' first_name = models.CharField(max_length=50) last_name = models.CharField(max_length=50) is_board_member = models.BooleanField('Board Member', default=False) sorting_filters = ( ('Board Members', {'is_board_member': True}), ('Non-Board Members', {'is_board_member': False}), ) def __unicode__(self): return '{} {}'.format(self.first_name, self.last_name) Extending custom templates ^^^^^^^^^^^^^^^^^^^^^^^^^^ By default, adminsortable's change form and change list views inherit from Django admin's standard templates. Sometimes you need to have a custom change form or change list, but also need adminsortable's CSS and JavaScript for inline models that are sortable for example. SortableAdmin has two attributes you can override for this use case: :: change_form_template_extends change_list_template_extends These attributes have default values of: :: change_form_template_extends = 'admin/change_form.html' change_list_template_extends = 'admin/change_list.html' If you need to extend the inline change form templates, you'll need to select the right one, depending on your version of Django. For Django 1.5.x or below, you'll need to extend one of the following: :: templates/adminsortable/edit_inline/stacked-1.5.x.html templates/adminsortable/edit_inline/tabular-inline-1.5.x.html For Django 1.6.x, extend: :: templates/adminsortable/edit_inline/stacked.html templates/adminsortable/edit_inline/tabular.html A Special Note About Stacked Inlines... ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The height of a stacked inline model can dynamically increase, which can make them difficult to sort. If you anticipate the height of a stacked inline is going to be very tall, I would suggest using SortableTabularInline instead. Django-CMS integration ~~~~~~~~~~~~~~~~~~~~~~ Django-CMS plugins use their own change form, and thus won't automatically include the necessary JavaScript for django-admin-sortable to work. Fortunately, this is easy to resolve, as the ``CMSPlugin`` class allows a change form template to be specified: :: # example plugin from cms.plugin_base import CMSPluginBase class CMSCarouselPlugin(CMSPluginBase): admin_preview = False change_form_template = 'cms/sortable-stacked-inline-change-form.html' inlines = [SlideInline] model = Carousel name = _('Carousel') render_template = 'carousels/carousel.html' def render(self, context, instance, placeholder): context.update({ 'carousel': instance, 'placeholder': placeholder }) return context plugin_pool.register_plugin(CMSCarouselPlugin) The contents of ``sortable-stacked-inline-change-form.html`` at a minimum need to extend the extrahead block with: :: {% extends "admin/cms/page/plugin_change_form.html" %} {% load static from staticfiles %} {% block extrahead %} {{ block.super }} {% endblock extrahead %} Sorting within Django-CMS is really only feasible for inline models of a plugin as Django-CMS already includes sorting for plugin instances. For tabular inlines, just substitute: :: with: :: Rationale ~~~~~~~~~ Other projects have added drag-and-drop ordering to the ChangeList view, however this introduces a couple of problems... - The ChangeList view supports pagination, which makes drag-and-drop ordering across pages impossible. - The ChangeList view by default, does not order records based on a foreign key, nor distinguish between rows that are associated with a foreign key. This makes ordering the records grouped by a foreign key impossible. - The ChangeList supports in-line editing, and adding drag-and-drop ordering on top of that just seemed a little much in my opinion. Status ~~~~~~ django-admin-sortable is currently used in production. What's new in 2.0.10? ~~~~~~~~~~~~~~~~~~~~~ - Bugfix for accessing custom ``order`` property of model. Thanks [@theithec](https://github.com/theithec) for reporting the issue. Future ~~~~~~ - Better template support for foreign keys that are self referential. If someone would like to take on rendering recursive sortables, that would be super. License ~~~~~~~ django-admin-sortable is released under the Apache Public License v2. .. |Build Status| image:: https://travis-ci.org/iambrandontaylor/django-admin-sortable.svg?branch=master :target: https://travis-ci.org/iambrandontaylor/django-admin-sortable python-django-adminsortable-2.0.10/adminsortable/000077500000000000000000000000001266525240600220315ustar00rootroot00000000000000python-django-adminsortable-2.0.10/adminsortable/__init__.py000066400000000000000000000005721266525240600241460ustar00rootroot00000000000000VERSION = (2, 0, 10) DEV_N = None def get_version(): version = '{0}.{1}'.format(VERSION[0], VERSION[1]) if VERSION[2]: version = '{0}.{1}'.format(version, VERSION[2]) try: if VERSION[3]: version = '{0}.{1}'.format(version, VERSION[3]) except IndexError: pass return version __version__ = get_version() python-django-adminsortable-2.0.10/adminsortable/admin.py000077500000000000000000000340751266525240600235070ustar00rootroot00000000000000import json from django import VERSION from django.conf import settings if VERSION > (1, 7): from django.conf.urls import url elif VERSION > (1, 5): from django.conf.urls import patterns, url else: from django.conf.urls.defaults import patterns, url from django.contrib.admin import ModelAdmin, TabularInline, StackedInline from django.contrib.admin.options import InlineModelAdmin if VERSION >= (1, 8): from django.contrib.auth import get_permission_codename from django.contrib.contenttypes.admin import (GenericStackedInline, GenericTabularInline) else: from django.contrib.contenttypes.generic import (GenericStackedInline, GenericTabularInline) from django.contrib.contenttypes.models import ContentType from django.http import HttpResponse from django.shortcuts import render from django.template.defaultfilters import capfirst from adminsortable.fields import SortableForeignKey from adminsortable.models import SortableMixin from adminsortable.utils import get_is_sortable STATIC_URL = settings.STATIC_URL class SortableAdminBase(object): sortable_change_list_with_sort_link_template = \ 'adminsortable/change_list_with_sort_link.html' sortable_change_form_template = 'adminsortable/change_form.html' sortable_change_list_template = 'adminsortable/change_list.html' change_form_template_extends = 'admin/change_form.html' change_list_template_extends = 'admin/change_list.html' def changelist_view(self, request, extra_context=None): """ If the model that inherits Sortable has more than one object, its sort order can be changed. This view adds a link to the object_tools block to take people to the view to change the sorting. """ try: qs_method = getattr(self, 'get_queryset', self.queryset) except AttributeError: qs_method = self.get_queryset if get_is_sortable(qs_method(request)): self.change_list_template = \ self.sortable_change_list_with_sort_link_template self.is_sortable = True if extra_context is None: extra_context = {} extra_context.update({ 'change_list_template_extends': self.change_list_template_extends, 'sorting_filters': [sort_filter[0] for sort_filter in getattr(self.model, 'sorting_filters', [])] }) return super(SortableAdminBase, self).changelist_view(request, extra_context=extra_context) class SortableAdmin(SortableAdminBase, ModelAdmin): """ Admin class to add template overrides and context objects to enable drag-and-drop ordering. """ class Meta: abstract = True def get_urls(self): urls = super(SortableAdmin, self).get_urls() # this ajax view changes the order admin_do_sorting_url = url(r'^sorting/do-sorting/(?P\d+)/$', self.admin_site.admin_view(self.do_sorting_view), name='admin_do_sorting') # this view displays the sortable objects admin_sort_url = url(r'^sort/$', self.admin_site.admin_view(self.sort_view), name='admin_sort') if VERSION > (1, 7): admin_urls = [ admin_do_sorting_url, admin_sort_url ] else: admin_urls = patterns('', admin_do_sorting_url, admin_sort_url,) return admin_urls + urls def sort_view(self, request): """ Custom admin view that displays the objects as a list whose sort order can be changed via drag-and-drop. """ opts = self.model._meta if VERSION >= (1, 8): codename = get_permission_codename('change', opts) has_perm = request.user.has_perm('{0}.{1}'.format(opts.app_label, codename)) else: has_perm = request.user.has_perm('{0}.{1}'.format(opts.app_label, opts.get_change_permission())) jquery_lib_path = 'admin/js/jquery.js' if VERSION < (1, 9) \ else 'admin/js/vendor/jquery/jquery.js' # get sort group index from querystring if present sort_filter_index = request.GET.get('sort_filter') filters = {} if sort_filter_index: try: filters = self.model.sorting_filters[int(sort_filter_index)][1] except (IndexError, ValueError): pass # Apply any sort filters to create a subset of sortable objects try: qs_method = getattr(self, 'get_queryset', self.queryset) except AttributeError: qs_method = self.get_queryset objects = qs_method(request).filter(**filters) # Determine if we need to regroup objects relative to a # foreign key specified on the model class that is extending Sortable. # Legacy support for 'sortable_by' defined as a model property sortable_by_property = getattr(self.model, 'sortable_by', None) # see if our model is sortable by a SortableForeignKey field # and that the number of objects available is >= 2 sortable_by_fk = None sortable_by_field_name = None sortable_by_class_is_sortable = False for field in self.model._meta.fields: if isinstance(field, SortableForeignKey): sortable_by_fk = field.rel.to sortable_by_field_name = field.name.lower() sortable_by_class_is_sortable = sortable_by_fk.objects.count() >= 2 if sortable_by_property: # backwards compatibility for < 1.1.1, where sortable_by was a # classmethod instead of a property try: sortable_by_class, sortable_by_expression = \ sortable_by_property() except (TypeError, ValueError): sortable_by_class = self.model.sortable_by sortable_by_expression = sortable_by_class.__name__.lower() sortable_by_class_display_name = sortable_by_class._meta \ .verbose_name_plural elif sortable_by_fk: # get sortable by properties from the SortableForeignKey # field - supported in 1.3+ sortable_by_class_display_name = sortable_by_fk._meta.verbose_name_plural sortable_by_class = sortable_by_fk sortable_by_expression = sortable_by_field_name else: # model is not sortable by another model sortable_by_class = sortable_by_expression = \ sortable_by_class_display_name = \ sortable_by_class_is_sortable = None if sortable_by_property or sortable_by_fk: # Order the objects by the property they are sortable by, # then by the order, otherwise the regroup # template tag will not show the objects correctly try: order_field_name = opts.model._meta.ordering[0] except (AttributeError, IndexError): # for Django 1.5.x order_field_name = opts.ordering[0] finally: order_field_name = 'order' objects = objects.order_by(sortable_by_expression, order_field_name) try: verbose_name_plural = opts.verbose_name_plural.__unicode__() except AttributeError: verbose_name_plural = opts.verbose_name_plural context = { 'title': u'Drag and drop {0} to change display order'.format( capfirst(verbose_name_plural)), 'opts': opts, 'app_label': opts.app_label, 'has_perm': has_perm, 'objects': objects, 'group_expression': sortable_by_expression, 'sortable_by_class': sortable_by_class, 'sortable_by_class_is_sortable': sortable_by_class_is_sortable, 'sortable_by_class_display_name': sortable_by_class_display_name, 'jquery_lib_path': jquery_lib_path } return render(request, self.sortable_change_list_template, context) def add_view(self, request, form_url='', extra_context=None): if extra_context is None: extra_context = {} extra_context.update({ 'change_form_template_extends': self.change_form_template_extends }) return super(SortableAdmin, self).add_view(request, form_url, extra_context=extra_context) def change_view(self, request, object_id, form_url='', extra_context=None): self.has_sortable_tabular_inlines = False self.has_sortable_stacked_inlines = False if extra_context is None: extra_context = {} extra_context.update({ 'change_form_template_extends': self.change_form_template_extends }) for klass in self.inlines: if issubclass(klass, SortableTabularInline) or issubclass(klass, SortableGenericTabularInline): self.has_sortable_tabular_inlines = True if issubclass(klass, SortableStackedInline) or issubclass(klass, SortableGenericStackedInline): self.has_sortable_stacked_inlines = True if self.has_sortable_tabular_inlines or \ self.has_sortable_stacked_inlines: self.change_form_template = self.sortable_change_form_template extra_context.update({ 'has_sortable_tabular_inlines': self.has_sortable_tabular_inlines, 'has_sortable_stacked_inlines': self.has_sortable_stacked_inlines }) return super(SortableAdmin, self).change_view(request, object_id, form_url='', extra_context=extra_context) def do_sorting_view(self, request, model_type_id=None): """ This view sets the ordering of the objects for the model type and primary keys passed in. It must be an Ajax POST. """ response = {'objects_sorted': False} if request.is_ajax() and request.method == 'POST': try: indexes = list(map(str, request.POST.get('indexes', []).split(','))) klass = ContentType.objects.get( id=model_type_id).model_class() objects_dict = dict([(str(obj.pk), obj) for obj in klass.objects.filter(pk__in=indexes)]) order_field_name = klass._meta.ordering[0] if order_field_name.startswith('-'): order_field_name = order_field_name[1:] step = -1 start_object = max(objects_dict.values(), key=lambda x: getattr(x, order_field_name)) else: step = 1 start_object = min(objects_dict.values(), key=lambda x: getattr(x, order_field_name)) start_index = getattr(start_object, order_field_name, len(indexes)) for index in indexes: obj = objects_dict.get(index) setattr(obj, order_field_name, start_index) obj.save() start_index += step response = {'objects_sorted': True} except (KeyError, IndexError, klass.DoesNotExist, AttributeError, ValueError): pass return HttpResponse(json.dumps(response, ensure_ascii=False), content_type='application/json') class NonSortableParentAdmin(SortableAdmin): def changelist_view(self, request, extra_context=None): return super(SortableAdminBase, self).changelist_view(request, extra_context=extra_context) class SortableInlineBase(SortableAdminBase, InlineModelAdmin): def __init__(self, *args, **kwargs): super(SortableInlineBase, self).__init__(*args, **kwargs) if not issubclass(self.model, SortableMixin): raise Warning(u'Models that are specified in SortableTabularInline' ' and SortableStackedInline must inherit from SortableMixin' ' (or Sortable for legacy implementations)') def get_queryset(self, request): if VERSION < (1, 6): qs = super(SortableInlineBase, self).queryset(request) else: qs = super(SortableInlineBase, self).get_queryset(request) if get_is_sortable(qs): self.model.is_sortable = True else: self.model.is_sortable = False return qs if VERSION < (1, 6): queryset = get_queryset class SortableTabularInline(TabularInline, SortableInlineBase): """Custom template that enables sorting for tabular inlines""" if VERSION < (1, 6): template = 'adminsortable/edit_inline/tabular-1.5.x.html' else: template = 'adminsortable/edit_inline/tabular.html' class SortableStackedInline(StackedInline, SortableInlineBase): """Custom template that enables sorting for stacked inlines""" if VERSION < (1, 6): template = 'adminsortable/edit_inline/stacked-1.5.x.html' else: template = 'adminsortable/edit_inline/stacked.html' class SortableGenericTabularInline(GenericTabularInline, SortableInlineBase): """Custom template that enables sorting for tabular inlines""" if VERSION < (1, 6): template = 'adminsortable/edit_inline/tabular-1.5.x.html' else: template = 'adminsortable/edit_inline/tabular.html' class SortableGenericStackedInline(GenericStackedInline, SortableInlineBase): """Custom template that enables sorting for stacked inlines""" if VERSION < (1, 6): template = 'adminsortable/edit_inline/stacked-1.5.x.html' else: template = 'adminsortable/edit_inline/stacked.html' python-django-adminsortable-2.0.10/adminsortable/fields.py000066400000000000000000000012521266525240600236510ustar00rootroot00000000000000from django.db.models.fields.related import ForeignKey class SortableForeignKey(ForeignKey): """ Field simply acts as a flag to determine the class to sort by. This field replaces previous functionality where `sortable_by` was defined as a model property that specified another model class. """ def south_field_triple(self): try: from south.modelsinspector import introspector cls_name = '{0}.{1}'.format( self.__class__.__module__, self.__class__.__name__) args, kwargs = introspector(self) return cls_name, args, kwargs except ImportError: pass python-django-adminsortable-2.0.10/adminsortable/locale/000077500000000000000000000000001266525240600232705ustar00rootroot00000000000000python-django-adminsortable-2.0.10/adminsortable/locale/de/000077500000000000000000000000001266525240600236605ustar00rootroot00000000000000python-django-adminsortable-2.0.10/adminsortable/locale/de/LC_MESSAGES/000077500000000000000000000000001266525240600254455ustar00rootroot00000000000000python-django-adminsortable-2.0.10/adminsortable/locale/de/LC_MESSAGES/django.mo000066400000000000000000000030751266525240600272510ustar00rootroot00000000000000 |  !./6.f<STIP d5n7D !+?^T]+    Change OrderDelete?Drag and drop %(model)s to change display orderDrag and drop %(model)s to change their order.Drag and drop %(sort_type)s %(model)s to change their order.RemoveReorderReturn to %(model)sThere are unsaved changes on this page. Please save your changes before reordering.You may also drag and drop %(sortable_by_class_display_name)s to change their order.drag and drop to change orderProject-Id-Version: Adminsortable 1.6.2 Report-Msgid-Bugs-To: POT-Creation-Date: 2013-12-03 10:36+0100 PO-Revision-Date: 2013-12-03 10:37+0100 Last-Translator: Moritz Pfeiffer Language-Team: LANGUAGE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Plural-Forms: nplurals=2; plural=(n != 1); X-Generator: Poedit 1.5.7 Reihenfolge ändernLöschen?Drag and drop %(model)s um die Reihenfolge zu ändernDrag and drop %(model)s um ihre Reihenfolge zu ändern.Drag and drop %(sort_type)s %(model)s um die Reihenfolge zu ändern.EntfernenReihenfolge ändernZurück zu %(model)sBitte speichern Sie zuerst die Änderungen auf dieser Seite bevor Sie die Reihenfolge ändern.Sie können per drag and drop die Reihenfolge von %(sortable_by_class_display_name)s ändern.drag and drop um die Reihenfolge zu ändernpython-django-adminsortable-2.0.10/adminsortable/locale/de/LC_MESSAGES/django.po000066400000000000000000000067401266525240600272560ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # msgid "" msgstr "" "Project-Id-Version: Adminsortable 1.6.2\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2013-12-03 10:36+0100\n" "PO-Revision-Date: 2013-12-03 10:37+0100\n" "Last-Translator: Moritz Pfeiffer \n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" "X-Generator: Poedit 1.5.7\n" #: templates/adminsortable/change_form.html:32 msgid "" "There are unsaved changes on this page. Please save your changes before " "reordering." msgstr "" "Bitte speichern Sie zuerst die Änderungen auf dieser Seite bevor Sie die " "Reihenfolge ändern." #: templates/adminsortable/change_list.html:19 #, python-format msgid "Drag and drop %(model)s to change display order" msgstr "Drag and drop %(model)s um die Reihenfolge zu ändern" #: templates/adminsortable/change_list.html:19 msgid "Django site admin" msgstr "" #: templates/adminsortable/change_list.html:24 msgid "Home" msgstr "" #: templates/adminsortable/change_list.html:31 msgid "Reorder" msgstr "Reihenfolge ändern" #: templates/adminsortable/change_list.html:38 #, python-format msgid "Drag and drop %(sort_type)s %(model)s to change their order." msgstr "Drag and drop %(sort_type)s %(model)s um die Reihenfolge zu ändern." #: templates/adminsortable/change_list.html:40 #, python-format msgid "Drag and drop %(model)s to change their order." msgstr "Drag and drop %(model)s um ihre Reihenfolge zu ändern." #: templates/adminsortable/change_list.html:45 #, python-format msgid "" "You may also drag and drop %(sortable_by_class_display_name)s to change " "their order." msgstr "" "Sie können per drag and drop die Reihenfolge von " "%(sortable_by_class_display_name)s ändern." #: templates/adminsortable/change_list.html:56 #, python-format msgid "Return to %(model)s" msgstr "Zurück zu %(model)s" #: templates/adminsortable/change_list_with_sort_link.html:6 msgid "Change Order" msgstr "Reihenfolge ändern" #: templates/adminsortable/edit_inline/stacked-1.5.x.html:4 #: templates/adminsortable/edit_inline/stacked.html:3 #: templates/adminsortable/edit_inline/tabular-1.5.x.html:7 #: templates/adminsortable/edit_inline/tabular.html:6 msgid "drag and drop to change order" msgstr "drag and drop um die Reihenfolge zu ändern" #: templates/adminsortable/edit_inline/stacked-1.5.x.html:10 #: templates/adminsortable/edit_inline/stacked.html:9 #: templates/adminsortable/edit_inline/tabular-1.5.x.html:30 #: templates/adminsortable/edit_inline/tabular.html:30 msgid "View on site" msgstr "" #: templates/adminsortable/edit_inline/stacked-1.5.x.html:71 #: templates/adminsortable/edit_inline/stacked.html:30 #: templates/adminsortable/edit_inline/tabular-1.5.x.html:118 #: templates/adminsortable/edit_inline/tabular.html:78 #, python-format msgid "Add another %(verbose_name)s" msgstr "" #: templates/adminsortable/edit_inline/stacked-1.5.x.html:74 #: templates/adminsortable/edit_inline/stacked.html:29 #: templates/adminsortable/edit_inline/tabular-1.5.x.html:121 #: templates/adminsortable/edit_inline/tabular.html:79 msgid "Remove" msgstr "Entfernen" #: templates/adminsortable/edit_inline/tabular-1.5.x.html:16 #: templates/adminsortable/edit_inline/tabular.html:17 msgid "Delete?" msgstr "Löschen?" python-django-adminsortable-2.0.10/adminsortable/locale/en/000077500000000000000000000000001266525240600236725ustar00rootroot00000000000000python-django-adminsortable-2.0.10/adminsortable/locale/en/LC_MESSAGES/000077500000000000000000000000001266525240600254575ustar00rootroot00000000000000python-django-adminsortable-2.0.10/adminsortable/locale/en/LC_MESSAGES/django.po000066400000000000000000000022541266525240600272640ustar00rootroot00000000000000#, fuzzy msgid "" msgstr "" "Project-Id-Version: adminsortable\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2011-09-22 15:42+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: templates/adminsortable/change_list.html:15 #, python-format msgid "Drag and drop %(model)s to change display order" msgstr "" #: templates/adminsortable/change_list.html:25 #, python-format msgid "Reorder" msgstr "" #: templates/adminsortable/change_list.html:32 #, python-format msgid "Drag and drop %(sort_type)s %(model)s to change their order." msgstr "" #: templates/adminsortable/change_list.html:34 #, python-format msgid "Drag and drop %(model)s to change their order." msgstr "" #: templates/adminsortable/change_list.html:39 #, python-format msgid "" "You may also drag and drop %(sortable_by_class_display_name)s to change " "their order." msgstr "" #: templates/adminsortable/change_list.html:50 #, python-format msgid "Return to %(model)s" msgstr "" #: templates/adminsortable/change_list_with_sort_link.html:6 msgid "Change Order" msgstr "" python-django-adminsortable-2.0.10/adminsortable/locale/es/000077500000000000000000000000001266525240600236775ustar00rootroot00000000000000python-django-adminsortable-2.0.10/adminsortable/locale/es/LC_MESSAGES/000077500000000000000000000000001266525240600254645ustar00rootroot00000000000000python-django-adminsortable-2.0.10/adminsortable/locale/es/LC_MESSAGES/django.mo000066400000000000000000000034261266525240600272700ustar00rootroot00000000000000, /. <<y~S TWku   !"-DP2A  $O9S(     Add another %(verbose_name)sChange OrderChange Order ofDelete?Django site adminDrag and drop %(model)s to change display orderDrag and drop %(model)s to change their order.Drag and drop %(sort_type)s %(model)s to change their order.HomeRemoveReorderReturn to %(model)sThere are unsaved changes on this page. Please save your changes before reordering.View on siteYou may also drag and drop %(sortable_by_class_display_name)s to change their order.drag and drop to change orderProject-Id-Version: PACKAGE VERSION Report-Msgid-Bugs-To: POT-Creation-Date: 2014-04-08 00:54-0600 PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE Last-Translator: FULL NAME Language-Team: LANGUAGE Language: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Plural-Forms: nplurals=2; plural=(n != 1); Añadir otro %(verbose_name)sCambiar ordenCambiar el orden de¿Eliminar?Sitio de administración de DjangoArrastrar y soltar %(model)s para cambiar el orden en que se muestraArrastrar y soltar %(model)s para cambiar su ordenArrastrar y soltar %(model)s %(sort_type)s para cambiar su orden.InicioEliminarReordenarRegresar a %(model)sHay cambios sin guardar en esta página. Guarda los cambios antes de reordenar.Ver en el sitioPuedes arrastrar y soltar %(sortable_by_class_display_name)s para cambiar su orden.arrastrar y soltar para cambiar el ordenpython-django-adminsortable-2.0.10/adminsortable/locale/es/LC_MESSAGES/django.po000066400000000000000000000071311266525240600272700ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2014-04-08 00:54-0600\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #: templates/adminsortable/change_form.html:32 msgid "" "There are unsaved changes on this page. Please save your changes before " "reordering." msgstr "Hay cambios sin guardar en esta página. Guarda los cambios antes de reordenar." #: templates/adminsortable/change_list.html:19 #, python-format msgid "Drag and drop %(model)s to change display order" msgstr "Arrastrar y soltar %(model)s para cambiar el orden en que se muestra" #: templates/adminsortable/change_list.html:19 msgid "Django site admin" msgstr "Sitio de administración de Django" #: templates/adminsortable/change_list.html:24 msgid "Home" msgstr "Inicio" #: templates/adminsortable/change_list.html:31 msgid "Reorder" msgstr "Reordenar" #: templates/adminsortable/change_list.html:38 #, python-format msgid "Drag and drop %(sort_type)s %(model)s to change their order." msgstr "Arrastrar y soltar %(model)s %(sort_type)s para cambiar su orden." #: templates/adminsortable/change_list.html:40 #, python-format msgid "Drag and drop %(model)s to change their order." msgstr "Arrastrar y soltar %(model)s para cambiar su orden" #: templates/adminsortable/change_list.html:45 #, python-format msgid "" "You may also drag and drop %(sortable_by_class_display_name)s to change " "their order." msgstr "Puedes arrastrar y soltar %(sortable_by_class_display_name)s para cambiar su orden." #: templates/adminsortable/change_list.html:56 #, python-format msgid "Return to %(model)s" msgstr "Regresar a %(model)s" #: templates/adminsortable/change_list_with_sort_link.html:7 msgid "Change Order of" msgstr "Cambiar el orden de" #: templates/adminsortable/change_list_with_sort_link.html:11 msgid "Change Order" msgstr "Cambiar orden" #: templates/adminsortable/edit_inline/stacked-1.5.x.html:4 #: templates/adminsortable/edit_inline/stacked.html:3 #: templates/adminsortable/edit_inline/tabular-1.5.x.html:7 #: templates/adminsortable/edit_inline/tabular.html:6 msgid "drag and drop to change order" msgstr "arrastrar y soltar para cambiar el orden" #: templates/adminsortable/edit_inline/stacked-1.5.x.html:10 #: templates/adminsortable/edit_inline/stacked.html:9 #: templates/adminsortable/edit_inline/tabular-1.5.x.html:30 #: templates/adminsortable/edit_inline/tabular.html:30 msgid "View on site" msgstr "Ver en el sitio" #: templates/adminsortable/edit_inline/stacked-1.5.x.html:71 #: templates/adminsortable/edit_inline/stacked.html:30 #: templates/adminsortable/edit_inline/tabular-1.5.x.html:118 #: templates/adminsortable/edit_inline/tabular.html:78 #, python-format msgid "Add another %(verbose_name)s" msgstr "Añadir otro %(verbose_name)s" #: templates/adminsortable/edit_inline/stacked-1.5.x.html:74 #: templates/adminsortable/edit_inline/stacked.html:29 #: templates/adminsortable/edit_inline/tabular-1.5.x.html:121 #: templates/adminsortable/edit_inline/tabular.html:79 msgid "Remove" msgstr "Eliminar" #: templates/adminsortable/edit_inline/tabular-1.5.x.html:16 #: templates/adminsortable/edit_inline/tabular.html:17 msgid "Delete?" msgstr "¿Eliminar?" python-django-adminsortable-2.0.10/adminsortable/locale/nl/000077500000000000000000000000001266525240600237015ustar00rootroot00000000000000python-django-adminsortable-2.0.10/adminsortable/locale/nl/LC_MESSAGES/000077500000000000000000000000001266525240600254665ustar00rootroot00000000000000python-django-adminsortable-2.0.10/adminsortable/locale/nl/LC_MESSAGES/django.mo000066400000000000000000000017611266525240600272720ustar00rootroot00000000000000L | .<"T6 ,!:NRChange OrderDrag and drop %(model)s to change their order.Drag and drop %(sort_type)s %(model)s to change their order.Return to %(model)sYou may also drag and drop %(sortable_by_class_display_name)s to change their order.Project-Id-Version: adminsortable Report-Msgid-Bugs-To: POT-Creation-Date: 2011-09-22 15:42+0200 PO-Revision-Date: 2011-09-22 15:50+0100 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Last-Translator: Jaap Roes Language-Team: Plural-Forms: nplurals=2; plural=(n != 1); X-Poedit-Language: Dutch X-Poedit-Country: NETHERLANDS Volgorde veranderenSleep %(model)s om de volgorde te veranderenSleep %(sort_type)s %(model)s om de volgorde te veranderenTerug naar %(model)sU kunt ook %(sortable_by_class_display_name)s slepen om de volgorde te veranderen.python-django-adminsortable-2.0.10/adminsortable/locale/nl/LC_MESSAGES/django.po000066400000000000000000000030701266525240600272700ustar00rootroot00000000000000msgid "" msgstr "" "Project-Id-Version: adminsortable\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2011-09-22 15:42+0200\n" "PO-Revision-Date: 2011-09-22 15:50+0100\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Last-Translator: Jaap Roes \n" "Language-Team: \n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" "X-Poedit-Language: Dutch\n" "X-Poedit-Country: NETHERLANDS\n" #: templates/adminsortable/change_list.html:15 #, python-format msgid "Drag and drop %(model)s to change display order" msgstr "" #: templates/adminsortable/change_list.html:25 #, python-format msgid "Reorder" msgstr "Reorder" #: templates/adminsortable/change_list.html:32 #, python-format msgid "Drag and drop %(sort_type)s %(model)s to change their order." msgstr "Sleep %(sort_type)s %(model)s om de volgorde te veranderen" #: templates/adminsortable/change_list.html:34 #, python-format msgid "Drag and drop %(model)s to change their order." msgstr "Sleep %(model)s om de volgorde te veranderen" #: templates/adminsortable/change_list.html:39 #, python-format msgid "You may also drag and drop %(sortable_by_class_display_name)s to change their order." msgstr "U kunt ook %(sortable_by_class_display_name)s slepen om de volgorde te veranderen." #: templates/adminsortable/change_list.html:50 #, python-format msgid "Return to %(model)s" msgstr "Terug naar %(model)s" #: templates/adminsortable/change_list_with_sort_link.html:6 msgid "Change Order" msgstr "Volgorde veranderen" python-django-adminsortable-2.0.10/adminsortable/locale/pl/000077500000000000000000000000001266525240600237035ustar00rootroot00000000000000python-django-adminsortable-2.0.10/adminsortable/locale/pl/LC_MESSAGES/000077500000000000000000000000001266525240600254705ustar00rootroot00000000000000python-django-adminsortable-2.0.10/adminsortable/locale/pl/LC_MESSAGES/django.mo000066400000000000000000000035101266525240600272660ustar00rootroot00000000000000 hi /.< GNVSj T >. AGK>H!4UHg/    Add another %(verbose_name)sChange OrderChange Order ofDelete?Drag and drop %(model)s to change display orderDrag and drop %(model)s to change their order.Drag and drop %(sort_type)s %(model)s to change their order.RemoveReorderReturn to %(model)sThere are unsaved changes on this page. Please save your changes before reordering.View on siteYou may also drag and drop %(sortable_by_class_display_name)s to change their order.drag and drop to change orderProject-Id-Version: django-adminsortable 1.8.1 Report-Msgid-Bugs-To: POT-Creation-Date: 2015-03-30 18:37+0200 PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE Last-Translator: Tomasz Gabrysiak Language-Team: LANGUAGE Language: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2); Dodaj kolejne %(verbose_name)sZmień kolejnośćZmień kolejnośćUsunąć?Przeciągnij i upuść %(model)s aby zmienić kolejność wyświetlaniaPrzeciągnij i upuść %(model)s aby zmienić ich kolejność.Przeciągnij i upuść %(sort_type)s %(model)s aby zmienić kolejność.UsuńZmień kolejnośćWróć do %(model)sNa stronie są niezapisane zmiany. Proszę zapisać zmiany przed zmianą kolejności.Zobacz na stronieMożesz też przeciągnąć i upuścić %(sortable_by_class_display_name)s aby zmienić ich kolejnośćprzeciągnij i upuść aby zmienić kolejnośćpython-django-adminsortable-2.0.10/adminsortable/locale/pl/LC_MESSAGES/django.po000066400000000000000000000073151266525240600273000ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: django-adminsortable 1.8.1\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2015-03-30 18:37+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Tomasz Gabrysiak \n" "Language-Team: LANGUAGE \n" "Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " "|| n%100>=20) ? 1 : 2);\n" #: templates/adminsortable/change_form.html:32 msgid "" "There are unsaved changes on this page. Please save your changes before " "reordering." msgstr "Na stronie są niezapisane zmiany. Proszę zapisać zmiany przed " "zmianą kolejności." #: templates/adminsortable/change_list.html:19 #, python-format msgid "Drag and drop %(model)s to change display order" msgstr "Przeciągnij i upuść %(model)s aby zmienić kolejność wyświetlania" #: templates/adminsortable/change_list.html:19 msgid "Django site admin" msgstr "" #: templates/adminsortable/change_list.html:24 msgid "Home" msgstr "" #: templates/adminsortable/change_list.html:31 msgid "Reorder" msgstr "Zmień kolejność" #: templates/adminsortable/change_list.html:38 #, python-format msgid "Drag and drop %(sort_type)s %(model)s to change their order." msgstr "Przeciągnij i upuść %(sort_type)s %(model)s aby zmienić kolejność." #: templates/adminsortable/change_list.html:40 #, python-format msgid "Drag and drop %(model)s to change their order." msgstr "Przeciągnij i upuść %(model)s aby zmienić ich kolejność." #: templates/adminsortable/change_list.html:45 #, python-format msgid "" "You may also drag and drop %(sortable_by_class_display_name)s to change " "their order." msgstr "Możesz też przeciągnąć i upuścić %(sortable_by_class_display_name)s aby zmienić " "ich kolejność" #: templates/adminsortable/change_list.html:56 #, python-format msgid "Return to %(model)s" msgstr "Wróć do %(model)s" #: templates/adminsortable/change_list_with_sort_link.html:7 msgid "Change Order of" msgstr "Zmień kolejność" #: templates/adminsortable/change_list_with_sort_link.html:11 msgid "Change Order" msgstr "Zmień kolejność" #: templates/adminsortable/edit_inline/stacked-1.5.x.html:4 #: templates/adminsortable/edit_inline/stacked.html:3 #: templates/adminsortable/edit_inline/tabular-1.5.x.html:7 #: templates/adminsortable/edit_inline/tabular.html:6 msgid "drag and drop to change order" msgstr "przeciągnij i upuść aby zmienić kolejność" #: templates/adminsortable/edit_inline/stacked-1.5.x.html:10 #: templates/adminsortable/edit_inline/stacked.html:9 #: templates/adminsortable/edit_inline/tabular-1.5.x.html:30 #: templates/adminsortable/edit_inline/tabular.html:30 msgid "View on site" msgstr "Zobacz na stronie" #: templates/adminsortable/edit_inline/stacked-1.5.x.html:71 #: templates/adminsortable/edit_inline/stacked.html:30 #: templates/adminsortable/edit_inline/tabular-1.5.x.html:118 #: templates/adminsortable/edit_inline/tabular.html:78 #, python-format msgid "Add another %(verbose_name)s" msgstr "Dodaj kolejne %(verbose_name)s" #: templates/adminsortable/edit_inline/stacked-1.5.x.html:74 #: templates/adminsortable/edit_inline/stacked.html:29 #: templates/adminsortable/edit_inline/tabular-1.5.x.html:121 #: templates/adminsortable/edit_inline/tabular.html:79 msgid "Remove" msgstr "Usuń" #: templates/adminsortable/edit_inline/tabular-1.5.x.html:16 #: templates/adminsortable/edit_inline/tabular.html:17 msgid "Delete?" msgstr "Usunąć?" python-django-adminsortable-2.0.10/adminsortable/locale/pt_BR/000077500000000000000000000000001266525240600242765ustar00rootroot00000000000000python-django-adminsortable-2.0.10/adminsortable/locale/pt_BR/LC_MESSAGES/000077500000000000000000000000001266525240600260635ustar00rootroot00000000000000python-django-adminsortable-2.0.10/adminsortable/locale/pt_BR/LC_MESSAGES/django.mo000066400000000000000000000027471266525240600276740ustar00rootroot00000000000000 '//._<S BTO& :/Z= ` S]_)Add another %(verbose_name)sChange OrderDelete?Drag and drop %(model)s to change display orderDrag and drop %(model)s to change their order.Drag and drop %(sort_type)s %(model)s to change their order.RemoveReorderReturn to %(model)sThere are unsaved changes on this page. Please save your changes before reordering.View on siteYou may also drag and drop %(sortable_by_class_display_name)s to change their order.drag and drop to change orderProject-Id-Version: adminsortable Report-Msgid-Bugs-To: POT-Creation-Date: 2013-05-20 16:24+0200 PO-Revision-Date: 2013-02-13 02:17+0200 Last-Translator: Gladson Simplicio Brito MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adicione mais %(verbose_name)sAlterar ordemDeletar?Arraste e solte %(model)s para mudar a ordem de exibiçãoArraste e solte %(model)s para alterar a ordem.Arraste e solte %(sort_type)s %(model)s para alterar a ordem.RemoverReordenarRetornar para %(model)sHá alterações não salvas nesta página. Por favor, salve as alterações antes de reordenar.Ver no siteVocê também pode arrastar e soltar %(sortable_by_class_display_name)s para alterar a ordem.arrastar e soltar para alterar a ordem depython-django-adminsortable-2.0.10/adminsortable/locale/pt_BR/LC_MESSAGES/django.po000066400000000000000000000064371266525240600276770ustar00rootroot00000000000000#, fuzzy msgid "" msgstr "" "Project-Id-Version: adminsortable\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2013-05-20 16:24+0200\n" "PO-Revision-Date: 2013-02-13 02:17+0200\n" "Last-Translator: Gladson Simplicio Brito \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: templates/adminsortable/change_form.html:32 msgid "" "There are unsaved changes on this page. Please save your changes before " "reordering." msgstr "" "Há alterações não salvas nesta página. Por favor, salve as alterações antes de " "reordenar." #: templates/adminsortable/change_list.html:19 #, python-format msgid "Drag and drop %(model)s to change display order" msgstr "Arraste e solte %(model)s para mudar a ordem de exibição" #: templates/adminsortable/change_list.html:19 msgid "Django site admin" msgstr "" #: templates/adminsortable/change_list.html:24 msgid "Home" msgstr "" #: templates/adminsortable/change_list.html:31 msgid "Reorder" msgstr "Reordenar" #: templates/adminsortable/change_list.html:38 #, python-format msgid "Drag and drop %(sort_type)s %(model)s to change their order." msgstr "Arraste e solte %(sort_type)s %(model)s para alterar a ordem." #: templates/adminsortable/change_list.html:40 #, python-format msgid "Drag and drop %(model)s to change their order." msgstr "Arraste e solte %(model)s para alterar a ordem." #: templates/adminsortable/change_list.html:45 #, python-format msgid "" "You may also drag and drop %(sortable_by_class_display_name)s to change " "their order." msgstr "" "Você também pode arrastar e soltar %(sortable_by_class_display_name)s " "para alterar a ordem." #: templates/adminsortable/change_list.html:56 #, python-format msgid "Return to %(model)s" msgstr "Retornar para %(model)s" #: templates/adminsortable/change_list_with_sort_link.html:6 msgid "Change Order" msgstr "Alterar ordem" #: templates/adminsortable/edit_inline/stacked-1.5.x.html:4 #: templates/adminsortable/edit_inline/stacked.html:3 #: templates/adminsortable/edit_inline/tabular-1.5.x.html:7 #: templates/adminsortable/edit_inline/tabular.html:6 msgid "drag and drop to change order" msgstr "arrastar e soltar para alterar a ordem de" #: templates/adminsortable/edit_inline/stacked-1.5.x.html:10 #: templates/adminsortable/edit_inline/stacked.html:9 #: templates/adminsortable/edit_inline/tabular-1.5.x.html:30 #: templates/adminsortable/edit_inline/tabular.html:30 msgid "View on site" msgstr "Ver no site" #: templates/adminsortable/edit_inline/stacked-1.5.x.html:71 #: templates/adminsortable/edit_inline/stacked.html:30 #: templates/adminsortable/edit_inline/tabular-1.5.x.html:118 #: templates/adminsortable/edit_inline/tabular.html:78 #, python-format msgid "Add another %(verbose_name)s" msgstr "Adicione mais %(verbose_name)s" #: templates/adminsortable/edit_inline/stacked-1.5.x.html:74 #: templates/adminsortable/edit_inline/stacked.html:29 #: templates/adminsortable/edit_inline/tabular-1.5.x.html:121 #: templates/adminsortable/edit_inline/tabular.html:79 msgid "Remove" msgstr "Remover" #: templates/adminsortable/edit_inline/tabular-1.5.x.html:16 #: templates/adminsortable/edit_inline/tabular.html:17 msgid "Delete?" msgstr "Deletar?"python-django-adminsortable-2.0.10/adminsortable/locale/ru/000077500000000000000000000000001266525240600237165ustar00rootroot00000000000000python-django-adminsortable-2.0.10/adminsortable/locale/ru/LC_MESSAGES/000077500000000000000000000000001266525240600255035ustar00rootroot00000000000000python-django-adminsortable-2.0.10/adminsortable/locale/ru/LC_MESSAGES/django.mo000066400000000000000000000042271266525240600273070ustar00rootroot00000000000000 hi /.< GNVSj T >(,)JtTZh3 $KK    Add another %(verbose_name)sChange OrderChange Order ofDelete?Drag and drop %(model)s to change display orderDrag and drop %(model)s to change their order.Drag and drop %(sort_type)s %(model)s to change their order.RemoveReorderReturn to %(model)sThere are unsaved changes on this page. Please save your changes before reordering.View on siteYou may also drag and drop %(sortable_by_class_display_name)s to change their order.drag and drop to change orderProject-Id-Version: PACKAGE VERSION Report-Msgid-Bugs-To: POT-Creation-Date: 2014-05-20 01:01-0500 PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE Last-Translator: FULL NAME Language-Team: LANGUAGE Language: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2); Добавить еще %(verbose_name)sИзменить порядок выводаИзменение порядка для УдалитьПеретащите %(model)s для изменения порядка выводаПеретащите %(model)s для изменения их порядка вывода.Перетащите %(sort_type)s %(model)s для изменения их порядка вывода.УбратьСортироватьВернуться к %(model)sЕсть несохраненные изменения на этой странице. Пожалуйста, сохраните изменения перед сортировкойПосмотреть на сайтеВы также можете перетащить %(sortable_by_class_display_name)s для изменения их порядка вывода.Перетащите для изменения порядка вывода.python-django-adminsortable-2.0.10/adminsortable/locale/ru/LC_MESSAGES/django.po000066400000000000000000000100301266525240600272770ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2014-05-20 01:01-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" "%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" #: templates/adminsortable/change_form.html:32 msgid "" "There are unsaved changes on this page. Please save your changes before " "reordering." msgstr "Есть несохраненные изменения на этой странице. Пожалуйста, сохраните изменения перед сортировкой" #: templates/adminsortable/change_list.html:19 #, python-format msgid "Drag and drop %(model)s to change display order" msgstr "Перетащите %(model)s для изменения порядка вывода" #: templates/adminsortable/change_list.html:19 msgid "Django site admin" msgstr "" #: templates/adminsortable/change_list.html:24 msgid "Home" msgstr "" #: templates/adminsortable/change_list.html:31 msgid "Reorder" msgstr "Сортировать" #: templates/adminsortable/change_list.html:38 #, python-format msgid "Drag and drop %(sort_type)s %(model)s to change their order." msgstr "Перетащите %(sort_type)s %(model)s для изменения их порядка вывода." #: templates/adminsortable/change_list.html:40 #, python-format msgid "Drag and drop %(model)s to change their order." msgstr "Перетащите %(model)s для изменения их порядка вывода." #: templates/adminsortable/change_list.html:45 #, python-format msgid "" "You may also drag and drop %(sortable_by_class_display_name)s to change " "their order." msgstr "" "Вы также можете перетащить %(sortable_by_class_display_name)s для изменения их порядка вывода." #: templates/adminsortable/change_list.html:56 #, python-format msgid "Return to %(model)s" msgstr "Вернуться к %(model)s" #: templates/adminsortable/change_list_with_sort_link.html:7 msgid "Change Order of" msgstr "Изменение порядка для " #: templates/adminsortable/change_list_with_sort_link.html:11 msgid "Change Order" msgstr "Изменить порядок вывода" #: templates/adminsortable/edit_inline/stacked-1.5.x.html:4 #: templates/adminsortable/edit_inline/stacked.html:3 #: templates/adminsortable/edit_inline/tabular-1.5.x.html:7 #: templates/adminsortable/edit_inline/tabular.html:6 msgid "drag and drop to change order" msgstr "Перетащите для изменения порядка вывода." #: templates/adminsortable/edit_inline/stacked-1.5.x.html:10 #: templates/adminsortable/edit_inline/stacked.html:9 #: templates/adminsortable/edit_inline/tabular-1.5.x.html:30 #: templates/adminsortable/edit_inline/tabular.html:30 msgid "View on site" msgstr "Посмотреть на сайте" #: templates/adminsortable/edit_inline/stacked-1.5.x.html:71 #: templates/adminsortable/edit_inline/stacked.html:30 #: templates/adminsortable/edit_inline/tabular-1.5.x.html:118 #: templates/adminsortable/edit_inline/tabular.html:78 #, python-format msgid "Add another %(verbose_name)s" msgstr "Добавить еще %(verbose_name)s" #: templates/adminsortable/edit_inline/stacked-1.5.x.html:74 #: templates/adminsortable/edit_inline/stacked.html:29 #: templates/adminsortable/edit_inline/tabular-1.5.x.html:121 #: templates/adminsortable/edit_inline/tabular.html:79 msgid "Remove" msgstr "Убрать" #: templates/adminsortable/edit_inline/tabular-1.5.x.html:16 #: templates/adminsortable/edit_inline/tabular.html:17 msgid "Delete?" msgstr "Удалить" python-django-adminsortable-2.0.10/adminsortable/models.py000066400000000000000000000121111266525240600236620ustar00rootroot00000000000000from django.contrib.contenttypes.models import ContentType from django.db import models from adminsortable.fields import SortableForeignKey class MultipleSortableForeignKeyException(Exception): def __init__(self, value): self.value = value def __str__(self): return repr(self.value) class SortableMixin(models.Model): """ `is_sortable` determines whether or not the Model is sortable by determining if the last value of the field used to determine the order of objects is greater than the default of 1, which should be present if there is only one object. `model_type_id` returns the ContentType.id for the Model that inherits Sortable `save` the override of save increments the last/highest value of `Meta.ordering` by 1 """ is_sortable = False sorting_filters = () # legacy support sortable_by = None sortable_foreign_key = None class Meta: abstract = True @classmethod def model_type_id(cls): return ContentType.objects.get_for_model(cls).id def __init__(self, *args, **kwargs): super(SortableMixin, self).__init__(*args, **kwargs) # Check that Meta.ordering contains one value try: self.order_field_name = self._meta.ordering[0].replace('-', '') except IndexError: raise ValueError(u'You must define the Meta.ordering ' u'property on your model.') # get the model field defined by `Meta.ordering` self.order_field = self._meta.get_field(self.order_field_name) integer_fields = (models.PositiveIntegerField, models.IntegerField, models.PositiveSmallIntegerField, models.SmallIntegerField, models.BigIntegerField,) # check that the order field is an integer type if not self.order_field or not isinstance(self.order_field, integer_fields): raise NotImplemented(u'You must define the field ' '`Meta.ordering` refers to, and it must be of type: ' 'PositiveIntegerField, IntegerField, ' 'PositiveSmallIntegerField, SmallIntegerField, ' 'BigIntegerField') # Validate that model only contains at most one SortableForeignKey sortable_foreign_keys = [] for field in self._meta.fields: if isinstance(field, SortableForeignKey): sortable_foreign_keys.append(field) sortable_foreign_keys_length = len(sortable_foreign_keys) if sortable_foreign_keys_length > 1: raise MultipleSortableForeignKeyException( u'{0} may only have one SortableForeignKey'.format(self)) elif sortable_foreign_keys_length == 1: self.__class__.sortable_foreign_key = sortable_foreign_keys[0] def _get_order_field_value(self): try: return int(self.order_field.value_to_string(self)) except ValueError: raise u'The value from the specified order field could not be ' 'typecast to an integer.' def save(self, *args, **kwargs): if not self.id: try: current_max = self.__class__.objects.aggregate( models.Max(self.order_field_name))[self.order_field_name + '__max'] or 0 setattr(self, self.order_field_name, current_max + 1) except (TypeError, IndexError): pass super(SortableMixin, self).save(*args, **kwargs) def _filter_objects(self, filters, extra_filters, filter_on_sortable_fk): if extra_filters: filters.update(extra_filters) if self.sortable_foreign_key and filter_on_sortable_fk: # sfk_obj == sortable foreign key instance sfk_obj = getattr(self, self.sortable_foreign_key.name) filters.update( {self.sortable_foreign_key.name: sfk_obj.id}) try: order_by = '-{0}'.format(self.order_field_name) \ if '{0}__lt'.format(self.order_field_name) in filters.keys() \ else self.order_field_name obj = self.__class__.objects.filter( **filters).order_by(order_by)[:1][0] except IndexError: obj = None return obj def get_next(self, extra_filters={}, filter_on_sortable_fk=True): return self._filter_objects( {'{0}__gt'.format(self.order_field_name): self._get_order_field_value()}, extra_filters, filter_on_sortable_fk) def get_previous(self, extra_filters={}, filter_on_sortable_fk=True): return self._filter_objects( {'{0}__lt'.format(self.order_field_name): self._get_order_field_value()}, extra_filters, filter_on_sortable_fk) # for legacy support of existing implementations class Sortable(SortableMixin): class Meta: abstract = True ordering = ['order'] order = models.PositiveIntegerField(default=0, editable=False, db_index=True) python-django-adminsortable-2.0.10/adminsortable/static/000077500000000000000000000000001266525240600233205ustar00rootroot00000000000000python-django-adminsortable-2.0.10/adminsortable/static/adminsortable/000077500000000000000000000000001266525240600261445ustar00rootroot00000000000000python-django-adminsortable-2.0.10/adminsortable/static/adminsortable/css/000077500000000000000000000000001266525240600267345ustar00rootroot00000000000000python-django-adminsortable-2.0.10/adminsortable/static/adminsortable/css/admin.sortable.css000066400000000000000000000012261266525240600323510ustar00rootroot00000000000000#sortable ul { -webkit-padding-start: 0; padding-left: 0; margin-top: 0.75em; } #sortable ul ul { margin-left: 1em; } #sortable ul li, #sortable ul li a { cursor: move; } #sortable ul li { overflow: auto; margin-left: 0; display: block; } #sortable .sortable { list-style: none; font-weight: 800; margin-bottom: 0.75em; } #sortable .sortable.single, #sortable ul ul a { font-weight: 400; } #sortable ul ul a { color: #5B80B2; margin-bottom: 0; } .sortable-help-text { color: #999; font-size: 13px; } .sortable a:hover { color: #003366; } .sortable .fa { margin-right: 7px; } python-django-adminsortable-2.0.10/adminsortable/static/adminsortable/css/admin.sortable.inline.css000066400000000000000000000007721266525240600336330ustar00rootroot00000000000000.sortable.has_original { cursor: move; } .sortable .inline-related .module.aligned .fa, .sortable.inline-group .module .fa { display: block; float: left; } .sortable .inline-related .module.aligned .fa { margin: 5px 10px 0 0; } .sortable .inline-related.flat-admin .module.aligned .fa { margin: 9px 10px 0 0; } .sortable.inline-group .module .fa { margin: 26px -10px 0 10px; } .sortable.inline-group.flat-admin .module .fa { margin: 34px -10px 0 10px; } python-django-adminsortable-2.0.10/adminsortable/static/adminsortable/js/000077500000000000000000000000001266525240600265605ustar00rootroot00000000000000python-django-adminsortable-2.0.10/adminsortable/static/adminsortable/js/admin.sortable.js000066400000000000000000000033431266525240600320230ustar00rootroot00000000000000(function($){ $(function() { jQuery('.sortable').sortable({ axis : 'y', containment : 'parent', tolerance : 'pointer', items : 'li', stop : function(event, ui) { var indexes = [], lineItems = ui.item.parent().find('> li'); lineItems.each(function(i) { indexes.push($(this).find(':hidden[name="pk"]').val()); }); $.ajax({ url: ui.item.find('a.admin_sorting_url').attr('href'), type: 'POST', data: { indexes: indexes.join(',') }, success: function() { // set icons based on position lineItems.each(function(index, element) { var icon = $(element).find('> a .fa'); icon.removeClass('fa-sort-desc fa-sort-asc fa-sort'); if (index === 0) { icon.addClass('fa fa-sort-desc'); } else if (index == lineItems.length - 1) { icon.addClass('fa fa-sort-asc'); } else { icon.addClass('fa fa-sort'); } }); ui.item.effect('highlight', {}, 1000); } }); } }).click(function(e){ e.preventDefault(); }); }); })(django.jQuery); admin.sortable.stacked.inlines.js000066400000000000000000000060421266525240600350200ustar00rootroot00000000000000python-django-adminsortable-2.0.10/adminsortable/static/adminsortable/js(function($){ $(function() { var sorting_urls = $(':hidden[name="admin_sorting_url"]'); if (sorting_urls.length > 0) { var sortable_inline_groups = sorting_urls.closest('.inline-group') var sortable_inline_rows = sortable_inline_groups.find('.inline-related'); sortable_inline_groups.addClass('sortable') sortable_inline_rows.addClass('sortable'); sortable_inline_groups.sortable({ axis : 'y', containment : 'parent', create: function(event, ui) { $('.inline-related :checkbox').unbind(); }, tolerance : 'pointer', items : '.inline-related', stop : function(event, ui) { if ($('.inline-deletelink').length > 0) { $(ui.sender).sortable('cancel'); alert($('#localized_save_before_reorder_message').val()); return false; } var indexes = []; ui.item.parent().children('.inline-related').each(function(i) { var index_value = $(this).find(':hidden[name$="-id"]').val(); if (index_value !== "" && index_value !== undefined) { indexes.push(index_value); } }); $.ajax({ url: ui.item.parent().find(':hidden[name="admin_sorting_url"]').val(), type: 'POST', data: { indexes : indexes.join(',') }, success: function() { var fieldsets = ui.item.find('fieldset'), highlightedSelector = fieldsets.filter('.collapsed').length === fieldsets.length ? 'h3' : '.form-row', icons = ui.item.parent().find(highlightedSelector).find('.fa'); // set icons based on position icons.removeClass('fa-sort-desc fa-sort-asc fa-sort'); icons.each(function(index, element) { var icon = $(element); if (index === 0) { icon.addClass('fa fa-sort-desc'); } else if (index == icons.length - 1) { icon.addClass('fa fa-sort-asc'); } else { icon.addClass('fa fa-sort'); } }); ui.item.find(highlightedSelector).effect('highlight', {}, 1000); } }); } }); } }); })(django.jQuery); admin.sortable.tabular.inlines.js000066400000000000000000000060321266525240600350330ustar00rootroot00000000000000python-django-adminsortable-2.0.10/adminsortable/static/adminsortable/js(function($){ $(function() { var sorting_urls = $(':hidden[name="admin_sorting_url"]'); if (sorting_urls.length) { var sortable_inline_group = sorting_urls.closest('.inline-group') var tabular_inline_rows = sortable_inline_group.find('.tabular table tbody tr'); tabular_inline_rows.addClass('sortable'); sortable_inline_group.find('.tabular.inline-related').sortable({ axis : 'y', containment : 'parent', create: function(event, ui) { $('td.delete :checkbox').unbind(); }, tolerance : 'pointer', items : 'tr:not(.add-row)', stop : function(event, ui) { if ($('.inline-deletelink').length > 0) { $(ui.sender).sortable('cancel'); alert($('#localized_save_before_reorder_message').val()); return false; } var indexes = []; ui.item.parent().children('tr').each(function(i) { var index_value = $(this).find('.original :hidden:first').val(); if (index_value !== '' && index_value !== undefined) { indexes.push(index_value); } }); $.ajax({ url: ui.item.parent().find(':hidden[name="admin_sorting_url"]').val(), type: 'POST', data: { indexes : indexes.join(',') }, success: function() { // set icons based on position var icons = ui.item.parent().find('.fa'); icons.removeClass('fa-sort-desc fa-sort-asc fa-sort'); icons.each(function(index, element) { var icon = $(element); if (index === 0) { icon.addClass('fa fa-sort-desc'); } else if (index == icons.length - 1) { icon.addClass('fa fa-sort-asc'); } else { icon.addClass('fa fa-sort'); } }); // highlight sorted row, then re-stripe table ui.item.effect('highlight', {}, 1000); tabular_inline_rows.removeClass('row1 row2'); $('.tabular table tbody tr:odd').addClass('row2'); $('.tabular table tbody tr:even').addClass('row1'); } }); } }); } }); })(django.jQuery); jquery-ui-django-admin.min.js000066400000000000000000006735161266525240600341230ustar00rootroot00000000000000python-django-adminsortable-2.0.10/adminsortable/static/adminsortable/jsjQuery=django.jQuery.noConflict(!1),function(a,b){function e(b,c){var d,e,g,h=b.nodeName.toLowerCase();return"area"===h?(d=b.parentNode,e=d.name,b.href&&e&&"map"===d.nodeName.toLowerCase()?(g=a("img[usemap=#"+e+"]")[0],!!g&&f(g)):!1):(/input|select|textarea|button|object/.test(h)?!b.disabled:"a"===h?b.href||c:c)&&f(b)}function f(b){return a.expr.filters.visible(b)&&!a(b).parents().addBack().filter(function(){return"hidden"===a.css(this,"visibility")}).length}var c=0,d=/^ui-id-\d+$/;a.ui=a.ui||{},a.extend(a.ui,{version:"1.10.3",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}}),a.fn.extend({focus:function(b){return function(c,d){return"number"==typeof c?this.each(function(){var b=this;setTimeout(function(){a(b).focus(),d&&d.call(b)},c)}):b.apply(this,arguments)}}(a.fn.focus),scrollParent:function(){var b;return b=a.ui.ie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(a.css(this,"position"))&&/(auto|scroll)/.test(a.css(this,"overflow")+a.css(this,"overflow-y")+a.css(this,"overflow-x"))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(a.css(this,"overflow")+a.css(this,"overflow-y")+a.css(this,"overflow-x"))}).eq(0),/fixed/.test(this.css("position"))||!b.length?a(document):b},zIndex:function(c){if(c!==b)return this.css("zIndex",c);if(this.length)for(var e,f,d=a(this[0]);d.length&&d[0]!==document;){if(e=d.css("position"),("absolute"===e||"relative"===e||"fixed"===e)&&(f=parseInt(d.css("zIndex"),10),!isNaN(f)&&0!==f))return f;d=d.parent()}return 0},uniqueId:function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++c)})},removeUniqueId:function(){return this.each(function(){d.test(this.id)&&a(this).removeAttr("id")})}}),a.extend(a.expr[":"],{data:a.expr.createPseudo?a.expr.createPseudo(function(b){return function(c){return!!a.data(c,b)}}):function(b,c,d){return!!a.data(b,d[3])},focusable:function(b){return e(b,!isNaN(a.attr(b,"tabindex")))},tabbable:function(b){var c=a.attr(b,"tabindex"),d=isNaN(c);return(d||c>=0)&&e(b,!d)}}),a("").outerWidth(1).jquery||a.each(["Width","Height"],function(c,d){function h(b,c,d,f){return a.each(e,function(){c-=parseFloat(a.css(b,"padding"+this))||0,d&&(c-=parseFloat(a.css(b,"border"+this+"Width"))||0),f&&(c-=parseFloat(a.css(b,"margin"+this))||0)}),c}var e="Width"===d?["Left","Right"]:["Top","Bottom"],f=d.toLowerCase(),g={innerWidth:a.fn.innerWidth,innerHeight:a.fn.innerHeight,outerWidth:a.fn.outerWidth,outerHeight:a.fn.outerHeight};a.fn["inner"+d]=function(c){return c===b?g["inner"+d].call(this):this.each(function(){a(this).css(f,h(this,c)+"px")})},a.fn["outer"+d]=function(b,c){return"number"!=typeof b?g["outer"+d].call(this,b):this.each(function(){a(this).css(f,h(this,b,!0,c)+"px")})}}),a.fn.addBack||(a.fn.addBack=function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}),a("").data("a-b","a").removeData("a-b").data("a-b")&&(a.fn.removeData=function(b){return function(c){return arguments.length?b.call(this,a.camelCase(c)):b.call(this)}}(a.fn.removeData)),a.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()),a.support.selectstart="onselectstart"in document.createElement("div"),a.fn.extend({disableSelection:function(){return this.bind((a.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}}),a.extend(a.ui,{plugin:{add:function(b,c,d){var e,f=a.ui[b].prototype;for(e in d)f.plugins[e]=f.plugins[e]||[],f.plugins[e].push([c,d[e]])},call:function(a,b,c){var d,e=a.plugins[b];if(e&&a.element[0].parentNode&&11!==a.element[0].parentNode.nodeType)for(d=0;d0?!0:(b[d]=1,e=b[d]>0,b[d]=0,e)}})}(jQuery),function(a,b){var c=0,d=Array.prototype.slice,e=a.cleanData;a.cleanData=function(b){for(var d,c=0;null!=(d=b[c]);c++)try{a(d).triggerHandler("remove")}catch(f){}e(b)},a.widget=function(b,c,d){var e,f,g,h,i={},j=b.split(".")[0];b=b.split(".")[1],e=j+"-"+b,d||(d=c,c=a.Widget),a.expr[":"][e.toLowerCase()]=function(b){return!!a.data(b,e)},a[j]=a[j]||{},f=a[j][b],g=a[j][b]=function(a,b){return this._createWidget?(arguments.length&&this._createWidget(a,b),void 0):new g(a,b)},a.extend(g,f,{version:d.version,_proto:a.extend({},d),_childConstructors:[]}),h=new c,h.options=a.widget.extend({},h.options),a.each(d,function(b,d){return a.isFunction(d)?(i[b]=function(){var a=function(){return c.prototype[b].apply(this,arguments)},e=function(a){return c.prototype[b].apply(this,a)};return function(){var f,b=this._super,c=this._superApply;return this._super=a,this._superApply=e,f=d.apply(this,arguments),this._super=b,this._superApply=c,f}}(),void 0):(i[b]=d,void 0)}),g.prototype=a.widget.extend(h,{widgetEventPrefix:f?h.widgetEventPrefix:b},i,{constructor:g,namespace:j,widgetName:b,widgetFullName:e}),f?(a.each(f._childConstructors,function(b,c){var d=c.prototype;a.widget(d.namespace+"."+d.widgetName,g,c._proto)}),delete f._childConstructors):c._childConstructors.push(g),a.widget.bridge(b,g)},a.widget.extend=function(c){for(var h,i,e=d.call(arguments,1),f=0,g=e.length;g>f;f++)for(h in e[f])i=e[f][h],e[f].hasOwnProperty(h)&&i!==b&&(c[h]=a.isPlainObject(i)?a.isPlainObject(c[h])?a.widget.extend({},c[h],i):a.widget.extend({},i):i);return c},a.widget.bridge=function(c,e){var f=e.prototype.widgetFullName||c;a.fn[c]=function(g){var h="string"==typeof g,i=d.call(arguments,1),j=this;return g=!h&&i.length?a.widget.extend.apply(null,[g].concat(i)):g,h?this.each(function(){var d,e=a.data(this,f);return e?a.isFunction(e[g])&&"_"!==g.charAt(0)?(d=e[g].apply(e,i),d!==e&&d!==b?(j=d&&d.jquery?j.pushStack(d.get()):d,!1):void 0):a.error("no such method '"+g+"' for "+c+" widget instance"):a.error("cannot call methods on "+c+" prior to initialization; "+"attempted to call method '"+g+"'")}):this.each(function(){var b=a.data(this,f);b?b.option(g||{})._init():a.data(this,f,new e(g,this))}),j}},a.Widget=function(){},a.Widget._childConstructors=[],a.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"
",options:{disabled:!1,create:null},_createWidget:function(b,d){d=a(d||this.defaultElement||this)[0],this.element=a(d),this.uuid=c++,this.eventNamespace="."+this.widgetName+this.uuid,this.options=a.widget.extend({},this.options,this._getCreateOptions(),b),this.bindings=a(),this.hoverable=a(),this.focusable=a(),d!==this&&(a.data(d,this.widgetFullName,this),this._on(!0,this.element,{remove:function(a){a.target===d&&this.destroy()}}),this.document=a(d.style?d.ownerDocument:d.document||d),this.window=a(this.document[0].defaultView||this.document[0].parentWindow)),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:a.noop,_getCreateEventData:a.noop,_create:a.noop,_init:a.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetName).removeData(this.widgetFullName).removeData(a.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled "+"ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:a.noop,widget:function(){return this.element},option:function(c,d){var f,g,h,e=c;if(0===arguments.length)return a.widget.extend({},this.options);if("string"==typeof c)if(e={},f=c.split("."),c=f.shift(),f.length){for(g=e[c]=a.widget.extend({},this.options[c]),h=0;h=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}})}(jQuery),function(a){a.widget("ui.draggable",a.ui.mouse,{version:"1.10.3",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1,drag:null,start:null,stop:null},_create:function(){"original"!==this.options.helper||/^(?:r|a|f)/.test(this.element.css("position"))||(this.element[0].style.position="relative"),this.options.addClasses&&this.element.addClass("ui-draggable"),this.options.disabled&&this.element.addClass("ui-draggable-disabled"),this._mouseInit()},_destroy:function(){this.element.removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"),this._mouseDestroy()},_mouseCapture:function(b){var c=this.options;return this.helper||c.disabled||a(b.target).closest(".ui-resizable-handle").length>0?!1:(this.handle=this._getHandle(b),this.handle?(a(c.iframeFix===!0?"iframe":c.iframeFix).each(function(){a("
").css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1e3}).css(a(this).offset()).appendTo("body")}),!0):!1)},_mouseStart:function(b){var c=this.options;return this.helper=this._createHelper(b),this.helper.addClass("ui-draggable-dragging"),this._cacheHelperProportions(),a.ui.ddmanager&&(a.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(),this.offsetParent=this.helper.offsetParent(),this.offsetParentCssPosition=this.offsetParent.css("position"),this.offset=this.positionAbs=this.element.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},this.offset.scroll=!1,a.extend(this.offset,{click:{left:b.pageX-this.offset.left,top:b.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.originalPosition=this.position=this._generatePosition(b),this.originalPageX=b.pageX,this.originalPageY=b.pageY,c.cursorAt&&this._adjustOffsetFromHelper(c.cursorAt),this._setContainment(),this._trigger("start",b)===!1?(this._clear(),!1):(this._cacheHelperProportions(),a.ui.ddmanager&&!c.dropBehaviour&&a.ui.ddmanager.prepareOffsets(this,b),this._mouseDrag(b,!0),a.ui.ddmanager&&a.ui.ddmanager.dragStart(this,b),!0)},_mouseDrag:function(b,c){if("fixed"===this.offsetParentCssPosition&&(this.offset.parent=this._getParentOffset()),this.position=this._generatePosition(b),this.positionAbs=this._convertPositionTo("absolute"),!c){var d=this._uiHash();if(this._trigger("drag",b,d)===!1)return this._mouseUp({}),!1;this.position=d.position}return this.options.axis&&"y"===this.options.axis||(this.helper[0].style.left=this.position.left+"px"),this.options.axis&&"x"===this.options.axis||(this.helper[0].style.top=this.position.top+"px"),a.ui.ddmanager&&a.ui.ddmanager.drag(this,b),!1},_mouseStop:function(b){var c=this,d=!1;return a.ui.ddmanager&&!this.options.dropBehaviour&&(d=a.ui.ddmanager.drop(this,b)),this.dropped&&(d=this.dropped,this.dropped=!1),"original"!==this.options.helper||a.contains(this.element[0].ownerDocument,this.element[0])?("invalid"===this.options.revert&&!d||"valid"===this.options.revert&&d||this.options.revert===!0||a.isFunction(this.options.revert)&&this.options.revert.call(this.element,d)?a(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){c._trigger("stop",b)!==!1&&c._clear()}):this._trigger("stop",b)!==!1&&this._clear(),!1):!1},_mouseUp:function(b){return a("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)}),a.ui.ddmanager&&a.ui.ddmanager.dragStop(this,b),a.ui.mouse.prototype._mouseUp.call(this,b)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear(),this},_getHandle:function(b){return this.options.handle?!!a(b.target).closest(this.element.find(this.options.handle)).length:!0},_createHelper:function(b){var c=this.options,d=a.isFunction(c.helper)?a(c.helper.apply(this.element[0],[b])):"clone"===c.helper?this.element.clone().removeAttr("id"):this.element;return d.parents("body").length||d.appendTo("parent"===c.appendTo?this.element[0].parentNode:c.appendTo),d[0]===this.element[0]||/(fixed|absolute)/.test(d.css("position"))||d.css("position","absolute"),d},_adjustOffsetFromHelper:function(b){"string"==typeof b&&(b=b.split(" ")),a.isArray(b)&&(b={left:+b[0],top:+b[1]||0}),"left"in b&&(this.offset.click.left=b.left+this.margins.left),"right"in b&&(this.offset.click.left=this.helperProportions.width-b.right+this.margins.left),"top"in b&&(this.offset.click.top=b.top+this.margins.top),"bottom"in b&&(this.offset.click.top=this.helperProportions.height-b.bottom+this.margins.top)},_getParentOffset:function(){var b=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==document&&a.contains(this.scrollParent[0],this.offsetParent[0])&&(b.left+=this.scrollParent.scrollLeft(),b.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===document.body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&a.ui.ie)&&(b={top:0,left:0}),{top:b.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:b.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"===this.cssPosition){var a=this.element.position();return{top:a.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:a.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var b,c,d,e=this.options;return e.containment?"window"===e.containment?(this.containment=[a(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,a(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,a(window).scrollLeft()+a(window).width()-this.helperProportions.width-this.margins.left,a(window).scrollTop()+(a(window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],void 0):"document"===e.containment?(this.containment=[0,0,a(document).width()-this.helperProportions.width-this.margins.left,(a(document).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],void 0):e.containment.constructor===Array?(this.containment=e.containment,void 0):("parent"===e.containment&&(e.containment=this.helper[0].parentNode),c=a(e.containment),d=c[0],d&&(b="hidden"!==c.css("overflow"),this.containment=[(parseInt(c.css("borderLeftWidth"),10)||0)+(parseInt(c.css("paddingLeft"),10)||0),(parseInt(c.css("borderTopWidth"),10)||0)+(parseInt(c.css("paddingTop"),10)||0),(b?Math.max(d.scrollWidth,d.offsetWidth):d.offsetWidth)-(parseInt(c.css("borderRightWidth"),10)||0)-(parseInt(c.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(b?Math.max(d.scrollHeight,d.offsetHeight):d.offsetHeight)-(parseInt(c.css("borderBottomWidth"),10)||0)-(parseInt(c.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relative_container=c),void 0):(this.containment=null,void 0)},_convertPositionTo:function(b,c){c||(c=this.position);var d="absolute"===b?1:-1,e="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&a.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent;return this.offset.scroll||(this.offset.scroll={top:e.scrollTop(),left:e.scrollLeft()}),{top:c.top+this.offset.relative.top*d+this.offset.parent.top*d-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():this.offset.scroll.top)*d,left:c.left+this.offset.relative.left*d+this.offset.parent.left*d-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():this.offset.scroll.left)*d}},_generatePosition:function(b){var c,d,e,f,g=this.options,h="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&a.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,i=b.pageX,j=b.pageY;return this.offset.scroll||(this.offset.scroll={top:h.scrollTop(),left:h.scrollLeft()}),this.originalPosition&&(this.containment&&(this.relative_container?(d=this.relative_container.offset(),c=[this.containment[0]+d.left,this.containment[1]+d.top,this.containment[2]+d.left,this.containment[3]+d.top]):c=this.containment,b.pageX-this.offset.click.leftc[2]&&(i=c[2]+this.offset.click.left),b.pageY-this.offset.click.top>c[3]&&(j=c[3]+this.offset.click.top)),g.grid&&(e=g.grid[1]?this.originalPageY+Math.round((j-this.originalPageY)/g.grid[1])*g.grid[1]:this.originalPageY,j=c?e-this.offset.click.top>=c[1]||e-this.offset.click.top>c[3]?e:e-this.offset.click.top>=c[1]?e-g.grid[1]:e+g.grid[1]:e,f=g.grid[0]?this.originalPageX+Math.round((i-this.originalPageX)/g.grid[0])*g.grid[0]:this.originalPageX,i=c?f-this.offset.click.left>=c[0]||f-this.offset.click.left>c[2]?f:f-this.offset.click.left>=c[0]?f-g.grid[0]:f+g.grid[0]:f)),{top:j-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():this.offset.scroll.top),left:i-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():this.offset.scroll.left)}},_clear:function(){this.helper.removeClass("ui-draggable-dragging"),this.helper[0]===this.element[0]||this.cancelHelperRemoval||this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1},_trigger:function(b,c,d){return d=d||this._uiHash(),a.ui.plugin.call(this,b,[c,d]),"drag"===b&&(this.positionAbs=this._convertPositionTo("absolute")),a.Widget.prototype._trigger.call(this,b,c,d)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),a.ui.plugin.add("draggable","connectToSortable",{start:function(b,c){var d=a(this).data("ui-draggable"),e=d.options,f=a.extend({},c,{item:d.element});d.sortables=[],a(e.connectToSortable).each(function(){var c=a.data(this,"ui-sortable");c&&!c.options.disabled&&(d.sortables.push({instance:c,shouldRevert:c.options.revert}),c.refreshPositions(),c._trigger("activate",b,f))})},stop:function(b,c){var d=a(this).data("ui-draggable"),e=a.extend({},c,{item:d.element});a.each(d.sortables,function(){this.instance.isOver?(this.instance.isOver=0,d.cancelHelperRemoval=!0,this.instance.cancelHelperRemoval=!1,this.shouldRevert&&(this.instance.options.revert=this.shouldRevert),this.instance._mouseStop(b),this.instance.options.helper=this.instance.options._helper,"original"===d.options.helper&&this.instance.currentItem.css({top:"auto",left:"auto"})):(this.instance.cancelHelperRemoval=!1,this.instance._trigger("deactivate",b,e))})},drag:function(b,c){var d=a(this).data("ui-draggable"),e=this;a.each(d.sortables,function(){var f=!1,g=this;this.instance.positionAbs=d.positionAbs,this.instance.helperProportions=d.helperProportions,this.instance.offset.click=d.offset.click,this.instance._intersectsWith(this.instance.containerCache)&&(f=!0,a.each(d.sortables,function(){return this.instance.positionAbs=d.positionAbs,this.instance.helperProportions=d.helperProportions,this.instance.offset.click=d.offset.click,this!==g&&this.instance._intersectsWith(this.instance.containerCache)&&a.contains(g.instance.element[0],this.instance.element[0])&&(f=!1),f})),f?(this.instance.isOver||(this.instance.isOver=1,this.instance.currentItem=a(e).clone().removeAttr("id").appendTo(this.instance.element).data("ui-sortable-item",!0),this.instance.options._helper=this.instance.options.helper,this.instance.options.helper=function(){return c.helper[0]},b.target=this.instance.currentItem[0],this.instance._mouseCapture(b,!0),this.instance._mouseStart(b,!0,!0),this.instance.offset.click.top=d.offset.click.top,this.instance.offset.click.left=d.offset.click.left,this.instance.offset.parent.left-=d.offset.parent.left-this.instance.offset.parent.left,this.instance.offset.parent.top-=d.offset.parent.top-this.instance.offset.parent.top,d._trigger("toSortable",b),d.dropped=this.instance.element,d.currentItem=d.element,this.instance.fromOutside=d),this.instance.currentItem&&this.instance._mouseDrag(b)):this.instance.isOver&&(this.instance.isOver=0,this.instance.cancelHelperRemoval=!0,this.instance.options.revert=!1,this.instance._trigger("out",b,this.instance._uiHash(this.instance)),this.instance._mouseStop(b,!0),this.instance.options.helper=this.instance.options._helper,this.instance.currentItem.remove(),this.instance.placeholder&&this.instance.placeholder.remove(),d._trigger("fromSortable",b),d.dropped=!1)})}}),a.ui.plugin.add("draggable","cursor",{start:function(){var b=a("body"),c=a(this).data("ui-draggable").options;b.css("cursor")&&(c._cursor=b.css("cursor")),b.css("cursor",c.cursor)},stop:function(){var b=a(this).data("ui-draggable").options;b._cursor&&a("body").css("cursor",b._cursor)}}),a.ui.plugin.add("draggable","opacity",{start:function(b,c){var d=a(c.helper),e=a(this).data("ui-draggable").options;d.css("opacity")&&(e._opacity=d.css("opacity")),d.css("opacity",e.opacity)},stop:function(b,c){var d=a(this).data("ui-draggable").options;d._opacity&&a(c.helper).css("opacity",d._opacity)}}),a.ui.plugin.add("draggable","scroll",{start:function(){var b=a(this).data("ui-draggable");b.scrollParent[0]!==document&&"HTML"!==b.scrollParent[0].tagName&&(b.overflowOffset=b.scrollParent.offset())},drag:function(b){var c=a(this).data("ui-draggable"),d=c.options,e=!1;c.scrollParent[0]!==document&&"HTML"!==c.scrollParent[0].tagName?(d.axis&&"x"===d.axis||(c.overflowOffset.top+c.scrollParent[0].offsetHeight-b.pageY=0;l--)h=n.snapElements[l].left,i=h+n.snapElements[l].width,j=n.snapElements[l].top,k=j+n.snapElements[l].height,h-p>r||q>i+p||j-p>t||s>k+p||!a.contains(n.snapElements[l].item.ownerDocument,n.snapElements[l].item)?(n.snapElements[l].snapping&&n.options.snap.release&&n.options.snap.release.call(n.element,b,a.extend(n._uiHash(),{snapItem:n.snapElements[l].item})),n.snapElements[l].snapping=!1):("inner"!==o.snapMode&&(d=Math.abs(j-t)<=p,e=Math.abs(k-s)<=p,f=Math.abs(h-r)<=p,g=Math.abs(i-q)<=p,d&&(c.position.top=n._convertPositionTo("relative",{top:j-n.helperProportions.height,left:0}).top-n.margins.top),e&&(c.position.top=n._convertPositionTo("relative",{top:k,left:0}).top-n.margins.top),f&&(c.position.left=n._convertPositionTo("relative",{top:0,left:h-n.helperProportions.width}).left-n.margins.left),g&&(c.position.left=n._convertPositionTo("relative",{top:0,left:i}).left-n.margins.left)),m=d||e||f||g,"outer"!==o.snapMode&&(d=Math.abs(j-s)<=p,e=Math.abs(k-t)<=p,f=Math.abs(h-q)<=p,g=Math.abs(i-r)<=p,d&&(c.position.top=n._convertPositionTo("relative",{top:j,left:0}).top-n.margins.top),e&&(c.position.top=n._convertPositionTo("relative",{top:k-n.helperProportions.height,left:0}).top-n.margins.top),f&&(c.position.left=n._convertPositionTo("relative",{top:0,left:h}).left-n.margins.left),g&&(c.position.left=n._convertPositionTo("relative",{top:0,left:i-n.helperProportions.width}).left-n.margins.left)),!n.snapElements[l].snapping&&(d||e||f||g||m)&&n.options.snap.snap&&n.options.snap.snap.call(n.element,b,a.extend(n._uiHash(),{snapItem:n.snapElements[l].item})),n.snapElements[l].snapping=d||e||f||g||m)}}),a.ui.plugin.add("draggable","stack",{start:function(){var b,c=this.data("ui-draggable").options,d=a.makeArray(a(c.stack)).sort(function(b,c){return(parseInt(a(b).css("zIndex"),10)||0)-(parseInt(a(c).css("zIndex"),10)||0)});d.length&&(b=parseInt(a(d[0]).css("zIndex"),10)||0,a(d).each(function(c){a(this).css("zIndex",b+c)}),this.css("zIndex",b+d.length))}}),a.ui.plugin.add("draggable","zIndex",{start:function(b,c){var d=a(c.helper),e=a(this).data("ui-draggable").options;d.css("zIndex")&&(e._zIndex=d.css("zIndex")),d.css("zIndex",e.zIndex)},stop:function(b,c){var d=a(this).data("ui-draggable").options;d._zIndex&&a(c.helper).css("zIndex",d._zIndex)}})}(jQuery),function(a){function c(a,b,c){return a>b&&b+c>a}a.widget("ui.droppable",{version:"1.10.3",widgetEventPrefix:"drop",options:{accept:"*",activeClass:!1,addClasses:!0,greedy:!1,hoverClass:!1,scope:"default",tolerance:"intersect",activate:null,deactivate:null,drop:null,out:null,over:null},_create:function(){var b=this.options,c=b.accept; this.isover=!1,this.isout=!0,this.accept=a.isFunction(c)?c:function(a){return a.is(c)},this.proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight},a.ui.ddmanager.droppables[b.scope]=a.ui.ddmanager.droppables[b.scope]||[],a.ui.ddmanager.droppables[b.scope].push(this),b.addClasses&&this.element.addClass("ui-droppable")},_destroy:function(){for(var b=0,c=a.ui.ddmanager.droppables[this.options.scope];b=k&&l>=h&&i>=m&&n>=j;case"intersect":return k=m&&n>=i||j>=m&&n>=j||m>i&&j>n)&&(g>=k&&l>=g||h>=k&&l>=h||k>g&&h>l);default:return!1}},a.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(b,c){var d,e,f=a.ui.ddmanager.droppables[b.options.scope]||[],g=c?c.type:null,h=(b.currentItem||b.element).find(":data(ui-droppable)").addBack();a:for(d=0;d
").css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("ui-resizable",this.element.data("ui-resizable")),this.elementIsWrapper=!0,this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")}),this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0}),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css({margin:this.originalElement.css("margin")}),this._proportionallyResize()),this.handles=h.handles||(a(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se"),this.handles.constructor===String)for("all"===this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw"),b=this.handles.split(","),this.handles={},c=0;c"),e.css({zIndex:h.zIndex}),"se"===d&&e.addClass("ui-icon ui-icon-gripsmall-diagonal-se"),this.handles[d]=".ui-resizable-"+d,this.element.append(e);this._renderAxis=function(b){var c,d,e,f;b=b||this.element;for(c in this.handles)this.handles[c].constructor===String&&(this.handles[c]=a(this.handles[c],this.element).show()),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)&&(d=a(this.handles[c],this.element),f=/sw|ne|nw|se|n|s/.test(c)?d.outerHeight():d.outerWidth(),e=["padding",/ne|nw|n/.test(c)?"Top":/se|sw|s/.test(c)?"Bottom":/^e$/.test(c)?"Right":"Left"].join(""),b.css(e,f),this._proportionallyResize()),a(this.handles[c]).length},this._renderAxis(this.element),this._handles=a(".ui-resizable-handle",this.element).disableSelection(),this._handles.mouseover(function(){g.resizing||(this.className&&(e=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),g.axis=e&&e[1]?e[1]:"se")}),h.autoHide&&(this._handles.hide(),a(this.element).addClass("ui-resizable-autohide").mouseenter(function(){h.disabled||(a(this).removeClass("ui-resizable-autohide"),g._handles.show())}).mouseleave(function(){h.disabled||g.resizing||(a(this).addClass("ui-resizable-autohide"),g._handles.hide())})),this._mouseInit()},_destroy:function(){this._mouseDestroy();var b,c=function(b){a(b).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").removeData("ui-resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};return this.elementIsWrapper&&(c(this.element),b=this.element,this.originalElement.css({position:b.css("position"),width:b.outerWidth(),height:b.outerHeight(),top:b.css("top"),left:b.css("left")}).insertAfter(b),b.remove()),this.originalElement.css("resize",this.originalResizeStyle),c(this.originalElement),this},_mouseCapture:function(b){var c,d,e=!1;for(c in this.handles)d=a(this.handles[c])[0],(d===b.target||a.contains(d,b.target))&&(e=!0);return!this.options.disabled&&e},_mouseStart:function(b){var d,e,f,g=this.options,h=this.element.position(),i=this.element;return this.resizing=!0,/absolute/.test(i.css("position"))?i.css({position:"absolute",top:i.css("top"),left:i.css("left")}):i.is(".ui-draggable")&&i.css({position:"absolute",top:h.top,left:h.left}),this._renderProxy(),d=c(this.helper.css("left")),e=c(this.helper.css("top")),g.containment&&(d+=a(g.containment).scrollLeft()||0,e+=a(g.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:d,top:e},this.size=this._helper?{width:i.outerWidth(),height:i.outerHeight()}:{width:i.width(),height:i.height()},this.originalSize=this._helper?{width:i.outerWidth(),height:i.outerHeight()}:{width:i.width(),height:i.height()},this.originalPosition={left:d,top:e},this.sizeDiff={width:i.outerWidth()-i.width(),height:i.outerHeight()-i.height()},this.originalMousePosition={left:b.pageX,top:b.pageY},this.aspectRatio="number"==typeof g.aspectRatio?g.aspectRatio:this.originalSize.width/this.originalSize.height||1,f=a(".ui-resizable-"+this.axis).css("cursor"),a("body").css("cursor","auto"===f?this.axis+"-resize":f),i.addClass("ui-resizable-resizing"),this._propagate("start",b),!0},_mouseDrag:function(b){var c,d=this.helper,e={},f=this.originalMousePosition,g=this.axis,h=this.position.top,i=this.position.left,j=this.size.width,k=this.size.height,l=b.pageX-f.left||0,m=b.pageY-f.top||0,n=this._change[g];return n?(c=n.apply(this,[b,l,m]),this._updateVirtualBoundaries(b.shiftKey),(this._aspectRatio||b.shiftKey)&&(c=this._updateRatio(c,b)),c=this._respectSize(c,b),this._updateCache(c),this._propagate("resize",b),this.position.top!==h&&(e.top=this.position.top+"px"),this.position.left!==i&&(e.left=this.position.left+"px"),this.size.width!==j&&(e.width=this.size.width+"px"),this.size.height!==k&&(e.height=this.size.height+"px"),d.css(e),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),a.isEmptyObject(e)||this._trigger("resize",b,this.ui()),!1):!1},_mouseStop:function(b){this.resizing=!1;var c,d,e,f,g,h,i,j=this.options,k=this;return this._helper&&(c=this._proportionallyResizeElements,d=c.length&&/textarea/i.test(c[0].nodeName),e=d&&a.ui.hasScroll(c[0],"left")?0:k.sizeDiff.height,f=d?0:k.sizeDiff.width,g={width:k.helper.width()-f,height:k.helper.height()-e},h=parseInt(k.element.css("left"),10)+(k.position.left-k.originalPosition.left)||null,i=parseInt(k.element.css("top"),10)+(k.position.top-k.originalPosition.top)||null,j.animate||this.element.css(a.extend(g,{top:i,left:h})),k.helper.height(k.size.height),k.helper.width(k.size.width),this._helper&&!j.animate&&this._proportionallyResize()),a("body").css("cursor","auto"),this.element.removeClass("ui-resizable-resizing"),this._propagate("stop",b),this._helper&&this.helper.remove(),!1},_updateVirtualBoundaries:function(a){var b,c,e,f,g,h=this.options;g={minWidth:d(h.minWidth)?h.minWidth:0,maxWidth:d(h.maxWidth)?h.maxWidth:1/0,minHeight:d(h.minHeight)?h.minHeight:0,maxHeight:d(h.maxHeight)?h.maxHeight:1/0},(this._aspectRatio||a)&&(b=g.minHeight*this.aspectRatio,e=g.minWidth/this.aspectRatio,c=g.maxHeight*this.aspectRatio,f=g.maxWidth/this.aspectRatio,b>g.minWidth&&(g.minWidth=b),e>g.minHeight&&(g.minHeight=e),ca.width,h=d(a.height)&&b.minHeight&&b.minHeight>a.height,i=this.originalPosition.left+this.originalSize.width,j=this.position.top+this.size.height,k=/sw|nw|w/.test(c),l=/nw|ne|n/.test(c);return g&&(a.width=b.minWidth),h&&(a.height=b.minHeight),e&&(a.width=b.maxWidth),f&&(a.height=b.maxHeight),g&&k&&(a.left=i-b.minWidth),e&&k&&(a.left=i-b.maxWidth),h&&l&&(a.top=j-b.minHeight),f&&l&&(a.top=j-b.maxHeight),a.width||a.height||a.left||!a.top?a.width||a.height||a.top||!a.left||(a.left=null):a.top=null,a},_proportionallyResize:function(){if(this._proportionallyResizeElements.length){var a,b,c,d,e,f=this.helper||this.element;for(a=0;a"),this.helper.addClass(this._helper).css({width:this.element.outerWidth()-1,height:this.element.outerHeight()-1,position:"absolute",left:this.elementOffset.left+"px",top:this.elementOffset.top+"px",zIndex:++c.zIndex}),this.helper.appendTo("body").disableSelection()):this.helper=this.element},_change:{e:function(a,b){return{width:this.originalSize.width+b}},w:function(a,b){var c=this.originalSize,d=this.originalPosition;return{left:d.left+b,width:c.width-b}},n:function(a,b,c){var d=this.originalSize,e=this.originalPosition;return{top:e.top+c,height:d.height-c}},s:function(a,b,c){return{height:this.originalSize.height+c}},se:function(b,c,d){return a.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[b,c,d]))},sw:function(b,c,d){return a.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[b,c,d]))},ne:function(b,c,d){return a.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[b,c,d]))},nw:function(b,c,d){return a.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[b,c,d]))}},_propagate:function(b,c){a.ui.plugin.call(this,b,[c,this.ui()]),"resize"!==b&&this._trigger(b,c,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}),a.ui.plugin.add("resizable","animate",{stop:function(b){var c=a(this).data("ui-resizable"),d=c.options,e=c._proportionallyResizeElements,f=e.length&&/textarea/i.test(e[0].nodeName),g=f&&a.ui.hasScroll(e[0],"left")?0:c.sizeDiff.height,h=f?0:c.sizeDiff.width,i={width:c.size.width-h,height:c.size.height-g},j=parseInt(c.element.css("left"),10)+(c.position.left-c.originalPosition.left)||null,k=parseInt(c.element.css("top"),10)+(c.position.top-c.originalPosition.top)||null;c.element.animate(a.extend(i,k&&j?{top:k,left:j}:{}),{duration:d.animateDuration,easing:d.animateEasing,step:function(){var d={width:parseInt(c.element.css("width"),10),height:parseInt(c.element.css("height"),10),top:parseInt(c.element.css("top"),10),left:parseInt(c.element.css("left"),10)};e&&e.length&&a(e[0]).css({width:d.width,height:d.height}),c._updateCache(d),c._propagate("resize",b)}})}}),a.ui.plugin.add("resizable","containment",{start:function(){var b,d,e,f,g,h,i,j=a(this).data("ui-resizable"),k=j.options,l=j.element,m=k.containment,n=m instanceof a?m.get(0):/parent/.test(m)?l.parent().get(0):m;n&&(j.containerElement=a(n),/document/.test(m)||m===document?(j.containerOffset={left:0,top:0},j.containerPosition={left:0,top:0},j.parentData={element:a(document),left:0,top:0,width:a(document).width(),height:a(document).height()||document.body.parentNode.scrollHeight}):(b=a(n),d=[],a(["Top","Right","Left","Bottom"]).each(function(a,e){d[a]=c(b.css("padding"+e))}),j.containerOffset=b.offset(),j.containerPosition=b.position(),j.containerSize={height:b.innerHeight()-d[3],width:b.innerWidth()-d[1]},e=j.containerOffset,f=j.containerSize.height,g=j.containerSize.width,h=a.ui.hasScroll(n,"left")?n.scrollWidth:g,i=a.ui.hasScroll(n)?n.scrollHeight:f,j.parentData={element:n,left:e.left,top:e.top,width:h,height:i}))},resize:function(b){var c,d,e,f,g=a(this).data("ui-resizable"),h=g.options,i=g.containerOffset,j=g.position,k=g._aspectRatio||b.shiftKey,l={top:0,left:0},m=g.containerElement;m[0]!==document&&/static/.test(m.css("position"))&&(l=i),j.left<(g._helper?i.left:0)&&(g.size.width=g.size.width+(g._helper?g.position.left-i.left:g.position.left-l.left),k&&(g.size.height=g.size.width/g.aspectRatio),g.position.left=h.helper?i.left:0),j.top<(g._helper?i.top:0)&&(g.size.height=g.size.height+(g._helper?g.position.top-i.top:g.position.top),k&&(g.size.width=g.size.height*g.aspectRatio),g.position.top=g._helper?i.top:0),g.offset.left=g.parentData.left+g.position.left,g.offset.top=g.parentData.top+g.position.top,c=Math.abs((g._helper?g.offset.left-l.left:g.offset.left-l.left)+g.sizeDiff.width),d=Math.abs((g._helper?g.offset.top-l.top:g.offset.top-i.top)+g.sizeDiff.height),e=g.containerElement.get(0)===g.element.parent().get(0),f=/relative|absolute/.test(g.containerElement.css("position")),e&&f&&(c-=g.parentData.left),c+g.size.width>=g.parentData.width&&(g.size.width=g.parentData.width-c,k&&(g.size.height=g.size.width/g.aspectRatio)),d+g.size.height>=g.parentData.height&&(g.size.height=g.parentData.height-d,k&&(g.size.width=g.size.height*g.aspectRatio))},stop:function(){var b=a(this).data("ui-resizable"),c=b.options,d=b.containerOffset,e=b.containerPosition,f=b.containerElement,g=a(b.helper),h=g.offset(),i=g.outerWidth()-b.sizeDiff.width,j=g.outerHeight()-b.sizeDiff.height;b._helper&&!c.animate&&/relative/.test(f.css("position"))&&a(this).css({left:h.left-e.left-d.left,width:i,height:j}),b._helper&&!c.animate&&/static/.test(f.css("position"))&&a(this).css({left:h.left-e.left-d.left,width:i,height:j})}}),a.ui.plugin.add("resizable","alsoResize",{start:function(){var b=a(this).data("ui-resizable"),c=b.options,d=function(b){a(b).each(function(){var b=a(this);b.data("ui-resizable-alsoresize",{width:parseInt(b.width(),10),height:parseInt(b.height(),10),left:parseInt(b.css("left"),10),top:parseInt(b.css("top"),10)})})};"object"!=typeof c.alsoResize||c.alsoResize.parentNode?d(c.alsoResize):c.alsoResize.length?(c.alsoResize=c.alsoResize[0],d(c.alsoResize)):a.each(c.alsoResize,function(a){d(a)})},resize:function(b,c){var d=a(this).data("ui-resizable"),e=d.options,f=d.originalSize,g=d.originalPosition,h={height:d.size.height-f.height||0,width:d.size.width-f.width||0,top:d.position.top-g.top||0,left:d.position.left-g.left||0},i=function(b,d){a(b).each(function(){var b=a(this),e=a(this).data("ui-resizable-alsoresize"),f={},g=d&&d.length?d:b.parents(c.originalElement[0]).length?["width","height"]:["width","height","top","left"];a.each(g,function(a,b){var c=(e[b]||0)+(h[b]||0);c&&c>=0&&(f[b]=c||null)}),b.css(f)})};"object"!=typeof e.alsoResize||e.alsoResize.nodeType?i(e.alsoResize):a.each(e.alsoResize,function(a,b){i(a,b)})},stop:function(){a(this).removeData("resizable-alsoresize")}}),a.ui.plugin.add("resizable","ghost",{start:function(){var b=a(this).data("ui-resizable"),c=b.options,d=b.size;b.ghost=b.originalElement.clone(),b.ghost.css({opacity:.25,display:"block",position:"relative",height:d.height,width:d.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass("string"==typeof c.ghost?c.ghost:""),b.ghost.appendTo(b.helper)},resize:function(){var b=a(this).data("ui-resizable");b.ghost&&b.ghost.css({position:"relative",height:b.size.height,width:b.size.width})},stop:function(){var b=a(this).data("ui-resizable");b.ghost&&b.helper&&b.helper.get(0).removeChild(b.ghost.get(0))}}),a.ui.plugin.add("resizable","grid",{resize:function(){var b=a(this).data("ui-resizable"),c=b.options,d=b.size,e=b.originalSize,f=b.originalPosition,g=b.axis,h="number"==typeof c.grid?[c.grid,c.grid]:c.grid,i=h[0]||1,j=h[1]||1,k=Math.round((d.width-e.width)/i)*i,l=Math.round((d.height-e.height)/j)*j,m=e.width+k,n=e.height+l,o=c.maxWidth&&c.maxWidthm,r=c.minHeight&&c.minHeight>n;c.grid=h,q&&(m+=i),r&&(n+=j),o&&(m-=i),p&&(n-=j),/^(se|s|e)$/.test(g)?(b.size.width=m,b.size.height=n):/^(ne)$/.test(g)?(b.size.width=m,b.size.height=n,b.position.top=f.top-l):/^(sw)$/.test(g)?(b.size.width=m,b.size.height=n,b.position.left=f.left-k):(b.size.width=m,b.size.height=n,b.position.top=f.top-l,b.position.left=f.left-k)}})}(jQuery),function(a){a.widget("ui.selectable",a.ui.mouse,{version:"1.10.3",options:{appendTo:"body",autoRefresh:!0,distance:0,filter:"*",tolerance:"touch",selected:null,selecting:null,start:null,stop:null,unselected:null,unselecting:null},_create:function(){var b,c=this;this.element.addClass("ui-selectable"),this.dragged=!1,this.refresh=function(){b=a(c.options.filter,c.element[0]),b.addClass("ui-selectee"),b.each(function(){var b=a(this),c=b.offset();a.data(this,"selectable-item",{element:this,$element:b,left:c.left,top:c.top,right:c.left+b.outerWidth(),bottom:c.top+b.outerHeight(),startselected:!1,selected:b.hasClass("ui-selected"),selecting:b.hasClass("ui-selecting"),unselecting:b.hasClass("ui-unselecting")})})},this.refresh(),this.selectees=b.addClass("ui-selectee"),this._mouseInit(),this.helper=a("
")},_destroy:function(){this.selectees.removeClass("ui-selectee").removeData("selectable-item"),this.element.removeClass("ui-selectable ui-selectable-disabled"),this._mouseDestroy()},_mouseStart:function(b){var c=this,d=this.options;this.opos=[b.pageX,b.pageY],this.options.disabled||(this.selectees=a(d.filter,this.element[0]),this._trigger("start",b),a(d.appendTo).append(this.helper),this.helper.css({left:b.pageX,top:b.pageY,width:0,height:0}),d.autoRefresh&&this.refresh(),this.selectees.filter(".ui-selected").each(function(){var d=a.data(this,"selectable-item");d.startselected=!0,b.metaKey||b.ctrlKey||(d.$element.removeClass("ui-selected"),d.selected=!1,d.$element.addClass("ui-unselecting"),d.unselecting=!0,c._trigger("unselecting",b,{unselecting:d.element}))}),a(b.target).parents().addBack().each(function(){var d,e=a.data(this,"selectable-item");return e?(d=!b.metaKey&&!b.ctrlKey||!e.$element.hasClass("ui-selected"),e.$element.removeClass(d?"ui-unselecting":"ui-selected").addClass(d?"ui-selecting":"ui-unselecting"),e.unselecting=!d,e.selecting=d,e.selected=d,d?c._trigger("selecting",b,{selecting:e.element}):c._trigger("unselecting",b,{unselecting:e.element}),!1):void 0}))},_mouseDrag:function(b){if(this.dragged=!0,!this.options.disabled){var c,d=this,e=this.options,f=this.opos[0],g=this.opos[1],h=b.pageX,i=b.pageY;return f>h&&(c=h,h=f,f=c),g>i&&(c=i,i=g,g=c),this.helper.css({left:f,top:g,width:h-f,height:i-g}),this.selectees.each(function(){var c=a.data(this,"selectable-item"),j=!1;c&&c.element!==d.element[0]&&("touch"===e.tolerance?j=!(c.left>h||c.righti||c.bottomf&&c.rightg&&c.bottomb&&b+c>a}function d(a){return/left|right/.test(a.css("float"))||/inline|table-cell/.test(a.css("display"))}a.widget("ui.sortable",a.ui.mouse,{version:"1.10.3",widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3,activate:null,beforeStop:null,change:null,deactivate:null,out:null,over:null,receive:null,remove:null,sort:null,start:null,stop:null,update:null},_create:function(){var a=this.options;this.containerCache={},this.element.addClass("ui-sortable"),this.refresh(),this.floating=this.items.length?"x"===a.axis||d(this.items[0].item):!1,this.offset=this.element.offset(),this._mouseInit(),this.ready=!0},_destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled"),this._mouseDestroy();for(var a=this.items.length-1;a>=0;a--)this.items[a].item.removeData(this.widgetName+"-item");return this},_setOption:function(b,c){"disabled"===b?(this.options[b]=c,this.widget().toggleClass("ui-sortable-disabled",!!c)):a.Widget.prototype._setOption.apply(this,arguments)},_mouseCapture:function(b,c){var d=null,e=!1,f=this;return this.reverting?!1:this.options.disabled||"static"===this.options.type?!1:(this._refreshItems(b),a(b.target).parents().each(function(){return a.data(this,f.widgetName+"-item")===f?(d=a(this),!1):void 0}),a.data(b.target,f.widgetName+"-item")===f&&(d=a(b.target)),d?!this.options.handle||c||(a(this.options.handle,d).find("*").addBack().each(function(){this===b.target&&(e=!0)}),e)?(this.currentItem=d,this._removeCurrentsFromItems(),!0):!1:!1)},_mouseStart:function(b,c,d){var e,f,g=this.options;if(this.currentContainer=this,this.refreshPositions(),this.helper=this._createHelper(b),this._cacheHelperProportions(),this._cacheMargins(),this.scrollParent=this.helper.scrollParent(),this.offset=this.currentItem.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},a.extend(this.offset,{click:{left:b.pageX-this.offset.left,top:b.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),this.originalPosition=this._generatePosition(b),this.originalPageX=b.pageX,this.originalPageY=b.pageY,g.cursorAt&&this._adjustOffsetFromHelper(g.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!==this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),g.containment&&this._setContainment(),g.cursor&&"auto"!==g.cursor&&(f=this.document.find("body"),this.storedCursor=f.css("cursor"),f.css("cursor",g.cursor),this.storedStylesheet=a("").appendTo(f)),g.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",g.opacity)),g.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",g.zIndex)),this.scrollParent[0]!==document&&"HTML"!==this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",b,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions(),!d)for(e=this.containers.length-1;e>=0;e--)this.containers[e]._trigger("activate",b,this._uiHash(this));return a.ui.ddmanager&&(a.ui.ddmanager.current=this),a.ui.ddmanager&&!g.dropBehaviour&&a.ui.ddmanager.prepareOffsets(this,b),this.dragging=!0,this.helper.addClass("ui-sortable-helper"),this._mouseDrag(b),!0},_mouseDrag:function(b){var c,d,e,f,g=this.options,h=!1;for(this.position=this._generatePosition(b),this.positionAbs=this._convertPositionTo("absolute"),this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs),this.options.scroll&&(this.scrollParent[0]!==document&&"HTML"!==this.scrollParent[0].tagName?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-b.pageY=0;c--)if(d=this.items[c],e=d.item[0],f=this._intersectsWithPointer(d),f&&d.instance===this.currentContainer&&e!==this.currentItem[0]&&this.placeholder[1===f?"next":"prev"]()[0]!==e&&!a.contains(this.placeholder[0],e)&&("semi-dynamic"===this.options.type?!a.contains(this.element[0],e):!0)){if(this.direction=1===f?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(d))break; this._rearrange(b,d),this._trigger("change",b,this._uiHash());break}return this._contactContainers(b),a.ui.ddmanager&&a.ui.ddmanager.drag(this,b),this._trigger("sort",b,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(b,c){if(b){if(a.ui.ddmanager&&!this.options.dropBehaviour&&a.ui.ddmanager.drop(this,b),this.options.revert){var d=this,e=this.placeholder.offset(),f=this.options.axis,g={};f&&"x"!==f||(g.left=e.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]===document.body?0:this.offsetParent[0].scrollLeft)),f&&"y"!==f||(g.top=e.top-this.offset.parent.top-this.margins.top+(this.offsetParent[0]===document.body?0:this.offsetParent[0].scrollTop)),this.reverting=!0,a(this.helper).animate(g,parseInt(this.options.revert,10)||500,function(){d._clear(b)})}else this._clear(b,c);return!1}},cancel:function(){if(this.dragging){this._mouseUp({target:null}),"original"===this.options.helper?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"):this.currentItem.show();for(var b=this.containers.length-1;b>=0;b--)this.containers[b]._trigger("deactivate",null,this._uiHash(this)),this.containers[b].containerCache.over&&(this.containers[b]._trigger("out",null,this._uiHash(this)),this.containers[b].containerCache.over=0)}return this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),"original"!==this.options.helper&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),a.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?a(this.domPosition.prev).after(this.currentItem):a(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(b){var c=this._getItemsAsjQuery(b&&b.connected),d=[];return b=b||{},a(c).each(function(){var c=(a(b.item||this).attr(b.attribute||"id")||"").match(b.expression||/(.+)[\-=_](.+)/);c&&d.push((b.key||c[1]+"[]")+"="+(b.key&&b.expression?c[1]:c[2]))}),!d.length&&b.key&&d.push(b.key+"="),d.join("&")},toArray:function(b){var c=this._getItemsAsjQuery(b&&b.connected),d=[];return b=b||{},c.each(function(){d.push(a(b.item||this).attr(b.attribute||"id")||"")}),d},_intersectsWith:function(a){var b=this.positionAbs.left,c=b+this.helperProportions.width,d=this.positionAbs.top,e=d+this.helperProportions.height,f=a.left,g=f+a.width,h=a.top,i=h+a.height,j=this.offset.click.top,k=this.offset.click.left,l="x"===this.options.axis||d+j>h&&i>d+j,m="y"===this.options.axis||b+k>f&&g>b+k,n=l&&m;return"pointer"===this.options.tolerance||this.options.forcePointerForContainers||"pointer"!==this.options.tolerance&&this.helperProportions[this.floating?"width":"height"]>a[this.floating?"width":"height"]?n:f0?"down":"up")},_getDragHorizontalDirection:function(){var a=this.positionAbs.left-this.lastPositionAbs.left;return 0!==a&&(a>0?"right":"left")},refresh:function(a){return this._refreshItems(a),this.refreshPositions(),this},_connectWith:function(){var a=this.options;return a.connectWith.constructor===String?[a.connectWith]:a.connectWith},_getItemsAsjQuery:function(b){var c,d,e,f,g=[],h=[],i=this._connectWith();if(i&&b)for(c=i.length-1;c>=0;c--)for(e=a(i[c]),d=e.length-1;d>=0;d--)f=a.data(e[d],this.widgetFullName),f&&f!==this&&!f.options.disabled&&h.push([a.isFunction(f.options.items)?f.options.items.call(f.element):a(f.options.items,f.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),f]);for(h.push([a.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):a(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]),c=h.length-1;c>=0;c--)h[c][0].each(function(){g.push(this)});return a(g)},_removeCurrentsFromItems:function(){var b=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=a.grep(this.items,function(a){for(var c=0;c=0;c--)for(e=a(m[c]),d=e.length-1;d>=0;d--)f=a.data(e[d],this.widgetFullName),f&&f!==this&&!f.options.disabled&&(l.push([a.isFunction(f.options.items)?f.options.items.call(f.element[0],b,{item:this.currentItem}):a(f.options.items,f.element),f]),this.containers.push(f));for(c=l.length-1;c>=0;c--)for(g=l[c][1],h=l[c][0],d=0,j=h.length;j>d;d++)i=a(h[d]),i.data(this.widgetName+"-item",g),k.push({item:i,instance:g,width:0,height:0,left:0,top:0})},refreshPositions:function(b){this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset());var c,d,e,f;for(c=this.items.length-1;c>=0;c--)d=this.items[c],d.instance!==this.currentContainer&&this.currentContainer&&d.item[0]!==this.currentItem[0]||(e=this.options.toleranceElement?a(this.options.toleranceElement,d.item):d.item,b||(d.width=e.outerWidth(),d.height=e.outerHeight()),f=e.offset(),d.left=f.left,d.top=f.top);if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(c=this.containers.length-1;c>=0;c--)f=this.containers[c].element.offset(),this.containers[c].containerCache.left=f.left,this.containers[c].containerCache.top=f.top,this.containers[c].containerCache.width=this.containers[c].element.outerWidth(),this.containers[c].containerCache.height=this.containers[c].element.outerHeight();return this},_createPlaceholder:function(b){b=b||this;var c,d=b.options;d.placeholder&&d.placeholder.constructor!==String||(c=d.placeholder,d.placeholder={element:function(){var d=b.currentItem[0].nodeName.toLowerCase(),e=a("<"+d+">",b.document[0]).addClass(c||b.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper");return"tr"===d?b.currentItem.children().each(function(){a(" ",b.document[0]).attr("colspan",a(this).attr("colspan")||1).appendTo(e)}):"img"===d&&e.attr("src",b.currentItem.attr("src")),c||e.css("visibility","hidden"),e},update:function(a,e){(!c||d.forcePlaceholderSize)&&(e.height()||e.height(b.currentItem.innerHeight()-parseInt(b.currentItem.css("paddingTop")||0,10)-parseInt(b.currentItem.css("paddingBottom")||0,10)),e.width()||e.width(b.currentItem.innerWidth()-parseInt(b.currentItem.css("paddingLeft")||0,10)-parseInt(b.currentItem.css("paddingRight")||0,10)))}}),b.placeholder=a(d.placeholder.element.call(b.element,b.currentItem)),b.currentItem.after(b.placeholder),d.placeholder.update(b,b.placeholder)},_contactContainers:function(b){var e,f,g,h,i,j,k,l,m,n,o=null,p=null;for(e=this.containers.length-1;e>=0;e--)if(!a.contains(this.currentItem[0],this.containers[e].element[0]))if(this._intersectsWith(this.containers[e].containerCache)){if(o&&a.contains(this.containers[e].element[0],o.element[0]))continue;o=this.containers[e],p=e}else this.containers[e].containerCache.over&&(this.containers[e]._trigger("out",b,this._uiHash(this)),this.containers[e].containerCache.over=0);if(o)if(1===this.containers.length)this.containers[p].containerCache.over||(this.containers[p]._trigger("over",b,this._uiHash(this)),this.containers[p].containerCache.over=1);else{for(g=1e4,h=null,n=o.floating||d(this.currentItem),i=n?"left":"top",j=n?"width":"height",k=this.positionAbs[i]+this.offset.click[i],f=this.items.length-1;f>=0;f--)a.contains(this.containers[p].element[0],this.items[f].item[0])&&this.items[f].item[0]!==this.currentItem[0]&&(!n||c(this.positionAbs.top+this.offset.click.top,this.items[f].top,this.items[f].height))&&(l=this.items[f].item.offset()[i],m=!1,Math.abs(l-k)>Math.abs(l+this.items[f][j]-k)&&(m=!0,l+=this.items[f][j]),Math.abs(l-k)this.containment[2]&&(f=this.containment[2]+this.offset.click.left),b.pageY-this.offset.click.top>this.containment[3]&&(g=this.containment[3]+this.offset.click.top)),e.grid&&(c=this.originalPageY+Math.round((g-this.originalPageY)/e.grid[1])*e.grid[1],g=this.containment?c-this.offset.click.top>=this.containment[1]&&c-this.offset.click.top<=this.containment[3]?c:c-this.offset.click.top>=this.containment[1]?c-e.grid[1]:c+e.grid[1]:c,d=this.originalPageX+Math.round((f-this.originalPageX)/e.grid[0])*e.grid[0],f=this.containment?d-this.offset.click.left>=this.containment[0]&&d-this.offset.click.left<=this.containment[2]?d:d-this.offset.click.left>=this.containment[0]?d-e.grid[0]:d+e.grid[0]:d)),{top:g-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():i?0:h.scrollTop()),left:f-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():i?0:h.scrollLeft())}},_rearrange:function(a,b,c,d){c?c[0].appendChild(this.placeholder[0]):b.item[0].parentNode.insertBefore(this.placeholder[0],"down"===this.direction?b.item[0]:b.item[0].nextSibling),this.counter=this.counter?++this.counter:1;var e=this.counter;this._delay(function(){e===this.counter&&this.refreshPositions(!d)})},_clear:function(a,b){this.reverting=!1;var c,d=[];if(!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem),this._noFinalSort=null,this.helper[0]===this.currentItem[0]){for(c in this._storedCSS)("auto"===this._storedCSS[c]||"static"===this._storedCSS[c])&&(this._storedCSS[c]="");this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else this.currentItem.show();for(this.fromOutside&&!b&&d.push(function(a){this._trigger("receive",a,this._uiHash(this.fromOutside))}),!this.fromOutside&&this.domPosition.prev===this.currentItem.prev().not(".ui-sortable-helper")[0]&&this.domPosition.parent===this.currentItem.parent()[0]||b||d.push(function(a){this._trigger("update",a,this._uiHash())}),this!==this.currentContainer&&(b||(d.push(function(a){this._trigger("remove",a,this._uiHash())}),d.push(function(a){return function(b){a._trigger("receive",b,this._uiHash(this))}}.call(this,this.currentContainer)),d.push(function(a){return function(b){a._trigger("update",b,this._uiHash(this))}}.call(this,this.currentContainer)))),c=this.containers.length-1;c>=0;c--)b||d.push(function(a){return function(b){a._trigger("deactivate",b,this._uiHash(this))}}.call(this,this.containers[c])),this.containers[c].containerCache.over&&(d.push(function(a){return function(b){a._trigger("out",b,this._uiHash(this))}}.call(this,this.containers[c])),this.containers[c].containerCache.over=0);if(this.storedCursor&&(this.document.find("body").css("cursor",this.storedCursor),this.storedStylesheet.remove()),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex","auto"===this._storedZIndex?"":this._storedZIndex),this.dragging=!1,this.cancelHelperRemoval){if(!b){for(this._trigger("beforeStop",a,this._uiHash()),c=0;ca?0:d.max6*c?a+6*(b-a)*c:1>2*c?b:2>3*c?a+6*(b-a)*(2/3-c):a}var k,c="backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",d=/^([\-+])=\s*(\d+\.?\d*)/,e=[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(a){return[a[1],a[2],a[3],a[4]]}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(a){return[2.55*a[1],2.55*a[2],2.55*a[3],a[4]]}},{re:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,parse:function(a){return[parseInt(a[1],16),parseInt(a[2],16),parseInt(a[3],16)]}},{re:/#([a-f0-9])([a-f0-9])([a-f0-9])/,parse:function(a){return[parseInt(a[1]+a[1],16),parseInt(a[2]+a[2],16),parseInt(a[3]+a[3],16)]}},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,space:"hsla",parse:function(a){return[a[1],a[2]/100,a[3]/100,a[4]]}}],f=a.Color=function(b,c,d,e){return new a.Color.fn.parse(b,c,d,e)},g={rgba:{props:{red:{idx:0,type:"byte"},green:{idx:1,type:"byte"},blue:{idx:2,type:"byte"}}},hsla:{props:{hue:{idx:0,type:"degrees"},saturation:{idx:1,type:"percent"},lightness:{idx:2,type:"percent"}}}},h={"byte":{floor:!0,max:255},percent:{max:1},degrees:{mod:360,floor:!0}},i=f.support={},j=a("

")[0],l=a.each;j.style.cssText="background-color:rgba(1,1,1,.5)",i.rgba=j.style.backgroundColor.indexOf("rgba")>-1,l(g,function(a,b){b.cache="_"+a,b.props.alpha={idx:3,type:"percent",def:1}}),f.fn=a.extend(f.prototype,{parse:function(c,d,e,h){if(c===b)return this._rgba=[null,null,null,null],this;(c.jquery||c.nodeType)&&(c=a(c).css(d),d=b);var i=this,j=a.type(c),o=this._rgba=[];return d!==b&&(c=[c,d,e,h],j="array"),"string"===j?this.parse(n(c)||k._default):"array"===j?(l(g.rgba.props,function(a,b){o[b.idx]=m(c[b.idx],b)}),this):"object"===j?(c instanceof f?l(g,function(a,b){c[b.cache]&&(i[b.cache]=c[b.cache].slice())}):l(g,function(b,d){var e=d.cache;l(d.props,function(a,b){if(!i[e]&&d.to){if("alpha"===a||null==c[a])return;i[e]=d.to(i._rgba)}i[e][b.idx]=m(c[a],b,!0)}),i[e]&&a.inArray(null,i[e].slice(0,3))<0&&(i[e][3]=1,d.from&&(i._rgba=d.from(i[e])))}),this):void 0},is:function(a){var b=f(a),c=!0,d=this;return l(g,function(a,e){var f,g=b[e.cache];return g&&(f=d[e.cache]||e.to&&e.to(d._rgba)||[],l(e.props,function(a,b){return null!=g[b.idx]?c=g[b.idx]===f[b.idx]:void 0})),c}),c},_space:function(){var a=[],b=this;return l(g,function(c,d){b[d.cache]&&a.push(c)}),a.pop()},transition:function(a,b){var c=f(a),d=c._space(),e=g[d],i=0===this.alpha()?f("transparent"):this,j=i[e.cache]||e.to(i._rgba),k=j.slice();return c=c[e.cache],l(e.props,function(a,d){var e=d.idx,f=j[e],g=c[e],i=h[d.type]||{};null!==g&&(null===f?k[e]=g:(i.mod&&(g-f>i.mod/2?f+=i.mod:f-g>i.mod/2&&(f-=i.mod)),k[e]=m((g-f)*b+f,d)))}),this[d](k)},blend:function(b){if(1===this._rgba[3])return this;var c=this._rgba.slice(),d=c.pop(),e=f(b)._rgba;return f(a.map(c,function(a,b){return(1-d)*e[b]+d*a}))},toRgbaString:function(){var b="rgba(",c=a.map(this._rgba,function(a,b){return null==a?b>2?1:0:a});return 1===c[3]&&(c.pop(),b="rgb("),b+c.join()+")"},toHslaString:function(){var b="hsla(",c=a.map(this.hsla(),function(a,b){return null==a&&(a=b>2?1:0),b&&3>b&&(a=Math.round(100*a)+"%"),a});return 1===c[3]&&(c.pop(),b="hsl("),b+c.join()+")"},toHexString:function(b){var c=this._rgba.slice(),d=c.pop();return b&&c.push(~~(255*d)),"#"+a.map(c,function(a){return a=(a||0).toString(16),1===a.length?"0"+a:a}).join("")},toString:function(){return 0===this._rgba[3]?"transparent":this.toRgbaString()}}),f.fn.parse.prototype=f.fn,g.hsla.to=function(a){if(null==a[0]||null==a[1]||null==a[2])return[null,null,null,a[3]];var k,l,b=a[0]/255,c=a[1]/255,d=a[2]/255,e=a[3],f=Math.max(b,c,d),g=Math.min(b,c,d),h=f-g,i=f+g,j=.5*i;return k=g===f?0:b===f?60*(c-d)/h+360:c===f?60*(d-b)/h+120:60*(b-c)/h+240,l=0===h?0:.5>=j?h/i:h/(2-i),[Math.round(k)%360,l,j,null==e?1:e]},g.hsla.from=function(a){if(null==a[0]||null==a[1]||null==a[2])return[null,null,null,a[3]];var b=a[0]/360,c=a[1],d=a[2],e=a[3],f=.5>=d?d*(1+c):d+c-d*c,g=2*d-f;return[Math.round(255*o(g,f,b+1/3)),Math.round(255*o(g,f,b)),Math.round(255*o(g,f,b-1/3)),e]},l(g,function(c,e){var g=e.props,h=e.cache,i=e.to,j=e.from;f.fn[c]=function(c){if(i&&!this[h]&&(this[h]=i(this._rgba)),c===b)return this[h].slice();var d,e=a.type(c),k="array"===e||"object"===e?c:arguments,n=this[h].slice();return l(g,function(a,b){var c=k["object"===e?a:b.idx];null==c&&(c=n[b.idx]),n[b.idx]=m(c,b)}),j?(d=f(j(n)),d[h]=n,d):f(n)},l(g,function(b,e){f.fn[b]||(f.fn[b]=function(f){var k,g=a.type(f),h="alpha"===b?this._hsla?"hsla":"rgba":c,i=this[h](),j=i[e.idx];return"undefined"===g?j:("function"===g&&(f=f.call(this,j),g=a.type(f)),null==f&&e.empty?this:("string"===g&&(k=d.exec(f),k&&(f=j+parseFloat(k[2])*("+"===k[1]?1:-1))),i[e.idx]=f,this[h](i)))})})}),f.hook=function(b){var c=b.split(" ");l(c,function(b,c){a.cssHooks[c]={set:function(b,d){var e,g,h="";if("transparent"!==d&&("string"!==a.type(d)||(e=n(d)))){if(d=f(e||d),!i.rgba&&1!==d._rgba[3]){for(g="backgroundColor"===c?b.parentNode:b;(""===h||"transparent"===h)&&g&&g.style;)try{h=a.css(g,"backgroundColor"),g=g.parentNode}catch(j){}d=d.blend(h&&"transparent"!==h?h:"_default")}d=d.toRgbaString()}try{b.style[c]=d}catch(j){}}},a.fx.step[c]=function(b){b.colorInit||(b.start=f(b.elem,c),b.end=f(b.end),b.colorInit=!0),a.cssHooks[c].set(b.elem,b.start.transition(b.end,b.pos))}})},f.hook(c),a.cssHooks.borderColor={expand:function(a){var b={};return l(["Top","Right","Bottom","Left"],function(c,d){b["border"+d+"Color"]=a}),b}},k=a.Color.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00",transparent:[null,null,null,0],_default:"#ffffff"}}(jQuery),function(){function e(b){var c,d,e=b.ownerDocument.defaultView?b.ownerDocument.defaultView.getComputedStyle(b,null):b.currentStyle,f={};if(e&&e.length&&e[0]&&e[e[0]])for(d=e.length;d--;)c=e[d],"string"==typeof e[c]&&(f[a.camelCase(c)]=e[c]);else for(c in e)"string"==typeof e[c]&&(f[c]=e[c]);return f}function f(b,c){var f,g,e={};for(f in c)g=c[f],b[f]!==g&&(d[f]||(a.fx.step[f]||!isNaN(parseFloat(g)))&&(e[f]=g));return e}var c=["add","remove","toggle"],d={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};a.each(["borderLeftStyle","borderRightStyle","borderBottomStyle","borderTopStyle"],function(b,c){a.fx.step[c]=function(a){("none"!==a.end&&!a.setAttr||1===a.pos&&!a.setAttr)&&(jQuery.style(a.elem,c,a.end),a.setAttr=!0)}}),a.fn.addBack||(a.fn.addBack=function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}),a.effects.animateClass=function(b,d,g,h){var i=a.speed(d,g,h);return this.queue(function(){var h,d=a(this),g=d.attr("class")||"",j=i.children?d.find("*").addBack():d;j=j.map(function(){var b=a(this);return{el:b,start:e(this)}}),h=function(){a.each(c,function(a,c){b[c]&&d[c+"Class"](b[c])})},h(),j=j.map(function(){return this.end=e(this.el[0]),this.diff=f(this.start,this.end),this}),d.attr("class",g),j=j.map(function(){var b=this,c=a.Deferred(),d=a.extend({},i,{queue:!1,complete:function(){c.resolve(b)}});return this.el.animate(this.diff,d),c.promise()}),a.when.apply(a,j.get()).done(function(){h(),a.each(arguments,function(){var b=this.el;a.each(this.diff,function(a){b.css(a,"")})}),i.complete.call(d[0])})})},a.fn.extend({addClass:function(b){return function(c,d,e,f){return d?a.effects.animateClass.call(this,{add:c},d,e,f):b.apply(this,arguments)}}(a.fn.addClass),removeClass:function(b){return function(c,d,e,f){return arguments.length>1?a.effects.animateClass.call(this,{remove:c},d,e,f):b.apply(this,arguments)}}(a.fn.removeClass),toggleClass:function(c){return function(d,e,f,g,h){return"boolean"==typeof e||e===b?f?a.effects.animateClass.call(this,e?{add:d}:{remove:d},f,g,h):c.apply(this,arguments):a.effects.animateClass.call(this,{toggle:d},e,f,g)}}(a.fn.toggleClass),switchClass:function(b,c,d,e,f){return a.effects.animateClass.call(this,{add:c,remove:b},d,e,f)}})}(),function(){function d(b,c,d,e){return a.isPlainObject(b)&&(c=b,b=b.effect),b={effect:b},null==c&&(c={}),a.isFunction(c)&&(e=c,d=null,c={}),("number"==typeof c||a.fx.speeds[c])&&(e=d,d=c,c={}),a.isFunction(d)&&(e=d,d=null),c&&a.extend(b,c),d=d||c.duration,b.duration=a.fx.off?0:"number"==typeof d?d:d in a.fx.speeds?a.fx.speeds[d]:a.fx.speeds._default,b.complete=e||c.complete,b}function e(b){return!b||"number"==typeof b||a.fx.speeds[b]?!0:"string"!=typeof b||a.effects.effect[b]?a.isFunction(b)?!0:"object"!=typeof b||b.effect?!1:!0:!0}a.extend(a.effects,{version:"1.10.3",save:function(a,b){for(var d=0;d").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),e={width:b.width(),height:b.height()},f=document.activeElement;try{f.id}catch(g){f=document.body}return b.wrap(d),(b[0]===f||a.contains(b[0],f))&&a(f).focus(),d=b.parent(),"static"===b.css("position")?(d.css({position:"relative"}),b.css({position:"relative"})):(a.extend(c,{position:b.css("position"),zIndex:b.css("z-index")}),a.each(["top","left","bottom","right"],function(a,d){c[d]=b.css(d),isNaN(parseInt(c[d],10))&&(c[d]="auto")}),b.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),b.css(e),d.css(c).show()},removeWrapper:function(b){var c=document.activeElement;return b.parent().is(".ui-effects-wrapper")&&(b.parent().replaceWith(b),(b[0]===c||a.contains(b[0],c))&&a(c).focus()),b},setTransition:function(b,c,d,e){return e=e||{},a.each(c,function(a,c){var f=b.cssUnit(c);f[0]>0&&(e[c]=f[0]*d+f[1])}),e}}),a.fn.extend({effect:function(){function g(c){function h(){a.isFunction(e)&&e.call(d[0]),a.isFunction(c)&&c()}var d=a(this),e=b.complete,g=b.mode;(d.is(":hidden")?"hide"===g:"show"===g)?(d[g](),h()):f.call(d[0],b,h)}var b=d.apply(this,arguments),c=b.mode,e=b.queue,f=a.effects.effect[b.effect];return a.fx.off||!f?c?this[c](b.duration,b.complete):this.each(function(){b.complete&&b.complete.call(this)}):e===!1?this.each(g):this.queue(e||"fx",g)},show:function(a){return function(b){if(e(b))return a.apply(this,arguments);var c=d.apply(this,arguments);return c.mode="show",this.effect.call(this,c)}}(a.fn.show),hide:function(a){return function(b){if(e(b))return a.apply(this,arguments);var c=d.apply(this,arguments);return c.mode="hide",this.effect.call(this,c)}}(a.fn.hide),toggle:function(a){return function(b){if(e(b)||"boolean"==typeof b)return a.apply(this,arguments);var c=d.apply(this,arguments);return c.mode="toggle",this.effect.call(this,c)}}(a.fn.toggle),cssUnit:function(b){var c=this.css(b),d=[];return a.each(["em","px","%","pt"],function(a,b){c.indexOf(b)>0&&(d=[parseFloat(c),b])}),d}})}(),function(){var b={};a.each(["Quad","Cubic","Quart","Quint","Expo"],function(a,c){b[c]=function(b){return Math.pow(b,a+2)}}),a.extend(b,{Sine:function(a){return 1-Math.cos(a*Math.PI/2)},Circ:function(a){return 1-Math.sqrt(1-a*a)},Elastic:function(a){return 0===a||1===a?a:-Math.pow(2,8*(a-1))*Math.sin((80*(a-1)-7.5)*Math.PI/15)},Back:function(a){return a*a*(3*a-2)},Bounce:function(a){for(var b,c=4;a<((b=Math.pow(2,--c))-1)/11;);return 1/Math.pow(4,3-c)-7.5625*Math.pow((3*b-2)/22-a,2)}}),a.each(b,function(b,c){a.easing["easeIn"+b]=c,a.easing["easeOut"+b]=function(a){return 1-c(1-a)},a.easing["easeInOut"+b]=function(a){return.5>a?c(2*a)/2:1-c(-2*a+2)/2}})}()}(jQuery),function(a){var c=0,d={},e={};d.height=d.paddingTop=d.paddingBottom=d.borderTopWidth=d.borderBottomWidth="hide",e.height=e.paddingTop=e.paddingBottom=e.borderTopWidth=e.borderBottomWidth="show",a.widget("ui.accordion",{version:"1.10.3",options:{active:0,animate:{},collapsible:!1,event:"click",header:"> li > :first-child,> :not(li):even",heightStyle:"auto",icons:{activeHeader:"ui-icon-triangle-1-s",header:"ui-icon-triangle-1-e"},activate:null,beforeActivate:null},_create:function(){var b=this.options;this.prevShow=this.prevHide=a(),this.element.addClass("ui-accordion ui-widget ui-helper-reset").attr("role","tablist"),b.collapsible||b.active!==!1&&null!=b.active||(b.active=0),this._processPanels(),b.active<0&&(b.active+=this.headers.length),this._refresh()},_getCreateEventData:function(){return{header:this.active,panel:this.active.length?this.active.next():a(),content:this.active.length?this.active.next():a()}},_createIcons:function(){var b=this.options.icons;b&&(a("").addClass("ui-accordion-header-icon ui-icon "+b.header).prependTo(this.headers),this.active.children(".ui-accordion-header-icon").removeClass(b.header).addClass(b.activeHeader),this.headers.addClass("ui-accordion-icons")) },_destroyIcons:function(){this.headers.removeClass("ui-accordion-icons").children(".ui-accordion-header-icon").remove()},_destroy:function(){var a;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role"),this.headers.removeClass("ui-accordion-header ui-accordion-header-active ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top").removeAttr("role").removeAttr("aria-selected").removeAttr("aria-controls").removeAttr("tabIndex").each(function(){/^ui-accordion/.test(this.id)&&this.removeAttribute("id")}),this._destroyIcons(),a=this.headers.next().css("display","").removeAttr("role").removeAttr("aria-expanded").removeAttr("aria-hidden").removeAttr("aria-labelledby").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-state-disabled").each(function(){/^ui-accordion/.test(this.id)&&this.removeAttribute("id")}),"content"!==this.options.heightStyle&&a.css("height","")},_setOption:function(a,b){return"active"===a?(this._activate(b),void 0):("event"===a&&(this.options.event&&this._off(this.headers,this.options.event),this._setupEvents(b)),this._super(a,b),"collapsible"!==a||b||this.options.active!==!1||this._activate(0),"icons"===a&&(this._destroyIcons(),b&&this._createIcons()),"disabled"===a&&this.headers.add(this.headers.next()).toggleClass("ui-state-disabled",!!b),void 0)},_keydown:function(b){if(!b.altKey&&!b.ctrlKey){var c=a.ui.keyCode,d=this.headers.length,e=this.headers.index(b.target),f=!1;switch(b.keyCode){case c.RIGHT:case c.DOWN:f=this.headers[(e+1)%d];break;case c.LEFT:case c.UP:f=this.headers[(e-1+d)%d];break;case c.SPACE:case c.ENTER:this._eventHandler(b);break;case c.HOME:f=this.headers[0];break;case c.END:f=this.headers[d-1]}f&&(a(b.target).attr("tabIndex",-1),a(f).attr("tabIndex",0),f.focus(),b.preventDefault())}},_panelKeyDown:function(b){b.keyCode===a.ui.keyCode.UP&&b.ctrlKey&&a(b.currentTarget).prev().focus()},refresh:function(){var b=this.options;this._processPanels(),b.active===!1&&b.collapsible===!0||!this.headers.length?(b.active=!1,this.active=a()):b.active===!1?this._activate(0):this.active.length&&!a.contains(this.element[0],this.active[0])?this.headers.length===this.headers.find(".ui-state-disabled").length?(b.active=!1,this.active=a()):this._activate(Math.max(0,b.active-1)):b.active=this.headers.index(this.active),this._destroyIcons(),this._refresh()},_processPanels:function(){this.headers=this.element.find(this.options.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all"),this.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom").filter(":not(.ui-accordion-content-active)").hide()},_refresh:function(){var b,d=this.options,e=d.heightStyle,f=this.element.parent(),g=this.accordionId="ui-accordion-"+(this.element.attr("id")||++c);this.active=this._findActive(d.active).addClass("ui-accordion-header-active ui-state-active ui-corner-top").removeClass("ui-corner-all"),this.active.next().addClass("ui-accordion-content-active").show(),this.headers.attr("role","tab").each(function(b){var c=a(this),d=c.attr("id"),e=c.next(),f=e.attr("id");d||(d=g+"-header-"+b,c.attr("id",d)),f||(f=g+"-panel-"+b,e.attr("id",f)),c.attr("aria-controls",f),e.attr("aria-labelledby",d)}).next().attr("role","tabpanel"),this.headers.not(this.active).attr({"aria-selected":"false",tabIndex:-1}).next().attr({"aria-expanded":"false","aria-hidden":"true"}).hide(),this.active.length?this.active.attr({"aria-selected":"true",tabIndex:0}).next().attr({"aria-expanded":"true","aria-hidden":"false"}):this.headers.eq(0).attr("tabIndex",0),this._createIcons(),this._setupEvents(d.event),"fill"===e?(b=f.height(),this.element.siblings(":visible").each(function(){var c=a(this),d=c.css("position");"absolute"!==d&&"fixed"!==d&&(b-=c.outerHeight(!0))}),this.headers.each(function(){b-=a(this).outerHeight(!0)}),this.headers.next().each(function(){a(this).height(Math.max(0,b-a(this).innerHeight()+a(this).height()))}).css("overflow","auto")):"auto"===e&&(b=0,this.headers.next().each(function(){b=Math.max(b,a(this).css("height","").height())}).height(b))},_activate:function(b){var c=this._findActive(b)[0];c!==this.active[0]&&(c=c||this.active[0],this._eventHandler({target:c,currentTarget:c,preventDefault:a.noop}))},_findActive:function(b){return"number"==typeof b?this.headers.eq(b):a()},_setupEvents:function(b){var c={keydown:"_keydown"};b&&a.each(b.split(" "),function(a,b){c[b]="_eventHandler"}),this._off(this.headers.add(this.headers.next())),this._on(this.headers,c),this._on(this.headers.next(),{keydown:"_panelKeyDown"}),this._hoverable(this.headers),this._focusable(this.headers)},_eventHandler:function(b){var c=this.options,d=this.active,e=a(b.currentTarget),f=e[0]===d[0],g=f&&c.collapsible,h=g?a():e.next(),i=d.next(),j={oldHeader:d,oldPanel:i,newHeader:g?a():e,newPanel:h};b.preventDefault(),f&&!c.collapsible||this._trigger("beforeActivate",b,j)===!1||(c.active=g?!1:this.headers.index(e),this.active=f?a():e,this._toggle(j),d.removeClass("ui-accordion-header-active ui-state-active"),c.icons&&d.children(".ui-accordion-header-icon").removeClass(c.icons.activeHeader).addClass(c.icons.header),f||(e.removeClass("ui-corner-all").addClass("ui-accordion-header-active ui-state-active ui-corner-top"),c.icons&&e.children(".ui-accordion-header-icon").removeClass(c.icons.header).addClass(c.icons.activeHeader),e.next().addClass("ui-accordion-content-active")))},_toggle:function(b){var c=b.newPanel,d=this.prevShow.length?this.prevShow:b.oldPanel;this.prevShow.add(this.prevHide).stop(!0,!0),this.prevShow=c,this.prevHide=d,this.options.animate?this._animate(c,d,b):(d.hide(),c.show(),this._toggleComplete(b)),d.attr({"aria-expanded":"false","aria-hidden":"true"}),d.prev().attr("aria-selected","false"),c.length&&d.length?d.prev().attr("tabIndex",-1):c.length&&this.headers.filter(function(){return 0===a(this).attr("tabIndex")}).attr("tabIndex",-1),c.attr({"aria-expanded":"true","aria-hidden":"false"}).prev().attr({"aria-selected":"true",tabIndex:0})},_animate:function(a,b,c){var f,g,h,i=this,j=0,k=a.length&&(!b.length||a.index()",options:{appendTo:null,autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null,change:null,close:null,focus:null,open:null,response:null,search:null,select:null},pending:0,_create:function(){var b,c,d,e=this.element[0].nodeName.toLowerCase(),f="textarea"===e,g="input"===e;this.isMultiLine=f?!0:g?!1:this.element.prop("isContentEditable"),this.valueMethod=this.element[f||g?"val":"text"],this.isNewMenu=!0,this.element.addClass("ui-autocomplete-input").attr("autocomplete","off"),this._on(this.element,{keydown:function(e){if(this.element.prop("readOnly"))return b=!0,d=!0,c=!0,void 0;b=!1,d=!1,c=!1;var f=a.ui.keyCode;switch(e.keyCode){case f.PAGE_UP:b=!0,this._move("previousPage",e);break;case f.PAGE_DOWN:b=!0,this._move("nextPage",e);break;case f.UP:b=!0,this._keyEvent("previous",e);break;case f.DOWN:b=!0,this._keyEvent("next",e);break;case f.ENTER:case f.NUMPAD_ENTER:this.menu.active&&(b=!0,e.preventDefault(),this.menu.select(e));break;case f.TAB:this.menu.active&&this.menu.select(e);break;case f.ESCAPE:this.menu.element.is(":visible")&&(this._value(this.term),this.close(e),e.preventDefault());break;default:c=!0,this._searchTimeout(e)}},keypress:function(d){if(b)return b=!1,(!this.isMultiLine||this.menu.element.is(":visible"))&&d.preventDefault(),void 0;if(!c){var e=a.ui.keyCode;switch(d.keyCode){case e.PAGE_UP:this._move("previousPage",d);break;case e.PAGE_DOWN:this._move("nextPage",d);break;case e.UP:this._keyEvent("previous",d);break;case e.DOWN:this._keyEvent("next",d)}}},input:function(a){return d?(d=!1,a.preventDefault(),void 0):(this._searchTimeout(a),void 0)},focus:function(){this.selectedItem=null,this.previous=this._value()},blur:function(a){return this.cancelBlur?(delete this.cancelBlur,void 0):(clearTimeout(this.searching),this.close(a),this._change(a),void 0)}}),this._initSource(),this.menu=a("