Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Removed admin_media/js/admin/add_calendars.js -- it wasn't being used

git-svn-id: http://code.djangoproject.com/svn/django/trunk@449 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 65f7e142e4fc9672591d4a4c8dbb065fb335d20f 1 parent e2426e6
Adrian Holovaty authored August 10, 2005
95  django/conf/admin_media/js/admin/add_calendars.js
... ...
@@ -1,95 +0,0 @@
1  
-// Finds all <input type="text" class="vDateField"> and inserts a calendar after them
2  
-
3  
-var AddCal = {
4  
-	cals: [],
5  
-	inps: [],
6  
-	divname1: 'calendarbox', // name of <div> that gets toggled
7  
-	divname2: 'calendarin',  // name of <div> that contains calendar
8  
-	init: function() {
9  
-		var inputs = document.getElementsByTagName('input');
10  
-		for (var i=0; i < inputs.length; i++) {
11  
-			var inp = inputs[i];
12  
-			if (inp.getAttribute('type') == 'text' && inp.className.match(/vDateField/)) {
13  
-				var num = AddCal.cals.length;
14  
-
15  
-				AddCal.inps[num] = inp;
16  
-
17  
-				// <a href="javascript:AddCal.toggle()">Calendar</a>
18  
-				var cal_link = document.createElement('a');
19  
-				cal_link.setAttribute('href', 'javascript:AddCal.toggle(' + num + ');');
20  
-				quickElement('img', cal_link, '', 'src', 'http://media.ljworld.com/img/admin/icon_calendar.gif', 'alt', 'Calendar');
21  
-				inp.parentNode.insertBefore(cal_link, inp.nextSibling);
22  
-
23  
-				// Markup looks like:
24  
-				//
25  
-				// <div id="calendarbox3" class="calendarbox module">
26  
-				//     <h2>
27  
-				//           <a href="#" class="link-previous">&lsaquo;</a>
28  
-				//           <a href="#" class="link-next">&rsaquo;</a> February 2003
29  
-				//     </h2>
30  
-				//     <div class="calendar" id="calendarin3">
31  
-				//         <!-- (cal) -->
32  
-				//     </div>
33  
-				//     <div class="calendar-shortcuts">
34  
-				//          <a href="#">Yesterday</a> | <a href="#">Today</a> | <a href="#">Tomorrow</a>
35  
-				//     </div>
36  
-				//     <p class="calendar-cancel"><a href="#">Cancel</a></p>
37  
-				// </div>
38  
-				var cal_box = document.createElement('div');
39  
-				cal_box.style.display = 'none';
40  
-				cal_box.style.position = 'absolute';
41  
-				cal_box.style.left = findPosX(cal_link) + 17 + 'px';
42  
-				cal_box.style.top = findPosY(cal_link) - 75 + 'px';
43  
-				cal_box.className = 'calendarbox module';
44  
-				cal_box.setAttribute('id', AddCal.divname1 + num);
45  
-
46  
-				// next-prev links
47  
-				var cal_nav = quickElement('div', cal_box, '');
48  
-				quickElement('a', cal_nav, '<', 'class', 'calendarnav-previous', 'href', 'javascript:AddCal.drawPrev('+num+');');
49  
-				quickElement('a', cal_nav, '>', 'class', 'calendarnav-next',     'href', 'javascript:AddCal.drawNext('+num+');');
50  
-				cal_box.appendChild(cal_nav);
51  
-
52  
-				// main box
53  
-				var cal_main = quickElement('div', cal_box, '', 'id', AddCal.divname2 + num);
54  
-				cal_main.className = 'calendar';
55  
-				document.body.appendChild(cal_box);
56  
-				AddCal.cals[num] = new Calendar(AddCal.divname2 + num, AddCal.handleCallback(num));
57  
-				AddCal.cals[num].drawCurrent();
58  
-
59  
-				// calendar shortcuts
60  
-				var shortcuts = quickElement('div', cal_box, '', 'class', 'calendar-shortcuts');
61  
-				quickElement('a', shortcuts, 'Yesterday', 'href', 'javascript:AddCal.handleQuickLink(' + num + ', -1);');
62  
-				shortcuts.appendChild(document.createTextNode('\240|\240'));
63  
-				quickElement('a', shortcuts, 'Today', 'href', 'javascript:AddCal.handleQuickLink(' + num + ', 0);');
64  
-				shortcuts.appendChild(document.createTextNode('\240|\240'));
65  
-				quickElement('a', shortcuts, 'Tomorrow', 'href', 'javascript:AddCal.handleQuickLink(' + num + ', +1);');
66  
-
67  
-				// cancel bar
68  
-				var cancel_p = quickElement('p', cal_box, '', 'class', 'calendar-cancel');
69  
-				quickElement('a', cancel_p, 'Cancel', 'href', 'javascript:AddCal.toggle(' + num + ');');
70  
-
71  
-
72  
-			}
73  
-		}
74  
-	},
75  
-	toggle: function(num) {
76  
-		var box = document.getElementById(AddCal.divname1+num);
77  
-		box.style.display = (box.style.display == 'none') ? 'block' : 'none';
78  
-	},
79  
-	drawPrev: function(num) {
80  
-		AddCal.cals[num].drawPreviousMonth();
81  
-	},
82  
-	drawNext: function(num) {
83  
-		AddCal.cals[num].drawNextMonth();
84  
-	},
85  
-	handleCallback: function(num) {
86  
-		return "function(y, m, d) { AddCal.inps["+num+"].value = y+'-'+m+'-'+d; document.getElementById(AddCal.divname1+"+num+").style.display='none';}";
87  
-	},
88  
-	handleQuickLink: function(num, offset) {
89  
-		var d = new Date();
90  
-		d.setDate(d.getDate() + offset)
91  
-		AddCal.inps[num].value = d.getISODate();
92  
-		AddCal.toggle(num);
93  
-	}
94  
-}
95  
-addEvent(window, 'load', AddCal.init);

0 notes on commit 65f7e14

Please sign in to comment.
Something went wrong with that request. Please try again.