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