Permalink
Browse files

Added admin media to the Django distribution

git-svn-id: http://code.djangoproject.com/svn/django/trunk@96 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent c0daa77 commit dd5320d1d56ca7603747dd68871e72eee99d9e67 @adrianholovaty adrianholovaty committed Jul 16, 2005
Showing with 2,175 additions and 0 deletions.
  1. +3 −0 media/css/base.css
  2. +59 −0 media/css/changelists.css
  3. +398 −0 media/css/global.css
  4. BIN media/img/calendar.gif
  5. BIN media/img/changelist-bg.gif
  6. BIN media/img/chooser-bg.gif
  7. BIN media/img/chooser_stacked-bg.gif
  8. BIN media/img/default-bg-reverse.gif
  9. BIN media/img/default-bg.gif
  10. BIN media/img/icon-no.gif
  11. BIN media/img/icon-yes.gif
  12. BIN media/img/icon_addlink.gif
  13. BIN media/img/icon_alert.gif
  14. BIN media/img/icon_calendar.gif
  15. BIN media/img/icon_changelink.gif
  16. BIN media/img/icon_clock.gif
  17. BIN media/img/icon_deletelink.gif
  18. BIN media/img/icon_error.gif
  19. BIN media/img/icon_searchbox.gif
  20. BIN media/img/icon_success.gif
  21. BIN media/img/nav-bg-grabber.gif
  22. BIN media/img/nav-bg-grabber2.gif
  23. BIN media/img/nav-bg-reverse.gif
  24. BIN media/img/nav-bg.gif
  25. BIN media/img/selector-add.gif
  26. BIN media/img/selector-addall.gif
  27. BIN media/img/selector-remove.gif
  28. BIN media/img/selector-removeall.gif
  29. BIN media/img/selector-search.gif
  30. BIN media/img/selector_stacked-add.gif
  31. BIN media/img/selector_stacked-remove.gif
  32. BIN media/img/tool-left.gif
  33. BIN media/img/tool-left_over.gif
  34. BIN media/img/tool-right.gif
  35. BIN media/img/tool-right_over.gif
  36. BIN media/img/tooltag-add.gif
  37. BIN media/img/tooltag-add_over.gif
  38. BIN media/img/tooltag-arrowright.gif
  39. BIN media/img/tooltag-arrowright_over.gif
  40. +110 −0 media/js/SelectBox.js
  41. +81 −0 media/js/SelectFilter.js
  42. +129 −0 media/js/SelectFilter2.js
  43. +82 −0 media/js/admin/CollapsedFieldsets.js
  44. +204 −0 media/js/admin/DateTimeShortcuts.js
  45. +33 −0 media/js/admin/RelatedObjectLookups.js
  46. +158 −0 media/js/admin/add_calendars.js
  47. +137 −0 media/js/admin/ordering.js
  48. +139 −0 media/js/calendar.js
  49. +138 −0 media/js/core.js
  50. +227 −0 media/js/dateparse.js
  51. +167 −0 media/js/getElementsBySelector.js
  52. +94 −0 media/js/timeparse.js
  53. +16 −0 media/js/urlify.js
