- var selector_chosen = quickElement('div', selector_div);
- selector_chosen.className = 'selector-chosen';
- var title_chosen = quickElement('h2', selector_chosen, interpolate(gettext('Chosen %s') + ' ', [field_name]));
- quickElement('img', title_chosen, '', 'src', admin_static_prefix + 'img/icon-unknown.gif', 'width', '10', 'height', '10', 'class', 'help help-tooltip', 'title', interpolate(gettext('This is the list of chosen %s. You may remove some by selecting them in the box below and then clicking the "Remove" arrow between the two boxes.'), [field_name]));
-
- var to_box = quickElement('select', selector_chosen, '', 'id', field_id + '_to', 'multiple', 'multiple', 'size', from_box.size, 'name', from_box.getAttribute('name'));
- to_box.className = 'filtered';
- var clear_all = quickElement('a', selector_chosen, gettext('Remove all'), 'title', interpolate(gettext('Click to remove all chosen %s at once.'), [field_name]), 'href', 'javascript: (function() { SelectBox.move_all("' + field_id + '_to", "' + field_id + '_from"); SelectFilter.refresh_icons("' + field_id + '");})()', 'id', field_id + '_remove_all_link');
- clear_all.className = 'selector-clearall';
-
- from_box.setAttribute('name', from_box.getAttribute('name') + '_old');
-
- // Set up the JavaScript event handlers for the select box filter interface
- addEvent(filter_input, 'keypress', function(e) { SelectFilter.filter_key_press(e, field_id); });
- addEvent(filter_input, 'keyup', function(e) { SelectFilter.filter_key_up(e, field_id); });
- addEvent(filter_input, 'keydown', function(e) { SelectFilter.filter_key_down(e, field_id); });
- addEvent(from_box, 'change', function(e) { SelectFilter.refresh_icons(field_id) });
- addEvent(to_box, 'change', function(e) { SelectFilter.refresh_icons(field_id) });
- addEvent(from_box, 'dblclick', function() { SelectBox.move(field_id + '_from', field_id + '_to'); SelectFilter.refresh_icons(field_id); });
- addEvent(to_box, 'dblclick', function() { SelectBox.move(field_id + '_to', field_id + '_from'); SelectFilter.refresh_icons(field_id); });
- addEvent(findForm(from_box), 'submit', function() { SelectBox.select_all(field_id + '_to'); });
- SelectBox.init(field_id + '_from');
- SelectBox.init(field_id + '_to');
- // Move selected from_box options to to_box
- SelectBox.move(field_id + '_from', field_id + '_to');
-
- if (!is_stacked) {
- // In horizontal mode, give the same height to the two boxes.
- var j_from_box = $(from_box);
- var j_to_box = $(to_box);
- var resize_filters = function() { j_to_box.height($(filter_p).outerHeight() + j_from_box.outerHeight()); }
- if (j_from_box.outerHeight() > 0) {
- resize_filters(); // This fieldset is already open. Resize now.
- } else {
- // This fieldset is probably collapsed. Wait for its 'show' event.
- j_to_box.closest('fieldset').one('show.fieldset', resize_filters);
- }
- }
-
- // Initial icon refresh
- SelectFilter.refresh_icons(field_id);
- },
- refresh_icons: function(field_id) {
- var from = $('#' + field_id + '_from');
- var to = $('#' + field_id + '_to');
- var is_from_selected = from.find('option:selected').length > 0;
- var is_to_selected = to.find('option:selected').length > 0;
- // Active if at least one item is selected
- $('#' + field_id + '_add_link').toggleClass('active', is_from_selected);
- $('#' + field_id + '_remove_link').toggleClass('active', is_to_selected);
- // Active if the corresponding box isn't empty
- $('#' + field_id + '_add_all_link').toggleClass('active', from.find('option').length > 0);
- $('#' + field_id + '_remove_all_link').toggleClass('active', to.find('option').length > 0);
- },
- filter_key_press: function(event, field_id) {
- var from = document.getElementById(field_id + '_from');
- // don't submit form if user pressed Enter
- if ((event.which && event.which == 13) || (event.keyCode && event.keyCode == 13)) {
- from.selectedIndex = 0;
- SelectBox.move(field_id + '_from', field_id + '_to');
- from.selectedIndex = 0;
- event.preventDefault()
- return false;
- }
- },
- filter_key_up: function(event, field_id) {
- var from = document.getElementById(field_id + '_from');
- var temp = from.selectedIndex;
- SelectBox.filter(field_id + '_from', document.getElementById(field_id + '_input').value);
- from.selectedIndex = temp;
- return true;
- },
- filter_key_down: function(event, field_id) {
- var from = document.getElementById(field_id + '_from');
- // right arrow -- move across
- if ((event.which && event.which == 39) || (event.keyCode && event.keyCode == 39)) {
- var old_index = from.selectedIndex;
- SelectBox.move(field_id + '_from', field_id + '_to');
- from.selectedIndex = (old_index == from.length) ? from.length - 1 : old_index;
- return false;
- }
- // down arrow -- wrap around
- if ((event.which && event.which == 40) || (event.keyCode && event.keyCode == 40)) {
- from.selectedIndex = (from.length == from.selectedIndex + 1) ? 0 : from.selectedIndex + 1;
- }
- // up arrow -- wrap around
- if ((event.which && event.which == 38) || (event.keyCode && event.keyCode == 38)) {
- from.selectedIndex = (from.selectedIndex == 0) ? from.length - 1 : from.selectedIndex - 1;
- }
- return true;
- }
-}
-
-})(django.jQuery);
diff --git a/ofu_app/static/admin/js/actions.js b/ofu_app/static/admin/js/actions.js
deleted file mode 100644
index 58f572f..0000000
--- a/ofu_app/static/admin/js/actions.js
+++ /dev/null
@@ -1,144 +0,0 @@
-(function($) {
- var lastChecked;
-
- $.fn.actions = function(opts) {
- var options = $.extend({}, $.fn.actions.defaults, opts);
- var actionCheckboxes = $(this);
- var list_editable_changed = false;
- var checker = function(checked) {
- if (checked) {
- showQuestion();
- } else {
- reset();
- }
- $(actionCheckboxes).prop("checked", checked)
- .parent().parent().toggleClass(options.selectedClass, checked);
- },
- updateCounter = function() {
- var sel = $(actionCheckboxes).filter(":checked").length;
- // _actions_icnt is defined in the generated HTML
- // and contains the total amount of objects in the queryset
- $(options.counterContainer).html(interpolate(
- ngettext('%(sel)s of %(cnt)s selected', '%(sel)s of %(cnt)s selected', sel), {
- sel: sel,
- cnt: _actions_icnt
- }, true));
- $(options.allToggle).prop("checked", function() {
- var value;
- if (sel == actionCheckboxes.length) {
- value = true;
- showQuestion();
- } else {
- value = false;
- clearAcross();
- }
- return value;
- });
- },
- showQuestion = function() {
- $(options.acrossClears).hide();
- $(options.acrossQuestions).show();
- $(options.allContainer).hide();
- },
- showClear = function() {
- $(options.acrossClears).show();
- $(options.acrossQuestions).hide();
- $(options.actionContainer).toggleClass(options.selectedClass);
- $(options.allContainer).show();
- $(options.counterContainer).hide();
- },
- reset = function() {
- $(options.acrossClears).hide();
- $(options.acrossQuestions).hide();
- $(options.allContainer).hide();
- $(options.counterContainer).show();
- },
- clearAcross = function() {
- reset();
- $(options.acrossInput).val(0);
- $(options.actionContainer).removeClass(options.selectedClass);
- };
- // Show counter by default
- $(options.counterContainer).show();
- // Check state of checkboxes and reinit state if needed
- $(this).filter(":checked").each(function(i) {
- $(this).parent().parent().toggleClass(options.selectedClass);
- updateCounter();
- if ($(options.acrossInput).val() == 1) {
- showClear();
- }
- });
- $(options.allToggle).show().click(function() {
- checker($(this).prop("checked"));
- updateCounter();
- });
- $("a", options.acrossQuestions).click(function(event) {
- event.preventDefault();
- $(options.acrossInput).val(1);
- showClear();
- });
- $("a", options.acrossClears).click(function(event) {
- event.preventDefault();
- $(options.allToggle).prop("checked", false);
- clearAcross();
- checker(0);
- updateCounter();
- });
- lastChecked = null;
- $(actionCheckboxes).click(function(event) {
- if (!event) { event = window.event; }
- var target = event.target ? event.target : event.srcElement;
- if (lastChecked && $.data(lastChecked) != $.data(target) && event.shiftKey === true) {
- var inrange = false;
- $(lastChecked).prop("checked", target.checked)
- .parent().parent().toggleClass(options.selectedClass, target.checked);
- $(actionCheckboxes).each(function() {
- if ($.data(this) == $.data(lastChecked) || $.data(this) == $.data(target)) {
- inrange = (inrange) ? false : true;
- }
- if (inrange) {
- $(this).prop("checked", target.checked)
- .parent().parent().toggleClass(options.selectedClass, target.checked);
- }
- });
- }
- $(target).parent().parent().toggleClass(options.selectedClass, target.checked);
- lastChecked = target;
- updateCounter();
- });
- $('form#changelist-form table#result_list tr').find('td:gt(0) :input').change(function() {
- list_editable_changed = true;
- });
- $('form#changelist-form button[name="index"]').click(function(event) {
- if (list_editable_changed) {
- return confirm(gettext("You have unsaved changes on individual editable fields. If you run an action, your unsaved changes will be lost."));
- }
- });
- $('form#changelist-form input[name="_save"]').click(function(event) {
- var action_changed = false;
- $('select option:selected', options.actionContainer).each(function() {
- if ($(this).val()) {
- action_changed = true;
- }
- });
- if (action_changed) {
- if (list_editable_changed) {
- return confirm(gettext("You have selected an action, but you haven't saved your changes to individual fields yet. Please click OK to save. You'll need to re-run the action."));
- } else {
- return confirm(gettext("You have selected an action, and you haven't made any changes on individual fields. You're probably looking for the Go button rather than the Save button."));
- }
- }
- });
- };
- /* Setup plugin defaults */
- $.fn.actions.defaults = {
- actionContainer: "div.actions",
- counterContainer: "span.action-counter",
- allContainer: "div.actions span.all",
- acrossInput: "div.actions input.select-across",
- acrossQuestions: "div.actions span.question",
- acrossClears: "div.actions span.clear",
- allToggle: "#action-toggle",
- selectedClass: "selected"
- };
-})(django.jQuery);
diff --git a/ofu_app/static/admin/js/actions.min.js b/ofu_app/static/admin/js/actions.min.js
deleted file mode 100644
index 0dd6683..0000000
--- a/ofu_app/static/admin/js/actions.min.js
+++ /dev/null
@@ -1,6 +0,0 @@
-(function(a){var f;a.fn.actions=function(q){var b=a.extend({},a.fn.actions.defaults,q),g=a(this),e=!1,m=function(c){c?k():l();a(g).prop("checked",c).parent().parent().toggleClass(b.selectedClass,c)},h=function(){var c=a(g).filter(":checked").length;a(b.counterContainer).html(interpolate(ngettext("%(sel)s of %(cnt)s selected","%(sel)s of %(cnt)s selected",c),{sel:c,cnt:_actions_icnt},!0));a(b.allToggle).prop("checked",function(){var a;c==g.length?(a=!0,k()):(a=!1,n());return a})},k=function(){a(b.acrossClears).hide();
-a(b.acrossQuestions).show();a(b.allContainer).hide()},p=function(){a(b.acrossClears).show();a(b.acrossQuestions).hide();a(b.actionContainer).toggleClass(b.selectedClass);a(b.allContainer).show();a(b.counterContainer).hide()},l=function(){a(b.acrossClears).hide();a(b.acrossQuestions).hide();a(b.allContainer).hide();a(b.counterContainer).show()},n=function(){l();a(b.acrossInput).val(0);a(b.actionContainer).removeClass(b.selectedClass)};a(b.counterContainer).show();a(this).filter(":checked").each(function(c){a(this).parent().parent().toggleClass(b.selectedClass);
-h();1==a(b.acrossInput).val()&&p()});a(b.allToggle).show().click(function(){m(a(this).prop("checked"));h()});a("a",b.acrossQuestions).click(function(c){c.preventDefault();a(b.acrossInput).val(1);p()});a("a",b.acrossClears).click(function(c){c.preventDefault();a(b.allToggle).prop("checked",!1);n();m(0);h()});f=null;a(g).click(function(c){c||(c=window.event);var d=c.target?c.target:c.srcElement;if(f&&a.data(f)!=a.data(d)&&!0===c.shiftKey){var e=!1;a(f).prop("checked",d.checked).parent().parent().toggleClass(b.selectedClass,
-d.checked);a(g).each(function(){if(a.data(this)==a.data(f)||a.data(this)==a.data(d))e=e?!1:!0;e&&a(this).prop("checked",d.checked).parent().parent().toggleClass(b.selectedClass,d.checked)})}a(d).parent().parent().toggleClass(b.selectedClass,d.checked);f=d;h()});a("form#changelist-form table#result_list tr").find("td:gt(0) :input").change(function(){e=!0});a('form#changelist-form button[name="index"]').click(function(a){if(e)return confirm(gettext("You have unsaved changes on individual editable fields. If you run an action, your unsaved changes will be lost."))});
-a('form#changelist-form input[name="_save"]').click(function(c){var d=!1;a("select option:selected",b.actionContainer).each(function(){a(this).val()&&(d=!0)});if(d)return e?confirm(gettext("You have selected an action, but you haven't saved your changes to individual fields yet. Please click OK to save. You'll need to re-run the action.")):confirm(gettext("You have selected an action, and you haven't made any changes on individual fields. You're probably looking for the Go button rather than the Save button."))})};
-a.fn.actions.defaults={actionContainer:"div.actions",counterContainer:"span.action-counter",allContainer:"div.actions span.all",acrossInput:"div.actions input.select-across",acrossQuestions:"div.actions span.question",acrossClears:"div.actions span.clear",allToggle:"#action-toggle",selectedClass:"selected"}})(django.jQuery);
diff --git a/ofu_app/static/admin/js/admin/DateTimeShortcuts.js b/ofu_app/static/admin/js/admin/DateTimeShortcuts.js
deleted file mode 100644
index 8d50046..0000000
--- a/ofu_app/static/admin/js/admin/DateTimeShortcuts.js
+++ /dev/null
@@ -1,357 +0,0 @@
-// Inserts shortcut buttons after all of the following:
-//
-//
-
-var DateTimeShortcuts = {
- calendars: [],
- calendarInputs: [],
- clockInputs: [],
- dismissClockFunc: [],
- dismissCalendarFunc: [],
- calendarDivName1: 'calendarbox', // name of calendar
that gets toggled
- calendarDivName2: 'calendarin', // name of
that contains calendar
- calendarLinkName: 'calendarlink',// name of the link that is used to toggle
- clockDivName: 'clockbox', // name of clock
that gets toggled
- clockLinkName: 'clocklink', // name of the link that is used to toggle
- shortCutsClass: 'datetimeshortcuts', // class of the clock and cal shortcuts
- timezoneWarningClass: 'timezonewarning', // class of the warning for timezone mismatch
- timezoneOffset: 0,
- admin_media_prefix: '',
- init: function() {
- // Get admin_media_prefix by grabbing it off the window object. It's
- // set in the admin/base.html template, so if it's not there, someone's
- // overridden the template. In that case, we'll set a clearly-invalid
- // value in the hopes that someone will examine HTTP requests and see it.
- if (window.__admin_media_prefix__ != undefined) {
- DateTimeShortcuts.admin_media_prefix = window.__admin_media_prefix__;
- } else {
- DateTimeShortcuts.admin_media_prefix = '/missing-admin-media-prefix/';
- }
-
- if (window.__admin_utc_offset__ != undefined) {
- var serverOffset = window.__admin_utc_offset__;
- var localOffset = new Date().getTimezoneOffset() * -60;
- DateTimeShortcuts.timezoneOffset = localOffset - serverOffset;
- }
-
- var inputs = document.getElementsByTagName('input');
- for (i=0; i 0) {
- message = ngettext(
- 'Note: You are %s hour ahead of server time.',
- 'Note: You are %s hours ahead of server time.',
- timezoneOffset
- );
- }
- else {
- timezoneOffset *= -1
- message = ngettext(
- 'Note: You are %s hour behind server time.',
- 'Note: You are %s hours behind server time.',
- timezoneOffset
- );
- }
- message = interpolate(message, [timezoneOffset]);
-
- var $warning = $('');
- $warning.attr('class', warningClass);
- $warning.text(message);
-
- $(inp).parent()
- .append($(' '))
- .append($warning)
- },
- // Add clock widget to a given field
- addClock: function(inp) {
- var num = DateTimeShortcuts.clockInputs.length;
- DateTimeShortcuts.clockInputs[num] = inp;
- DateTimeShortcuts.dismissClockFunc[num] = function() { DateTimeShortcuts.dismissClock(num); return true; };
-
- // Shortcut links (clock icon and "Now" link)
- var shortcuts_span = document.createElement('span');
- shortcuts_span.className = DateTimeShortcuts.shortCutsClass;
- inp.parentNode.insertBefore(shortcuts_span, inp.nextSibling);
- var now_link = document.createElement('a');
- now_link.setAttribute('href', "javascript:DateTimeShortcuts.handleClockQuicklink(" + num + ", -1);");
- now_link.appendChild(document.createTextNode(gettext('Now')));
- var clock_link = document.createElement('a');
- clock_link.setAttribute('href', 'javascript:DateTimeShortcuts.openClock(' + num + ');');
- clock_link.id = DateTimeShortcuts.clockLinkName + num;
- quickElement('img', clock_link, '', 'src', DateTimeShortcuts.admin_media_prefix + 'img/icon_clock.gif', 'alt', gettext('Clock'));
- shortcuts_span.appendChild(document.createTextNode('\240'));
- shortcuts_span.appendChild(now_link);
- shortcuts_span.appendChild(document.createTextNode('\240|\240'));
- shortcuts_span.appendChild(clock_link);
-
- // Create clock link div
- //
- // Markup looks like:
- //
");
- addButton = $this.filter(":last").next().find("a");
- }
- addButton.click(function(e) {
- e.preventDefault();
- var totalForms = $("#id_" + options.prefix + "-TOTAL_FORMS");
- var template = $("#" + options.prefix + "-empty");
- var row = template.clone(true);
- row.removeClass(options.emptyCssClass)
- .addClass(options.formCssClass)
- .attr("id", options.prefix + "-" + nextIndex);
- if (row.is("tr")) {
- // If the forms are laid out in table rows, insert
- // the remove button into the last table cell:
- row.children(":last").append('
");
- } else {
- // Otherwise, just insert the remove button as the
- // last child element of the form's container:
- row.children(":first").append('' + options.deleteText + "");
- }
- row.find("*").each(function() {
- updateElementIndex(this, options.prefix, totalForms.val());
- });
- // Insert the new form when it has been fully edited
- row.insertBefore($(template));
- // Update number of total forms
- $(totalForms).val(parseInt(totalForms.val(), 10) + 1);
- nextIndex += 1;
- // Hide add button in case we've hit the max, except we want to add infinitely
- if ((maxForms.val() !== '') && (maxForms.val()-totalForms.val()) <= 0) {
- addButton.parent().hide();
- }
- // The delete button of each row triggers a bunch of other things
- row.find("a." + options.deleteCssClass).click(function(e) {
- e.preventDefault();
- // Remove the parent form containing this button:
- var row = $(this).parents("." + options.formCssClass);
- row.remove();
- nextIndex -= 1;
- // If a post-delete callback was provided, call it with the deleted form:
- if (options.removed) {
- options.removed(row);
- }
- // Update the TOTAL_FORMS form count.
- var forms = $("." + options.formCssClass);
- $("#id_" + options.prefix + "-TOTAL_FORMS").val(forms.length);
- // Show add button again once we drop below max
- if ((maxForms.val() === '') || (maxForms.val()-forms.length) > 0) {
- addButton.parent().show();
- }
- // Also, update names and ids for all remaining form controls
- // so they remain in sequence:
- for (var i=0, formCount=forms.length; i0;i.each(function(){a(this).not("."+
-b.emptyCssClass).addClass(b.formCssClass)});if(i.length&&l){var f;if(i.prop("tagName")=="TR"){i=this.eq(-1).children().length;g.append('