Not Reviewed
Show More
Add another comment
| @@ -11,7 +11,7 | |||
|
|
11 | 11 | // use. That means, you can include it in your product, or your web |
|
|
12 | 12 | // site, or any other form where the code is actually being used. You |
|
|
13 | 13 | // may not put the plain javascript up on your site for download or |
|
|
14 |
// include it in your javascript libraries for download. |
|
|
|
14 | // include it in your javascript libraries for download. | |
|
|
15 | 15 | // If you wish to share this code with others, please just point them |
|
|
16 | 16 | // to the URL instead. |
|
|
17 | 17 | // Please DO NOT link directly to my .js files from your site. Copy |
| @@ -21,7 +21,7 | |||
|
|
21 | 21 | |
|
|
22 | 22 | /* SOURCE FILE: AnchorPosition.js */ |
|
|
23 | 23 | |
|
|
24 |
/* |
|
|
|
24 | /* | |
|
|
25 | 25 | AnchorPosition.js |
|
|
26 | 26 | Author: Matt Kruse |
|
|
27 | 27 | Last modified: 10/11/02 |
| @@ -30,7 +30,7 DESCRIPTION: These functions find the position of an <A> tag in a document, | |||
|
|
30 | 30 | so other elements can be positioned relative to it. |
|
|
31 | 31 | |
|
|
32 | 32 | COMPATABILITY: Netscape 4.x,6.x,Mozilla, IE 5.x,6.x on Windows. Some small |
|
|
33 |
positioning errors - usually with Window positioning - occur on the |
|
|
|
33 | positioning errors - usually with Window positioning - occur on the | |
|
|
34 | 34 | Macintosh platform. |
|
|
35 | 35 | |
|
|
36 | 36 | FUNCTIONS: |
| @@ -44,16 +44,16 getAnchorWindowPosition(anchorname) | |||
|
|
44 | 44 | |
|
|
45 | 45 | NOTES: |
|
|
46 | 46 | |
|
|
47 |
1) For popping up separate browser windows, use getAnchorWindowPosition. |
|
|
|
47 | 1) For popping up separate browser windows, use getAnchorWindowPosition. | |
|
|
48 | 48 | Otherwise, use getAnchorPosition |
|
|
49 | 49 | |
|
|
50 |
2) Your anchor tag MUST contain both NAME and ID attributes which are the |
|
|
|
50 | 2) Your anchor tag MUST contain both NAME and ID attributes which are the | |
|
|
51 | 51 | same. For example: |
|
|
52 | 52 | <A NAME="test" ID="test"> </A> |
|
|
53 | 53 | |
|
|
54 |
3) There must be at least a space between <A> </A> for IE5.5 to see the |
|
|
|
54 | 3) There must be at least a space between <A> </A> for IE5.5 to see the | |
|
|
55 | 55 | anchor tag correctly. Do not do <A></A> with no space. |
|
|
56 |
*/ |
|
|
|
56 | */ | |
|
|
57 | 57 | |
|
|
58 | 58 | // getAnchorPosition(anchorname) |
|
|
59 | 59 | // This function returns an object having .x and .y properties which are the coordinates |
| @@ -139,7 +139,7 function AnchorPosition_getPageOffsetLeft (el) { | |||
|
|
139 | 139 | } |
|
|
140 | 140 | function AnchorPosition_getWindowOffsetLeft (el) { |
|
|
141 | 141 | return AnchorPosition_getPageOffsetLeft(el)-document.body.scrollLeft; |
|
|
142 |
} |
|
|
|
142 | } | |
|
|
143 | 143 | function AnchorPosition_getPageOffsetTop (el) { |
|
|
144 | 144 | var ot=el.offsetTop; |
|
|
145 | 145 | while((el=el.offsetParent) != null) { ot += el.offsetTop; } |
| @@ -156,14 +156,14 function AnchorPosition_getWindowOffsetTop (el) { | |||
|
|
156 | 156 | // May 17, 2003: Fixed bug in parseDate() for dates <1970 |
|
|
157 | 157 | // March 11, 2003: Added parseDate() function |
|
|
158 | 158 | // March 11, 2003: Added "NNN" formatting option. Doesn't match up |
|
|
159 |
// perfectly with SimpleDateFormat formats, but |
|
|
|
159 | // perfectly with SimpleDateFormat formats, but | |
|
|
160 | 160 | // backwards-compatability was required. |
|
|
161 | 161 | |
|
|
162 | 162 | // ------------------------------------------------------------------ |
|
|
163 |
// These functions use the same 'format' strings as the |
|
|
|
163 | // These functions use the same 'format' strings as the | |
|
|
164 | 164 | // java.text.SimpleDateFormat class, with minor exceptions. |
|
|
165 | 165 | // The format string consists of the following abbreviations: |
|
|
166 |
// |
|
|
|
166 | // | |
|
|
167 | 167 | // Field | Full Form | Short Form |
|
|
168 | 168 | // -------------+--------------------+----------------------- |
|
|
169 | 169 | // Year | yyyy (4 digits) | yy (2 digits), y (2 or 4 digits) |
| @@ -286,7 +286,7 function formatDate(date,format) { | |||
|
|
286 | 286 | } |
|
|
287 | 287 | return result; |
|
|
288 | 288 | } |
|
|
289 | ||
|
|
289 | ||
|
|
290 | 290 | // ------------------------------------------------------------------ |
|
|
291 | 291 | // Utility functions for parsing in getDateFromFormat() |
|
|
292 | 292 | // ------------------------------------------------------------------ |
| @@ -305,12 +305,12 function _getInt(str,i,minlength,maxlength) { | |||
|
|
305 | 305 | } |
|
|
306 | 306 | return null; |
|
|
307 | 307 | } |
|
|
308 | ||
|
|
308 | ||
|
|
309 | 309 | // ------------------------------------------------------------------ |
|
|
310 | 310 | // getDateFromFormat( date_string , format_string ) |
|
|
311 | 311 | // |
|
|
312 | 312 | // This function takes a date string and a format string. It matches |
|
|
313 |
// If the date string matches the format string, it returns the |
|
|
|
313 | // If the date string matches the format string, it returns the | |
|
|
314 | 314 | // getTime() of the date. If it does not match, it returns 0. |
|
|
315 | 315 | // ------------------------------------------------------------------ |
|
|
316 | 316 | function getDateFromFormat(val,format) { |
| @@ -330,7 +330,7 function getDateFromFormat(val,format) { | |||
|
|
330 | 330 | var mm=now.getMinutes(); |
|
|
331 | 331 | var ss=now.getSeconds(); |
|
|
332 | 332 | var ampm=""; |
|
|
333 | ||
|
|
333 | ||
|
|
334 | 334 | while (i_format < format.length) { |
|
|
335 | 335 | // Get next token from format string |
|
|
336 | 336 | c=format.charAt(i_format); |
| @@ -469,7 +469,7 function parseDate(val) { | |||
|
|
469 | 469 | |
|
|
470 | 470 | /* SOURCE FILE: PopupWindow.js */ |
|
|
471 | 471 | |
|
|
472 |
/* |
|
|
|
472 | /* | |
|
|
473 | 473 | PopupWindow.js |
|
|
474 | 474 | Author: Matt Kruse |
|
|
475 | 475 | Last modified: 02/16/04 |
| @@ -479,20 +479,20 in a certain place. The window can either be a DIV or a separate browser | |||
|
|
479 | 479 | window. |
|
|
480 | 480 | |
|
|
481 | 481 | COMPATABILITY: Works with Netscape 4.x, 6.x, IE 5.x on Windows. Some small |
|
|
482 |
positioning errors - usually with Window positioning - occur on the |
|
|
|
483 |
Macintosh platform. Due to bugs in Netscape 4.x, populating the popup |
|
|
|
482 | positioning errors - usually with Window positioning - occur on the | |
|
|
483 | Macintosh platform. Due to bugs in Netscape 4.x, populating the popup | |
|
|
484 | 484 | window with <STYLE> tags may cause errors. |
|
|
485 | 485 | |
|
|
486 | 486 | USAGE: |
|
|
487 | 487 | // Create an object for a WINDOW popup |
|
|
488 |
var win = new PopupWindow(); |
|
|
|
488 | var win = new PopupWindow(); | |
|
|
489 | 489 | |
|
|
490 | 490 | // Create an object for a DIV window using the DIV named 'mydiv' |
|
|
491 |
var win = new PopupWindow('mydiv'); |
|
|
|
491 | var win = new PopupWindow('mydiv'); | |
|
|
492 | 492 | |
|
|
493 |
// Set the window to automatically hide itself when the user clicks |
|
|
|
493 | // Set the window to automatically hide itself when the user clicks | |
|
|
494 | 494 | // anywhere else on the page except the popup |
|
|
495 |
win.autoHide(); |
|
|
|
495 | win.autoHide(); | |
|
|
496 | 496 | |
|
|
497 | 497 | // Show the window relative to the anchor name passed in |
|
|
498 | 498 | win.showPopup(anchorname); |
| @@ -503,7 +503,7 win.hidePopup(); | |||
|
|
503 | 503 | // Set the size of the popup window (only applies to WINDOW popups |
|
|
504 | 504 | win.setSize(width,height); |
|
|
505 | 505 | |
|
|
506 |
// Populate the contents of the popup window that will be shown. If you |
|
|
|
506 | // Populate the contents of the popup window that will be shown. If you | |
|
|
507 | 507 | // change the contents while it is displayed, you will need to refresh() |
|
|
508 | 508 | win.populate(string); |
|
|
509 | 509 | |
| @@ -523,18 +523,18 win.offsetY = 100; | |||
|
|
523 | 523 | NOTES: |
|
|
524 | 524 | 1) Requires the functions in AnchorPosition.js |
|
|
525 | 525 | |
|
|
526 |
2) Your anchor tag MUST contain both NAME and ID attributes which are the |
|
|
|
526 | 2) Your anchor tag MUST contain both NAME and ID attributes which are the | |
|
|
527 | 527 | same. For example: |
|
|
528 | 528 | <A NAME="test" ID="test"> </A> |
|
|
529 | 529 | |
|
|
530 |
3) There must be at least a space between <A> </A> for IE5.5 to see the |
|
|
|
530 | 3) There must be at least a space between <A> </A> for IE5.5 to see the | |
|
|
531 | 531 | anchor tag correctly. Do not do <A></A> with no space. |
|
|
532 | 532 | |
|
|
533 | 533 | 4) When a PopupWindow object is created, a handler for 'onmouseup' is |
|
|
534 | 534 | attached to any event handler you may have already defined. Do NOT define |
|
|
535 | 535 | an event handler for 'onmouseup' after you define a PopupWindow object or |
|
|
536 | 536 | the autoHide() will not work correctly. |
|
|
537 |
*/ |
|
|
|
537 | */ | |
|
|
538 | 538 | |
|
|
539 | 539 | // Set the position of the popup window based on the anchor |
|
|
540 | 540 | function PopupWindow_getXYPosition(anchorname) { |
| @@ -573,11 +573,11 function PopupWindow_refresh() { | |||
|
|
573 | 573 | if (this.use_gebi) { |
|
|
574 | 574 | document.getElementById(this.divName).innerHTML = this.contents; |
|
|
575 | 575 | } |
|
|
576 |
else if (this.use_css) { |
|
|
|
576 | else if (this.use_css) { | |
|
|
577 | 577 | document.all[this.divName].innerHTML = this.contents; |
|
|
578 | 578 | } |
|
|
579 |
else if (this.use_layers) { |
|
|
|
580 |
var d = document.layers[this.divName]; |
|
|
|
579 | else if (this.use_layers) { | |
|
|
580 | var d = document.layers[this.divName]; | |
|
|
581 | 581 | d.document.open(); |
|
|
582 | 582 | d.document.writeln(this.contents); |
|
|
583 | 583 | d.document.close(); |
| @@ -752,7 +752,7 function PopupWindow() { | |||
|
|
752 | 752 | this.populated = false; |
|
|
753 | 753 | this.visible = false; |
|
|
754 | 754 | this.autoHideEnabled = false; |
|
|
755 | ||
|
|
755 | ||
|
|
756 | 756 | this.contents = ""; |
|
|
757 | 757 | this.url=""; |
|
|
758 | 758 | this.windowProperties="toolbar=no,location=no,status=no,menubar=no,scrollbars=auto,resizable,alwaysRaised,dependent,titlebar=no"; |
| @@ -801,13 +801,13 function PopupWindow() { | |||
|
|
801 | 801 | // CSS prefix. |
|
|
802 | 802 | // August 19, 2003: Renamed the function to get styles, and made it |
|
|
803 | 803 | // work correctly without an object reference |
|
|
804 |
// August 18, 2003: Changed showYearNavigation and |
|
|
|
804 | // August 18, 2003: Changed showYearNavigation and | |
|
|
805 | 805 | // showYearNavigationInput to optionally take an argument of |
|
|
806 | 806 | // true or false |
|
|
807 | 807 | // July 31, 2003: Added text input option for year navigation. |
|
|
808 |
// Added a per-calendar CSS prefix option to optionally use |
|
|
|
808 | // Added a per-calendar CSS prefix option to optionally use | |
|
|
809 | 809 | // different styles for different calendars. |
|
|
810 |
// July 29, 2003: Fixed bug causing the Today link to be clickable |
|
|
|
810 | // July 29, 2003: Fixed bug causing the Today link to be clickable | |
|
|
811 | 811 | // even though today falls in a disabled date range. |
|
|
812 | 812 | // Changed formatting to use pure CSS, allowing greater control |
|
|
813 | 813 | // over look-and-feel options. |
| @@ -815,35 +815,35 function PopupWindow() { | |||
|
|
815 | 815 | // under certain cases when some days of week are disabled |
|
|
816 | 816 | // March 14, 2003: Added ability to disable individual dates or date |
|
|
817 | 817 | // ranges, display as light gray and strike-through |
|
|
818 |
// March 14, 2003: Removed dependency on graypixel.gif and instead |
|
|
|
818 | // March 14, 2003: Removed dependency on graypixel.gif and instead | |
|
|
819 | 819 | /// use table border coloring |
|
|
820 | 820 | // March 12, 2003: Modified showCalendar() function to allow optional |
|
|
821 | 821 | // start-date parameter |
|
|
822 | 822 | // March 11, 2003: Modified select() function to allow optional |
|
|
823 | 823 | // start-date parameter |
|
|
824 |
/* |
|
|
|
824 | /* | |
|
|
825 | 825 | DESCRIPTION: This object implements a popup calendar to allow the user to |
|
|
826 | 826 | select a date, month, quarter, or year. |
|
|
827 | 827 | |
|
|
828 | 828 | COMPATABILITY: Works with Netscape 4.x, 6.x, IE 5.x on Windows. Some small |
|
|
829 |
positioning errors - usually with Window positioning - occur on the |
|
|
|
829 | positioning errors - usually with Window positioning - occur on the | |
|
|
830 | 830 | Macintosh platform. |
|
|
831 |
The calendar can be modified to work for any location in the world by |
|
|
|
831 | The calendar can be modified to work for any location in the world by | |
|
|
832 | 832 | changing which weekday is displayed as the first column, changing the month |
|
|
833 | 833 | names, and changing the column headers for each day. |
|
|
834 | 834 | |
|
|
835 | 835 | USAGE: |
|
|
836 | 836 | // Create a new CalendarPopup object of type WINDOW |
|
|
837 |
var cal = new CalendarPopup(); |
|
|
|
837 | var cal = new CalendarPopup(); | |
|
|
838 | 838 | |
|
|
839 | 839 | // Create a new CalendarPopup object of type DIV using the DIV named 'mydiv' |
|
|
840 |
var cal = new CalendarPopup('mydiv'); |
|
|
|
840 | var cal = new CalendarPopup('mydiv'); | |
|
|
841 | 841 | |
|
|
842 |
// Easy method to link the popup calendar with an input box. |
|
|
|
842 | // Easy method to link the popup calendar with an input box. | |
|
|
843 | 843 | cal.select(inputObject, anchorname, dateFormat); |
|
|
844 | 844 | // Same method, but passing a default date other than the field's current value |
|
|
845 | 845 | cal.select(inputObject, anchorname, dateFormat, '01/02/2000'); |
|
|
846 |
// This is an example call to the popup calendar from a link to populate an |
|
|
|
846 | // This is an example call to the popup calendar from a link to populate an | |
|
|
847 | 847 | // input box. Note that to use this, date.js must also be included!! |
|
|
848 | 848 | <A HREF="#" onClick="cal.select(document.forms[0].date,'anchorname','MM/dd/yyyy'); return false;">Select</A> |
|
|
849 | 849 | |
| @@ -880,7 +880,7 cal.showYearNavigation(); | |||
|
|
880 | 880 | // Show month and year dropdowns, for quicker selection of month of dates |
|
|
881 | 881 | cal.showNavigationDropdowns(); |
|
|
882 | 882 | |
|
|
883 |
// Set the text to be used above each day column. The days start with |
|
|
|
883 | // Set the text to be used above each day column. The days start with | |
|
|
884 | 884 | // sunday regardless of the value of WeekStartDay |
|
|
885 | 885 | cal.setDayHeaders("S","M","T",...); |
|
|
886 | 886 | |
| @@ -907,7 +907,7 cal.addDisabledDates("Jan 01, 2003", null); | |||
|
|
907 | 907 | // Pass two dates to disable all dates inbetween and including the two |
|
|
908 | 908 | cal.addDisabledDates("January 01, 2003", "Dec 31, 2003"); |
|
|
909 | 909 | |
|
|
910 |
// When the 'year' select is displayed, set the number of years back from the |
|
|
|
910 | // When the 'year' select is displayed, set the number of years back from the | |
|
|
911 | 911 | // current year to start listing years. Default is 2. |
|
|
912 | 912 | // This is also used for year drop-down, to decide how many years +/- to display |
|
|
913 | 913 | cal.setYearSelectStartOffset(2); |
| @@ -940,21 +940,21 cal.offsetY = 20; | |||
|
|
940 | 940 | NOTES: |
|
|
941 | 941 | 1) Requires the functions in AnchorPosition.js and PopupWindow.js |
|
|
942 | 942 | |
|
|
943 |
2) Your anchor tag MUST contain both NAME and ID attributes which are the |
|
|
|
943 | 2) Your anchor tag MUST contain both NAME and ID attributes which are the | |
|
|
944 | 944 | same. For example: |
|
|
945 | 945 | <A NAME="test" ID="test"> </A> |
|
|
946 | 946 | |
|
|
947 |
3) There must be at least a space between <A> </A> for IE5.5 to see the |
|
|
|
947 | 3) There must be at least a space between <A> </A> for IE5.5 to see the | |
|
|
948 | 948 | anchor tag correctly. Do not do <A></A> with no space. |
|
|
949 | 949 | |
|
|
950 | 950 | 4) When a CalendarPopup object is created, a handler for 'onmouseup' is |
|
|
951 | 951 | attached to any event handler you may have already defined. Do NOT define |
|
|
952 |
an event handler for 'onmouseup' after you define a CalendarPopup object |
|
|
|
952 | an event handler for 'onmouseup' after you define a CalendarPopup object | |
|
|
953 | 953 | or the autoHide() will not work correctly. |
|
|
954 | ||
|
|
954 | ||
|
|
955 | 955 | 5) The calendar popup display uses style sheets to make it look nice. |
|
|
956 | 956 | |
|
|
957 |
*/ |
|
|
|
957 | */ | |
|
|
958 | 958 | |
|
|
959 | 959 | // Quick fix for FF3 |
|
|
960 | 960 | function CP_stop(e) { if (e && e.stopPropagation) { e.stopPropagation(); } } |
| @@ -1024,7 +1024,7 function CalendarPopup() { | |||
|
|
1024 | 1024 | return c; |
|
|
1025 | 1025 | } |
|
|
1026 | 1026 | function CP_copyMonthNamesToWindow() { |
|
|
1027 |
// Copy these values over to the date.js |
|
|
|
1027 | // Copy these values over to the date.js | |
|
|
1028 | 1028 | if (typeof(window.MONTH_NAMES)!="undefined" && window.MONTH_NAMES!=null) { |
|
|
1029 | 1029 | window.MONTH_NAMES = new Array(); |
|
|
1030 | 1030 | for (var i=0; i<this.monthNames.length; i++) { |
| @@ -1036,24 +1036,24 function CP_copyMonthNamesToWindow() { | |||
|
|
1036 | 1036 | } |
|
|
1037 | 1037 | } |
|
|
1038 | 1038 | // Temporary default functions to be called when items clicked, so no error is thrown |
|
|
1039 |
function CP_tmpReturnFunction(y,m,d) { |
|
|
|
1039 | function CP_tmpReturnFunction(y,m,d) { | |
|
|
1040 | 1040 | if (window.CP_targetInput!=null) { |
|
|
1041 | 1041 | var dt = new Date(y,m-1,d,0,0,0); |
|
|
1042 | 1042 | if (window.CP_calendarObject!=null) { window.CP_calendarObject.copyMonthNamesToWindow(); } |
|
|
1043 | 1043 | window.CP_targetInput.value = formatDate(dt,window.CP_dateFormat); |
|
|
1044 | 1044 | } |
|
|
1045 | 1045 | else { |
|
|
1046 |
alert('Use setReturnFunction() to define which function will get the clicked results!'); |
|
|
|
1046 | alert('Use setReturnFunction() to define which function will get the clicked results!'); | |
|
|
1047 | 1047 | } |
|
|
1048 | 1048 | } |
|
|
1049 |
function CP_tmpReturnMonthFunction(y,m) { |
|
|
|
1050 |
alert('Use setReturnMonthFunction() to define which function will get the clicked results!\nYou clicked: year='+y+' , month='+m); |
|
|
|
1049 | function CP_tmpReturnMonthFunction(y,m) { | |
|
|
1050 | alert('Use setReturnMonthFunction() to define which function will get the clicked results!\nYou clicked: year='+y+' , month='+m); | |
|
|
1051 | 1051 | } |
|
|
1052 |
function CP_tmpReturnQuarterFunction(y,q) { |
|
|
|
1053 |
alert('Use setReturnQuarterFunction() to define which function will get the clicked results!\nYou clicked: year='+y+' , quarter='+q); |
|
|
|
1052 | function CP_tmpReturnQuarterFunction(y,q) { | |
|
|
1053 | alert('Use setReturnQuarterFunction() to define which function will get the clicked results!\nYou clicked: year='+y+' , quarter='+q); | |
|
|
1054 | 1054 | } |
|
|
1055 |
function CP_tmpReturnYearFunction(y) { |
|
|
|
1056 |
alert('Use setReturnYearFunction() to define which function will get the clicked results!\nYou clicked: year='+y); |
|
|
|
1055 | function CP_tmpReturnYearFunction(y) { | |
|
|
1056 | alert('Use setReturnYearFunction() to define which function will get the clicked results!\nYou clicked: year='+y); | |
|
|
1057 | 1057 | } |
|
|
1058 | 1058 | |
|
|
1059 | 1059 | // Set the name of the functions to call to get the clicked item |
| @@ -1100,7 +1100,7 function CP_setDisabledWeekDays() { | |||
|
|
1100 | 1100 | this.disabledWeekDays = new Object(); |
|
|
1101 | 1101 | for (var i=0; i<arguments.length; i++) { this.disabledWeekDays[arguments[i]] = true; } |
|
|
1102 | 1102 | } |
|
|
1103 | ||
|
|
1103 | ||
|
|
1104 | 1104 | // Disable individual dates or ranges |
|
|
1105 | 1105 | // Builds an internal logical test which is run via eval() for efficiency |
|
|
1106 | 1106 | function CP_addDisabledDates(start, end) { |
| @@ -1113,15 +1113,15 function CP_addDisabledDates(start, end) { | |||
|
|
1113 | 1113 | else if (end ==null) { this.disabledDatesExpression+="(ds>="+start+")"; } |
|
|
1114 | 1114 | else { this.disabledDatesExpression+="(ds>="+start+"&&ds<="+end+")"; } |
|
|
1115 | 1115 | } |
|
|
1116 | ||
|
|
1116 | ||
|
|
1117 | 1117 | // Set the text to use for the "Today" link |
|
|
1118 | 1118 | function CP_setTodayText(text) { |
|
|
1119 | 1119 | this.todayText = text; |
|
|
1120 | 1120 | } |
|
|
1121 | 1121 | |
|
|
1122 | 1122 | // Set the prefix to be added to all CSS classes when writing output |
|
|
1123 |
function CP_setCssPrefix(val) { |
|
|
|
1124 |
this.cssPrefix = val; |
|
|
|
1123 | function CP_setCssPrefix(val) { | |
|
|
1124 | this.cssPrefix = val; | |
|
|
1125 | 1125 | } |
|
|
1126 | 1126 | |
|
|
1127 | 1127 | // Show the navigation as an dropdowns that can be manually changed |
| @@ -1139,7 +1139,7 function CP_hideCalendar() { | |||
|
|
1139 | 1139 | // Refresh the contents of the calendar display |
|
|
1140 | 1140 | function CP_refreshCalendar(index) { |
|
|
1141 | 1141 | var calObject = window.popupWindowObjects[index]; |
|
|
1142 |
if (arguments.length>1) { |
|
|
|
1142 | if (arguments.length>1) { | |
|
|
1143 | 1143 | calObject.populate(calObject.getCalendar(arguments[1],arguments[2],arguments[3],arguments[4],arguments[5])); |
|
|
1144 | 1144 | } |
|
|
1145 | 1145 | else { |
| @@ -1173,8 +1173,8 function CP_select(inputobj, linkname, format) { | |||
|
|
1173 | 1173 | alert("calendar.select: This function can only be used with displayType 'date' or 'week-end'"); |
|
|
1174 | 1174 | return; |
|
|
1175 | 1175 | } |
|
|
1176 |
if (inputobj.type!="text" && inputobj.type!="hidden" && inputobj.type!="textarea") { |
|
|
|
1177 |
alert("calendar.select: Input object passed is not a valid form input object"); |
|
|
|
1176 | if (inputobj.type!="text" && inputobj.type!="hidden" && inputobj.type!="textarea") { | |
|
|
1177 | alert("calendar.select: Input object passed is not a valid form input object"); | |
|
|
1178 | 1178 | window.CP_targetInput=null; |
|
|
1179 | 1179 | return; |
|
|
1180 | 1180 | } |
| @@ -1196,7 +1196,7 function CP_select(inputobj, linkname, format) { | |||
|
|
1196 | 1196 | window.CP_dateFormat = format; |
|
|
1197 | 1197 | this.showCalendar(linkname); |
|
|
1198 | 1198 | } |
|
|
1199 | ||
|
|
1199 | ||
|
|
1200 | 1200 | // Get style block needed to display the calendar correctly |
|
|
1201 | 1201 | function getCalendarStyles() { |
|
|
1202 | 1202 | var result = ""; |
| @@ -1256,7 +1256,7 function CP_getCalendar() { | |||
|
|
1256 | 1256 | var display_date = 1; |
|
|
1257 | 1257 | var weekday= current_month.getDay(); |
|
|
1258 | 1258 | var offset = 0; |
|
|
1259 | ||
|
|
1259 | ||
|
|
1260 | 1260 | offset = (weekday >= this.weekStartDay) ? weekday-this.weekStartDay : 7-this.weekStartDay+weekday ; |
|
|
1261 | 1261 | if (offset > 0) { |
|
|
1262 | 1262 | display_month--; |
| @@ -1393,7 +1393,7 function CP_getCalendar() { | |||
|
|
1393 | 1393 | // ------------------------------------ |
|
|
1394 | 1394 | if (this.displayType=="month" || this.displayType=="quarter" || this.displayType=="year") { |
|
|
1395 | 1395 | if (arguments.length > 0) { var year = arguments[0]; } |
|
|
1396 |
else { |
|
|
|
1396 | else { | |
|
|
1397 | 1397 | if (this.displayType=="year") { var year = now.getFullYear()-this.yearSelectStartOffset; } |
|
|
1398 | 1398 | else { var year = now.getFullYear(); } |
|
|
1399 | 1399 | } |
| @@ -1406,8 +1406,8 function CP_getCalendar() { | |||
|
|
1406 | 1406 | result += '</TR></TABLE>\n'; |
|
|
1407 | 1407 | } |
|
|
1408 | 1408 | } |
|
|
1409 | ||
|
|
1410 |
// Code for MONTH display |
|
|
|
1409 | ||
|
|
1410 | // Code for MONTH display | |
|
|
1411 | 1411 | // ---------------------- |
|
|
1412 | 1412 | if (this.displayType=="month") { |
|
|
1413 | 1413 | // If POPUP, write entire HTML document |
| @@ -1422,7 +1422,7 function CP_getCalendar() { | |||
|
|
1422 | 1422 | } |
|
|
1423 | 1423 | result += '</TABLE></CENTER></TD></TR></TABLE>\n'; |
|
|
1424 | 1424 | } |
|
|
1425 | ||
|
|
1425 | ||
|
|
1426 | 1426 | // Code for QUARTER display |
|
|
1427 | 1427 | // ------------------------ |
|
|
1428 | 1428 | if (this.displayType=="quarter") { |
| @@ -23,4 +23,4 if($victim) | |||
|
|
23 | 23 | adminlog("Tweet $victim deleted.", MTS_TWITTER, MTA_DELETE); |
|
|
24 | 24 | _redirect( ADMIN_PATH . '/character-twitter.php?deleted=success' ); |
|
|
25 | 25 | |
|
|
26 | ?> No newline at end of file | |
|
|
26 | ?> | |
| @@ -23,4 +23,4 if($victim) | |||
|
|
23 | 23 | adminlog("Twitter $victim deleted.", MTS_TWITTER, MTA_DELETE); |
|
|
24 | 24 | _redirect( ADMIN_PATH . '/manage-twitter-users.php?deleted=success' ); |
|
|
25 | 25 | |
|
|
26 | ?> No newline at end of file | |
|
|
26 | ?> | |
| @@ -27,7 +27,7 adminmenu('manage-metatypes.php'); | |||
|
|
27 | 27 | <td width="66%"><input name="name" type="text" id="name" value="<?php echo htmlentities($type->name); ?>" /></td> |
|
|
28 | 28 | </tr> |
|
|
29 | 29 | </table> |
|
|
30 | ||
|
|
30 | ||
|
|
31 | 31 | <p class="submit"><input type="submit" value="Save »" name="submit" /></p> |
|
|
32 | 32 | |
|
|
33 | 33 | </div> |
| @@ -23,10 +23,10 if( $_POST ) { | |||
|
|
23 | 23 | } |
|
|
24 | 24 | |
|
|
25 | 25 | $action = isset($_POST['publish']) ? 'post' : 'edit'; |
|
|
26 | ||
|
|
26 | ||
|
|
27 | 27 | if( isset( $_POST['publish'] ) ) $page->status = 'published'; // If [publish] button is used, ignore radio button |
|
|
28 | 28 | |
|
|
29 | ||
|
|
29 | ||
|
|
30 | 30 | switch( $_POST['action'] ) { |
|
|
31 | 31 | case 'new_page': |
|
|
32 | 32 | check_nonce('new-page'); |
| @@ -36,14 +36,14 if( $_POST ) { | |||
|
|
36 | 36 | mtdie('There was an error inserting the page into the database.', 'SQL Error'); |
|
|
37 | 37 | } |
|
|
38 | 38 | break; |
|
|
39 | ||
|
|
39 | ||
|
|
40 | 40 | case 'savepage': |
|
|
41 | 41 | check_nonce('save-page-' . $page->url_name); |
|
|
42 | 42 | updatepage($page); |
|
|
43 | 43 | break; |
|
|
44 | 44 | } |
|
|
45 | 45 | if( $upload_info ) $info.=$upload_info; |
|
|
46 |
if( $upload_error ) $error.=$upload_error; |
|
|
|
46 | if( $upload_error ) $error.=$upload_error; | |
|
|
47 | 47 | if( $error ) $action='edit'; |
|
|
48 | 48 | |
|
|
49 | 49 | if( 'post' == $action ) _redirect( ADMIN_PATH . '/manage-pages.php?saved=success' ); |
| @@ -41,7 +41,7 adminmenu('manage-types.php'); | |||
|
|
41 | 41 | ?></td> |
|
|
42 | 42 | </tr> |
|
|
43 | 43 | </table> |
|
|
44 | ||
|
|
44 | ||
|
|
45 | 45 | <p class="submit"><input type="submit" value="Save »" name="submit" /></p> |
|
|
46 | 46 | |
|
|
47 | 47 | </div> |
| @@ -39,7 +39,7 $submenu['manage-comics.php'] = array( | |||
|
|
39 | 39 | 'manage-rants.php' => 'Rants' , |
|
|
40 | 40 | 'manage-pages.php' => 'Pages', |
|
|
41 | 41 | 'manage-types.php' => 'Types', |
|
|
42 |
'manage-twitter-users.php' => ' |
|
|
|
42 | 'manage-twitter-users.php' => 'Twitter Users', | |
|
|
43 | 43 | 'manage-metatypes.php' => 'Metatypes', |
|
|
44 | 44 | 'swap-comics.php' => 'Swap Comics', |
|
|
45 | 45 | 'character-twitter.php' => 'Character Twitters', |
| @@ -26,7 +26,7 function human_time_diff( $from, $to = '' ) { | |||
|
|
26 | 26 | $days = 1; |
|
|
27 | 27 | } |
|
|
28 | 28 | $since = sprintf( $days == 1 ? '%s day' : '%s days', $days); |
|
|
29 |
} else { |
|
|
|
29 | } else { | |
|
|
30 | 30 | $weeks = round($diff / 604800); |
|
|
31 | 31 | if( $weeks <= 1) { |
|
|
32 | 32 | $weeks = 1; |
| @@ -57,7 +57,7 adminmenu(); | |||
|
|
57 | 57 | ?> |
|
|
58 | 58 | </ul> |
|
|
59 | 59 | <p style="padding-bottom:1em;"><input type="text" name="message" /><input type="submit" value="Send" /></p> |
|
|
60 | ||
|
|
60 | ||
|
|
61 | 61 | </form><br> |
|
|
62 | 62 | |
|
|
63 | 63 | <h2>Recent Strips</h2> |
| @@ -2,7 +2,7 | |||
|
|
2 | 2 | |
|
|
3 | 3 | require_once('include/admin.inc.php'); |
|
|
4 | 4 | |
|
|
5 |
/* Megatokyo admin system assumes that everyone has equivilent |
|
|
|
5 | /* Megatokyo admin system assumes that everyone has equivilent | |
|
|
6 | 6 | ability to create and alter content. There are no permission |
|
|
7 | 7 | levels or access controls other than "Can they login?" */ |
|
|
8 | 8 | |
| @@ -16,7 +16,7 switch( $_REQUEST['action'] ) { | |||
|
|
16 | 16 | case 'login': |
|
|
17 | 17 | $log = $_POST['log']; |
|
|
18 | 18 | $pwd = $_POST['pwd']; |
|
|
19 | ||
|
|
19 | ||
|
|
20 | 20 | if( mt_login( $log, $pwd )) { |
|
|
21 | 21 | //logthis ( "AUTH: Successful login from $log at " . $_SERVER["REMOTE_ADDR"], false ); |
|
|
22 | 22 | adminlog("User ".$log." has logged in from ".$_SERVER['REMOTE_ADDR'], MTS_LOGIN, MTA_CHANGE); |
| @@ -28,17 +28,17 switch( $_REQUEST['action'] ) { | |||
|
|
28 | 28 | } else { |
|
|
29 | 29 | //logthis ('AUTH: Failed login attempt from ' . $_SERVER["REMOTE_ADDR"], var_export( $_REQUEST, true ) ); |
|
|
30 | 30 | } |
|
|
31 |
// incorrect username or password, fall through to error display |
|
|
|
32 | ||
|
|
31 | // incorrect username or password, fall through to error display | |
|
|
32 | ||
|
|
33 | 33 | case 'error': |
|
|
34 | 34 | default: |
|
|
35 | ||
|
|
35 | ||
|
|
36 | 36 | if ( !empty($_COOKIE[USER_COOKIE]) && mt_login($_COOKIE[USER_COOKIE], $_COOKIE[PASS_COOKIE], true) ) { |
|
|
37 | 37 | // Already logged in, redirect to admin dashboard. |
|
|
38 | 38 | nocache_headers(); |
|
|
39 | 39 | _redirect( ADMIN_PATH .'/' ); |
|
|
40 | 40 | } |
|
|
41 | ||
|
|
41 | ||
|
|
42 | 42 | if( $_GET['loggedout'] == true ) $error.='<p>Successfully logged you out.</p>'; |
|
|
43 | 43 | ?> |
|
|
44 | 44 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| @@ -81,16 +81,16 switch( $_REQUEST['action'] ) { | |||
|
|
81 | 81 | <input type="hidden" name="action" value="login" /> |
|
|
82 | 82 | </p> |
|
|
83 | 83 | </form></div> |
|
|
84 | ||
|
|
84 | ||
|
|
85 | 85 | <ul> |
|
|
86 | 86 | <li><a href="<?php echo SITE_HOST.SITE_PATH; ?>" title="Return to the public Megatokyo website.">Back to Megatokyo Website</a></li> |
|
|
87 | 87 | </ul> |
|
|
88 | ||
|
|
88 | ||
|
|
89 | 89 | </body> |
|
|
90 | 90 | </html> |
|
|
91 | 91 | <?php |
|
|
92 | 92 | die(); |
|
|
93 | ||
|
|
93 | ||
|
|
94 | 94 | } // end switch |
|
|
95 | 95 | |
|
|
96 | 96 | |
| @@ -18,7 +18,7 if(isset($_REQUEST['next']) && $_REQUEST['next'] == "yes") | |||
|
|
18 | 18 | //in general, this is the case that is desired |
|
|
19 | 19 | // the next monday, wednesday, or friday that isn't today |
|
|
20 | 20 | $post_date = min( strtotime("next Monday +1 hour", $tomorrow), strtotime("next Wednesday +1 hour", $tomorrow), strtotime("next Friday +1 hour", $tomorrow) ); |
|
|
21 | ||
|
|
21 | ||
|
|
22 | 22 | //however, if it is monday, wednesday, or friday AND before 1 AM |
|
|
23 | 23 | // then we want to post at 1 AM on this day |
|
|
24 | 24 | $today = date("l"); |
| @@ -64,7 +64,7 tinyMCE.init({ | |||
|
|
64 | 64 | |
|
|
65 | 65 | <fieldset id="postdivrich"> |
|
|
66 | 66 | <legend>Page</legend> |
|
|
67 | ||
|
|
67 | ||
|
|
68 | 68 | <style type="text/css"> |
|
|
69 | 69 | #postdivrich table, #postdivrich #quicktags {border-top: none;} |
|
|
70 | 70 | #quicktags {border-bottom: none; padding-bottom: 2px; margin-bottom: -1px;} |
| @@ -85,7 +85,7 tinyMCE.init({ | |||
|
|
85 | 85 | |
|
|
86 | 86 | <fieldset id="cssdivrich"> |
|
|
87 | 87 | <legend>Optional CSS</legend> |
|
|
88 | ||
|
|
88 | ||
|
|
89 | 89 | <style type="text/css"> |
|
|
90 | 90 | #postdivrich table, #postdivrich #quicktags {border-top: none;} |
|
|
91 | 91 | #quicktags {border-bottom: none; padding-bottom: 2px; margin-bottom: -1px;} |
| @@ -59,7 +59,7 tinyMCE.init({ | |||
|
|
59 | 59 | <?php |
|
|
60 | 60 | // What side does this author usually post on? |
|
|
61 | 61 | $usual = $mtdb->getOne( 'SELECT side,count(*) c FROM rant WHERE author=' . (int)$currentuser->id . ' GROUP BY side ORDER BY c DESC limit 1' ); |
|
|
62 | ||
|
|
62 | ||
|
|
63 | 63 | $sides = array('left'=>'Left','right'=>'Right'); |
|
|
64 | 64 | foreach( $sides as $k=>$v ) { |
|
|
65 | 65 | printf('<option value="%s" %s>%s</option>', htmlentities($k), ($usual == $k ? 'selected="selected"' : '' ), $v ); |
| @@ -69,7 +69,7 tinyMCE.init({ | |||
|
|
69 | 69 | </fieldset> |
|
|
70 | 70 | |
|
|
71 | 71 | <fieldset id="authordiv" class="dbx-box"> |
|
|
72 |
<h3 class="dbx-handle">Author</h3> |
|
|
|
72 | <h3 class="dbx-handle">Author</h3> | |
|
|
73 | 73 | <div class="dbx-content"><select name="rant_author"><?php |
|
|
74 | 74 | $contrib = $mtdb->getAll('select id,name from contributor'); |
|
|
75 | 75 | foreach( $contrib as $k=>$v ) { |
| @@ -106,7 +106,7 tinyMCE.init({ | |||
|
|
106 | 106 | |
|
|
107 | 107 | <fieldset id="postdivrich"> |
|
|
108 | 108 | <legend>Post</legend> |
|
|
109 | ||
|
|
109 | ||
|
|
110 | 110 | <style type="text/css"> |
|
|
111 | 111 | #postdivrich table, #postdivrich #quicktags {border-top: none;} |
|
|
112 | 112 | #quicktags {border-bottom: none; padding-bottom: 2px; margin-bottom: -1px;} |
| @@ -114,7 +114,7 tinyMCE.init({ | |||
|
|
114 | 114 | </style> |
|
|
115 | 115 | <div><textarea class="mceEditor" rows="13" cols="40" name="content" tabindex="3" id="content"></textarea></div> |
|
|
116 | 116 | |
|
|
117 | ||
|
|
117 | ||
|
|
118 | 118 | <?php |
|
|
119 | 119 | /* |
|
|
120 | 120 | include("include/fckeditor/fckeditor_php4.php"); |
| @@ -124,9 +124,9 tinyMCE.init({ | |||
|
|
124 | 124 | $oFCKeditor->Create(); |
|
|
125 | 125 | */ |
|
|
126 | 126 | ?> |
|
|
127 | ||
|
|
128 | ||
|
|
129 | ||
|
|
127 | ||
|
|
128 | ||
|
|
129 | ||
|
|
130 | 130 | </fieldset> |
|
|
131 | 131 | |
|
|
132 | 132 | |
| @@ -163,7 +163,7 tinyMCE.init({ | |||
|
|
163 | 163 | <input type="hidden" name="MAX_FILE_SIZE" value="10000000" /> |
|
|
164 | 164 | <input name="ranterImage" type="file"/> |
|
|
165 | 165 | </p> |
|
|
166 | ||
|
|
166 | ||
|
|
167 | 167 | </td><td> |
|
|
168 | 168 | <?php if ( $rantimage_filename ): ?> |
|
|
169 | 169 | <p><img src="<?php echo SITE_HOST . '/' . SITE_PATH . '/' . $rantimage_filename; ?>" width="150" /></p> |
| @@ -7,7 +7,7 auth_redirect(); // Require logged in user to access this page. | |||
|
|
7 | 7 | if($_POST) |
|
|
8 | 8 | { |
|
|
9 | 9 | check_nonce('swap-strip'); |
|
|
10 | ||
|
|
10 | ||
|
|
11 | 11 | if(!is_numeric($_POST['comic_a']) || !is_numeric($_POST['comic_b'])) |
|
|
12 | 12 | mtdie('This tool only works on numeric strip numbers.'); |
|
|
13 | 13 | |
| @@ -16,11 +16,11 if($_POST) | |||
|
|
16 | 16 | |
|
|
17 | 17 | $f = fopen(SITE_PATH_ABS.'/'.SITE_STRIP.'/'.SITE_STRIP_LOCK, 'w'); |
|
|
18 | 18 | flock($f, LOCK_EX); |
|
|
19 | ||
|
|
19 | ||
|
|
20 | 20 | swap_strips( $a, $b ); |
|
|
21 | ||
|
|
21 | ||
|
|
22 | 22 | close($f); |
|
|
23 | ||
|
|
23 | ||
|
|
24 | 24 | $info.='<p>Strips $a and $b swapped successfully.</p>'; |
|
|
25 | 25 | adminlog("Strips $a and $b have been swapped.", MTS_STRIP, MTA_MODIFY); |
|
|
26 | 26 | } |
| @@ -48,7 +48,7 adminmenu('swap-comics.php'); | |||
|
|
48 | 48 | <td width="66%"><input name="comic_b" type="text" id="comic_b" value="" /></th> |
|
|
49 | 49 | </tr> |
|
|
50 | 50 | </table> |
|
|
51 | ||
|
|
51 | ||
|
|
52 | 52 | <p class="submit"><input type="submit" value="Swap »" name="submit" /></p> |
|
|
53 | 53 | |
|
|
54 | 54 | </div> |
Comments 0
You need to be logged in to leave comments.
Login now