View
@@ -0,0 +1,3 @@
+@import url('global.css');
+@import url('changelists.css');
+
View
@@ -0,0 +1,59 @@
+/*
+ ______________________________
+ WORLD ONLINE PUBLISHING SYSTEM
+ Admin Changelist Styles
+
+ Extends global.css
+
+ by World Online, Copyright 2004
+
+ 645 New Hampshire
+ Lawrence, KS 66044
+
+ webmaster@ljworld.com
+
+*/
+
+#changelist {position:relative; width:100%;}
+#changelist table {width:100%;}
+.change-list .filtered table { border-right:1px solid #ddd; }
+.change-list .filtered {min-height:400px; _height:400px;}
+.change-list .filtered {background:white url(../img/admin/changelist-bg.gif) top right repeat-y !important;}
+.change-list .filtered table, .filtered .paginator, .filtered #toolbar, .filtered div.xfull {margin-right:160px !important; width:auto !important; }
+.change-list .filtered table tbody th {padding-right:10px;}
+#changelist .toplinks {border-bottom:1px solid #ccc !important;}
+#changelist .paginator { color:#666; border-top:1px solid #eee; border-bottom:1px solid #eee; background:white url(../img/admin/nav-bg.gif) 0 180% repeat-x; overflow:hidden;}
+.change-list .filtered .paginator { border-right:1px solid #ddd; }
+
+/* CHANGELIST TABLES */
+
+#changelist table thead th {white-space:nowrap;}
+#changelist table tbody td {border-left: 1px solid #ddd;}
+#changelist table tfoot {color: #666;}
+
+/* TOOLBAR */
+
+#changelist #toolbar {padding:3px; border-bottom:1px solid #ddd; background:#e1e1e1 url(../img/admin/nav-bg.gif) top left repeat-x; color:#666;}
+#changelist #toolbar form input {font-size:11px; padding:1px 2px;}
+#changelist #toolbar form #searchbar {padding:2px;}
+#changelist #changelist-search img {vertical-align:middle;}
+
+/* FILTER COLUMN */
+
+#changelist-filter {position:absolute; top:0; right:0; z-index:1000; width:160px; border-left:1px solid #ddd; background:#efefef; margin:0;}
+#changelist-filter h2 {font-size:11px; padding:2px 5px; border-bottom:1px solid #ddd;}
+#changelist-filter h3 {font-size:12px; margin-bottom:0;}
+#changelist-filter ul {padding-left:0;margin-left:10px;_margin-right:-10px;}
+#changelist-filter li {list-style-type:none; margin-left:0; padding-left:0;}
+#changelist-filter a {color:#999;}
+#changelist-filter a:hover {color:#036;}
+#changelist-filter li.selected {border-left:5px solid #ccc; padding-left:5px;margin-left:-10px;}
+#changelist-filter li.selected a {color:#5b80b2 !important;}
+
+/* DATE DRILLDOWN */
+
+.change-list ul.toplinks {display:block; background:white url(../img/admin/nav-bg-reverse.gif) 0 -10px repeat-x; border-top:1px solid white; float:left; padding:0 !important; margin:0 !important; width:100%;}
+.change-list ul.toplinks li {float: left; width: 9em; padding:3px 6px; font-weight: bold; list-style-type:none;}
+.change-list ul.toplinks .date-back a {color:#999;}
+.change-list ul.toplinks .date-back a:hover {color:#036;}
+
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Diff not rendered.
Diff not rendered.
Diff not rendered.
View
Diff not rendered.
Diff not rendered.
View
Diff not rendered.
Diff not rendered.
View
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
View
@@ -0,0 +1,110 @@
+var SelectBox = {
+ cache: new Object(),
+ init: function(id) {
+ var box = document.getElementById(id);
+ var node;
+ SelectBox.cache[id] = new Array();
+ var cache = SelectBox.cache[id];
+ for (var i = 0; (node = box.options[i]); i++) {
+ cache.push({ value: node.value, text: node.text, displayed: 1 });
+ }
+ },
+ redisplay: function(id) {
+ // Repopulate HTML select box from cache
+ var box = document.getElementById(id);
+ box.options.length = 0; // clear all options
+ for (var i = 0, j = SelectBox.cache[id].length; i < j; i++) {
+ var node = SelectBox.cache[id][i];
+ if (node.displayed) {
+ box.options[box.options.length] = new Option(node.text, node.value, false, false);
+ }
+ }
+ },
+ filter: function(id, text) {
+ // Redisplay the HTML select box, displaying only the choices containing ALL
+ // the words in text. (It's an AND search.)
+ var tokens = text.toLowerCase().split(/\s+/);
+ var node, token;
+ for (var i = 0; (node = SelectBox.cache[id][i]); i++) {
+ node.displayed = 1;
+ for (var j = 0; (token = tokens[j]); j++) {
+ if (node.text.toLowerCase().indexOf(token) == -1) {
+ node.displayed = 0;
+ }
+ }
+ }
+ SelectBox.redisplay(id);
+ },
+ delete_from_cache: function(id, value) {
+ var node, delete_index = null;
+ for (var i = 0; (node = SelectBox.cache[id][i]); i++) {
+ if (node.value == value) {
+ delete_index = i;
+ break;
+ }
+ }
+ var j = SelectBox.cache[id].length - 1;
+ for (var i = delete_index; i < j; i++) {
+ SelectBox.cache[id][i] = SelectBox.cache[id][i+1];
+ }
+ SelectBox.cache[id].length--;
+ },
+ add_to_cache: function(id, option) {
+ SelectBox.cache[id].push({ value: option.value, text: option.text, displayed: 1 });
+// SelectBox.sort(id) // Commented out for performance. Can this be deleted?
+ },
+ cache_contains: function(id, value) {
+ // Check if an item is contained in the cache
+ var node;
+ for (var i = 0; (node = SelectBox.cache[id][i]); i++) {
+ if (node.value == value) {
+ return true;
+ }
+ }
+ return false;
+ },
+ move: function(from, to) {
+ var from_box = document.getElementById(from);
+ var to_box = document.getElementById(to);
+ var option;
+ for (var i = 0; (option = from_box.options[i]); i++) {
+ if (option.selected && SelectBox.cache_contains(from, option.value)) {
+ SelectBox.add_to_cache(to, { value: option.value, text: option.text, displayed: 1 });
+ SelectBox.delete_from_cache(from, option.value);
+ }
+ }
+ SelectBox.redisplay(from);
+ SelectBox.redisplay(to);
+ },
+ move_all: function(from, to) {
+ var from_box = document.getElementById(from);
+ var to_box = document.getElementById(to);
+ var option;
+ for (var i = 0; (option = from_box.options[i]); i++) {
+ SelectBox.add_to_cache(to, { value: option.value, text: option.text, displayed: 1 });
+ SelectBox.delete_from_cache(from, option.value);
+ }
+ SelectBox.redisplay(from);
+ SelectBox.redisplay(to);
+ },
+ sort: function(id) {
+ SelectBox.cache[id].sort( function(a, b) {
+ a = a.text.toLowerCase();
+ b = b.text.toLowerCase();
+ try {
+ if (a > b) return 1;
+ if (a < b) return -1;
+ }
+ catch (e) {
+ // silently fail on IE 'unknown' exception
+ }
+ return 0;
+ } );
+ },
+ select_all: function(id) {
+ var box = document.getElementById(id);
+ for (var i = 0; i < box.options.length; i++) {
+ box.options[i].selected = 'selected';
+ }
+ }
+}
View
@@ -0,0 +1,81 @@
+/*
+SelectFilter - Turns a multiple-select box into a filter interface.
+
+Requires SelectBox.js and addevent.js.
+*/
+
+function findForm(node) {
+ // returns the node of the form containing the given node
+ if (node.tagName.toLowerCase() != 'form') {
+ return findForm(node.parentNode);
+ }
+ return node;
+}
+
+var SelectFilter = {
+ init: function(field_id) {
+ var from_box = document.getElementById(field_id);
+ from_box.id += '_from'; // change its ID
+ // Create the INPUT input box
+ var input_box = document.createElement('input');
+ input_box.id = field_id + '_input';
+ input_box.setAttribute('type', 'text');
+ from_box.parentNode.insertBefore(input_box, from_box);
+ from_box.parentNode.insertBefore(document.createElement('br'), input_box.nextSibling);
+ // Create the TO box
+ var to_box = document.createElement('select');
+ to_box.id = field_id + '_to';
+ to_box.setAttribute('multiple', 'multiple');
+ to_box.setAttribute('size', from_box.size);
+ from_box.parentNode.insertBefore(to_box, from_box.nextSibling);
+ to_box.setAttribute('name', from_box.getAttribute('name'));
+ from_box.setAttribute('name', from_box.getAttribute('name') + '_old');
+ // Give the filters a CSS hook
+ from_box.setAttribute('class', 'filtered');
+ to_box.setAttribute('class', 'filtered');
+ // Set up the JavaScript event handlers for the select box filter interface
+ addEvent(input_box, 'keyup', function(e) { SelectFilter.filter_key_up(e, field_id); });
+ addEvent(input_box, 'keydown', function(e) { SelectFilter.filter_key_down(e, field_id); });
+ addEvent(from_box, 'dblclick', function() { SelectBox.move(field_id + '_from', field_id + '_to'); });
+ addEvent(from_box, 'focus', function() { input_box.focus(); });
+ addEvent(to_box, 'dblclick', function() { SelectBox.move(field_id + '_to', field_id + '_from'); });
+ 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');
+ },
+ filter_key_up: function(event, field_id) {
+ 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;
+ return false;
+ }
+ 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) {
+ 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;
+ }
+}
View
@@ -0,0 +1,129 @@
+/*
+SelectFilter2 - Turns a multiple-select box into a filter interface.
+
+Different than SelectFilter because this is coupled to the admin framework.
+
+Requires SelectBox.js and addevent.js.
+*/
+
+// quickElement(tagType, parentReference, textInChildNode, [, attribute, attributeValue ...]);
+function quickElement() {
+ var obj = document.createElement(arguments[0]);
+ if (arguments[2] != '' && arguments[2] != null) {
+ var textNode = document.createTextNode(arguments[2]);
+ obj.appendChild(textNode);
+ }
+ var len = arguments.length;
+ for (var i = 3; i < len; i += 2) {
+ obj.setAttribute(arguments[i], arguments[i+1]);
+ }
+ arguments[1].appendChild(obj);
+ return obj;
+}
+
+function findForm(node) {
+ // returns the node of the form containing the given node
+ if (node.tagName.toLowerCase() != 'form') {
+ return findForm(node.parentNode);
+ }
+ return node;
+}
+
+var SelectFilter = {
+ init: function(field_id, field_name, is_stacked) {
+ var from_box = document.getElementById(field_id);
+ from_box.id += '_from'; // change its ID
+ from_box.className = 'filtered';
+
+ // Remove <p class="info">, because it just gets in the way.
+ var ps = from_box.parentNode.getElementsByTagName('p');
+ for (var i=0; i<ps.length; i++) {
+ from_box.parentNode.removeChild(ps[i]);
+ }
+
+ // <div class="selector"> or <div class="selector stacked">
+ var selector_div = quickElement('div', from_box.parentNode);
+ selector_div.className = is_stacked ? 'selector stacked' : 'selector';
+
+ // <div class="selector-available">
+ var selector_available = quickElement('div', selector_div, '');
+ selector_available.className = 'selector-available';
+ quickElement('h2', selector_available, 'Available ' + field_name);
+ var filter_p = quickElement('p', selector_available, '');
+ filter_p.className = 'selector-filter';
+ quickElement('img', filter_p, '', 'src', 'http://media.ljworld.com/img/admin/selector-search.gif');
+ filter_p.appendChild(document.createTextNode(' '));
+ var filter_input = quickElement('input', filter_p, '', 'type', 'text');
+ filter_input.id = field_id + '_input';
+ selector_available.appendChild(from_box);
+ var choose_all = quickElement('a', selector_available, 'Choose all', 'href', 'javascript: (function(){ SelectBox.move_all("' + field_id + '_from", "' + field_id + '_to"); })()');
+ choose_all.className = 'selector-chooseall';
+
+ // <ul class="selector-chooser">
+ var selector_chooser = quickElement('ul', selector_div, '');
+ selector_chooser.className = 'selector-chooser';
+ var add_link = quickElement('a', quickElement('li', selector_chooser, ''), 'Add', 'href', 'javascript: (function(){ SelectBox.move("' + field_id + '_from","' + field_id + '_to");})()');
+ add_link.className = 'selector-add';
+ var remove_link = quickElement('a', quickElement('li', selector_chooser, ''), 'Remove', 'href', 'javascript: (function(){ SelectBox.move("' + field_id + '_to","' + field_id + '_from");})()');
+ remove_link.className = 'selector-remove';
+
+ // <div class="selector-chosen">
+ var selector_chosen = quickElement('div', selector_div, '');
+ selector_chosen.className = 'selector-chosen';
+ quickElement('h2', selector_chosen, 'Chosen ' + field_name);
+ var selector_filter = quickElement('p', selector_chosen, 'Select your choice(s) and click ');
+ selector_filter.className = 'selector-filter';
+ quickElement('img', selector_filter, '', 'src', 'http://media.ljworld.com/img/admin/selector-add.gif', 'alt', 'Add');
+ 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, 'Clear all', 'href', 'javascript: (function() { SelectBox.move_all("' + field_id + '_to", "' + field_id + '_from");})()');
+ 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, '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, 'dblclick', function() { SelectBox.move(field_id + '_from', field_id + '_to'); });
+ addEvent(from_box, 'focus', function() { filter_input.focus(); });
+ addEvent(to_box, 'dblclick', function() { SelectBox.move(field_id + '_to', field_id + '_from'); });
+ 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');
+ },
+ filter_key_up: function(event, field_id) {
+ 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;
+ return false;
+ }
+ 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) {
+ 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;
+ }
+}
Oops, something went wrong.

0 comments on commit dd5320d

Please sign in to comment.