Events Manager - Version 3.0

Version Description

Download this release

Release Info

Developer netweblogic
Plugin Icon 128x128 Events Manager
Version 3.0
Comparing to
See all releases

Code changes from version 2.2.2 to 3.0

Files changed (220) hide show
  1. admin/admin.php +163 -0
  2. admin/bookings.php +84 -0
  3. admin/categories.php +174 -0
  4. admin/event.php +564 -0
  5. admin/events.php +286 -0
  6. admin/functions.php +64 -0
  7. admin/locations-search.php +38 -0
  8. admin/locations.php +296 -0
  9. admin/options.php +259 -0
  10. admin/people.php +123 -0
  11. admin/support.php +41 -0
  12. ajax.php +53 -0
  13. bookings.php +164 -0
  14. classes/booking.php +139 -0
  15. classes/bookings.php +196 -0
  16. classes/calendar.php +324 -0
  17. classes/category.php +18 -0
  18. classes/event.php +797 -0
  19. classes/events.php +249 -0
  20. classes/location.php +279 -0
  21. classes/locations.php +37 -0
  22. classes/mailer.php +74 -0
  23. classes/map.php +61 -0
  24. classes/object.php +224 -0
  25. classes/people.php +25 -0
  26. classes/person.php +117 -0
  27. {phpmailer → classes/phpmailer}/class.phpmailer.php +0 -0
  28. {phpmailer → classes/phpmailer}/class.smtp.php +0 -0
  29. {phpmailer → classes/phpmailer}/language/phpmailer.lang-br.php +0 -0
  30. {phpmailer → classes/phpmailer}/language/phpmailer.lang-ca.php +0 -0
  31. {phpmailer → classes/phpmailer}/language/phpmailer.lang-cz.php +0 -0
  32. {phpmailer → classes/phpmailer}/language/phpmailer.lang-de.php +0 -0
  33. {phpmailer → classes/phpmailer}/language/phpmailer.lang-dk.php +0 -0
  34. {phpmailer → classes/phpmailer}/language/phpmailer.lang-en.php +0 -0
  35. {phpmailer → classes/phpmailer}/language/phpmailer.lang-es.php +0 -0
  36. {phpmailer → classes/phpmailer}/language/phpmailer.lang-fi.php +0 -0
  37. {phpmailer → classes/phpmailer}/language/phpmailer.lang-fo.php +0 -0
  38. {phpmailer → classes/phpmailer}/language/phpmailer.lang-fr.php +0 -0
  39. {phpmailer → classes/phpmailer}/language/phpmailer.lang-hu.php +0 -0
  40. {phpmailer → classes/phpmailer}/language/phpmailer.lang-it.php +0 -0
  41. {phpmailer → classes/phpmailer}/language/phpmailer.lang-ja.php +0 -0
  42. {phpmailer → classes/phpmailer}/language/phpmailer.lang-nl.php +0 -0
  43. {phpmailer → classes/phpmailer}/language/phpmailer.lang-no.php +0 -0
  44. {phpmailer → classes/phpmailer}/language/phpmailer.lang-pl.php +0 -0
  45. {phpmailer → classes/phpmailer}/language/phpmailer.lang-ro.php +0 -0
  46. {phpmailer → classes/phpmailer}/language/phpmailer.lang-ru.php +0 -0
  47. {phpmailer → classes/phpmailer}/language/phpmailer.lang-se.php +0 -0
  48. {phpmailer → classes/phpmailer}/language/phpmailer.lang-tr.php +0 -0
  49. classes/recurrence.php +89 -0
  50. dbem-recurrence.php +0 -267
  51. dbem.js +0 -86
  52. dbem_UI_helpers.php +0 -93
  53. dbem_calendar.php +0 -496
  54. dbem_events.php +0 -2358
  55. dbem_global_map.js +0 -108
  56. dbem_locations.php +0 -726
  57. dbem_people.php +0 -223
  58. dbem_rsvp.php +0 -391
  59. dbem_single_location_map.js +0 -32
  60. dbem_widgets.php +0 -194
  61. em-bugs.txt +59 -0
  62. events-manager.php +205 -679
  63. events.php +123 -0
  64. functions.php +148 -0
  65. events_manager.css → includes/css/events_manager.css +33 -5
  66. includes/css/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
  67. includes/css/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
  68. includes/css/images/ui-bg_flat_10_000000_40x100.png +0 -0
  69. includes/css/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
  70. includes/css/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
  71. includes/css/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  72. includes/css/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
  73. includes/css/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
  74. includes/css/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
  75. includes/css/images/ui-icons_222222_256x240.png +0 -0
  76. includes/css/images/ui-icons_228ef1_256x240.png +0 -0
  77. includes/css/images/ui-icons_ef8c08_256x240.png +0 -0
  78. includes/css/images/ui-icons_ffd27a_256x240.png +0 -0
  79. includes/css/images/ui-icons_ffffff_256x240.png +0 -0
  80. includes/css/jquery-ui-1.7.3.custom.css +344 -0
  81. includes/css/jquery-ui-1.8.5.custom.css +419 -0
  82. {images → includes/images}/baloon.png +0 -0
  83. {images → includes/images}/calendar-16.png +0 -0
  84. {images → includes/images}/calendar-32.png +0 -0
  85. includes/js/em_admin.js +217 -0
  86. includes/js/em_calendar_ajax.js +7 -0
  87. includes/js/em_maps.js +73 -0
  88. includes/js/em_ui.js +27 -0
  89. includes/js/i18n/jquery-ui-i18n.js +1199 -0
  90. includes/js/i18n/jquery.ui.datepicker-af.js +23 -0
  91. includes/js/i18n/jquery.ui.datepicker-ar.js +24 -0
  92. includes/js/i18n/jquery.ui.datepicker-az.js +23 -0
  93. includes/js/i18n/jquery.ui.datepicker-bg.js +24 -0
  94. includes/js/i18n/jquery.ui.datepicker-bs.js +23 -0
  95. js/jquery-ui-datepicker/i18n/ui.datepicker-ca.js → includes/js/i18n/jquery.ui.datepicker-ca.js +12 -11
  96. includes/js/i18n/jquery.ui.datepicker-cs.js +23 -0
  97. includes/js/i18n/jquery.ui.datepicker-da.js +23 -0
  98. includes/js/i18n/jquery.ui.datepicker-de.js +23 -0
  99. includes/js/i18n/jquery.ui.datepicker-el.js +23 -0
  100. includes/js/i18n/jquery.ui.datepicker-en-GB.js +23 -0
  101. includes/js/i18n/jquery.ui.datepicker-eo.js +23 -0
  102. js/jquery-ui-datepicker/i18n/ui.datepicker-es.js → includes/js/i18n/jquery.ui.datepicker-es.js +13 -12
  103. includes/js/i18n/jquery.ui.datepicker-et.js +23 -0
  104. includes/js/i18n/jquery.ui.datepicker-eu.js +23 -0
  105. includes/js/i18n/jquery.ui.datepicker-fa.js +23 -0
  106. js/jquery-ui-datepicker/i18n/ui.datepicker-fi.js → includes/js/i18n/jquery.ui.datepicker-fi.js +12 -13
  107. includes/js/i18n/jquery.ui.datepicker-fo.js +23 -0
  108. includes/js/i18n/jquery.ui.datepicker-fr-CH.js +23 -0
  109. includes/js/i18n/jquery.ui.datepicker-fr.js +23 -0
  110. js/jquery-ui-datepicker/i18n/ui.datepicker-he.js → includes/js/i18n/jquery.ui.datepicker-he.js +13 -12
  111. includes/js/i18n/jquery.ui.datepicker-hr.js +23 -0
  112. includes/js/i18n/jquery.ui.datepicker-hu.js +23 -0
  113. js/jquery-ui-datepicker/i18n/ui.datepicker-hy.js → includes/js/i18n/jquery.ui.datepicker-hy.js +11 -10
  114. includes/js/i18n/jquery.ui.datepicker-id.js +23 -0
  115. js/jquery-ui-datepicker/i18n/ui.datepicker-is.js → includes/js/i18n/jquery.ui.datepicker-is.js +11 -10
  116. includes/js/i18n/jquery.ui.datepicker-it.js +23 -0
  117. includes/js/i18n/jquery.ui.datepicker-ja.js +23 -0
  118. includes/js/i18n/jquery.ui.datepicker-ko.js +23 -0
  119. includes/js/i18n/jquery.ui.datepicker-kz.js +23 -0
  120. includes/js/i18n/jquery.ui.datepicker-lt.js +23 -0
  121. js/jquery-ui-datepicker/i18n/ui.datepicker-lv.js → includes/js/i18n/jquery.ui.datepicker-lv.js +12 -14
  122. includes/js/i18n/jquery.ui.datepicker-ms.js +23 -0
  123. includes/js/i18n/jquery.ui.datepicker-nl.js +23 -0
  124. includes/js/i18n/jquery.ui.datepicker-no.js +23 -0
  125. includes/js/i18n/jquery.ui.datepicker-pl.js +23 -0
  126. includes/js/i18n/jquery.ui.datepicker-pt-BR.js +23 -0
  127. includes/js/i18n/jquery.ui.datepicker-ro.js +26 -0
  128. js/jquery-ui-datepicker/i18n/ui.datepicker-ru.js → includes/js/i18n/jquery.ui.datepicker-ru.js +11 -10
  129. js/jquery-ui-datepicker/i18n/ui.datepicker-sk.js → includes/js/i18n/jquery.ui.datepicker-sk.js +11 -10
  130. includes/js/i18n/jquery.ui.datepicker-sl.js +24 -0
  131. includes/js/i18n/jquery.ui.datepicker-sq.js +23 -0
  132. includes/js/i18n/jquery.ui.datepicker-sr-SR.js +23 -0
  133. includes/js/i18n/jquery.ui.datepicker-sr.js +23 -0
  134. includes/js/i18n/jquery.ui.datepicker-sv.js +23 -0
  135. includes/js/i18n/jquery.ui.datepicker-ta.js +23 -0
  136. js/jquery-ui-datepicker/i18n/ui.datepicker-th.js → includes/js/i18n/jquery.ui.datepicker-th.js +11 -10
  137. js/jquery-ui-datepicker/i18n/ui.datepicker-tr.js → includes/js/i18n/jquery.ui.datepicker-tr.js +11 -10
  138. js/jquery-ui-datepicker/i18n/ui.datepicker-uk.js → includes/js/i18n/jquery.ui.datepicker-uk.js +12 -11
  139. includes/js/i18n/jquery.ui.datepicker-vi.js +23 -0
  140. js/jquery-ui-datepicker/i18n/ui.datepicker-zh-CN.js → includes/js/i18n/jquery.ui.datepicker-zh-CN.js +11 -10
  141. includes/js/i18n/jquery.ui.datepicker-zh-HK.js +23 -0
  142. js/jquery-ui-datepicker/i18n/ui.datepicker-zh-TW.js → includes/js/i18n/jquery.ui.datepicker-zh-TW.js +10 -10
  143. includes/js/jquery-ui-1.8.5/jquery-ui-1.8.5.custom.min.js +160 -0
  144. {js → includes/js}/timeentry/jquery.timeentry-de.js +0 -0
  145. {js → includes/js}/timeentry/jquery.timeentry-es.js +0 -0
  146. {js → includes/js}/timeentry/jquery.timeentry-fr.js +0 -0
  147. {js → includes/js}/timeentry/jquery.timeentry-hu.js +0 -0
  148. {js → includes/js}/timeentry/jquery.timeentry-it.js +0 -0
  149. {js → includes/js}/timeentry/jquery.timeentry-nl.js +0 -0
  150. {js → includes/js}/timeentry/jquery.timeentry-pl.js +0 -0
  151. {js → includes/js}/timeentry/jquery.timeentry-pt.js +0 -0
  152. {js → includes/js}/timeentry/jquery.timeentry-ro.js +0 -0
  153. {js → includes/js}/timeentry/jquery.timeentry-ru.js +0 -0
  154. {js → includes/js}/timeentry/jquery.timeentry-sk.js +0 -0
  155. {js → includes/js}/timeentry/jquery.timeentry-sv.js +0 -0
  156. {js → includes/js}/timeentry/jquery.timeentry-tr.js +0 -0
  157. {js → includes/js}/timeentry/jquery.timeentry-zh-CN.js +0 -0
  158. {js → includes/js}/timeentry/jquery.timeentry.compat-1.2.6.js +0 -0
  159. {js → includes/js}/timeentry/jquery.timeentry.css +0 -0
  160. {js → includes/js}/timeentry/jquery.timeentry.ent +0 -0
  161. {js → includes/js}/timeentry/jquery.timeentry.js +0 -0
  162. {js → includes/js}/timeentry/jquery.timeentry.min.js +0 -0
  163. {js → includes/js}/timeentry/jquery.timeentry.pack.js +0 -0
  164. {js → includes/js}/timeentry/timeEntry.png +0 -0
  165. {js → includes/js}/timeentry/timeEntry2.png +0 -0
  166. {js → includes/js}/timeentry/timeEntry3.png +0 -0
  167. {js → includes/js}/timeentry/timeEntry4.png +0 -0
  168. {js → includes/js}/timeentry/timeEntry5.png +0 -0
  169. {js → includes/js}/timeentry/timeEntry6.png +0 -0
  170. {langs → includes/langs}/dbem-cs_CZ.mo +0 -0
  171. {langs → includes/langs}/dbem-cs_CZ.po +0 -0
  172. {langs → includes/langs}/dbem-de_DE.mo +0 -0
  173. {langs → includes/langs}/dbem-es_ES.mo +0 -0
  174. {langs → includes/langs}/dbem-es_ES.po +0 -0
  175. {langs → includes/langs}/dbem-it_IT.mo +0 -0
  176. {langs → includes/langs}/dbem-it_IT.po +0 -0
  177. {langs → includes/langs}/dbem-pt_BR.mo +0 -0
  178. {langs → includes/langs}/dbem-pt_BR.po +0 -0
  179. {langs → includes/langs}/dbem-sv_SE.mo +0 -0
  180. {langs → includes/langs}/dbem-sv_SE.po +0 -0
  181. includes/sample-placeholers/event-single.html +63 -0
  182. install.php +485 -0
  183. js/jquery-autocomplete/changelog.txt +0 -20
  184. js/jquery-autocomplete/jquery.autocomplete.css +0 -48
  185. js/jquery-autocomplete/jquery.autocomplete.min.js +0 -15
  186. js/jquery-autocomplete/jquery.autocomplete.pack.js +0 -13
  187. js/jquery-autocomplete/lib/jquery.ajaxQueue.js +0 -116
  188. js/jquery-autocomplete/lib/jquery.bgiframe.min.js +0 -10
  189. js/jquery-autocomplete/todo +0 -166
  190. js/jquery-ui-datepicker/i18n/ui.datepicker-ar.js +0 -23
  191. js/jquery-ui-datepicker/i18n/ui.datepicker-bg.js +0 -22
  192. js/jquery-ui-datepicker/i18n/ui.datepicker-cs.js +0 -22
  193. js/jquery-ui-datepicker/i18n/ui.datepicker-da.js +0 -22
  194. js/jquery-ui-datepicker/i18n/ui.datepicker-de.js +0 -22
  195. js/jquery-ui-datepicker/i18n/ui.datepicker-fr.js +0 -22
  196. js/jquery-ui-datepicker/i18n/ui.datepicker-hu.js +0 -22
  197. js/jquery-ui-datepicker/i18n/ui.datepicker-id.js +0 -22
  198. js/jquery-ui-datepicker/i18n/ui.datepicker-it.js +0 -22
  199. js/jquery-ui-datepicker/i18n/ui.datepicker-ja.js +0 -22
  200. js/jquery-ui-datepicker/i18n/ui.datepicker-ko.js +0 -22
  201. js/jquery-ui-datepicker/i18n/ui.datepicker-lt.js +0 -25
  202. js/jquery-ui-datepicker/i18n/ui.datepicker-nl.js +0 -21
  203. js/jquery-ui-datepicker/i18n/ui.datepicker-no.js +0 -23
  204. js/jquery-ui-datepicker/i18n/ui.datepicker-pl.js +0 -22
  205. js/jquery-ui-datepicker/i18n/ui.datepicker-pt-BR.js +0 -22
  206. js/jquery-ui-datepicker/i18n/ui.datepicker-ro.js +0 -22
  207. js/jquery-ui-datepicker/i18n/ui.datepicker-sv.js +0 -22
  208. js/jquery-ui-datepicker/ui.datepicker.css +0 -213
  209. js/jquery-ui-datepicker/ui.datepicker.js +0 -1674
  210. locations-search.php +0 -37
  211. locations.php +77 -0
  212. marcus-extras.php +0 -388
  213. phpmailer/dbem_phpmailer.php +0 -47
  214. readme.txt +30 -15
  215. rss.php +54 -0
  216. shortcode.php +95 -0
  217. template-tags-depreciated.php +125 -0
  218. template-tags.php +86 -0
  219. widgets/calendar.php +52 -0
  220. widgets/events.php +87 -0
admin/admin.php ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ //Admin javascript and style loading
3
+
4
+ /**
5
+ * Called by admin_print_scripts-(hook|page) action, created when adding menu items in events-manager.php
6
+ */
7
+ function em_admin_load_scripts(){
8
+ if( get_option('dbem_gmap_is_active') ){
9
+ wp_enqueue_script('em-google-maps', 'http://maps.google.com/maps/api/js?sensor=false');
10
+ }
11
+ wp_enqueue_script('em-timeentry', WP_PLUGIN_URL.'/events-manager/includes/js/timeentry/jquery.timeentry.js', array('jquery'));
12
+ //Load the UI items, currently date picker and autocomplete plus dependencies
13
+ //wp_enqueue_script('em-ui-js', WP_PLUGIN_URL.'/events-manager/includes/js/jquery-ui-1.8.5.custom.min.js', array('jquery', 'jquery-ui-core'));
14
+ wp_enqueue_script('em-ui-js', WP_PLUGIN_URL.'/events-manager/includes/js/em_ui.js', array('jquery', 'jquery-ui-core'));
15
+ //Date Picker Locale
16
+ $locale_code = substr ( get_locale (), 0, 2 );
17
+ $locale_file = "/events-manager/includes/js/i18n/jquery.ui.datepicker-$locale_code.js";
18
+ if ( file_exists(WP_PLUGIN_DIR.$locale_file) ) {
19
+ wp_enqueue_script("em-ui-datepicker-$locale_code", WP_PLUGIN_URL.$locale_file, array('em-ui-js'));
20
+ }
21
+ wp_enqueue_script('em-script', WP_PLUGIN_URL.'/events-manager/includes/js/em_admin.js', array('em-ui-js'));
22
+ }
23
+
24
+ /**
25
+ * Called by admin_print_styles-(hook|page) action, created when adding menu items in events-manager.php
26
+ */
27
+ function em_admin_load_styles() {
28
+ wp_enqueue_style('em-ui-css', WP_PLUGIN_URL.'/events-manager/includes/css/jquery-ui-1.7.3.custom.css');
29
+ wp_enqueue_style('events-manager-admin', WP_PLUGIN_URL.'/events-manager/includes/css/events_manager.css');
30
+ }
31
+
32
+ /**
33
+ * Loads script inline due to insertion of php values
34
+ */
35
+ function em_admin_general_script() {
36
+ //TODO clean script up, remove dependency of php so it can be moved to js file.
37
+ // Check if the locale is there and loads it
38
+ $locale_code = substr ( get_locale (), 0, 2 );
39
+ $show24Hours = 'true';
40
+ // Setting 12 hours format for those countries using it
41
+ if (preg_match ( "/en|sk|zh|us|uk/", $locale_code ))
42
+ $show24Hours = 'false';
43
+ ?>
44
+ <script type="text/javascript">
45
+ //<![CDATA[
46
+ // TODO: make more general, to support also latitude and longitude (when added)
47
+
48
+ jQuery(document).ready( function($) {
49
+
50
+ function updateIntervalDescriptor () {
51
+ $(".interval-desc").hide();
52
+ var number = "-plural";
53
+ if ($('input#recurrence-interval').val() == 1 || $('input#recurrence-interval').val() == "")
54
+ number = "-singular"
55
+ var descriptor = "span#interval-"+$("select#recurrence-frequency").val()+number;
56
+ $(descriptor).show();
57
+ }
58
+ function updateIntervalSelectors () {
59
+ $('p.alternate-selector').hide();
60
+ $('p#'+ $('select#recurrence-frequency').val() + "-selector").show();
61
+ }
62
+ function updateShowHideRsvp () {
63
+ if($('input#rsvp-checkbox').attr("checked")) {
64
+ $("div#rsvp-data").fadeIn();
65
+ } else {
66
+ $("div#rsvp-data").hide();
67
+ }
68
+ }
69
+ function updateShowHideRecurrence () {
70
+ if( $('input#event-recurrence').attr("checked")) {
71
+ $("#event_recurrence_pattern").fadeIn();
72
+ $("#event-date-explanation").hide();
73
+ $("#recurrence-dates-explanation").show();
74
+ $("h3#recurrence-dates-title").show();
75
+ $("h3#event-date-title").hide();
76
+ } else {
77
+ $("#event_recurrence_pattern").hide();
78
+ $("#recurrence-dates-explanation").hide();
79
+ $("#event-date-explanation").show();
80
+ $("h3#recurrence-dates-title").hide();
81
+ $("h3#event-date-title").show();
82
+ }
83
+ }
84
+ $("#recurrence-dates-explanation").hide();
85
+ $("#localised-date").show();
86
+ $("#localised-end-date").show();
87
+
88
+ $("#date-to-submit").hide();
89
+ $("#end-date-to-submit").hide();
90
+
91
+ $("#start-time").timeEntry({spinnerImage: '', show24Hours: <?php echo $show24Hours; ?> });
92
+ $("#end-time").timeEntry({spinnerImage: '', show24Hours: <?php echo $show24Hours; ?>});
93
+
94
+ $('input.select-all').change(function(){
95
+ if($(this).is(':checked'))
96
+ $('input.row-selector').attr('checked', true);
97
+ else
98
+ $('input.row-selector').attr('checked', false);
99
+ });
100
+
101
+ updateIntervalDescriptor();
102
+ updateIntervalSelectors();
103
+ updateShowHideRecurrence();
104
+ updateShowHideRsvp();
105
+ $('input#event-recurrence').change(updateShowHideRecurrence);
106
+ $('input#rsvp-checkbox').change(updateShowHideRsvp);
107
+
108
+ // recurrency elements
109
+ $('input#recurrence-interval').keyup(updateIntervalDescriptor);
110
+ $('select#recurrence-frequency').change(updateIntervalDescriptor);
111
+ $('select#recurrence-frequency').change(updateIntervalSelectors);
112
+
113
+ // hiding or showing notes according to their content
114
+ $('.postbox h3').prepend('<a class="togbox">+</a> ');
115
+ $('#event_notes h3').click( function() {
116
+ $(this).parent().first().toggleClass('closed');
117
+ });
118
+
119
+ // users cannot submit the event form unless some fields are filled
120
+ function validateEventForm(){
121
+ errors = "";
122
+ var recurring = $("input[@name=repeated_event]:checked").val();
123
+ requiredFields= new Array('event_name', 'localised_event_date', 'location_name','location_address','location_town');
124
+ var localisedRequiredFields = {
125
+ 'event_name':"<?php _e ( 'Name', 'dbem' )?>",
126
+ 'localised_event_date':"<?php _e ( 'Date', 'dbem' )?>",
127
+ 'location_name':"<?php _e ( 'Location', 'dbem' )?>",
128
+ 'location_address':"<?php _e ( 'Address', 'dbem' )?>",
129
+ 'location_town':"<?php _e ( 'Town', 'dbem' )?>"
130
+ };
131
+ missingFields = new Array;
132
+ for (var i in requiredFields) {
133
+ if ($("input[@name=" + requiredFields[i]+ "]").val() == 0) {
134
+ missingFields.push(localisedRequiredFields[requiredFields[i]]);
135
+ $("input[@name=" + requiredFields[i]+ "]").css('border','2px solid red');
136
+ } else {
137
+ $("input[@name=" + requiredFields[i]+ "]").css('border','1px solid #DFDFDF');
138
+ }
139
+ }
140
+
141
+ // alert('ciao ' + recurring+ " end: " + $("input[@name=localised_event_end_date]").val());
142
+ if (missingFields.length > 0) {
143
+ errors = "<?php _e ( 'Some required fields are missing:', 'dbem' )?> " + missingFields.join(", ") + ".\n";
144
+ }
145
+ if(recurring && $("input[@name=localised_event_end_date]").val() == "") {
146
+ errors = errors + "<?php _e ( 'Since the event is repeated, you must specify an end date', 'dbem' )?>.";
147
+ $("input[@name=localised_event_end_date]").css('border','2px solid red');
148
+ } else {
149
+ $("input[@name=localised_event_end_date]").css('border','1px solid #DFDFDF');
150
+ }
151
+ if(errors != "") {
152
+ alert(errors);
153
+ return false;
154
+ }
155
+ return true;
156
+ }
157
+ $('#eventForm').bind("submit", validateEventForm);
158
+ });
159
+ //]]>
160
+ </script>
161
+ <?php
162
+ }
163
+ ?>
admin/bookings.php ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Check if there's any actions to take for bookings
4
+ * @return null
5
+ */
6
+ function dbem_admin_actions_bookings() {
7
+ global $dbem_form_add_message;
8
+ global $dbem_form_delete_message;
9
+ global $wpdb;
10
+
11
+ //DELETE Bookings
12
+ if( $_POST['secondaryAction'] == 'delete_bookings' ){
13
+ if( EM_Object::array_is_numeric($_GET['bookings']) && count($_GET['bookings']) > 0 ){
14
+ $bookings = $_GET['bookings'];
15
+ $sql = "DELETE FROM ". $wpdb->prefix.BOOKINGS_TBNAME ." WHERE booking_id = ". implode(' OR booking_id = ', $bookings);
16
+ $wpdb->query($sql);
17
+ $dbem_form_delete_message = __('Bookings deleted', 'dbem');
18
+ }
19
+ }
20
+ }
21
+ add_action('init','dbem_admin_actions_bookings');
22
+
23
+ /**
24
+ * Shows table of bookings for an event
25
+ * @return null
26
+ */
27
+ function dbem_bookings_table() {
28
+ global $EM_Event;
29
+ ?>
30
+ <form id='bookings-filter' method='get' action='<?php bloginfo('wpurl') ?>/wp-admin/edit.php'>
31
+ <input type='hidden' name='page' value='events-manager/events-manager.php'/>
32
+ <input type='hidden' name='action' value='edit_event'/>
33
+ <input type='hidden' name='event_id' value='<?php echo $EM_Event->id ?>'/>
34
+ <input type='hidden' name='secondaryAction' value='delete_bookings'/>
35
+ <div class='wrap'>
36
+ <h2>Bookings</h2>
37
+ <table id='dbem-bookings-table' class='widefat post fixed'>
38
+ <thead>
39
+ <tr>
40
+ <th class='manage-column column-cb check-column' scope='col'>&nbsp;</th>
41
+ <th class='manage-column ' scope='col'>Booker</th>
42
+ <th scope='col'>E-mail</th>
43
+ <th scope='col'>Phone number</th>
44
+ <th scope='col'>Seats</th>
45
+ </tr>
46
+ </thead>
47
+ <tbody>
48
+ <?php
49
+ foreach ($EM_Event->bookings->bookings as $EM_Booking) {
50
+ ?>
51
+ <tr>
52
+ <td><input type='checkbox' value='<?php echo $EM_Booking->id ?>' name='bookings[]'/></td>
53
+ <td><?php echo $EM_Booking->name ?></td>
54
+ <td><?php echo $EM_Booking->email ?></td>
55
+ <td><?php echo $EM_Booking->phone ?></td>
56
+ <td><?php echo $EM_Booking->seats ?></td>
57
+ </tr>
58
+ <?php
59
+ }
60
+ ?>
61
+ </tbody>
62
+ <tfoot>
63
+ <tr>
64
+ <th scope='row' colspan='4'>Booked seats:</th>
65
+ <td class='booking-result' id='booked-seats'><?php echo $EM_Event->bookings->get_booked_seats() ?></td>
66
+ </tr>
67
+ <tr>
68
+ <th scope='row' colspan='4'>Available seats:</th>
69
+ <td class='booking-result' id='available-seats'><?php echo $EM_Event->bookings->get_booked_seats() ?></td>
70
+ </tr>
71
+ </tfoot>
72
+ </table>
73
+ </div>
74
+ <div class='tablenav'>
75
+ <div class='alignleft actions'>
76
+ <input class='button-secondary action' type='submit' name='doaction2' value='Delete'/>
77
+ <br class='clear'/>
78
+ </div>
79
+ <br class='clear'/>
80
+ </div>
81
+ </form>
82
+ <?php
83
+ }
84
+ ?>
admin/categories.php ADDED
@@ -0,0 +1,174 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ function dbem_categories_subpanel() {
3
+ global $wpdb;
4
+
5
+ if(isset($_GET['action']) && $_GET['action'] == "edit") {
6
+ // edit category
7
+ dbem_categories_edit_layout();
8
+ } else {
9
+ // Insert/Update/Delete Record
10
+ $categories_table = $wpdb->prefix.DBEM_CATEGORIES_TBNAME;
11
+ if( isset($_POST['action']) && $_POST['action'] == "edit" ) {
12
+ // category update required
13
+ $category = array();
14
+ $category['category_name'] = $_POST['category_name'];
15
+ $validation_result = $wpdb->update( $categories_table, $category, array('category_id' => $_POST['category_ID']) );
16
+ } elseif( isset($_POST['action']) && $_POST['action'] == "add" ) {
17
+ // Add a new category
18
+ $category = array();
19
+ $category['category_name'] = $_POST['category_name'];
20
+ $validation_result = $wpdb->insert($categories_table, $category);
21
+ } elseif( isset($_POST['action']) && $_POST['action'] == "delete" ) {
22
+ // Delete category or multiple
23
+ $categories = $_POST['categories'];
24
+ if(is_array($categories)){
25
+ //Run the query if we have an array of category ids with at least one value
26
+ if( EM_Object::array_is_numeric($categories) ){
27
+ $validation_result = $wpdb->query( "DELETE FROM $categories_table WHERE category_id =". implode(" OR category_id =", $categories) );
28
+ }else{
29
+ $validation_result = false;
30
+ $message = "Couldn't delete the categories. Incorrect category IDs supplied. Please try agian.";
31
+ }
32
+ }
33
+ }
34
+ //die(print_r($_POST));
35
+ if ( is_numeric($validation_result) ) {
36
+ $message = (isset($message)) ? $message : __("Successfully {$_POST['action']}ed category", "dbem");
37
+ dbem_categories_table_layout($message);
38
+ } elseif ( $validation_result === false ) {
39
+ $message = (isset($message)) ? $message : __("There was a problem {$_POST['action']}ing your category, please try again.");
40
+ dbem_categories_table_layout($message);
41
+ } else {
42
+ // no action, just a categories list
43
+ dbem_categories_table_layout();
44
+ }
45
+ }
46
+ }
47
+
48
+ function dbem_categories_table_layout($message = "") {
49
+ $categories = EM_Category::get();
50
+ $destination = get_bloginfo('url')."/wp-admin/admin.php";
51
+ ?>
52
+ <div class='wrap nosubsub'>
53
+ <div id='icon-edit' class='icon32'>
54
+ <br/>
55
+ </div>
56
+ <h2><?php echo __('Categories', 'dbem') ?></h2>
57
+
58
+ <?php if($message != "") : ?>
59
+ <div id='message' class='updated fade below-h2' style='background-color: rgb(255, 251, 204);'>
60
+ <p><?php echo $message ?></p>
61
+ </div>
62
+ <?php endif; ?>
63
+
64
+ <div id='col-container'>
65
+ <!-- begin col-right -->
66
+ <div id='col-right'>
67
+ <div class='col-wrap'>
68
+ <form id='bookings-filter' method='post' action='<?php echo get_bloginfo('wpurl') ?>/wp-admin/admin.php?page=events-manager-categories'>
69
+ <input type='hidden' name='action' value='delete'/>
70
+ <?php if (count($categories)>0) : ?>
71
+ <table class='widefat'>
72
+ <thead>
73
+ <tr>
74
+ <th class='manage-column column-cb check-column' scope='col'><input type='checkbox' class='select-all' value='1'/></th>
75
+ <th><?php echo __('ID', 'dbem') ?></th>
76
+ <th><?php echo __('Name', 'dbem') ?></th>
77
+ </tr>
78
+ </thead>
79
+ <tfoot>
80
+ <tr>
81
+ <th class='manage-column column-cb check-column' scope='col'><input type='checkbox' class='select-all' value='1'/></th>
82
+ <th><?php echo __('ID', 'dbem') ?></th>
83
+ <th><?php echo __('Name', 'dbem') ?></th>
84
+ </tr>
85
+ </tfoot>
86
+ <tbody>
87
+ <?php foreach ($categories as $this_category) : ?>
88
+ <tr>
89
+ <td><input type='checkbox' class ='row-selector' value='<?php echo $this_category['category_id'] ?>' name='categories[]'/></td>
90
+ <td><a href='<?php echo get_bloginfo('wpurl') ?>/wp-admin/admin.php?page=events-manager-categories&amp;action=edit&amp;category_ID=<?php echo $this_category['category_id'] ?>'><?php echo htmlspecialchars($this_category['category_id'], ENT_QUOTES); ?></a></td>
91
+ <td><a href='<?php echo get_bloginfo('wpurl') ?>/wp-admin/admin.php?page=events-manager-categories&amp;action=edit&amp;category_ID=<?php echo $this_category['category_id'] ?>'><?php echo htmlspecialchars($this_category['category_name'], ENT_QUOTES); ?></a></td>
92
+ </tr>
93
+ <?php endforeach; ?>
94
+ </tbody>
95
+
96
+ </table>
97
+
98
+ <div class='tablenav'>
99
+ <div class='alignleft actions'>
100
+ <input class='button-secondary action' type='submit' name='doaction2' value='Delete'/>
101
+ <br class='clear'/>
102
+ </div>
103
+ <br class='clear'/>
104
+ </div>
105
+ <?php else: ?>
106
+ <p><?php echo __('No categories have been inserted yet!', 'dbem'); ?></p>
107
+ <?php endif; ?>
108
+ </form>
109
+ </div>
110
+ </div>
111
+ <!-- end col-right -->
112
+
113
+ <!-- begin col-left -->
114
+ <div id='col-left'>
115
+ <div class='col-wrap'>
116
+ <div class='form-wrap'>
117
+ <div id='ajax-response'>
118
+ <h3><?php echo __('Add category', 'dbem') ?></h3>
119
+ <form name='add' id='add' method='post' action='admin.php?page=events-manager-categories' class='add:the-list: validate'>
120
+ <input type='hidden' name='action' value='add' />
121
+ <div class='form-field form-required'>
122
+ <label for='category_name'><?php echo __('Category name', 'dbem') ?></label>
123
+ <input id='category-name' name='category_name' id='category_name' type='text' size='40' />
124
+ <p><?php echo __('The name of the category', 'dbem'); ?></p>
125
+ </div>
126
+ <p class='submit'><input type='submit' class='button' name='submit' value='<?php echo __('Add category', 'dbem') ?>' /></p>
127
+ </form>
128
+ </div>
129
+ </div>
130
+ </div>
131
+ </div>
132
+ <!-- end col-left -->
133
+ </div>
134
+ </div>
135
+ <?php
136
+ }
137
+
138
+
139
+ function dbem_categories_edit_layout($message = "") {
140
+ $category_id = $_GET['category_ID'];
141
+ $category = EM_Category::get($category_id);
142
+ ?>
143
+ <div class='wrap'>
144
+ <div id='icon-edit' class='icon32'>
145
+ <br/>
146
+ </div>
147
+
148
+ <h2><?php echo __('Edit category', 'dbem') ?></h2>
149
+
150
+ <?php if($message != "") : ?>
151
+ <div id='message' class='updated fade below-h2' style='background-color: rgb(255, 251, 204);'>
152
+ <p><?php echo $message ?></p>
153
+ </div>
154
+ <?php endif; ?>
155
+
156
+ <div id='ajax-response'></div>
157
+
158
+ <form name='editcat' id='editcat' method='post' action='admin.php?page=events-manager-categories' class='validate'>
159
+ <input type='hidden' name='action' value='edit' />
160
+ <input type='hidden' name='category_ID' value='<?php echo $category['category_id'] ?>'/>
161
+
162
+ <table class='form-table'>
163
+ <tr class='form-field form-required'>
164
+ <th scope='row' valign='top'><label for='category_name'><?php echo __('Category name', 'dbem') ?></label></th>
165
+ <td><input name='category_name' id='category-name' type='text' value='<?php echo $category['category_name'] ?>' size='40' /><br />
166
+ <?php echo __('The name of the category', 'dbem') ?></td>
167
+ </tr>
168
+ </table>
169
+ <p class='submit'><input type='submit' class='button-primary' name='submit' value='<?php echo __('Update category', 'dbem') ?>' /></p>
170
+ </form>
171
+ </div>
172
+ <?php
173
+ }
174
+ ?>
admin/event.php ADDED
@@ -0,0 +1,564 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ function dbem_new_event_page() {
3
+ global $EM_Event;
4
+ $title = __ ( "Insert New Event", 'dbem' );
5
+ $EM_Event = new EM_Event(); //Empty event
6
+ dbem_event_form ( $title );
7
+ }
8
+
9
+ /**
10
+ * Generates Event Admin page, for adding and updating a single (or recurring) event.
11
+ * @param $title
12
+ * @return null
13
+ */
14
+ function dbem_event_form( $title ) {
15
+ global $EM_Event;
16
+ global $localised_date_formats;
17
+ $use_select_for_locations = get_option('dbem_use_select_for_locations');
18
+ // change prefix according to event/recurrence
19
+ $pref = "event_";
20
+ $form_destination = "edit.php?page=events-manager/events-manager.php&amp;action=update_event&amp;event_id=" . $EM_Event->id;
21
+
22
+ $locale_code = substr ( get_locale (), 0, 2 );
23
+ $localised_date_format = $localised_date_formats [$locale_code];
24
+
25
+ //FIXME time useage is very flimsy imho
26
+ $hours_locale_regexp = "H:i";
27
+ // Setting 12 hours format for those countries using it
28
+ if (preg_match ( "/en|sk|zh|us|uk/", $locale_code ))
29
+ $hours_locale_regexp = "h:iA";
30
+
31
+ $days_names = array (1 => __ ( 'Mon' ), 2 => __ ( 'Tue' ), 3 => __ ( 'Wed' ), 4 => __ ( 'Thu' ), 5 => __ ( 'Fri' ), 6 => __ ( 'Sat' ), 7 => __ ( 'Sun' ) );
32
+ ?>
33
+ <form id="eventForm" method="post" action="<?php echo $form_destination; ?>">
34
+ <div class="wrap">
35
+ <div id="icon-events" class="icon32"><br /></div>
36
+ <h2><?php echo $title; ?></h2>
37
+ <?php if ( $EM_Event->is_recurrence() || $EM_Event->is_recurring() ) : ?>
38
+ <p id='recurrence_warning'>
39
+ <?php
40
+ //TODO better warning system when changing a recurring event (e.g. when removing recurrences).
41
+ if ( $EM_Event->is_recurring() ) {
42
+ _e ( 'WARNING: This is a recurring event.', 'dbem' );
43
+ echo "<br />";
44
+ _e ( 'Modifying these data all the events linked to this recurrence will be rescheduled', 'dbem' );
45
+ echo " ";
46
+ _e ( 'and all booking information will be deleted!', 'dbem' );
47
+ } elseif ( $EM_Event->is_recurrence() ) {
48
+ //TODO Terminology confusing with methods, maybe worth changing?
49
+ _e ( 'WARNING: This is a recurrence.', 'dbem' );
50
+ echo "<br />";
51
+ _e ( 'If you change these data and save, this will become an independent event.', 'dbem' );
52
+ }
53
+ ?>
54
+ </p>
55
+ <?php endif; ?>
56
+ <div id="poststuff" class="metabox-holder has-right-sidebar">
57
+ <!-- SIDEBAR -->
58
+ <div id="side-info-column" class='inner-sidebar'>
59
+ <div id='side-sortables'>
60
+ <?php if(get_option('dbem_recurrence_enabled')) : ?>
61
+ <!-- START recurrence postbox -->
62
+ <div class="postbox ">
63
+ <div class="handlediv" title="Fare clic per cambiare."><br />
64
+ </div>
65
+ <h3 class='hndle'><span>
66
+ <?php _e ( "Recurrence", 'dbem' ); ?>
67
+ </span></h3>
68
+ <div class="inside">
69
+ <?php //TODO add js warning if rescheduling, since all bookings are deleted ?>
70
+ <?php if ( !$EM_Event->id || $EM_Event->is_recurring() ) : ?>
71
+ <p>
72
+ <input id="event-recurrence" type="checkbox" name="repeated_event" value="1" <?php echo ( $EM_Event->is_recurring() ) ? 'checked="checked"':'' ; ?> />
73
+ <?php _e ( 'Repeated event', 'dbem' ); ?>
74
+ </p>
75
+ <div id="event_recurrence_pattern">
76
+ <p>
77
+ Frequency:
78
+ <select id="recurrence-frequency" name="recurrence_freq">
79
+ <?php
80
+ $freq_options = array ("daily" => __ ( 'Daily', 'dbem' ), "weekly" => __ ( 'Weekly', 'dbem' ), "monthly" => __ ( 'Monthly', 'dbem' ) );
81
+ dbem_option_items ( $freq_options, $EM_Event->freq );
82
+ ?>
83
+ </select>
84
+ </p>
85
+ <p>
86
+ <?php _e ( 'Every', 'dbem' )?>
87
+ <input id="recurrence-interval" name='recurrence_interval' size='2' value='<?php echo $EM_Event->interval ; ?>' />
88
+ <span class='interval-desc' id="interval-daily-singular">
89
+ <?php _e ( 'day', 'dbem' )?>
90
+ </span> <span class='interval-desc' id="interval-daily-plural">
91
+ <?php _e ( 'days', 'dbem' ) ?>
92
+ </span> <span class='interval-desc' id="interval-weekly-singular">
93
+ <?php _e ( 'week', 'dbem' )?>
94
+ </span> <span class='interval-desc' id="interval-weekly-plural">
95
+ <?php _e ( 'weeks', 'dbem' )?>
96
+ </span> <span class='interval-desc' id="interval-monthly-singular">
97
+ <?php _e ( 'month', 'dbem' )?>
98
+ </span> <span class='interval-desc' id="interval-monthly-plural">
99
+ <?php _e ( 'months', 'dbem' )?>
100
+ </span>
101
+ </p>
102
+ <p class="alternate-selector" id="weekly-selector">
103
+ <?php
104
+ $saved_bydays = ($EM_Event->is_recurring()) ? explode ( ",", $EM_Event->byday ) : array();
105
+ dbem_checkbox_items ( 'recurrence_bydays[]', $days_names, $saved_bydays );
106
+ ?>
107
+ </p>
108
+ <p class="alternate-selector" id="monthly-selector">
109
+ <?php _e ( 'Every', 'dbem' )?>
110
+ <select id="monthly-modifier" name="recurrence_byweekno">
111
+ <?php
112
+ $weekno_options = array ("1" => __ ( 'first', 'dbem' ), '2' => __ ( 'second', 'dbem' ), '3' => __ ( 'third', 'dbem' ), '4' => __ ( 'fourth', 'dbem' ), '-1' => __ ( 'last', 'dbem' ) );
113
+ dbem_option_items ( $weekno_options, $EM_Event->byweekno );
114
+ ?>
115
+ </select>
116
+ <select id="recurrence-weekday" name="recurrence_byday">
117
+ <?php dbem_option_items ( $days_names, $EM_Event->byday ); ?>
118
+ </select>
119
+ &nbsp;
120
+ </p>
121
+ </div>
122
+ <p id="recurrence-tip">
123
+ <?php _e ( 'Check if your event happens more than once according to a regular pattern', 'dbem' )?>
124
+ </p>
125
+ <?php elseif( $EM_Event->is_recurrence() ) : ?>
126
+ <p>
127
+ <?php echo $EM_Event->get_recurrence_description(); ?>
128
+ <br />
129
+ <a href="<?php bloginfo ( 'wpurl' )?>/wp-admin/edit.php?page=events-manager/events-manager.php&amp;action=edit_event&amp;event_id=<?php echo $EM_Event->recurrence_id; ?>">
130
+ <?php _e ( 'Reschedule', 'dbem' ); ?>
131
+ </a>
132
+ <input type="hidden" name="recurrence_id" value="<?php echo $EM_Event->recurrence_id; ?>" />
133
+ </p>
134
+ <?php else : ?>
135
+ <p><?php _e ( 'This is\'t a recurrent event', 'dbem' ) ?></p>
136
+ <?php endif; ?>
137
+ </div>
138
+ </div>
139
+ <!-- END recurrence postbox -->
140
+ <?php endif; ?>
141
+ <?php if(get_option('dbem_rsvp_enabled')) : ?>
142
+ <!-- START RSVP -->
143
+ <div class="postbox ">
144
+ <div class="handlediv" title="Fare clic per cambiare."><br />
145
+ </div>
146
+ <h3 class='hndle'><span>
147
+ <?php _e ( 'Contact Person', 'dbem' ); ?>
148
+ </span></h3>
149
+ <div class="inside">
150
+ <p><?php _e('Contact','dbem'); ?>
151
+ <?php wp_dropdown_users ( array ('name' => 'event_contactperson_id', 'show_option_none' => __ ( "Select...", 'dbem' ), 'selected' => $EM_Event->contactperson_id ) ); ?>
152
+ </p>
153
+ </div>
154
+ </div>
155
+ <div class="postbox ">
156
+ <div class="handlediv" title="Fare clic per cambiare."><br />
157
+ </div>
158
+ <h3 class='hndle'><span><?php _e('RSVP','dbem'); ?></span></h3>
159
+ <div class="inside">
160
+ <p>
161
+ <input id="rsvp-checkbox" name='event_rsvp' value='1' type='checkbox' <?php echo ($EM_Event->rsvp) ? 'checked="checked"' : ''; ?> />
162
+ <?php _e ( 'Enable registration for this event', 'dbem' )?>
163
+ </p>
164
+ <div id='rsvp-data'>
165
+ <?php
166
+ if ($EM_Event->contactperson_id != NULL){
167
+ $selected = $EM_Event->contactperson_id;
168
+ }else{
169
+ $selected = '0';
170
+ }
171
+ ?>
172
+ <p>
173
+ <?php _e ( 'Spaces','dbem' ); ?> :
174
+ <input id="seats-input" type="text" name="event_seats" size='5' value="<?php echo $EM_Event->seats ?>" />
175
+ </p>
176
+ <!-- START RSVP Stats -->
177
+ <?php
178
+ if ($EM_Event->rsvp ) {
179
+ $EM_Event->get_bookings(); //Load bookings since we'll display this info later.
180
+ $available_seats = $EM_Event->bookings->get_available_seats();
181
+ $booked_seats = $EM_Event->bookings->get_booked_seats();
182
+
183
+ if ( count($EM_Event->bookings->bookings) > 0 ) {
184
+ ?>
185
+ <div class='wrap'>
186
+ <h4><?php echo $booked_seats ?> <?php echo __('responses so far') ?></h4>
187
+
188
+ <table id='dbem-bookings-table-<?php echo $EM_Event->id ?>' class='widefat post fixed'>
189
+ <thead>
190
+ <tr>
191
+ <th class='manage-column column-cb check-column' scope='col'>&nbsp;</th>
192
+ <th class='manage-column ' scope='col'><?php _e('Responder', 'dbem') ?></th>
193
+ <th scope='col'><?php _e('Spaces', 'dbem') ?></th>
194
+ </tr>
195
+ </thead>
196
+ <tfoot>
197
+ <tr>
198
+ <th scope='row' colspan='2'><?php _e('Booked spaces','dbem') ?>:</th><td class='booking-result' id='booked-seats'><?php echo $booked_seats ?></td></tr>
199
+ <tr><th scope='row' colspan='2'><?php _e('Available spaces','dbem') ?>:</th><td class='booking-result' id='available-seats'><?php echo $available_seats ?></td>
200
+ </tr>
201
+ </tfoot>
202
+ <tbody>
203
+ <?php
204
+ foreach ($EM_Event->bookings->bookings as $EM_Booking) {
205
+ ?>
206
+ <tr id='booking-<?php echo $EM_Booking->id ?>'>
207
+ <td>
208
+ <?php if($EM_Booking->comment) : ?>
209
+ <img src='../wp-content/plugins/events-manager/includes/images/baloon.png' title='<?php _e('Comment:','dbem'); ?> <?php echo $EM_Booking->comment ?>' alt='comment'/>
210
+ <?php endif; ?>
211
+ <a id='booking-check-<?php echo $EM_Booking->id ?>' class='bookingdelbutton'>X</a>
212
+ </td>
213
+ <td><a title='<?php echo $EM_Booking->person->email ?> - <?php echo $EM_Booking->person->phone ?>'><?php echo $EM_Booking->person->name ?></a></td>
214
+ <td><?php echo $EM_Booking->seats ?></td>
215
+ </tr>
216
+ <?php
217
+ }
218
+ ?>
219
+ </tbody>
220
+ </table>
221
+ </div>
222
+
223
+ <br class='clear'/>
224
+
225
+ <div id='major-publishing-actions'>
226
+ <div id='publishing-action'>
227
+ <a id='printable' target='_blank' href='<?php echo get_bloginfo('wpurl') . "/wp-admin/admin.php?page=people&action=printable&event_id=".$EM_Event->id ?>'><?php _e('Printable view','dbem')?></a>
228
+ <br class='clear'/>
229
+ </div>
230
+ <br class='clear'/>
231
+ </div>
232
+ <?php
233
+ } else {
234
+ ?>
235
+ <p><em><?php _e('No responses yet!')?></em></p>
236
+ <?php
237
+ }
238
+ }
239
+ ?>
240
+ <!-- END RSVP Stats -->
241
+ </div>
242
+ </div>
243
+ </div>
244
+ <!-- END RSVP -->
245
+ <?php endif; ?>
246
+ <?php if(get_option('dbem_categories_enabled')) :?>
247
+ <!-- START Categories -->
248
+ <div class="postbox ">
249
+ <div class="handlediv" title="Fare clic per cambiare."><br />
250
+ </div>
251
+ <h3 class='hndle'><span>
252
+ <?php _e ( 'Category', 'dbem' ); ?>
253
+ </span></h3>
254
+ <div class="inside">
255
+ <p><?php _e ( 'Category:', 'dbem' ); ?>
256
+ <select name="event_category_id">
257
+ <?php
258
+ $categories = EM_Category::get();
259
+ foreach ( $categories as $category ){
260
+ $selected = ($category['category_id'] == $EM_Event->category_id) ? "selected='selected'": '';
261
+ ?>
262
+ <option value="<?php echo $category['category_id'] ?>" <?php echo $selected ?>>
263
+ <?php echo $category['category_name'] ?>
264
+ </option>
265
+ <?php
266
+ } ?>
267
+ </select>
268
+ </p>
269
+ </div>
270
+ </div>
271
+ <!-- END Categories -->
272
+ <?php endif; ?>
273
+ </div>
274
+ </div>
275
+ <!-- END OF SIDEBAR -->
276
+ <div id="post-body">
277
+ <div id="post-body-content">
278
+ <div id="event_name" class="stuffbox">
279
+ <h3>
280
+ <?php _e ( 'Name', 'dbem' ); ?>
281
+ </h3>
282
+ <div class="inside">
283
+ <input type="text" name="event_name" value="<?php echo htmlspecialchars($EM_Event->name,ENT_QUOTES); ?>" />
284
+ <br />
285
+ <?php _e ( 'The event name. Example: Birthday party', 'dbem' )?>
286
+ </div>
287
+ </div>
288
+ <div id="event_start_date" class="stuffbox">
289
+ <h3 id='event-date-title'>
290
+ <?php _e ( 'Event date', 'dbem' ); ?>
291
+ </h3>
292
+ <h3 id='recurrence-dates-title'>
293
+ <?php _e ( 'Recurrence dates', 'dbem' ); ?>
294
+ </h3>
295
+ <div class="inside">
296
+ <input id="localised-date" type="text" name="localised_event_date" style="display: none;" />
297
+ <input id="date-to-submit" type="text" name="event_start_date" value="<?php echo $EM_Event->start_date ?>" style="background: #FCFFAA" />
298
+ <input id="localised-end-date" type="text" name="localised_event_end_date" style="display: none;" />
299
+ <input id="end-date-to-submit" type="text" name="event_end_date" value="<?php echo $EM_Event->end_date ?>" style="background: #FCFFAA" />
300
+ <br />
301
+ <span id='event-date-explanation'>
302
+ <?php
303
+ _e ( 'The event date.', 'dbem' );
304
+ /* Marcus Begin Edit */
305
+ echo " ";
306
+ _e ( 'When not reoccurring, this event spans between the beginning and end date.', 'dbem' );
307
+ /* Marcus End Edit */
308
+ ?>
309
+ </span>
310
+ <span id='recurrence-dates-explanation'>
311
+ <?php _e ( 'The recurrence beginning and end date.', 'dbem' ); ?>
312
+ </span>
313
+ </div>
314
+ </div>
315
+ <div id="event_end_day" class="stuffbox">
316
+ <h3>
317
+ <?php _e ( 'Event time', 'dbem' ); ?>
318
+ </h3>
319
+ <div class="inside">
320
+ <input id="start-time" type="text" size="8" maxlength="8" name="event_start_time" value="<?php echo date( $hours_locale_regexp, strtotime($EM_Event->start_time) ); ?>" />
321
+ -
322
+ <input id="end-time" type="text" size="8" maxlength="8" name="event_end_time" value="<?php echo date( $hours_locale_regexp, strtotime($EM_Event->end_time) ); ?>" />
323
+ <br />
324
+ <?php _e ( 'The time of the event beginning and end', 'dbem' )?>.
325
+ </div>
326
+ </div>
327
+ <div id="location_coordinates" class="stuffbox" style='display: none;'>
328
+ <h3>
329
+ <?php _e ( 'Coordinates', 'dbem' ); ?>
330
+ </h3>
331
+ <div class="inside">
332
+ <input id='location-latitude' name='location_latitude' type='text' value='<?php echo $EM_Event->latitude; ?>' size='15' />
333
+ -
334
+ <input id='location-longitude' name='location_longitude' type='text' value='<?php echo $EM_Event->longitude; ?>' size='15' />
335
+ </div>
336
+ </div>
337
+ <div id="location_info" class="stuffbox">
338
+ <h3>
339
+ <?php _e ( 'Location', 'dbem' ); ?>
340
+ </h3>
341
+ <div class="inside">
342
+ <table id="dbem-location-data">
343
+ <tr>
344
+ <td style="padding-right:20px">
345
+ <table>
346
+ <?php if($use_select_for_locations) : ?>
347
+ <tr>
348
+ <th><?php _e('Location:','dbem') ?></th>
349
+ <td>
350
+ <select name="location-select-id" id='location-select-id' size="1">
351
+ <?php
352
+ $locations = EM_Locations::get();
353
+ foreach($locations as $location) {
354
+ $selected = "";
355
+ if( is_object($EM_Event->location) ) {
356
+ if ($EM_Event->location->id == $location->id)
357
+ $selected = "selected='selected' ";
358
+ }
359
+ ?>
360
+ <option value="<?php echo $location->id ?>" title="<?php echo "{$location->latitude},{$location->longitude}" ?>" <?php echo $selected ?>><?php echo $location->name; ?></option>
361
+ <?php
362
+ }
363
+ ?>
364
+ </select>
365
+ <p><?php _e ( 'The name of the location where the event takes place. You can use the name of a venue, a square, etc', 'dbem' )?></p>
366
+ </td>
367
+ </tr>
368
+ <?php else : ?>
369
+ <tr>
370
+ <th><?php _e ( 'Name:' )?></th>
371
+ <td>
372
+ <input id="location-name" type="text" name="location_name" value="<?php echo htmlspecialchars($EM_Event->location->name, ENT_QUOTES); ?>" />
373
+ <p><?php _e ( 'Select a location for your event', 'dbem' )?></p>
374
+ </td>
375
+ </tr>
376
+ <tr>
377
+ <th><?php _e ( 'Address:' )?>&nbsp;</th>
378
+ <td>
379
+ <input id="location-address" type="text" name="location_address" value="<?php echo htmlspecialchars($EM_Event->location->address, ENT_QUOTES); ; ?>" />
380
+ <p><?php _e ( 'The address of the location where the event takes place. Example: 21, Dominick Street', 'dbem' )?></p>
381
+ </td>
382
+ </tr>
383
+ <tr>
384
+ <th><?php _e ( 'Town:' )?>&nbsp;</th>
385
+ <td>
386
+ <input id="location-town" type="text" name="location_town" value="<?php echo htmlspecialchars($EM_Event->location->town, ENT_QUOTES); ?>" />
387
+ <p><?php _e ( 'The town where the location is located. If you\'re using the Google Map integration and want to avoid geotagging ambiguities include the country in the town field. Example: Verona, Italy.', 'dbem' )?></p>
388
+ </td>
389
+ </tr>
390
+ <?php endif; ?>
391
+ </table>
392
+ </td>
393
+ <?php if ( get_option ( 'dbem_gmap_is_active' ) ) : ?>
394
+ <td width="400">
395
+ <div id='em-map-404' style='width: 400px; vertical-align:middle; text-align: center;'>
396
+ <p><em><?php _e ( 'Location not found', 'dbem' ); ?></em></p>
397
+ </div>
398
+ <div id='em-map' style='width: 400px; height: 300px; display: none;'></div>
399
+ </td>
400
+ <?php endif; ?>
401
+ </tr>
402
+ </table>
403
+ </div>
404
+ </div>
405
+ <div id="event_notes" class="postbox">
406
+ <h3>
407
+ <?php _e ( 'Details', 'dbem' ); ?>
408
+ </h3>
409
+ <div class="inside">
410
+ <div id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>" class="postarea">
411
+ <?php the_editor($EM_Event->notes ); ?>
412
+ </div>
413
+ <br />
414
+ <?php _e ( 'Details about the event', 'dbem' )?>
415
+ </div>
416
+ </div>
417
+
418
+ <?php if(get_option('dbem_attributes_enabled')) : ?>
419
+ <div id="event_attributes" class="postbox">
420
+ <h3>
421
+ <?php _e ( 'Attributes', 'dbem' ); ?>
422
+ </h3>
423
+ <div class="inside">
424
+ <?php
425
+ //We also get a list of attribute names and create a ddm list (since placeholders are fixed)
426
+ $formats =
427
+ get_option ( 'dbem_event_list_item_format' ).
428
+ get_option ( 'dbem_event_page_title_format' ).
429
+ get_option ( 'dbem_full_calendar_event_format' ).
430
+ get_option ( 'dbem_location_baloon_format' ).
431
+ get_option ( 'dbem_location_event_list_item_format' ).
432
+ get_option ( 'dbem_location_page_title_format' ).
433
+ get_option ( 'dbem_map_text_format' ).
434
+ get_option ( 'dbem_rss_description_format' ).
435
+ get_option ( 'dbem_rss_title_format' ).
436
+ get_option ( 'dbem_single_event_format' ).
437
+ get_option ( 'dbem_single_location_format' );
438
+ //We now have one long string of formats, get all the attribute placeholders
439
+ preg_match_all('/#_ATT\{.+?\}(\{.+?\})?/', $formats, $placeholders);
440
+ //Now grab all the unique attributes we can use in our event.
441
+ $attributes = array();
442
+ foreach($placeholders[0] as $result) {
443
+ $attribute = substr( substr($result, 0, strpos($result, '}')), 6 );
444
+ if( !in_array($attribute, $attributes) ){
445
+ $attributes[] = $attribute ;
446
+ }
447
+ }
448
+ ?>
449
+ <div class="wrap">
450
+ <?php if( count( $attributes ) > 0 ) : ?>
451
+ <h2>Attributes</h2>
452
+ <p>Add attributes here</p>
453
+ <table class="form-table">
454
+ <thead>
455
+ <tr valign="top">
456
+ <td><strong>Attribute Name</strong></td>
457
+ <td><strong>Value</strong></td>
458
+ </tr>
459
+ </thead>
460
+ <tfoot>
461
+ <tr valign="top">
462
+ <td colspan="3"><a href="#" id="mtm_add_tag">Add new tag</a></td>
463
+ </tr>
464
+ </tfoot>
465
+ <tbody id="mtm_body">
466
+ <?php
467
+ $count = 1;
468
+ if( is_array($EM_Event->attributes) and count($EM_Event->attributes) > 0){
469
+ foreach( $EM_Event->attributes as $name => $value){
470
+ ?>
471
+ <tr valign="top" id="mtm_<?php echo $count ?>">
472
+ <td scope="row">
473
+ <select name="mtm_<?php echo $count ?>_ref">
474
+ <?php
475
+ if( !in_array($name, $attributes) ){
476
+ echo "<option value='$name'>$name (".__('Not defined in templates', 'dbem').")</option>";
477
+ }
478
+ foreach( $attributes as $attribute ){
479
+ if( $attribute == $name ) {
480
+ echo "<option selected='selected'>$attribute</option>";
481
+ }else{
482
+ echo "<option>$attribute</option>";
483
+ }
484
+ }
485
+ ?>
486
+ </select>
487
+ <a href="#" rel="<?php echo $count ?>">Remove</a>
488
+ </td>
489
+ <td>
490
+ <input type="text" name="mtm_<?php echo $count ?>_name" value="<?php echo htmlspecialchars($value, ENT_QUOTES); ?>" />
491
+ </td>
492
+ </tr>
493
+ <?php
494
+ $count++;
495
+ }
496
+ }else{
497
+ ?>
498
+ <tr valign="top" id="mtm_<?php echo $count ?>">
499
+ <td scope="row">
500
+ <select name="mtm_<?php echo $count ?>_ref">
501
+ <?php
502
+ foreach( $attributes as $attribute ){
503
+ echo "<option>$attribute</option>";
504
+ }
505
+ ?>
506
+ </select>
507
+ <a href="#" rel="<?php echo $count ?>">Remove</a>
508
+ </td>
509
+ <td>
510
+ <input type="text" name="mtm_<?php echo $count ?>_name" value="<?php echo htmlspecialchars($value, ENT_QUOTES); ?>" />
511
+ </td>
512
+ </tr>
513
+ <?php
514
+ }
515
+ ?>
516
+ </tbody>
517
+ </table>
518
+ <?php else : ?>
519
+ <p>
520
+ <?php _e('In order to use attributes, you must define some in your templates, otherwise they\'ll never show. Go to Events > Settings to add attribute placeholders.', 'dbem'); ?>
521
+ </p>
522
+ <script>
523
+ jQuery(document).ready(function($){ $('#event_attributes').addClass('closed'); });
524
+ </script>
525
+ <?php endif; ?>
526
+ </div>
527
+ </div>
528
+ </div>
529
+ <?php endif; ?>
530
+ </div>
531
+ <p class="submit">
532
+ <input type="submit" name="events_update" value="<?php _e ( 'Submit Event', 'dbem' ); ?> &raquo;" />
533
+ </p>
534
+ </div>
535
+ </div>
536
+ </div>
537
+ </form>
538
+ <script type="text/javascript">
539
+ jQuery(document).ready( function($) {
540
+ <?php if( $EM_Event->is_recurring() ): ?>
541
+ //Recurrence Warnings
542
+ $('#eventForm').submit( function(event){
543
+ confirmation = confirm('<?php _e('Are you sure you want to reschedule this recurring event? If you do this, you will lose all booking information and the old recurring events will be deleted.', 'dbem'); ?>');
544
+ if( confirmation == false ){
545
+ event.preventDefault();
546
+ }
547
+ });
548
+ <?php endif; ?>
549
+ <?php if( $EM_Event->rsvp == 1 ): ?>
550
+ //RSVP Warning
551
+ $('#rsvp-checkbox').click( function(event){
552
+ if( !this.checked ){
553
+ confirmation = confirm('<?php _e('Are you sure you want to disable bookings? If you do this and save, you will lose all previous bookings. If you wish to prevent further bookings, reduce the number of seats available to the amount of bookings you currently have', 'dbem'); ?>');
554
+ if( confirmation == false ){
555
+ event.preventDefault();
556
+ }
557
+ }
558
+ });
559
+ <?php endif; ?>
560
+ });
561
+ </script>
562
+ <?php
563
+ }
564
+ ?>
admin/events.php ADDED
@@ -0,0 +1,286 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Determines whether to show event page or events page, and saves any updates to the event or events
5
+ * @return null
6
+ */
7
+ function dbem_events_subpanel() {
8
+ //TODO Simplify panel for events, use form flags to detect certain actions (e.g. submitted, etc)
9
+ global $wpdb;
10
+ global $EM_Event;
11
+ $action = $_GET ['action'];
12
+ $action2 = $_GET ['action2'];
13
+ $event_ID = $_GET ['event_id'];
14
+ $recurrence_ID = $_GET ['recurrence_id'];
15
+ $scope = ($_GET ['scope'] != '') ? $_GET['scope']:'future';
16
+ $order = $_GET ['order']; //FIXME order not used consistently in admin area
17
+ $selectedEvents = $_GET ['events'];
18
+
19
+ if ($order == ""){
20
+ $order = "ASC";
21
+ }
22
+ $event_table_name = $wpdb->prefix . EVENTS_TBNAME;
23
+
24
+ // DELETE action
25
+ if ($action == 'deleteEvents') {
26
+ EM_Events::delete( $selectedEvents );
27
+ dbem_events_table ( EM_Events::get( array('scope'=>$scope) ), "Future events" );
28
+ }
29
+ // UPDATE or CREATE action
30
+ if ($action == 'update_event') {
31
+
32
+ if( !is_object($EM_Event) ){
33
+ $EM_Event = new EM_Event();
34
+ }
35
+ $validation = $EM_Event->get_post();
36
+ $title = ($EM_Event->is_recurring()) ? __( "Reschedule", 'dbem' )." '{$EM_Event->name}'" : "Edit event {$EM_Event->name}" ;
37
+ if ( $validation ) { //EM_Event gets the event if submitted via POST and validates it (safer than to depend on JS)
38
+ //Save
39
+ if( $EM_Event->save() ) {
40
+ ?>
41
+ <div id='message' class='updated fade'>
42
+ <p><?php echo $EM_Event->feedback_message ?></p>
43
+ </div>
44
+ <?php
45
+ dbem_events_table ( EM_Events::get( array('scope'=>$scope) ), "Future events" );
46
+ }else{
47
+ // saving unsuccessful
48
+ ?>
49
+ <div id='message' class='error '>
50
+ <p>
51
+ <?php echo "<strong>" . __( "Ach, there's a problem here:", "dbem" ) . "</strong><br /><br />" .implode('<br />', $EM_Event->errors); ?>
52
+ </p>
53
+ </div>
54
+ <?php
55
+ dbem_event_form ( $title );
56
+ }
57
+ } else {
58
+ // validation unsuccessful
59
+ ?>
60
+ <div id='message' class='error '>
61
+ <p><?php echo "<strong>" . __( "Ach, there's a problem here:", "dbem" ) . "</strong><br /><br />" . implode('<br />', $EM_Event->errors); ?></p>
62
+ </div>
63
+ <?php
64
+ dbem_event_form ( $title );
65
+ }
66
+ }
67
+
68
+ //Add or Edit Events
69
+ if ($action == 'edit_event') {
70
+ if( !is_object($EM_Event) ){
71
+ $EM_Event = new EM_Event();
72
+ $title = __ ( "Insert New Event", 'dbem' );
73
+ } else {
74
+ $title = __ ( "Edit Event", 'dbem' ) . " '" . $EM_Event->name . "'";
75
+ }
76
+ //Generate Event Form
77
+ dbem_event_form ( $title );
78
+ }
79
+
80
+ //Copy the event
81
+ if ($action == 'duplicate_event') {
82
+ global $EZSQL_ERROR;
83
+ if( $EM_Event->duplicate() ){
84
+ //Now we edit the duplicated item
85
+ $title = __ ( "Edit Event", 'dbem' ) . " '" . $EM_Event->name . "'";
86
+ echo "<div id='message' class='updated below-h2'>You are now editing the duplicated event.</div>";
87
+ dbem_event_form ( $title );
88
+ }else{
89
+ echo "<div class='error'><p>There was an error duplicating the event. Try again maybe?</div>";
90
+ dbem_events_table ( EM_Events::get(array('scope'=>$scope)), $title );
91
+ }
92
+ }
93
+
94
+ if ($action == "-1" || $action == "") {
95
+ // No action, only showing the events list
96
+ switch ($scope) {
97
+ case "past" :
98
+ $title = __ ( 'Past Events', 'dbem' );
99
+ break;
100
+ case "all" :
101
+ $title = __ ( 'All Events', 'dbem' );
102
+ break;
103
+ default :
104
+ $title = __ ( 'Future Events', 'dbem' );
105
+ $scope = "future";
106
+ }
107
+ $events = EM_Events::get( array('scope'=>$scope, 'order'=>$order ) );
108
+ dbem_events_table ( $events, $title );
109
+ }
110
+ }
111
+
112
+ function dbem_events_table($events, $title) {
113
+ $offset = ($_GET ['offset'] == '') ? 0 : $_GET ['offset'];
114
+ $limit = ($_GET ['limit'] > 0) ? $_GET['limit'] : 20;//Default limit
115
+ $scope_names = array (
116
+ 'past' => __ ( 'Past events', 'dbem' ),
117
+ 'all' => __ ( 'All events', 'dbem' ),
118
+ 'future' => __ ( 'Future events', 'dbem' )
119
+ );
120
+ $scope = ( array_key_exists( $_GET ['scope'], $scope_names) ) ? $_GET ['scope']:'future';
121
+ $events_count = count ( $events );
122
+
123
+ if (isset ( $_GET ['offset'] ))
124
+ $offset = $_GET ['offset'];
125
+
126
+ $use_events_end = get_option ( 'dbem_use_event_end' );
127
+ ?>
128
+ <div class="wrap">
129
+ <div id="icon-events" class="icon32"><br />
130
+ </div>
131
+ <h2><?php echo $title; ?></h2>
132
+ <?php
133
+ em_hello_to_new_user ();
134
+
135
+ $link = array ();
136
+ $link ['past'] = "<a href='" . get_bloginfo ( 'wpurl' ) . "/wp-admin/edit.php?page=events-manager/events-manager.php&amp;scope=past&amp;order=desc'>" . __ ( 'Past events', 'dbem' ) . "</a>";
137
+ $link ['all'] = " <a href='" . get_bloginfo ( 'wpurl' ) . "/wp-admin/edit.php?page=events-manager/events-manager.php&amp;scope=all&amp;order=desc'>" . __ ( 'All events', 'dbem' ) . "</a>";
138
+ $link ['future'] = " <a href='" . get_bloginfo ( 'wpurl' ) . "/wp-admin/edit.php?page=events-manager/events-manager.php&amp;scope=future'>" . __ ( 'Future events', 'dbem' ) . "</a>";
139
+ ?>
140
+
141
+ <form id="posts-filter" action="" method="get"><input type='hidden' name='page' value='events-manager/events-manager.php' />
142
+ <ul class="subsubsub">
143
+ <li><a href='edit.php' class="current"><?php _e ( 'Total', 'dbem' ); ?> <span
144
+ class="count">(<?php echo (count ( $events )); ?>)</span></a></li>
145
+ </ul>
146
+
147
+ <div class="tablenav">
148
+
149
+ <div class="alignleft actions">
150
+ <select name="action">
151
+ <option value="-1" selected="selected"><?php _e ( 'Bulk Actions' ); ?></option>
152
+ <option value="deleteEvents"><?php _e ( 'Delete selected','dbem' ); ?></option>
153
+ </select>
154
+ <input type="submit" value="<?php _e ( 'Apply' ); ?>" name="doaction2" id="doaction2" class="button-secondary action" />
155
+ <select name="scope">
156
+ <?php
157
+ foreach ( $scope_names as $key => $value ) {
158
+ $selected = "";
159
+ if ($key == $scope)
160
+ $selected = "selected='selected'";
161
+ echo "<option value='$key' $selected>$value</option> ";
162
+ }
163
+ ?>
164
+ </select>
165
+ <input id="post-query-submit" class="button-secondary" type="submit" value="<?php _e ( 'Filter' )?>" />
166
+ <?php
167
+ $events_nav = '';
168
+ $backward = ($offset - $limit < 0) ? 0 : $offset - $limit;
169
+ $forward = $offset + $limit;
170
+ if ($offset > 0)
171
+ $events_nav .= " <a href='" . get_bloginfo ( 'wpurl' ) . "/wp-admin/edit.php?page=events-manager/events-manager.php&amp;limit=$limit&amp;scope=$scope&amp;offset=$backward'>&lt;&lt; ".__('Previous Page','dbem')."</a> ";
172
+ if ($events_count > $limit+$offset)
173
+ $events_nav .= "<a href='" . get_bloginfo ( 'wpurl' ) . "/wp-admin/edit.php?page=events-manager/events-manager.php&amp;limit=$limit&amp;scope=$scope&amp;offset=$forward'>".__('Next Page','dbem')." &gt;&gt;</a>";
174
+ echo $events_nav;
175
+ ?>
176
+ </div>
177
+ <div class="clear"></div>
178
+
179
+ <?php
180
+ if (empty ( $events )) {
181
+ // TODO localize
182
+ _e ( 'no events','dbem' );
183
+ } else {
184
+ ?>
185
+
186
+ <table class="widefat">
187
+ <thead>
188
+ <tr>
189
+ <th class='manage-column column-cb check-column' scope='col'>
190
+ <input class='select-all' type="checkbox" value='1' />
191
+ </th>
192
+ <th><?php _e ( 'Name', 'dbem' ); ?></th>
193
+ <th>&nbsp;</th>
194
+ <th><?php _e ( 'Location', 'dbem' ); ?></th>
195
+ <th colspan="2"><?php _e ( 'Date and time', 'dbem' ); ?></th>
196
+ </tr>
197
+ </thead>
198
+ <tbody>
199
+ <?php
200
+ $i = 1;
201
+ $rowno = 0;
202
+ foreach ( $events as $event ) {
203
+ if( $i >= $offset && $i <= $offset+$limit ) {
204
+ $rowno++;
205
+ $class = ($rowno % 2) ? ' class="alternate"' : '';
206
+ // FIXME set to american
207
+ $localised_start_date = mysql2date ( __ ( 'D d M Y' ), $event->start_date );
208
+ $localised_end_date = mysql2date ( __ ( 'D d M Y' ), $event->end_date );
209
+ $style = "";
210
+ $today = date ( "Y-m-d" );
211
+ $location_summary = "<b>" . $event->location->name . "</b><br/>" . $event->location->address . " - " . $event->location->town;
212
+ $category = EM_Category::get($event->id);
213
+
214
+ if ($event->start_date < $today && $event->end_date < $today){
215
+ $style = "style ='background-color: #FADDB7;'";
216
+ }
217
+ ?>
218
+ <tr <?php echo "$class $style"; ?>>
219
+
220
+ <td>
221
+ <input type='checkbox' class='row-selector' value='<?php echo $event->id; ?>' name='events[]' />
222
+ </td>
223
+ <td>
224
+ <strong>
225
+ <a class="row-title" href="<?php bloginfo ( 'wpurl' )?>/wp-admin/edit.php?page=events-manager/events-manager.php&amp;action=edit_event&amp;event_id=<?php echo $event->id ?>"><?php echo ($event->name); ?></a>
226
+ </strong>
227
+ <?php if($category) : ?>
228
+ <br/><span title='<?php _e( 'Category', 'dbem' ).": ".$category['category_name'] ?>'><?php $category['category_name'] ?></span>
229
+ <?php endif; ?>
230
+ </td>
231
+ <td>
232
+ <a href="<?php bloginfo ( 'wpurl' )?>/wp-admin/edit.php?page=events-manager/events-manager.php&amp;action=duplicate_event&amp;event_id=<?php echo $event->id; ?>" title="<?php _e ( 'Duplicate this event', 'dbem' ); ?>">
233
+ <strong>+</strong>
234
+ </a>
235
+ </td>
236
+ <td>
237
+ <?php echo $location_summary; ?>
238
+ </td>
239
+
240
+ <td>
241
+ <?php echo $localised_start_date; ?>
242
+ <?php echo ($localised_end_date != $localised_start_date) ? " - $localised_end_date":'' ?>
243
+ <br />
244
+ <?php
245
+ //TODO Should 00:00 - 00:00 be treated as an all day event?
246
+ echo substr ( $event->start_time, 0, 5 ) . " - " . substr ( $event->end_time, 0, 5 );
247
+ ?>
248
+ </td>
249
+ <td>
250
+ <?php
251
+ if ( $event->is_recurrence() ) {
252
+ ?>
253
+ <strong>
254
+ <?php echo $event->get_recurrence_description(); ?> <br />
255
+ <a href="<?php bloginfo ( 'wpurl' )?>/wp-admin/edit.php?page=events-manager/events-manager.php&amp;action=edit_event&amp;event_id=<?php echo $event->recurrence_id ?>"><?php _e ( 'Reschedule', 'dbem' ); ?></a>
256
+ </strong>
257
+ <?php
258
+ }
259
+ ?>
260
+ </td>
261
+ </tr>
262
+ <?php
263
+ }
264
+ $i ++;
265
+ }
266
+ ?>
267
+ </tbody>
268
+ </table>
269
+ <?php
270
+ } // end of table
271
+ ?>
272
+
273
+ <div class='tablenav'>
274
+ <div class="alignleft actions">
275
+ <?php echo $events_nav; ?>
276
+ <br class='clear' />
277
+ </div>
278
+ <br class='clear' />
279
+ </div>
280
+ </div>
281
+ </form>
282
+ </div>
283
+ <?php
284
+ }
285
+
286
+ ?>
admin/functions.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*Random Admin Functions*/
3
+
4
+ //This adds the tinymce editor
5
+ function dbem_tinymce(){
6
+ add_action( 'admin_print_footer_scripts', 'wp_tiny_mce', 25 );
7
+ wp_enqueue_script('post');
8
+ if ( user_can_richedit() )
9
+ wp_enqueue_script('editor');
10
+ add_thickbox();
11
+ wp_enqueue_script('media-upload');
12
+ wp_enqueue_script('word-count');
13
+ wp_enqueue_script('quicktags');
14
+ }
15
+ add_action ( 'admin_init', 'dbem_tinymce' );
16
+
17
+ // ADMIN CSS for debug
18
+ function dbem_admin_css() {
19
+ $css = "
20
+ <style type='text/css'>
21
+ .debug{
22
+ color: green;
23
+ background: #B7F98C;
24
+ margin: 15px;
25
+ padding: 10px;
26
+ border: 1px solid #629948;
27
+ }
28
+ .switch-tab {
29
+ background: #aaa;
30
+ width: 100px;
31
+ float: right;
32
+ text-align: center;
33
+ margin: 3px 1px 0 5px;
34
+ padding: 2px;
35
+ }
36
+ .switch-tab a {
37
+ color: #fff;
38
+ text-decoration: none;
39
+ }
40
+ .switch-tab a:hover {
41
+ color: #D54E21;
42
+
43
+ }
44
+ #events-pagination {
45
+ text-align: center;
46
+
47
+ }
48
+ #events-pagination a {
49
+ margin: 0 20px 0 20px;
50
+ text-decoration: none;
51
+ width: 80px;
52
+ padding: 3px 0;
53
+ background: #FAF4B7;
54
+ border: 1px solid #ccc;
55
+ border-top: none;
56
+ }
57
+ #new-event {
58
+ float: left;
59
+
60
+ }
61
+ </style>";
62
+ echo $css;
63
+ }
64
+ add_action ( 'admin_print_scripts', 'dbem_admin_css' );
admin/locations-search.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * This page will search for either a specific location via GET "id" variable
4
+ * or will search for events by name via the GET "q" variable.
5
+ */
6
+ require_once('../../../../wp-load.php');
7
+
8
+ global $wpdb;
9
+
10
+ $locations_table = $wpdb->prefix . LOCATIONS_TBNAME;
11
+
12
+ $term = (isset($_GET['term'])) ? '%'.$_GET['term'].'%' : '%'.$_GET['q'].'%';
13
+ $sql = $wpdb->prepare("
14
+ SELECT
15
+ Concat( location_name, ', ', location_address, ', ', location_town) AS `label`,
16
+ location_name AS `value`,
17
+ location_address AS `address`,
18
+ location_town AS `town`,
19
+ location_id AS `id`
20
+ FROM $locations_table
21
+ WHERE ( `location_name` LIKE %s ) LIMIT 10
22
+ ", $term);
23
+
24
+ $locations_array = $wpdb->get_results($sql);
25
+
26
+ echo EM_Object::json_encode($locations_array);
27
+ /*
28
+ $return_string_array = array();
29
+ foreach($locations_array as $location){
30
+ $return_string_class = array();
31
+ foreach($location as $key => $value ){
32
+ $return_string_class[] = "$key : '".addslashes($value)."'";
33
+ }
34
+ $return_string_array[] = '{'. implode(',', $return_string_class) .'}';
35
+ }
36
+ echo '['. implode(',', $return_string_array) .']';
37
+ */
38
+ ?>
admin/locations.php ADDED
@@ -0,0 +1,296 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ function dbem_intercept_locations_actions() {
3
+ if(isset($_GET['page']) && $_GET['page'] == "locations") {
4
+ if(isset($_GET['doaction2']) && $_GET['doaction2'] == "Delete") {
5
+ if(isset($_GET['action2']) && $_GET['action2'] == "delete") {
6
+ $locations = $_GET['locations'];
7
+ foreach($locations as $location_id) {
8
+ dbem_delete_location($location_id);
9
+ }
10
+ }
11
+ }
12
+ }
13
+ }
14
+ add_action('init', 'dbem_intercept_locations_actions');
15
+
16
+ /**
17
+ * Looks at the request values, saves/updates and then displays the right menu in the admin
18
+ * @return null
19
+ */
20
+ function dbem_locations_page() {
21
+ //TODO EM_Location is globalized, use it fully here
22
+ global $EM_Location;
23
+ if(isset($_GET['action']) && $_GET['action'] == "edit") {
24
+ // edit location
25
+ dbem_admin_location();
26
+ } else {
27
+ if(isset($_POST['action']) && $_POST['action'] == "editedlocation") {
28
+ // location update required
29
+ $EM_Location->get_post();
30
+ $validation_result = $EM_Location->validate();
31
+ if ( $validation_result ) {
32
+ $EM_Location->save();
33
+ $message = __('The location has been updated.', 'dbem');
34
+ $locations = EM_Locations::get();
35
+ dbem_admin_locations($locations, null, $message);
36
+ } else {
37
+ $message = $validation_result;
38
+ dbem_admin_location($message);
39
+ }
40
+ } elseif(isset($_POST['action']) && $_POST['action'] == "addlocation") {
41
+ $EM_Location = new EM_Location();
42
+ $EM_Location->get_post();
43
+ $validation_result = $EM_Location->validate();
44
+ if ($validation_result) {
45
+ $EM_Location->save();
46
+ ?>
47
+ <div id='message' class='updated fade below-h2' style='background-color: rgb(255, 251, 204);'>
48
+ <p><?php _e('The location has been added.', 'dbem') ?></p>
49
+ </div>
50
+ <?php
51
+ $locations = EM_Locations::get();
52
+ dbem_admin_locations($locations, null);
53
+ } else {
54
+ ?>
55
+ <div id='message' class='error '>
56
+ <p>
57
+ <strong><?php _e( "Ach, there's a problem here:", "dbem" ) ?></strong><br /><br /><?php echo implode('<br />', $EM_Location->errors); ?>
58
+ </p>
59
+ </div>
60
+ <?php
61
+ $locations = EM_Locations::get();
62
+ dbem_admin_locations($locations, $EM_Location, $message);
63
+ }
64
+ } else {
65
+ // no action, just a locations list
66
+ $locations = EM_Locations::get();
67
+ dbem_admin_locations($locations, $message);
68
+ }
69
+ }
70
+ }
71
+
72
+ function dbem_admin_locations($locations, $new_location, $message = "") {
73
+ $destination = get_bloginfo('wpurl')."/wp-admin/admin.php";
74
+ $new_location = (get_class($new_location) == 'EM_Location') ? $new_location->to_array() : array();
75
+ ?>
76
+ <div class='wrap'>
77
+ <div id='icon-edit' class='icon32'>
78
+ <br/>
79
+ </div>
80
+ <h2><?php _e('Locations', 'dbem'); ?></h2>
81
+
82
+ <div id='col-container'>
83
+ <div id='col-right'>
84
+ <div class='col-wrap'>
85
+ <form id='bookings-filter' method='get' action='<?php echo $destination ?>'>
86
+ <input type='hidden' name='page' value='locations'/>
87
+ <input type='hidden' name='action' value='addlocation'/>
88
+
89
+ <?php if (count($locations)>0) : ?>
90
+ <table class='widefat'>
91
+ <thead>
92
+ <tr>
93
+ <th class='manage-column column-cb check-column' scope='col'><input type='checkbox' class='select-all' value='1'/></th>
94
+ <th><?php echo __('Name', 'dbem') ?></th>
95
+ <th><?php echo __('Address', 'dbem') ?></th>
96
+ <th><?php echo __('Town', 'dbem') ?></th>
97
+ </tr>
98
+ </thead>
99
+ <tfoot>
100
+ <tr>
101
+ <th class='manage-column column-cb check-column' scope='col'><input type='checkbox' class='select-all' value='1'/></th>
102
+ <th><?php echo __('Name', 'dbem') ?></th>
103
+ <th><?php echo __('Address', 'dbem') ?></th>
104
+ <th><?php echo __('Town', 'dbem') ?></th>
105
+ </tr>
106
+ </tfoot>
107
+ <tbody>
108
+ <?php foreach ($locations as $location) : ?>
109
+ <tr>
110
+ <td><input type='checkbox' class ='row-selector' value='<?php echo $location->id ?>' name='locations[]'/></td>
111
+ <td><a href='<?php echo get_bloginfo('wpurl') ?>/wp-admin/admin.php?page=locations&amp;action=edit&amp;location_id=<?php echo $location->id ?>'><?php echo $location->name ?></a></td>
112
+ <td><?php echo $location->address ?></td>
113
+ <td><?php echo $location->location_town ?></td>
114
+ </tr>
115
+ <?php endforeach; ?>
116
+ </tbody>
117
+
118
+ </table>
119
+
120
+ <div class='tablenav'>
121
+ <div class='alignleft actions'>
122
+ <input type='hidden' name='action2' value='delete'/>
123
+ <input class='button-secondary action' type='submit' name='doaction2' value='Delete'/>
124
+ <br class='clear'/>
125
+ </div>
126
+ <br class='clear'/>
127
+ </div>
128
+ <?php else: ?>
129
+ <p><?php echo __('No venues have been inserted yet!', 'dbem') ?></p>
130
+ <?php endif; ?>
131
+ </form>
132
+ </div>
133
+ </div> <!-- end col-right -->
134
+
135
+ <div id='col-left'>
136
+ <div class='col-wrap'>
137
+ <div class='form-wrap'>
138
+ <div id='ajax-response'/>
139
+ <h3><?php echo __('Add location', 'dbem') ?></h3>
140
+ <form enctype='multipart/form-data' name='addlocation' id='locationForm' method='post' action='admin.php?page=locations' class='add:the-list: validate'>
141
+ <input type='hidden' name='action' value='addlocation' />
142
+ <div class='form-field form-required'>
143
+ <label for='location_name'><?php echo __('Location name', 'dbem') ?></label>
144
+ <input id='location-name' name='location_name' id='location_name' type='text' value='<?php echo $new_location['location_name'] ?>' size='40' />
145
+ <p><?php echo __('The name of the location', 'dbem') ?>.</p>
146
+ </div>
147
+
148
+ <div class='form-field'>
149
+ <label for='location_address'><?php echo __('Location address', 'dbem') ?></label>
150
+ <input id='location-address' name='location_address' id='location_address' type='text' value='<?php echo $new_location['location_address'] ?>' size='40' />
151
+ <p><?php echo __('The address of the location', 'dbem') ?>.</p>
152
+ </div>
153
+
154
+ <div class='form-field '>
155
+ <label for='location_town'><?php echo __('Location town', 'dbem') ?></label>
156
+ <input id='location-town' name='location_town' id='location_town' type='text' value='<?php echo $new_location['location_town'] ?>' size='40' />
157
+ <p><?php echo __('The town of the location', 'dbem') ?>.</p>
158
+ </div>
159
+
160
+ <div class='form-field' style='display:none;'>
161
+ <label for='location_latitude'>LAT</label>
162
+ <input id='location-latitude' name='location_latitude' type='text' value='<?php echo $new_location['location_latitude'] ?>' size='40' />
163
+ </div>
164
+ <div class='form-field' style='display:none;'>
165
+ <label for='location_longitude'>LONG</label>
166
+ <input id='location-longitude' name='location_longitude' type='text' value='<?php echo $new_location['location_longitude'] ?>' size='40' />
167
+ </div>
168
+
169
+ <?php if ( get_option('dbem_gmap_is_active') ) : ?>
170
+ <div class="events-map">
171
+ <div id='em-map-404' style='width: 450px; vertical-align:middle; text-align: center;'>
172
+ <p><em><?php _e ( 'Location not found', 'dbem' ); ?></em></p>
173
+ </div>
174
+ <div id='em-map' style='width: 450px; height: 350px; display: none;'></div>
175
+ <br style='clear:both;' />
176
+ </div>
177
+ <?php endif; ?>
178
+
179
+ <div class='form-field'>
180
+ <label for='location_image'><?php echo __('Location image', 'dbem') ?></label>
181
+ <input id='location-image' name='location_image' id='location_image' type='file' size='35' />
182
+ <p><?php echo __('Select an image to upload', 'dbem') ?>.</p>
183
+ </div>
184
+
185
+ <div id="poststuff">
186
+ <label for='location_description'><?php _e('Location description', 'dbem') ?></label>
187
+ <div class="inside">
188
+ <div id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>" class="postarea">
189
+ <?php the_editor($new_location['location_description']); ?>
190
+ </div>
191
+ <?php _e('A description of the Location. You may include any kind of info here.', 'dbem') ?>
192
+ </div>
193
+ </div>
194
+ <p class='submit'><input type='submit' class='button' name='submit' value='<?php echo __('Add location', 'dbem') ?>' /></p>
195
+ </form>
196
+ </div>
197
+ </div>
198
+ </div> <!-- end col-left -->
199
+ </div>
200
+ </div>
201
+ </div>
202
+ <?php
203
+ }
204
+
205
+ function dbem_admin_location($message = "") {
206
+ global $EM_Location;
207
+ ?>
208
+ <div class='wrap'>
209
+ <div id='icon-edit' class='icon32'>
210
+ <br/>
211
+ </div>
212
+ <h2><?php echo __('Edit location', 'dbem') ?></h2>
213
+
214
+ <?php if($message != "") : ?>
215
+ <div id='message' class='updated fade below-h2' style='background-color: rgb(255, 251, 204);'>
216
+ <p><?php echo $message ?></p>
217
+ </div>
218
+ <?php endif; ?>
219
+ <div id='ajax-response'></div>
220
+
221
+ <form enctype='multipart/form-data' name='editcat' id='locationForm' method='post' action='admin.php?page=locations' class='validate'>
222
+ <input type='hidden' name='action' value='editedlocation' />
223
+ <input type='hidden' name='location_id' value='<?php echo $EM_Location->id ?>'/>
224
+ <table class='form-table'>
225
+ <tr class='form-field form-required'>
226
+ <th scope='row' valign='top'><label for='location_name'><?php echo __('Location name', 'dbem') ?></label></th>
227
+ <td><input name='location_name' id='location-name' type='text' value='<?php echo htmlspecialchars($EM_Location->name, ENT_QUOTES); ?>' size='40' /><br />
228
+ <?php echo __('The name of the location', 'dbem') ?></td>
229
+ </tr>
230
+
231
+ <tr class='form-field'>
232
+ <th scope='row' valign='top'><label for='location_address'><?php echo __('Location address', 'dbem') ?></label></th>
233
+ <td><input name='location_address' id='location-address' type='text' value='<?php echo htmlspecialchars($EM_Location->address, ENT_QUOTES); ?>' size='40' /><br />
234
+ <?php echo __('The address of the location', 'dbem') ?>.</td>
235
+
236
+ </tr>
237
+
238
+ <tr class='form-field'>
239
+ <th scope='row' valign='top'> <label for='location_town'><?php echo __('Location town', 'dbem') ?></label></th>
240
+ <td><input name='location_town' id='location-town' type='text' value='<?php echo htmlspecialchars($EM_Location->town, ENT_QUOTES); ?>' size='40' /><br />
241
+ <?php echo __('The town where the location is located', 'dbem') ?>.</td>
242
+
243
+ </tr>
244
+
245
+ <tr style='display:none;'>
246
+ <td>Coordinates</td>
247
+ <td><input id='location-latitude' name='location_latitude' id='location_latitude' type='text' value='<?php echo $EM_Location->latitude ?>' size='15' />
248
+ <input id='location-longitude' name='location_longitude' id='location_longitude' type='text' value='<?php echo $EM_Location->longitude ?>' size='15' /></td>
249
+ </tr>
250
+
251
+ <?php if (get_option('dbem_gmap_is_active')) { ?>
252
+ <tr>
253
+ <th scope='row' valign='top'><label for='location_map'><?php echo __('Location map', 'dbem') ?></label></th>
254
+ <td>
255
+ <div id='em-map-404' style='width: 450px; height: 350px; vertical-align:middle; text-align: center;'>
256
+ <p><em><?php _e ( 'Location not found', 'dbem' ); ?></em></p>
257
+ </div>
258
+ <div id='em-map' style='width: 450px; height: 350px; display: none;'></div>
259
+ </td>
260
+ </tr>
261
+ <?php
262
+ }
263
+ ?>
264
+ <tr class='form-field'>
265
+ <th scope='row' valign='top'><label for='location_description'><?php _e('Location description', 'dbem') ?></label></th>
266
+ <td>
267
+ <div class="inside">
268
+ <div id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>" class="postarea">
269
+ <?php the_editor($EM_Location->description); ?>
270
+ </div>
271
+ <?php _e('A description of the Location. You may include any kind of info here.', 'dbem') ?>
272
+ </div>
273
+ </td>
274
+ </tr>
275
+ <tr class='form-field'>
276
+ <th scope='row' valign='top'><label for='location_picture'><?php echo __('Location image', 'dbem') ?></label></th>
277
+ <td>
278
+ <?php if ($EM_Location->image_url != '') : ?>
279
+ <img src='<?php echo $EM_Location->image_url; ?>' alt='<?php echo $EM_Location->name ?>'/>
280
+ <?php else : ?>
281
+ <?php echo __('No image uploaded for this location yet', 'debm') ?>
282
+ <?php endif; ?>
283
+ </td>
284
+ </tr>
285
+ <tr>
286
+ <th scope='row' valign='top'><label for='location_image'><?php echo __('Upload/change picture', 'dbem') ?></label></th>
287
+ <td><input id='location-image' name='location_image' id='location_image' type='file' size='40' /></td>
288
+ </tr>
289
+ </table>
290
+ <p class='submit'><input type='submit' class='button-primary' name='submit' value='<?php echo __('Update location', 'dbem') ?>' /></p>
291
+ </form>
292
+ </div>
293
+ <?php
294
+ }
295
+
296
+ ?>
admin/options.php ADDED
@@ -0,0 +1,259 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // Function composing the options subpanel
3
+ function em_options_save(){
4
+ if( current_user_can('activate_plugins') and $_POST['em-submitted'] == '1' ){
5
+ //Build the array of options here
6
+ foreach ($_POST as $postKey => $postValue){
7
+ if( substr($postKey, 0, 5) == 'dbem_' ){
8
+ //For now, no validation, since this is in admin area.
9
+ //TODO slashes being added?
10
+ //$postValue = EM_Object::sanitize($postValue)
11
+ update_option($postKey, stripslashes($postValue));
12
+ }
13
+ }
14
+ function em_options_saved_notice(){
15
+ ?>
16
+ <div class="updated"><p><strong><?php _e('Changes saved.'); ?></strong></p></div>
17
+ <?php
18
+ }
19
+ add_action ( 'admin_notices', 'em_options_saved_notice' );
20
+ }
21
+ if( current_user_can('activate_plugins') and $_GET['revert-to2'] == '1' ){
22
+ update_option('dbem_version',2);
23
+ function em_reverted_to2(){
24
+ ?>
25
+ <div class="updated"><p><strong><?php _e('Succesfully reverted to 2. Now deactivate Events Manager and replace it with versione 2.2.'); ?></strong></p></div>
26
+ <?php
27
+ }
28
+ add_action ( 'admin_notices', 'em_reverted_to2' );
29
+
30
+ }
31
+ }
32
+ add_action('admin_head', 'em_options_save');
33
+
34
+
35
+
36
+ function dbem_options_subpanel() {
37
+ //TODO place all options into an array
38
+ $save_button = '<tr><th>&nbsp;</th><td><p class="submit" style="margin:0px; padding:0px; text-align:right;"><input type="submit" id="dbem_options_submit" name="Submit" value="'. __( 'Save Changes' ) .' ('. __('All','dbem') .')" /></p></ts></td></tr>';
39
+ ?>
40
+ <script type="text/javascript" charset="utf-8">
41
+ jQuery(document).ready(function($){
42
+ var close_text = '<?php _e('Collapse All','dbem'); ?>';
43
+ var open_text = '<?php _e('Expand All','dbem'); ?>';
44
+ var open_close = $('<a href="#" style="display:block; float:right; clear:right; margin:10px;">'+close_text+'</a>');
45
+ $('#icon-options-general').after(open_close);
46
+ open_close.click( function(e){
47
+ e.preventDefault();
48
+ if($(this).text() == close_text){
49
+ $(".postbox").addClass('closed');
50
+ $(this).text(open_text);
51
+ }else{
52
+ $(".postbox").removeClass('closed');
53
+ $(this).text(close_text);
54
+ }
55
+ });
56
+ });
57
+ </script>
58
+ <div class="wrap">
59
+ <div id='icon-options-general' class='icon32'><br />
60
+ </div>
61
+ <h2><?php _e ( 'Event Manager Options', 'dbem' ); ?></h2>
62
+
63
+ <form id="dbem_options_form" method="post" action="">
64
+
65
+ <div class="metabox-holder">
66
+ <!-- // TODO Move style in css -->
67
+ <div class='postbox-container' style='width: 99.5%'>
68
+ <div id="" class="meta-box-sortables" >
69
+
70
+ <div class="postbox " >
71
+ <div class="handlediv" title="<?php __('Click to toggle'); ?>"><br /></div><h3 class='hndle'><span><?php _e ( 'General options', 'dbem' ); ?> </span></h3>
72
+ <div class="inside">
73
+ <table class="form-table">
74
+ <?php
75
+ dbem_options_radio_binary ( __( 'Use dropdown for locations?' ), 'dbem_use_select_for_locations', __( 'Select yes to select location from a drow-down menu; location selection will be faster, but you will lose the ability to insert locations with events','dbem' ) );
76
+ dbem_options_radio_binary ( __( 'Use recurrence?' ), 'dbem_recurrence_enabled', __( 'Select yes to enable the recurrence features feature','dbem' ) );
77
+ dbem_options_radio_binary ( __( 'Use RSVP?' ), 'dbem_rsvp_enabled', __( 'Select yes to enable the recurrence features feature','dbem' ) );
78
+ dbem_options_radio_binary ( __( 'Use categories?' ), 'dbem_categories_enabled', __( 'Select yes to enable the category features','dbem' ) );
79
+ dbem_options_radio_binary ( __( 'Use attributes?' ), 'dbem_attributes_enabled', __( 'Select yes to enable the attributes feature','dbem' ) );
80
+ echo $save_button;
81
+ ?>
82
+ </table>
83
+
84
+ </div> <!-- . inside -->
85
+ </div> <!-- .postbox -->
86
+
87
+ <div class="postbox " >
88
+ <div class="handlediv" title="<?php __('Click to toggle'); ?>"><br /></div><h3 class='hndle'><span><?php _e ( 'Events page', 'dbem' ); ?> </span></h3>
89
+ <div class="inside">
90
+ <table class="form-table">
91
+ <?php
92
+ //Wordpress Pages
93
+ global $em_disable_filter; //Using a flag here instead
94
+ $em_disable_filter = true;
95
+ $get_pages = get_pages();
96
+ $events_page_options = array();
97
+ //TODO Add the hierarchy style ddm, like when choosing page parents
98
+ foreach($get_pages as $page){
99
+ $events_page_options[$page->ID] = $page->post_title;
100
+ }
101
+ $events_page_options[0] = __('No Events Page');
102
+ dbem_options_select ( __( 'Events page' ), 'dbem_events_page', $events_page_options, __( 'This option allows you to select which page to use as an events page','dbem' ) );
103
+ $em_disable_filter = false;
104
+ //Rest
105
+ dbem_options_radio_binary ( __( 'Show events page in lists?', 'dbem' ), 'dbem_list_events_page', __( 'Check this option if you want the events page to appear together with other pages in pages lists.', 'dbem' ) );
106
+ dbem_options_radio_binary ( __( 'Display calendar in events page?', 'dbem' ), 'dbem_display_calendar_in_events_page', __( 'This options allows to display the calendar in the events page, instead of the default list. It is recommended not to display both the calendar widget and a calendar page.','dbem' ) );
107
+ echo $save_button;
108
+ ?>
109
+ </table>
110
+ </div> <!-- . inside -->
111
+ </div> <!-- .postbox -->
112
+
113
+ <div class="postbox " >
114
+ <div class="handlediv" title="<?php __('Click to toggle'); ?>"><br /></div><h3 class='hndle'><span><?php _e ( 'Events format', 'dbem' ); ?> </span></h3>
115
+ <div class="inside">
116
+ <table class="form-table">
117
+ <?php
118
+ dbem_options_textarea ( __( 'Default event list format header', 'dbem' ), 'dbem_event_list_item_format_header', __( 'This content will appear just above your code for the default event list format. Default is blank', 'dbem' ) );
119
+ dbem_options_textarea ( __( 'Default event list format', 'dbem' ), 'dbem_event_list_item_format', __( 'The format of any events in a list.<br/>Insert one or more of the following placeholders: <code>#_NAME</code>, <code>#_LOCATION</code>, <code>#_ADDRESS</code>, <code>#_TOWN</code>, <code>#_NOTES</code>.<br/> Use <code>#_EXCERPT</code> to show <code>#_NOTES</code> until you place a &lt;!&ndash;&ndash; more &ndash;&ndash;&gt; marker.<br/> Use <code>#_LINKEDNAME</code> for the event name with a link to the given event page.<br/> Use <code>#_EVENTPAGEURL</code> to print the event page URL and make your own customised links.<br/> Use <code>#_LOCATIONPAGEURL</code> to print the location page URL and make your own customised links.<br/>Use <code>#_EDITEVENTLINK</code> to add add a link to edit page for the event, which will appear only when a user is logged in.<br/>To insert date and time values, use <a href="http://www.php.net/manual/en/function.date.php">PHP time format characters</a> with a <code>#</code> symbol before them, i.e. <code>#m</code>, <code>#M</code>, <code>#j</code>, etc.<br/> For the end time, put <code>#@</code> in front of the character, ie. <code>#@h</code>, <code>#@i</code>, etc.<br/> You can also create a date format without prepending <code>#</code> by wrapping it in #_{} or #@_{} (e.g. <code>#_{d/m/Y}</code>). If there is no end date, the value is not shown.<br/>Feel free to use HTML tags as <code>li</code>, <code>br</code> and so on.<br/>For custom attributes, you use <code>#_ATT{key}{alternative text}</code>, the second braces are optional and will appear if the attribute is not defined or left blank for that event. This key will appear as an option when adding attributes to your event.', 'dbem' ) );
120
+ dbem_options_textarea ( __( 'Default event list format footer', 'dbem' ), 'dbem_event_list_item_format_footer', __( 'This content will appear just below your code for the default event list format. Default is blank', 'dbem' ) );
121
+ dbem_options_input_text ( __( 'Single event page title format', 'dbem' ), 'dbem_event_page_title_format', __( 'The format of a single event page title. Follow the previous formatting instructions.', 'dbem' ) );
122
+ dbem_options_textarea ( __( 'Default single event format', 'dbem' ), 'dbem_single_event_format', __( 'The format of a single event page.<br/>Follow the previous formatting instructions. <br/>Use <code>#_MAP</code> to insert a map.<br/>Use <code>#_CONTACTNAME</code>, <code>#_CONTACTEMAIL</code>, <code>#_CONTACTPHONE</code> to insert respectively the name, e-mail address and phone number of the designated contact person. <br/>Use <code>#_ADDBOOKINGFORM</code> to insert a form to allow the user to respond to your events reserving one or more places (RSVP).<br/> Use <code>#_REMOVEBOOKINGFORM</code> to insert a form where users, inserting their name and e-mail address, can remove their bookings.', 'dbem' ) );
123
+ dbem_options_input_text ( __( 'Events page title', 'dbem' ), 'dbem_events_page_title', __( 'The title on the multiple events page.', 'dbem' ) );
124
+ dbem_options_input_text ( __( 'No events message', 'dbem' ), 'dbem_no_events_message', __( 'The message displayed when no events are available.', 'dbem' ) );
125
+ dbem_options_input_text ( __( 'List events by date title', 'dbem' ), 'dbem_list_date_title', __( 'If viewing a page for events on a specific dates, this is the title that would show up. To insert date values, use <a href="http://www.php.net/manual/en/function.date.php">PHP time format characters</a> with a <code>#</code> symbol before them, i.e. <code>#m</code>, <code>#M</code>, <code>#j</code>, etc.<br/>', 'dbem' ) );
126
+ echo $save_button;
127
+ ?>
128
+ </table>
129
+ </div> <!-- . inside -->
130
+ </div> <!-- .postbox -->
131
+
132
+ <div class="postbox " >
133
+ <div class="handlediv" title="<?php __('Click to toggle'); ?>"><br /></div><h3 class='hndle'><span><?php _e ( 'Calendar format', 'dbem' ); ?></span></h3>
134
+ <div class="inside">
135
+ <table class="form-table">
136
+ <?php
137
+ dbem_options_input_text ( __( 'Small calendar title', 'dbem' ), 'dbem_small_calendar_event_title_format', __( 'The format of the title, corresponding to the text that appears when hovering on an eventful calendar day.', 'dbem' ) );
138
+ dbem_options_input_text ( __( 'Small calendar title separator', 'dbem' ), 'dbem_small_calendar_event_title_separator', __( 'The separator appearing on the above title when more than one events are taking place on the same day.', 'dbem' ) );
139
+ dbem_options_input_text ( __( 'Full calendar events format', 'dbem' ), 'dbem_full_calendar_event_format', __( 'The format of each event when displayed in the full calendar. Remember to include <code>li</code> tags before and after the event.', 'dbem' ) );
140
+ echo $save_button;
141
+ ?>
142
+ </table>
143
+ </div> <!-- . inside -->
144
+ </div> <!-- .postbox -->
145
+
146
+ <div class="postbox " >
147
+ <div class="handlediv" title="<?php __('Click to toggle'); ?>"><br /></div><h3 class='hndle'><span><?php _e ( 'Locations format', 'dbem' ); ?> </span></h3>
148
+ <div class="inside">
149
+ <table class="form-table">
150
+ <?php
151
+ dbem_options_input_text ( __( 'Single location page title format', 'dbem' ), 'dbem_location_page_title_format', __( 'The format of a single location page title.<br/>Follow the previous formatting instructions.', 'dbem' ) );
152
+ dbem_options_textarea ( __( 'Default single location page format', 'dbem' ), 'dbem_single_location_format', __( 'The format of a single location page.<br/>Insert one or more of the following placeholders: <code>#_NAME</code>, <code>#_ADDRESS</code>, <code>#_TOWN</code>, <code>#_DESCRIPTION</code>.<br/> Use <code>#_MAP</code> to display a map of the event location, and <code>#_IMAGE</code> to display an image of the location.<br/> Use <code>#_NEXTEVENTS</code> to insert a list of the upcoming events, <code>#_PASTEVENTS</code> for a list of past events, <code>#_ALLEVENTS</code> for a list of all events taking place in this location.', 'dbem' ) );
153
+ dbem_options_textarea ( __( 'Default location baloon format', 'dbem' ), 'dbem_location_baloon_format', __( 'The format of of the text appearing in the baloon describing the location in the map.<br/>Insert one or more of the following placeholders: <code>#_NAME</code>, <code>#_ADDRESS</code>, <code>#_TOWN</code>, <code>#_DESCRIPTION</code> or <code>#_IMAGE</code>.', 'dbem' ) );
154
+ dbem_options_textarea ( __( 'Default location event list format', 'dbem' ), 'dbem_location_event_list_item_format', __( 'The format of the events the list inserted in the location page through the <code>#_NEXTEVENTS</code>, <code>#_PASTEVENTS</code> and <code>#_ALLEVENTS</code> element. <br/> Follow the events formatting instructions', 'dbem' ) );
155
+ dbem_options_textarea ( __( 'Default no events message', 'dbem' ), 'dbem_location_no_events_message', __( 'The message to be displayed in the list generated by <code>#_NEXTEVENTS</code>, <code>#_PASTEVENTS</code> and <code>#_ALLEVENTS</code> when no events are available.', 'dbem' ) );
156
+ echo $save_button;
157
+ ?>
158
+ </table>
159
+ </div> <!-- . inside -->
160
+ </div> <!-- .postbox -->
161
+
162
+ <div class="postbox " >
163
+ <div class="handlediv" title="<?php __('Click to toggle'); ?>"><br /></div><h3 class='hndle'><span><?php _e ( 'RSS feed format', 'dbem' ); ?> </span></h3>
164
+ <div class="inside">
165
+ <table class="form-table">
166
+ <?php
167
+ dbem_options_input_text ( __( 'RSS main title', 'dbem' ), 'dbem_rss_main_title', __( 'The main title of your RSS events feed.', 'dbem' ) );
168
+ dbem_options_input_text ( __( 'RSS main description', 'dbem' ), 'dbem_rss_main_description', __( 'The main description of your RSS events feed.', 'dbem' ) );
169
+ dbem_options_input_text ( __( 'RSS title format', 'dbem' ), 'dbem_rss_title_format', __( 'The format of the title of each item in the events RSS feed.', 'dbem' ) );
170
+ dbem_options_input_text ( __( 'RSS description format', 'dbem' ), 'dbem_rss_description_format', __( 'The format of the description of each item in the events RSS feed. Follow the previous formatting instructions.', 'dbem' ) );
171
+ echo $save_button;
172
+ ?>
173
+ </table>
174
+ </div> <!-- . inside -->
175
+ </div> <!-- .postbox -->
176
+
177
+ <div class="postbox " >
178
+ <div class="handlediv" title="<?php __('Click to toggle'); ?>"><br /></div><h3 class='hndle'><span><?php _e ( 'Maps and geotagging', 'dbem' ); ?> </span></h3>
179
+ <div class="inside">
180
+ <table class='form-table'>
181
+ <?php $gmap_is_active = get_option ( 'dbem_gmap_is_active' ); ?>
182
+ <tr valign="top">
183
+ <th scope="row"><?php _e ( 'Enable Google Maps integration?', 'dbem' ); ?></th>
184
+ <td>
185
+ <input id="dbem_gmap_is_active_yes" name="dbem_gmap_is_active" type="radio" value="1" <?php echo ($gmap_is_active) ? "checked='checked'":''; ?> /><?php _e ( 'Yes' ); ?><br />
186
+ <input name="dbem_gmap_is_active" type="radio" value="0" <?php echo ($gmap_is_active) ? '':"checked='checked'"; ?> /> <?php _e ( 'No' ); ?> <br />
187
+ <?php _e ( 'Check this option to enable Goggle Map integration.', 'dbem' )?>
188
+ </td>
189
+ </tr>
190
+ <?php
191
+ dbem_options_textarea ( __( 'Map text format', 'dbem' ), 'dbem_map_text_format', __( 'The format the text appearing in the event page map cloud.<br/>Follow the previous formatting instructions.', 'dbem' ) );
192
+ echo $save_button;
193
+ ?>
194
+ </table>
195
+ </div> <!-- . inside -->
196
+ </div> <!-- .postbox -->
197
+
198
+ <div class="postbox " >
199
+ <div class="handlediv" title="<?php __('Click to toggle'); ?>"><br /></div><h3 class='hndle'><span><?php _e ( 'RSVP and bookings', 'dbem' ); ?> </span></h3>
200
+ <div class="inside">
201
+ <table class='form-table'>
202
+ <?php
203
+ dbem_options_select ( __( 'Default contact person', 'dbem' ), 'dbem_default_contact_person', em_get_wp_users (), __( 'Select the default contact person. This user will be employed whenever a contact person is not explicitly specified for an event', 'dbem' ) );
204
+ dbem_options_radio_binary ( __( 'Enable the RSVP e-mail notifications?', 'dbem' ), 'dbem_rsvp_mail_notify_is_active', __( 'Check this option if you want to receive an email when someone books places for your events.', 'dbem' ) );
205
+ dbem_options_textarea ( __( 'Contact person email format', 'dbem' ), 'dbem_contactperson_email_body', __( 'The format or the email which will be sent to the contact person. Follow the events formatting instructions. <br/>Use <code>#_RESPNAME</code>, <code>#_RESPEMAIL</code> and <code>#_RESPPHONE</code> to display respectively the name, e-mail, address and phone of the respondent.<br/>Use <code>#_SPACES</code> to display the number of spaces reserved by the respondent. Use <code>#_COMMENT</code> to display the respondent\'s comment. <br/> Use <code>#_BOOKEDSEATS</code> and <code>#_AVAILABLESEATS</code> to display respectively the number of booked and available seats.', 'dbem' ) );
206
+ dbem_options_textarea ( __( 'Contact person email format', 'dbem' ), 'dbem_respondent_email_body', __( 'The format or the email which will be sent to reposdent. Follow the events formatting instructions. <br/>Use <code>#_RESPNAME</code> to display the name of the respondent.<br/>Use <code>#_CONTACTNAME</code> and <code>#_CONTACTEMAIL</code> a to display respectively the name and e-mail of the contact person.<br/>Use <code>#_SPACES</code> to display the number of spaces reserved by the respondent. Use <code>#_COMMENT</code> to display the respondent\'s comment.', 'dbem' ) );
207
+ dbem_options_input_text ( __( 'Default notification receiver address', 'dbem' ), 'dbem_mail_receiver_address', __( "Insert the address of the receiver of your notifications", 'dbem' ) );
208
+ echo $save_button;
209
+ ?>
210
+ </table>
211
+ </div> <!-- . inside -->
212
+ </div> <!-- .postbox -->
213
+
214
+ <div class="postbox " >
215
+ <div class="handlediv" title="<?php __('Click to toggle'); ?>"><br /></div><h3 class='hndle'><span><?php _e ( 'Email Settings', 'dbem' ); ?> </span></h3>
216
+ <div class="inside">
217
+ <table class='form-table'>
218
+ <?php
219
+ dbem_options_input_text ( __( 'Notification sender name', 'dbem' ), 'dbem_mail_sender_name', __( "Insert the display name of the notification sender.", 'dbem' ) );
220
+ dbem_options_input_text ( __( 'Notification sender address', 'dbem' ), 'dbem_mail_sender_address', __( "Insert the address of the notification sender. It must corresponds with your gmail account user", 'dbem' ) );
221
+ dbem_options_input_text ( 'Mail sending port', 'dbem_rsvp_mail_port', __( "The port through which you e-mail notifications will be sent. Make sure the firewall doesn't block this port", 'dbem' ) );
222
+ dbem_options_select ( __( 'Mail sending method', 'dbem' ), 'dbem_rsvp_mail_send_method', array ('smtp' => 'SMTP', 'mail' => __( 'PHP mail function', 'dbem' ), 'sendmail' => 'Sendmail', 'qmail' => 'Qmail' ), __( 'Select the method to send email notification.', 'dbem' ) );
223
+ dbem_options_radio_binary ( __( 'Use SMTP authentication?', 'dbem' ), 'dbem_rsvp_mail_SMTPAuth', __( 'SMTP authenticatio is often needed. If you use GMail, make sure to set this parameter to Yes', 'dbem' ) );
224
+ dbem_options_input_text ( 'SMTP host', 'dbem_smtp_host', __( "The SMTP host. Usually it corresponds to 'localhost'. If you use GMail, set this value to 'ssl://smtp.gmail.com:465'.", 'dbem' ) );
225
+ dbem_options_input_text ( __( 'SMTP username', 'dbem' ), 'dbem_smtp_username', __( "Insert the username to be used to access your SMTP server.", 'dbem' ) );
226
+ dbem_options_input_password ( __( 'SMTP password', 'dbem' ), "dbem_smtp_password", __( "Insert the password to be used to access your SMTP server", 'dbem' ) );
227
+ echo $save_button;
228
+ ?>
229
+ </table>
230
+ </div> <!-- . inside -->
231
+ </div> <!-- .postbox -->
232
+
233
+ <div class="postbox " >
234
+ <div class="handlediv" title="<?php __('Click to toggle'); ?>"><br /></div><h3 class='hndle'><span><?php _e ( 'Images size', 'dbem' ); ?> </span></h3>
235
+ <div class="inside">
236
+ <table class='form-table'>
237
+ <?php
238
+ dbem_options_input_text ( __( 'Maximum width (px)', 'dbem' ), 'dbem_image_max_width', __( 'The maximum allowed width for images uploades', 'dbem' ) );
239
+ dbem_options_input_text ( __( 'Maximum height (px)', 'dbem' ), 'dbem_image_max_height', __( "The maximum allowed width for images uploaded, in pixels", 'dbem' ) );
240
+ dbem_options_input_text ( __( 'Maximum size (bytes)', 'dbem' ), 'dbem_image_max_size', __( "The maximum allowed size for images uploaded, in pixels", 'dbem' ) );
241
+ ?>
242
+ </table>
243
+ </div> <!-- . inside -->
244
+ </div> <!-- .postbox -->
245
+
246
+ <p class="submit">
247
+ <input type="submit" id="dbem_options_submit" name="Submit" value="<?php _e ( 'Save Changes' )?>" />
248
+ <input type="hidden" name="em-submitted" value="1" />
249
+ </p>
250
+
251
+ </div> <!-- .metabox-sortables -->
252
+ </div> <!-- .postbox-container -->
253
+
254
+ </div> <!-- .metabox-holder -->
255
+ </form>
256
+ </div>
257
+ <?php
258
+ }
259
+ ?>
admin/people.php ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ function dbem_people_page() {
3
+ // Managing AJAX booking removal
4
+ if(isset($_GET['action']) && $_GET['action'] == 'remove_booking') {
5
+ if(isset($_POST['booking_id'])){
6
+ $EM_Booking = new EM_Booking($_POST['booking_id']);
7
+ $EM_Booking->delete();
8
+ }
9
+ }
10
+ ?>
11
+ <div class='wrap'>
12
+ <div id="icon-users" class="icon32"><br/></div>
13
+ <h2>People</h2>
14
+ <?php dbem_people_table(); ?>
15
+ </div>
16
+ <?php
17
+ }
18
+
19
+ function dbem_printable_booking_report() {
20
+ global $EM_Event;
21
+ if(isset($_GET['action']) && $_GET['action'] == 'printable' && is_object($EM_Event)){
22
+ ?>
23
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
24
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
25
+ <html>
26
+ <head>
27
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
28
+ <title>Bookings for <?php echo $EM_Event->name; ?></title>
29
+ <link rel="stylesheet" href="<?php echo bloginfo('wpurl') ?>/wp-content/plugins/events-manager/includes/css/events_manager.css" type="text/css" media="screen" />
30
+ </head>
31
+ <body id="printable">
32
+ <div id="container">
33
+ <h1>Bookings for <?php echo $EM_Event->name; ?></h1>
34
+ <p><?php echo $EM_Event->output("#d #M #Y"); ?></p>
35
+ <p><?php echo $EM_Event->output("#_LOCATION, #_ADDRESS, #_TOWN"); ?></p>
36
+ <h2><?php _e('Bookings data', 'dbem');?></h2>
37
+ <table id="bookings-table">
38
+ <tr>
39
+ <th scope='col'><?php _e('Name', 'dbem')?></th>
40
+ <th scope='col'><?php _e('E-mail', 'dbem')?></th>
41
+ <th scope='col'><?php _e('Phone number', 'dbem')?></th>
42
+ <th scope='col'><?php _e('Seats', 'dbem')?></th>
43
+ <th scope='col'><?php _e('Comment', 'dbem')?></th>
44
+ </tr>
45
+ <?php foreach($EM_Event->bookings->bookings as $EM_Booking) { ?>
46
+ <tr>
47
+
48
+ <td><?php echo $EM_Booking->person->name ?></td>
49
+ <td><?php echo $EM_Booking->person->email ?></td>
50
+ <td><?php echo $EM_Booking->person->phone ?></td>
51
+ <td class='seats-number'><?php echo $EM_Booking->seats ?></td>
52
+ <td><?php echo $EM_Booking->comment ?></td>
53
+ </tr>
54
+ <?php } ?>
55
+ <tr id='booked-seats'>
56
+ <td colspan='3'>&nbsp;</td>
57
+ <td class='total-label'><?php _e('Booked', 'dbem')?>:</td>
58
+ <td class='seats-number'><?php echo $EM_Event->bookings->get_booked_seats(); ?></td>
59
+ </tr>
60
+ <tr id='available-seats'>
61
+ <td colspan='3'>&nbsp;</td>
62
+ <td class='total-label'><?php _e('Available', 'dbem')?>:</td>
63
+ <td class='seats-number'><?php echo $EM_Event->bookings->get_available_seats(); ?></td>
64
+ </tr>
65
+ </table>
66
+ </div>
67
+ </body>
68
+ </html>
69
+ <?php
70
+ die();
71
+ }
72
+ }
73
+ add_action('init', 'dbem_printable_booking_report');
74
+
75
+ function dbem_people_table() {
76
+ $EM_People = EM_People::get();
77
+ if (count($EM_People) < 1 ) {
78
+ _e("No people have responded to your events yet!", 'dbem');
79
+ } else {
80
+ ?>
81
+ <p><?php _e('This table collects the data about the people who responded to your events', 'dbem') ?></p>
82
+ <table id='dbem-people-table' class='widefat post fixed'>
83
+ <thead>
84
+ <tr>
85
+ <th class='manage-column column-cb check-column' scope='col'>&nbsp;</th>
86
+ <th class='manage-column ' scope='col'>Name</th>
87
+ <th scope='col'>E-mail</th>
88
+ <th scope='col'>Phone number</th>
89
+ </tr>
90
+ </thead>
91
+ <tfoot>
92
+ <tr>
93
+ <th class='manage-column column-cb check-column' scope='col'>&nbsp;</th>
94
+ <th class='manage-column ' scope='col'>Name</th>
95
+ <th scope='col'>E-mail</th>
96
+ <th scope='col'>Phone number</th>
97
+ </tr>
98
+ </tfoot>
99
+ <?php foreach ($EM_People as $EM_Person): ?>
100
+ <tr>
101
+ <td>&nbsp;</td>
102
+ <td><?php echo $EM_Person->name ?></td>
103
+ <td><?php echo $EM_Person->email ?></td>
104
+ <td><?php echo $EM_Person->phone ?></td>
105
+ </tr>
106
+ <?php endforeach; ?>
107
+ </table>
108
+ <?php
109
+ }
110
+ }
111
+
112
+ /**
113
+ * Adds phone number to contact info of users, compatible with previous phone field method
114
+ * @param $array
115
+ * @return array
116
+ */
117
+ function dbem_contact_methods($array){
118
+ $array['dbem_phone'] = __('Phone','dbem') . ' <span class="description">('. __('Events Manager','dbem') .')</span>';
119
+ return $array;
120
+ }
121
+ add_filter( 'user_contactmethods' , 'dbem_contact_methods' , 10 , 1 );
122
+
123
+ ?>
admin/support.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Display function for the support page. here we can give links to forums and special upgrade instructions e.g. migration features
4
+ */
5
+ function em_admin_support(){
6
+ global $wpdb;
7
+ ?>
8
+ <div class="wrap">
9
+ <div id="icon-events" class="icon32"><br /></div>
10
+ <h2><?php _e('Getting Help for Events Manager','dbem'); ?></h2>
11
+ <p>
12
+ If you require further support or encounter any bugs please visit us at our <a href="http://davidebenini.it/events-manager-forum/">Forum</a>. We ask that you give the documentation a good read first, as this answers many common questions.
13
+ </p>
14
+ <?php
15
+ //Is this a previously imported installation?
16
+ $old_table_name = $wpdb->prefix.OLD_EVENTS_TBNAME;
17
+ if( $wpdb->get_var("SHOW TABLES LIKE '$old_table_name'") == $old_table_name ){
18
+ ?>
19
+ <div class="updated">
20
+ <h2>Troubleshooting upgrades from version 2.x to 3.x</h2>
21
+ <p>We notice that you upgraded from version 2, as we are now using new database tables, and we do not delete the old tables in case something went wrong with this upgrade.</p>
22
+ <p>If something went wrong with the update to version 3 read on:</p>
23
+ <h3>Scenario 1: the plugin is working, but for some reason the old events weren't imported</h3>
24
+ <p>You can safely reimport your old events from the previous tables without any risk of deleting them. However, if you click the link below <b>YOU WILL OVERWRITE ANY NEW EVENTS YOU CREATED IN VERSION 3</b></p>
25
+ <p><a onclick="return confirm('Are you sure you want to do this? Any new changes made since updating will be overwritten by your old ones, and this cannot be undone');" href="<?php echo wp_nonce_url( get_bloginfo('wpurl').'/wp-admin/admin.php?page=events-manager-support&em_reimport=1', 'em_reimport' ) ?>">Reimport Events from version 2</a></p>
26
+ <h3>Scenario 2: the plugin is not working, I want to go back to version 2!</h3>
27
+ <p>You can safely downgrade and will not lose any information.</p>
28
+ <ol>
29
+ <li>First of all, <a href='http://downloads.wordpress.org/plugin/events-manager.2.2.2.zip'>dowload a copy of version 2.2</a></li>
30
+ <li>Deactivate and delete Events Manager in the plugin page</li>
31
+ <li><a href="<?php bloginfo('wpurl'); ?>/wp-admin/plugin-install.php?tab=upload">Upload the zip file you just downloaded here</a></li>
32
+ <li>Let the developers know, of any bugs you ran into while upgrading. We'll help you out if there is a simple solution, and will fix reported bugs within days, if not quicker!</li>
33
+ </ol>
34
+ </div>
35
+ <?php
36
+ }
37
+ ?>
38
+ </div>
39
+ <?php
40
+ }
41
+ ?>
ajax.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ //AJAX function
3
+ function em_ajax_actions() {
4
+ //Clean this up.... use a uniformed way of calling EM Ajax actions
5
+ if(isset($_REQUEST['dbem_ajax_action']) && $_REQUEST['dbem_ajax_action'] == 'booking_data') {
6
+ if(isset($_REQUEST['id'])){
7
+ $EM_Event = new EM_Event($_REQUEST['id']);
8
+ echo "[ {bookedSeats:".$EM_Event->bookings->get_booked_seats().", availableSeats:".$EM_Event->bookings->get_available_seats()."}]";
9
+ }
10
+ die();
11
+ }
12
+ if(isset($_REQUEST['em_ajax_action']) && $_REQUEST['em_ajax_action'] == 'get_location') {
13
+ if(isset($_REQUEST['id'])){
14
+ $EM_Location = new EM_Location($_REQUEST['id']);
15
+ $location_array = $EM_Location->to_array();
16
+ $location_array['location_balloon'] = $EM_Location->output(get_option('dbem_location_baloon_format'));
17
+ echo EM_Object::json_encode($location_array);
18
+ }
19
+ die();
20
+ }
21
+ if(isset($_REQUEST['query']) && $_REQUEST['query'] == 'GlobalMapData') {
22
+ $locations = EM_Locations::get(array('eventful' => 1));
23
+ $json_locations = array();
24
+ foreach($locations as $location_key => $location) {
25
+ $json_locations[$location_key] = $location->to_array();
26
+ $json_locations[$location_key]['location_balloon'] = $location->output(get_option('dbem_map_text_format'));
27
+ }
28
+ echo EM_Object::json_encode($json_locations);
29
+ die();
30
+ }
31
+
32
+ if(isset($_REQUEST['ajaxCalendar']) && $_REQUEST['ajaxCalendar']) {
33
+ //FIXME if long events enabled originally, this won't show up on ajax call
34
+ $args = array();
35
+ if( isset($_REQUEST['full']) && $_REQUEST['full'] == 1 ) {
36
+ $args['full'] = 1;
37
+ }
38
+ if( isset($_REQUEST['longevents']) && $_REQUEST['longevents'] ) {
39
+ $args['long_events'] = 1;
40
+ }
41
+ if( isset($_REQUEST['calmonth']) ) {
42
+ $args['month'] = $_REQUEST['calmonth'];
43
+ }
44
+ if( isset($_REQUEST['calyear']) ) {
45
+ $args['year'] = $_REQUEST['calyear'];
46
+ }
47
+ echo EM_Calendar::get($args);
48
+ die();
49
+ }
50
+ }
51
+ add_action('init','em_ajax_actions');
52
+
53
+ ?>
bookings.php ADDED
@@ -0,0 +1,164 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /* Contains functions to handle save and delete requests on the front-end for bookings */
3
+ global $dbem_form_messages_booking_delete;
4
+ $dbem_form_messages_booking_delete = array();
5
+ global $dbem_form_messages_booking_add;
6
+ $dbem_form_messages_booking_add = array();
7
+
8
+ /**
9
+ * Check if there's any actions to take for bookings
10
+ * @return null
11
+ */
12
+ function em_actions_bookings() {
13
+ global $dbem_form_messages_booking_delete, $dbem_form_messages_booking_add;
14
+ global $wpdb;
15
+ global $EM_Event;
16
+
17
+ if( @get_class($EM_Event) == 'EM_Event' ){
18
+ //ADD/EDIT Booking
19
+ if (isset($_POST['eventAction']) && $_POST['eventAction'] == 'add_booking') {
20
+ $EM_Event->get_bookings();
21
+ if( $EM_Event->bookings->add( new EM_Booking($_POST) ) ){
22
+ $dbem_form_messages_booking_add['success'] = $EM_Event->bookings->feedback_message;
23
+ }else{
24
+ $dbem_form_messages_booking_add['error'] = implode('<br />', $EM_Event->bookings->errors);
25
+ }
26
+ }
27
+ //DELETE Booking
28
+ if (isset($_POST['eventAction']) && $_POST['eventAction'] == 'delete_booking') {
29
+ $EM_Event->get_bookings();
30
+ $EM_Person = new EM_Person();
31
+ if( $EM_Person->get(array('person_name' => $_POST['person_name'], 'person_email' => $_POST['person_email'])) ){
32
+ $deleted = 0;
33
+ foreach($EM_Event->bookings->bookings as $EM_Booking){
34
+ if($EM_Booking->person->id == $EM_Person->id ){
35
+ $EM_Booking->delete();
36
+ $deleted++;
37
+ }
38
+ }
39
+ }
40
+ if($deleted > 0){
41
+ $dbem_form_messages_booking_delete['success'] = __('Booking deleted', 'dbem');
42
+ }else{
43
+ $dbem_form_messages_booking_delete['error'] = __('There are no bookings associated to this name and e-mail', 'dbem');
44
+ }
45
+ }
46
+ }
47
+ }
48
+ add_action('init','em_actions_bookings');
49
+
50
+ /**
51
+ * Returns the booking form for the front-end, displayed when using placeholder #_ADDBOOKINGFORM
52
+ * @return string
53
+ */
54
+ function em_add_booking_form() {
55
+ global $dbem_form_messages_booking_add, $EM_Event;
56
+
57
+ $destination = "?".$_SERVER['QUERY_STRING']."#dbem-rsvp";
58
+ $booked_places_options = array();
59
+ for ( $i = 1; $i <= 10; $i++ ) {
60
+ $booking_seats = ($_POST['booking_seats'] == $i) ? 'selected="selected"':'';
61
+ array_push($booked_places_options, "<option value='$i' $booking_seats>$i</option>");
62
+ }
63
+ ob_start();
64
+ ?>
65
+ <div id="dbem-rsvp">
66
+ <a name="dbem-rsvp"></a>
67
+ <h3><?php _e('Book now!','dbem') ?></h3>
68
+
69
+ <?php if( !empty($dbem_form_messages_booking_add['success']) ) : ?>
70
+ <div class='dbem-rsvp-message-success'><?php echo $dbem_form_messages_booking_add['success'] ?></div>
71
+ <?php elseif( !empty($dbem_form_messages_booking_add['error']) ) : ?>
72
+ <div class='dbem-rsvp-message-error'><?php echo $dbem_form_messages_booking_add['error'] ?></div>
73
+ <?php elseif( !empty($dbem_form_messages_booking_add['message']) ) : ?>
74
+ <div class='dbem-rsvp-message'><?php echo $dbem_form_messages_booking_add['message'] ?></div>
75
+ <?php endif; ?>
76
+
77
+ <form id='dbem-rsvp-form' name='booking-form' method='post' action='<?php echo $destination ?>'>
78
+ <table class='dbem-rsvp-form'>
79
+ <tr><th scope='row'><?php _e('Name', 'dbem') ?>:</th><td><input type='text' name='person_name' value='<?php echo $_POST['person_name'] ?>'/></td></tr>
80
+ <tr><th scope='row'><?php _e('E-Mail', 'dbem') ?>:</th><td><input type='text' name='person_email' value='<?php echo $_POST['person_email'] ?>'/></td></tr>
81
+ <tr><th scope='row'><?php _e('Phone number', 'dbem') ?>:</th><td><input type='text' name='person_phone' value='<?php echo $_POST['person_phone'] ?>'/></td></tr>
82
+ <tr>
83
+ <th scope='row'><?php _e('Seats', 'dbem') ?>:</th>
84
+ <td>
85
+ <select name='booking_seats' >
86
+ <?php
87
+ foreach($booked_places_options as $option) {
88
+ echo $option ."\n";
89
+ }
90
+ ?>
91
+ </select>
92
+ </td>
93
+ </tr>
94
+ <tr><th scope='row'><?php _e('Comment', 'dbem') ?>:</th><td><textarea name='booking_comment'><?php echo $_POST['booking_comment'] ?></textarea></td></tr>
95
+ </table>
96
+ <p>
97
+ <input type='submit' value='<?php _e('Send your booking', 'dbem') ?>'/>&nbsp;&nbsp;&nbsp;&nbsp;
98
+ <input type='hidden' name='eventAction' value='add_booking'/>
99
+ <input type='hidden' name='event_id' value='<?php echo $EM_Event->id; ?>'/>
100
+ </p>
101
+ </form>
102
+ </div>
103
+ <script type="text/javascript">
104
+ jQuery(document).ready( function($){
105
+ if( $('#dbem-booking-delete').size() > 0 ){
106
+ var triggerText = '<?php ($_POST['eventAction'] == 'delete_booking') ? _e('Hide cancellation form', 'dbem') : _e('Cancel a booking', 'dbem'); ?>';
107
+ $('#dbem-rsvp input[type=submit]').after(' <a href="#" id="dbem-booking-cancel">'+triggerText+'</a>');
108
+ if( $('#dbem-booking-cancel').html() == '<?php _e('Cancel a booking', 'dbem'); ?>' ) { $('#dbem-booking-delete').hide(); }
109
+ $('#dbem-booking-cancel').click( function(event){
110
+ event.preventDefault();
111
+ if( $('#dbem-booking-cancel').html() == '<?php _e('Cancel a booking', 'dbem'); ?>' ){
112
+ $('#dbem-booking-cancel').html('<?php _e('Hide cancellation form', 'dbem'); ?>');
113
+ $('#dbem-booking-delete').slideDown();
114
+ }else{
115
+ $('#dbem-booking-cancel').html('<?php _e('Cancel a booking', 'dbem'); ?>');
116
+ $('#dbem-booking-delete').slideUp();
117
+ }
118
+ });
119
+ }
120
+ });
121
+ </script>
122
+ <?php
123
+ return ob_get_clean();
124
+ }
125
+
126
+ /**
127
+ * Booking removal in front end, called by placeholder #_REMOVEBOOKINGFORM
128
+ * @return string
129
+ */
130
+ function em_delete_booking_form() {
131
+ global $dbem_form_messages_booking_delete, $EM_Event;
132
+ $destination = "?".$_SERVER['QUERY_STRING'];
133
+ ob_start();
134
+ ?>
135
+ <div id="dbem-booking-delete">
136
+ <a name="dbem-booking-delete"></a>
137
+ <h3><?php _e('Cancel your booking', 'dbem') ?></h3>
138
+
139
+ <?php if( !empty($dbem_form_messages_booking_delete['success']) ) : ?>
140
+ <div class='dbem-rsvp-message-success'><?php echo $dbem_form_messages_booking_delete['success'] ?></div>
141
+ <?php elseif( !empty($dbem_form_messages_booking_delete['error']) ) : ?>
142
+ <div class='dbem-rsvp-message-error'><?php echo $dbem_form_messages_booking_delete['error'] ?></div>
143
+ <?php elseif( !empty($dbem_form_messages_booking_delete['message']) ) : ?>
144
+ <div class='dbem-rsvp-message'><?php echo $dbem_form_messages_booking_delete['message'] ?></div>
145
+ <?php endif; ?>
146
+
147
+ <form name='booking-delete-form' method='post' action='<?php echo $destination ?>#dbem-booking-delete'>
148
+ <table class='dbem-rsvp-form'>
149
+ <tr>
150
+ <th scope='row'><?php _e('Name', 'dbem') ?>:</th><td><input type='text' name='person_name' value='<?php echo $_POST['person_name'] ?>'/></td>
151
+ </tr>
152
+ <tr>
153
+ <th scope='row'><?php _e('E-Mail', 'dbem') ?>:</th><td><input type='text' name='person_email' value='<?php echo $_POST['person_email'] ?>'/></td>
154
+ </tr>
155
+ </table>
156
+ <input type='hidden' name='eventAction' value='delete_booking'/>
157
+ <input type='hidden' name='event_id' value='<?php echo $EM_Event->id; ?>'/>
158
+ <input type='submit' value='<?php _e('Cancel your booking', 'dbem') ?>'/>
159
+ </form>
160
+ </div>
161
+ <?php
162
+ return ob_get_clean();
163
+ }
164
+ ?>
classes/booking.php ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class EM_Booking extends EM_Object{
3
+ //DB Fields
4
+ var $id;
5
+ var $event_id;
6
+ var $person_id;
7
+ var $seats;
8
+ var $comment;
9
+ //Other Vars
10
+ var $fields = array(
11
+ 'booking_id' => array('name'=>'id','type'=>'%d'),
12
+ 'event_id' => array('name'=>'event_id','type'=>'%d'),
13
+ 'person_id' => array('name'=>'person_id','type'=>'%d'),
14
+ 'booking_seats' => array('name'=>'seats','type'=>'%d'),
15
+ 'booking_comment' => array('name'=>'comment','type'=>'%s')
16
+ );
17
+ var $person;
18
+ var $required_fields = array('booking_id', 'event_id', 'person_id', 'booking_seats');
19
+ var $feedback_message = "";
20
+ var $errors = array();
21
+
22
+ /**
23
+ * Creates booking object and retreives booking data (default is a blank booking object). Accepts either array of booking data (from db) or a booking id.
24
+ * @param mixed $booking_data
25
+ * @return null
26
+ */
27
+ function EM_Booking( $booking_data = false ){
28
+ if( $booking_data !== false ){
29
+ //Load booking data
30
+ $booking = array();
31
+ if( is_array($booking_data) ){
32
+ $booking = $booking_data;
33
+ //Also create a person out of this...
34
+ $this->person = new EM_Person($booking_data);
35
+ }elseif( $booking_data > 0 ){
36
+ //Retreiving from the database
37
+ global $wpdb;
38
+ $sql = "SELECT * FROM ". $wpdb->prefix . BOOKINGS_TBNAME ." WHERE booking_id ='$booking_data'";
39
+ $booking = $wpdb->get_row($sql, ARRAY_A);
40
+ //Get the person for this booking
41
+ $this->person = new EM_Person($booking['person_id']);
42
+ }
43
+ //Save into the object
44
+ $this->to_object($booking);
45
+ }
46
+ }
47
+
48
+ /**
49
+ * Saves the booking into the database, whether a new or existing booking
50
+ * @return boolean
51
+ */
52
+ function save(){
53
+ global $wpdb;
54
+ $table = $wpdb->prefix.BOOKINGS_TBNAME;
55
+ //First the person
56
+ //Does this person exist?
57
+ $person_result = $this->person->save();
58
+ if( $person_result === false ){
59
+ $this->errors = array_merge($this->errors, $this->person->errors);
60
+ return false;
61
+ }
62
+ $this->person_id = $this->person->id;
63
+
64
+ //Now we save the booking
65
+ $data = $this->to_array();
66
+ if($this->id != ''){
67
+ $where = array( 'booking_id' => $this->id );
68
+ $result = $wpdb->update($table, $data, $where, $this->get_types($data));
69
+ }else{
70
+ $result = $wpdb->insert($table, $data, $this->get_types($data));
71
+ $this->id = $wpdb->insert_id;
72
+ }
73
+ if( $result === false ){
74
+ $this->errors[] = __('There was a problem saving the booking.', 'dbem');
75
+ }
76
+
77
+ //Give feedback on result
78
+ if( count($this->errors) == 0 ){
79
+ //Success
80
+ $this->feedback_message = __('Your booking has been recorded','dbem');
81
+ return true;
82
+ }else{
83
+ return false;
84
+ }
85
+ return true;
86
+ }
87
+
88
+ /**
89
+ * Load an record into this object by passing an associative array of table criterie to search for.
90
+ * Returns boolean depending on whether a record is found or not.
91
+ * @param $search
92
+ * @return boolean
93
+ */
94
+ function get($search) {
95
+ global $wpdb;
96
+ $conds = array();
97
+ foreach($search as $key => $value) {
98
+ if( array_key_exists($key, $this->fields) ){
99
+ $value = $wpdb->escape($value);
100
+ $conds[] = "`$key`='$value'";
101
+ }
102
+ }
103
+ $sql = "SELECT * FROM ". $wpdb->BOOKINGS_TBNAME ." WHERE " . implode(' AND ', $conds) ;
104
+ $result = $wpdb->get_row($sql, ARRAY_A);
105
+ if($result){
106
+ $this->to_object($result);
107
+ return true;
108
+ }else{
109
+ return false;
110
+ }
111
+ }
112
+
113
+ /**
114
+ * I wonder what this does....
115
+ * @return boolean
116
+ */
117
+ function delete(){
118
+ global $wpdb;
119
+ $sql = $wpdb->prepare("DELETE FROM ". $wpdb->prefix.BOOKINGS_TBNAME . " WHERE booking_id=%d", $this->id);
120
+ return ( $wpdb->query( $sql ) !== false );
121
+ }
122
+
123
+ /**
124
+ * Returns this object in the form of an array
125
+ * @return array
126
+ */
127
+ function to_array($person = false){
128
+ $booking = array();
129
+ //Core Event Data
130
+ $booking = parent::to_array();
131
+ //Location Data
132
+ if($person && is_object($this->person)){
133
+ $person = $this->person->to_array();
134
+ $booking = array_merge($booking, $person);
135
+ }
136
+ return $booking;
137
+ }
138
+ }
139
+ ?>
classes/bookings.php ADDED
@@ -0,0 +1,196 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Deals with the booking info for an event
4
+ * @author marcus
5
+ *
6
+ */
7
+ class EM_Bookings extends EM_Object{
8
+ //TODO Bookings needs redoing
9
+
10
+ /**
11
+ * Array of EM_Booking objects for a specific event
12
+ * @var array
13
+ */
14
+ var $bookings = array();
15
+ /**
16
+ * Event ID
17
+ * @var int
18
+ */
19
+ var $event_id;
20
+ /**
21
+ * Number of seats for this event
22
+ * @var int
23
+ */
24
+ var $seats;
25
+
26
+ var $feedback_message = "";
27
+ var $errors = array();
28
+
29
+ /**
30
+ * Creates an EM_Bookings instance,
31
+ * @param EM_Event $event
32
+ * @return null
33
+ */
34
+ function EM_Bookings( $event ){
35
+ //TODO maybe not load bookings here (for speed), and have an init() function called by all functions?
36
+ if( is_object($event) && get_class($event) == "EM_Event" ){ //Creates a blank bookings object if needed
37
+ global $wpdb;
38
+ $this->event_id = $event->id;
39
+ $this->seats = $event->seats;
40
+ $sql = "SELECT * FROM ". $wpdb->prefix . BOOKINGS_TBNAME ." b, ". $wpdb->prefix . PEOPLE_TBNAME ." p WHERE event_id ='{$this->event_id}' AND p.person_id=b.person_id";
41
+ $bookings = $wpdb->get_results($sql, ARRAY_A);
42
+ foreach ($bookings as $booking){
43
+ $this->bookings[] = new EM_Booking($booking);
44
+ }
45
+ }
46
+ }
47
+
48
+ /**
49
+ * Add a booking into this event (or add seats if person already booked this), checking that there's enough space for the event
50
+ * @param $EM_Booking
51
+ * @return boolean
52
+ */
53
+ function add( $EM_Booking ){
54
+ global $wpdb;
55
+ if ( $this->get_available_seats() >= $EM_Booking->seats ) {
56
+ $EM_Booking->event_id = $this->event_id;
57
+ // checking whether the booker has already booked places
58
+ $previous_booking = $this->find_previous_booking( $EM_Booking );
59
+ $email = false;
60
+ if ( is_object($previous_booking) ) {
61
+ //Previously booked, so we add these seats to the booking
62
+ $new_seats = $EM_Booking->seats;
63
+ $EM_Booking = $previous_booking;
64
+ $EM_Booking->seats += $new_seats;
65
+ $result = $EM_Booking->save();
66
+ if($result){
67
+ $email = $this->email($EM_Booking);
68
+ }
69
+ } else {
70
+ //New booking, so let's save the booking
71
+ $result = $EM_Booking->save();
72
+ if($result){
73
+ $email = $this->email($EM_Booking);
74
+ }
75
+ }
76
+ if($result){
77
+ //Success
78
+ $this->feedback_message = __('Booking successful.', 'dbem');
79
+ if(!$email){
80
+ $this->feedback_message .= ' '.__('However, we were not able to send you an email.', 'dbem');
81
+ if( current_user_can('activate_plugins') ){
82
+ $this->feedback_message .= '<br/><strong>Errors:</strong> (only admins see this)<br/><ul><li>'. implode('</li><li>', $EM_Mailer->errors).'</li></ul>';
83
+ }
84
+ }
85
+ return true;
86
+ }else{
87
+ //Failure
88
+ $this->errors[] = "<strong>".__('Booking could not be created').":</strong><br />". implode('<br />', $EM_Booking->errors);
89
+ }
90
+ } else {
91
+ $this->errors[] = __('Booking cannot be made, not enough seats available!', 'dbem');
92
+ return false;
93
+ }
94
+ }
95
+
96
+ /**
97
+ * Delete all numbers
98
+ * @return boolean
99
+ */
100
+ function delete(){
101
+ global $wpdb;
102
+ $result = $wpdb->query("DELETE FROM ".$wpdb->prefix.BOOKINGS_TBNAME." WHERE event_id='{$this->event_id}'");
103
+ return ($result);
104
+ }
105
+
106
+ /**
107
+ * Returns number of available seats for this event
108
+ * @return int
109
+ */
110
+ function get_available_seats(){
111
+ $booked_seats = 0;
112
+ foreach ( $this->bookings as $booking ){
113
+ $booked_seats += $booking->seats;
114
+ }
115
+ return $this->seats - $booked_seats;
116
+ }
117
+
118
+ /**
119
+ * Returns number of booked seats for this event
120
+ * @return int
121
+ */
122
+ function get_booked_seats(){
123
+ $booked_seats = 0;
124
+ foreach ( $this->bookings as $booking ){
125
+ $booked_seats += $booking->seats;
126
+ }
127
+ return $booked_seats;
128
+ }
129
+
130
+ /**
131
+ * Checks if a person with similar details has booked for this before
132
+ * @param $person_id
133
+ * @return EM_Booking
134
+ */
135
+ function find_previous_booking($EM_Booking){
136
+ //First see if we have a similar person on record that's making this booking
137
+ $EM_Booking->person->load_similar();
138
+ //If person exists on record, see if they've booked this event before, if so return the booking.
139
+ if( is_numeric($EM_Booking->person->id) && $EM_Booking->person->id > 0 ){
140
+ $EM_Booking->person_id = $EM_Booking->person->id;
141
+ foreach ($this->bookings as $booking){
142
+ if( $booking->person_id == $EM_Booking->person->id ){
143
+ return $booking;
144
+ }
145
+ }
146
+ }
147
+ return false;
148
+ }
149
+
150
+ /**
151
+ * @param $EM_Booking
152
+ * @return boolean
153
+ */
154
+ function email($EM_Booking){
155
+ global $EM_Event, $EM_Mailer;
156
+
157
+ $contact_id = ( $EM_Event->contactperson_id != "") ? $EM_Event->contactperson_id : get_option('dbem_default_contact_person');
158
+
159
+ $contact_body = get_option('dbem_contactperson_email_body');
160
+ $booker_body = get_option('dbem_respondent_email_body');
161
+
162
+ // email specific placeholders
163
+ // TODO make placeholders for RSVP consistent, we shouldn't need some of these as they're on the main events output function
164
+ $placeholders = array(
165
+ '#_CONTACTEMAIL'=> $EM_Event->contact->user_email,
166
+ '#_RESPNAME' => $EM_Booking->person->name,
167
+ '#_RESPEMAIL' => $EM_Booking->person->email,
168
+ '#_RESPPHONE' => $EM_Booking->person->phone,
169
+ '#_SPACES' => $EM_Booking->seats,
170
+ '#_COMMENT' => $EM_Booking->comment,
171
+ '#_RESERVEDSPACES' => $this->get_booked_seats(),
172
+ '#_AVAILABLESPACES' => $this->get_available_seats()
173
+ );
174
+ foreach($placeholders as $key => $value) {
175
+ $contact_body= str_replace($key, $value, $contact_body);
176
+ $booker_body= str_replace($key, $value, $booker_body);
177
+ }
178
+
179
+ $contact_body = $EM_Event->output( $contact_body );
180
+ $booker_body = $EM_Event->output( $booker_body );
181
+
182
+ //TODO offer subject changes
183
+ if( !$EM_Mailer->send(__('Reservation confirmed','dbem'),$booker_body, $EM_Booking->person->email) ){
184
+ return false;
185
+ }
186
+ if( !$EM_Mailer->send(__("New booking",'dbem'), $contact_body, $EM_Event->contact->user_email) && current_user_can('activate_plugins')){
187
+ $EM_Mailer->errors[] = 'Confirmation email could not be sent to contact person. Registrant should have gotten their email (only admin see this warning).';
188
+ return false;
189
+ }
190
+
191
+ //TODO need error checking for booking mail send
192
+ return true;
193
+ }
194
+
195
+ }
196
+ ?>
classes/calendar.php ADDED
@@ -0,0 +1,324 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class EM_Calendar extends EM_Object {
3
+
4
+ function init(){
5
+ add_action('wp_head', array('EM_Calendar', 'insert_js'));
6
+ }
7
+
8
+ function get($args = array()) {
9
+ $args = self::get_default_search($args);
10
+ $full = $args['full']; //For ZDE, don't delete pls
11
+ $month = $args['month'];
12
+ $year = $args['year'];
13
+ $long_events = ($args['long_events']) ? 1:0;
14
+
15
+ $week_starts_on_sunday = get_option('dbem_week_starts_sunday');
16
+ $start_of_week = get_option('start_of_week');
17
+
18
+ global $wpdb;
19
+ if( !(is_numeric($month) && $month <= 12 && $month > 0) ) {
20
+ $month = date('m');
21
+ }
22
+ if( !( is_numeric($year) ) ){
23
+ $year = date('Y');
24
+ }
25
+
26
+ $date = mktime(0,0,0,$month, date('d'), $year);
27
+ $day = date('d', $date);
28
+ // $month = date('m', $date);
29
+ // $year = date('Y', $date);
30
+ // Get the first day of the month
31
+ $month_start = mktime(0,0,0,$month, 1, $year);
32
+ // Get friendly month name
33
+
34
+ $month_name = mysql2date('M', "$year-$month-$day 00:00:00");
35
+ // Figure out which day of the week
36
+ // the month starts on.
37
+ $month_start_day = date('D', $month_start);
38
+
39
+ switch($month_start_day){
40
+ case "Sun": $offset = 0; break;
41
+ case "Mon": $offset = 1; break;
42
+ case "Tue": $offset = 2; break;
43
+ case "Wed": $offset = 3; break;
44
+ case "Thu": $offset = 4; break;
45
+ case "Fri": $offset = 5; break;
46
+ case "Sat": $offset = 6; break;
47
+ }
48
+
49
+ $offset -= $start_of_week;
50
+ if($offset<0)
51
+ $offset += 7;
52
+
53
+ // determine how many days are in the last month.
54
+ if($month == 1) {
55
+ $num_days_last = self::days_in_month(12, ($year -1));
56
+ } else {
57
+ $num_days_last = self::days_in_month(($month-1), $year);
58
+ }
59
+ // determine how many days are in the current month.
60
+ $num_days_current = self::days_in_month($month, $year);
61
+ // Build an array for the current days
62
+ // in the month
63
+ for($i = 1; $i <= $num_days_current; $i++){
64
+ $num_days_array[] = mktime(0,0,0,$month, $i, $year);
65
+ }
66
+ // Build an array for the number of days
67
+ // in last month
68
+ for($i = 1; $i <= $num_days_last; $i++){
69
+ $num_days_last_array[] = $i;
70
+ }
71
+ // If the $offset from the starting day of the
72
+ // week happens to be Sunday, $offset would be 0,
73
+ // so don't need an offset correction.
74
+
75
+ if($offset > 0){
76
+ $offset_correction = array_slice($num_days_last_array, -$offset, $offset);
77
+ $new_count = array_merge($offset_correction, $num_days_array);
78
+ $offset_count = count($offset_correction);
79
+ }
80
+
81
+ // The else statement is to prevent building the $offset array.
82
+ else {
83
+ $offset_count = 0;
84
+ $new_count = $num_days_array;
85
+ }
86
+ // count how many days we have with the two
87
+ // previous arrays merged together
88
+ $current_num = count($new_count);
89
+
90
+ // Since we will have 5 HTML table rows (TR)
91
+ // with 7 table data entries (TD)
92
+ // we need to fill in 35 TDs
93
+ // so, we will have to figure out
94
+ // how many days to appened to the end
95
+ // of the final array to make it 35 days.
96
+
97
+
98
+ if($current_num > 35){
99
+ $num_weeks = 6;
100
+ $outset = (42 - $current_num);
101
+ } elseif($current_num < 35){
102
+ $num_weeks = 5;
103
+ $outset = (35 - $current_num);
104
+ }
105
+ if($current_num == 35){
106
+ $num_weeks = 5;
107
+ $outset = 0;
108
+ }
109
+ // Outset Correction
110
+ for($i = 1; $i <= $outset; $i++){
111
+ $new_count[] = $i;
112
+ }
113
+ // Now let's "chunk" the $all_days array
114
+ // into weeks. Each week has 7 days
115
+ // so we will array_chunk it into 7 days.
116
+ $weeks = array_chunk($new_count, 7);
117
+
118
+
119
+
120
+ // Build Previous and Next Links
121
+ $base_link = "?".$_SERVER['QUERY_STRING']."&amp;";
122
+
123
+ if($month == 1){
124
+ $back_month = 12;
125
+ $back_year = $year-1;
126
+ } else {
127
+ $back_month = $month -1;
128
+ $back_year = $year;
129
+ }
130
+ $full ? $link_extra_class = "full-link" : $link_extra_class = '';
131
+ $previous_link = "<a class='em-calnav $link_extra_class' href='?ajaxCalendar=1&amp;calmonth={$back_month}&amp;calyear={$back_year}&amp;longevents={$long_events}'>&lt;&lt;</a>";
132
+
133
+ if($month == 12){
134
+ $next_month = 1;
135
+ $next_year = $year+1;
136
+ } else {
137
+ $next_month = $month + 1;
138
+ $next_year = $year;
139
+ }
140
+ $next_link = "<a class='em-calnav $link_extra_class' href='?ajaxCalendar=1&amp;calmonth={$next_month}&amp;calyear={$next_year}&amp;longevents={$long_events}'>&gt;&gt;</a>";
141
+ $class = ($full) ? 'dbem-calendar-full' : 'dbem-calendar';
142
+ $calendar="<div class='$class'><div style='display:none' class='month_n'>$month</div><div class='year_n' style='display:none' >$year</div>";
143
+
144
+ $weekdays = array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
145
+ $n = 0 ;
146
+ while( $n < $start_of_week ) {
147
+ $last_day = array_shift($weekdays);
148
+ $weekdays[]= $last_day;
149
+ $n++;
150
+ }
151
+
152
+ $days_initials = "";
153
+ foreach($weekdays as $weekday) {
154
+ $days_initials .= "<td>".self::translate_and_trim($weekday)."</td>";
155
+ }
156
+ $full ? $fullclass = 'fullcalendar' : $fullclass='';
157
+ // Build the heading portion of the calendar table
158
+ $calendar .= "<table class='dbem-calendar-table $fullclass'>\n".
159
+ "<thead>\n<tr>\n".
160
+ "<td>$previous_link</td><td class='month_name' colspan='5'>$month_name $year</td><td>$next_link</td>\n".
161
+ "</tr>\n</thead>\n".
162
+ "<tr class='days-names'>\n".
163
+ $days_initials.
164
+ "</tr>\n";
165
+
166
+ // Now we break each key of the array
167
+ // into a week and create a new table row for each
168
+ // week with the days of that week in the table data
169
+
170
+ $i = 0;
171
+ foreach($weeks as $week){
172
+ $calendar .= "<tr>\n";
173
+ foreach($week as $d){
174
+ if($i < $offset_count){ //if it is PREVIOUS month
175
+ $calendar .= "<td class='eventless-pre'>$d</td>\n";
176
+ }
177
+ if(($i >= $offset_count) && ($i < ($num_weeks * 7) - $outset)){ // if it is THIS month
178
+ $fullday=$d;
179
+ $d=date('j', $d);
180
+ $day_link = "$d";
181
+ if($d == date('j') && $month == date('m') && $year == date('Y')) {
182
+ $calendar .= "<td class='eventless-today'>$d</td>\n";
183
+ } else {
184
+ $calendar .= "<td class='eventless'>$day_link</td>\n";
185
+ }
186
+ } elseif(($outset > 0)) { //if it is NEXT month
187
+ if(($i >= ($num_weeks * 7) - $outset)){
188
+ $calendar .= "<td class='eventless-post'>$d</td>\n";
189
+ }
190
+ }
191
+ $i++;
192
+ }
193
+ $calendar .= "</tr>\n";
194
+ }
195
+
196
+ $calendar .= " </table>\n</div>";
197
+
198
+ // query the database for events in this time span
199
+ if ($month == 1) {
200
+ $month_pre=12;
201
+ $month_post=2;
202
+ $year_pre=$year-1;
203
+ $year_post=$year;
204
+ } elseif($month == 12) {
205
+ $month_pre=11;
206
+ $month_post=1;
207
+ $year_pre=$year;
208
+ $year_post=$year+1;
209
+ } else {
210
+ $month_pre=$month-1;
211
+ $month_post=$month+1;
212
+ $year_pre=$year;
213
+ $year_post=$year;
214
+ }
215
+ //TODO expand by including category, location, etc. criteria
216
+ $events = EM_Events::get( array('year'=>array($year_pre, $year_post), 'month'=>array($month_pre, $month_post)) );
217
+
218
+ $eventful_days= array();
219
+ if($events){
220
+ //Go through the events and slot them into the right d-m index
221
+ foreach($events as $event) {
222
+ if( $long_events ){
223
+ //If $long_events is set then show a date as eventful if there is an multi-day event which runs during that day
224
+ $event_start_date = strtotime($event->start_date);
225
+ $event_end_date = strtotime($event->end_date);
226
+ if( $event_end_date == '' ) $event_end_date = $event_start_date;
227
+ while( $event_start_date <= $event_end_date ){
228
+ $event_eventful_date = date('Y-m-d', $event_start_date);
229
+ if( array_key_exists($event_eventful_date, $eventful_days) && is_array($eventful_days[$event_eventful_date]) ){
230
+ $eventful_days[$event_eventful_date][] = $event;
231
+ } else {
232
+ $eventful_days[$event_eventful_date] = array($event);
233
+ }
234
+ $event_start_date += (60*60*24);
235
+ }
236
+ }else{
237
+ //Only show events on the day that they start
238
+ if( isset($eventful_days[$event->start_date]) && is_array($eventful_days[$event->start_date]) ){
239
+ $eventful_days[$event->start_date][] = $event;
240
+ } else {
241
+ $eventful_days[$event->start_date] = array($event);
242
+ }
243
+ }
244
+ }
245
+ }
246
+
247
+ $event_format = get_option('dbem_full_calendar_event_format');
248
+ $event_title_format = get_option('dbem_small_calendar_event_title_format');
249
+ $event_title_separator_format = get_option('dbem_small_calendar_event_title_separator');
250
+ $cells = array() ;
251
+ foreach($eventful_days as $day_key => $events) {
252
+ //Set the date into the key
253
+ $event_start_date = explode('-', $day_key);
254
+ $cells[$day_key]['day'] = ltrim($event_start_date[2],'0');
255
+ $cells[$day_key]['month'] = $event_start_date[1];
256
+ $events_titles = array();
257
+ foreach($events as $event) {
258
+ $events_titles[] = $event->output($event_title_format);
259
+ }
260
+ $link_title = implode($event_title_separator_format,$events_titles);
261
+
262
+ $events_page_id = get_option('dbem_events_page');
263
+ $event_page_link = get_permalink($events_page_id);
264
+ if (stristr($event_page_link, "?"))
265
+ $joiner = "&amp;";
266
+ else
267
+ $joiner = "?";
268
+
269
+
270
+ $cells[$day_key]['cell'] = "<a title='$link_title' href='".$event_page_link.$joiner."calendar_day={$day_key}'>{$cells[$day_key]['day']}</a>";
271
+ if ($full) {
272
+ $cells[$day_key]['cell'] .= "<ul>";
273
+
274
+ foreach($events as $event) {
275
+ $cells[$day_key]['cell'] .= $event->output($event_format);
276
+ }
277
+ $cells[$day_key]['cell'] .= "</ul>";
278
+ }
279
+ }
280
+
281
+ if($events){
282
+ foreach($cells as $cell) {
283
+ if ($cell['month'] == $month_pre) {
284
+ $calendar=str_replace("<td class='eventless-pre'>".$cell['day']."</td>","<td class='eventful-pre'>".$cell['cell']."</td>",$calendar);
285
+ } elseif($cell['month'] == $month_post) {
286
+ $calendar=str_replace("<td class='eventless-post'>".$cell['day']."</td>","<td class='eventful-post'>".$cell['cell']."</td>",$calendar);
287
+ } elseif($cell['day'] == $day && $cell['month'] == date('m')) {
288
+ $calendar=str_replace("<td class='eventless-today'>".$cell['day']."</td>","<td class='eventful-today'>".$cell['cell']."</td>",$calendar);
289
+ } elseif( $cell['month'] == $month ){
290
+ $calendar=str_replace("<td class='eventless'>".$cell['day']."</td>","<td class='eventful'>".$cell['cell']."</td>",$calendar);
291
+ }
292
+ }
293
+ }
294
+ return $calendar;
295
+ }
296
+
297
+ /**
298
+ * Echoes the calendar external JS contents directly into the head of the document
299
+ * @return unknown_type
300
+ */
301
+ function insert_js() {
302
+ ?>
303
+ <script type='text/javascript'>
304
+ <?php include(WP_PLUGIN_DIR.'/events-manager/includes/js/em_calendar_ajax.js'); ?>
305
+ </script>
306
+ <?php
307
+ }
308
+
309
+
310
+ function days_in_month($month, $year) {
311
+ return cal_days_in_month(CAL_GREGORIAN, $month, $year);
312
+ }
313
+
314
+ function translate_and_trim($string, $length = 1) {
315
+ return substr(__($string), 0, $length);
316
+ }
317
+
318
+ function get_default_search($array=array()){
319
+ $defaults = array( 'full' => 0, 'month' => '', 'year' => '', 'long_events' => 0 );
320
+ return parent::get_default_search($defaults, $array);
321
+ }
322
+ }
323
+ add_action('init', array('EM_Calendar', 'init'));
324
+ ?>
classes/category.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ //TODO expand em_category to be like other classes
3
+ class EM_Category extends EM_Object {
4
+
5
+ function get( $category_id = false ){
6
+ global $wpdb;
7
+ $categories_table = $wpdb->prefix.DBEM_CATEGORIES_TBNAME;
8
+ if( $category_id === false ){
9
+ //No id supplied, so we return everything
10
+ return $wpdb->get_results("SELECT * FROM $categories_table", ARRAY_A);
11
+ }else{
12
+ $sql = "SELECT * FROM $categories_table WHERE category_id ='$category_id'";
13
+ $category = $wpdb->get_row($sql, ARRAY_A);
14
+ return $category;
15
+ }
16
+ }
17
+ }
18
+ ?>
classes/event.php ADDED
@@ -0,0 +1,797 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Event Object. This holds all the info pertaining to an event, including location and recurrence info.
4
+ * An event object can be one of three "types" a recurring event, recurrence of a recurring event, or a single event.
5
+ * The single event might be part of a set of recurring events, but if loaded by specific event id then any operations and saves are
6
+ * specifically done on this event. However, if you edit the recurring group, any changes made to single events are overwritten.
7
+ *
8
+ * @author marcus
9
+ */
10
+ //TODO Can add more recurring functionality such as "also update all future recurring events" or "edit all events" like google calendar does.
11
+ //TODO Integrate recurrences into events table
12
+ //FIXME If you create a super long recurrence timespan, there could be thousands of events... need an upper limit here.
13
+ class EM_Event extends EM_Object{
14
+ /**
15
+ * Assoc array where keys are names of database fields and values are array corresponding object property name, regex, data types, etc.
16
+ * for use when importing/exporting event data between database and object
17
+ * @var array
18
+ */
19
+ var $fields = array(
20
+ 'event_id' => array( 'name'=>'id', 'type'=>'%d' ),
21
+ 'event_author' => array( 'name'=>'author', 'type'=>'%d' ),
22
+ 'event_name' => array( 'name'=>'name', 'type'=>'%s' ),
23
+ 'event_start_time' => array( 'name'=>'start_time', 'type'=>'%s' ),
24
+ 'event_end_time' => array( 'name'=>'end_time', 'type'=>'%s' ),
25
+ 'event_start_date' => array( 'name'=>'start_date', 'type'=>'%s' ),
26
+ 'event_end_date' => array( 'name'=>'end_date', 'type'=>'%s' ),
27
+ 'event_notes' => array( 'name'=>'notes', 'type'=>'%s' ),
28
+ 'event_rsvp' => array( 'name'=>'rsvp', 'type'=>'%d' ),
29
+ 'event_seats' => array( 'name'=>'seats', 'type'=>'%d' ),
30
+ 'event_contactperson_id' => array( 'name'=>'contactperson_id', 'type'=>'%d' ),
31
+ 'location_id' => array( 'name'=>'location_id', 'type'=>'%d' ),
32
+ 'recurrence_id' => array( 'name'=>'recurrence_id', 'type'=>'%d' ),
33
+ 'event_category_id' => array( 'name'=>'category_id', 'type'=>'%d' ),
34
+ 'event_attributes' => array( 'name'=>'attributes', 'type'=>'%s' ),
35
+ 'recurrence' => array( 'name'=>'recurrence', 'type'=>'%d' ),
36
+ 'recurrence_interval' => array( 'name'=>'interval', 'type'=>'%d' ),
37
+ 'recurrence_freq' => array( 'name'=>'freq', 'type'=>'%s' ),
38
+ 'recurrence_byday' => array( 'name'=>'byday', 'type'=>'%s' ),
39
+ 'recurrence_byweekno' => array( 'name'=>'byweekno', 'type'=>'%d' )
40
+ );
41
+
42
+ /**
43
+ * @var EM_Location
44
+ */
45
+ var $location;
46
+ /**
47
+ * @var EM_Bookings
48
+ */
49
+ var $bookings;
50
+ /**
51
+ * The contact person for this event
52
+ * @var WP_User
53
+ */
54
+ var $contact;
55
+ /**
56
+ * If there are any errors, they will be added here.
57
+ * @var array
58
+ */
59
+ var $errors = array();
60
+ /**
61
+ * If something was successful, a feedback message might be supplied here.
62
+ * @var string
63
+ */
64
+ var $feedback_message;
65
+ /**
66
+ * Array of dbem_event field names required to create an event
67
+ * @var array
68
+ */
69
+ var $required_fields = array('event_name', 'event_start_date');
70
+
71
+ /**
72
+ * Initialize an event. You can provide event data in an associative array (using database table field names), an id number, or false (default) to create empty event.
73
+ * @param mixed $event_data
74
+ * @param boolean $recurrent
75
+ * @return null
76
+ */
77
+ function EM_Event($event_data = false, $recurrent = false) {
78
+ global $wpdb, $EM_Recurrences;
79
+ //TODO Change the way we deal with time, maybe revert to timestamps for manipulation, and worry about output in html and db writes?
80
+ if( $event_data !== false ){
81
+ $event = array();
82
+ if( is_array($event_data) ){
83
+ //Accepts a raw array that'll just be imported directly into the object with no DB lookups (same for event and recurrence)
84
+ $event = $event_data;
85
+ //FIXME this could lead to potential blank locations, if not supplied in array... do we load or not?
86
+ $this->location = new EM_Location( $event );
87
+ }elseif( is_numeric($event_data) && $event_data > 0 ){
88
+ //Retreiving from the database
89
+ $events_table = $wpdb->prefix . EVENTS_TBNAME;
90
+ $locations_table = $wpdb->prefix . LOCATIONS_TBNAME;
91
+ $sql = "
92
+ SELECT * FROM $events_table
93
+ LEFT JOIN $locations_table ON {$locations_table}.location_id={$events_table}.location_id
94
+ WHERE event_id = $event_data
95
+ "; //We get event and location data here to avoid extra queries
96
+ $event = $wpdb->get_row ( $sql, ARRAY_A );
97
+ //Sort Location
98
+ $this->location = new EM_Location ( $event );
99
+ }
100
+ //Sort out attributes
101
+ $event ['event_attributes'] = @unserialize($event ['event_attributes']);
102
+ $event ['event_attributes'] = (!is_array($event ['event_attributes'])) ? array() : $event ['event_attributes'] ;
103
+ $this->to_object($event, true);
104
+ //Add Contact Person
105
+ if($this->contactperson_id){
106
+ if($this->contactperson_id > 0){
107
+ $this->contact = get_userdata($this->contactperson_id);
108
+ }
109
+ }
110
+ if( !is_object($this->contact) ){
111
+ $this->contactperson_id = get_option('dbem_default_contact_person');
112
+ $this->contact = get_userdata($this->contactperson_id);
113
+ }
114
+ if( is_object($this->contact) ){
115
+ $this->contact->phone = get_user_meta($this->contact->ID, 'dbem_phone', true);
116
+ }
117
+ //Now, if this is a recurrence, get the recurring for caching to the $EM_Recurrences
118
+ if( $this->is_recurrence() && !array_key_exists($this->recurrence_id, $EM_Recurrences) ){
119
+ $EM_Recurrences[$this->recurrence_id] = new EM_Event($this->recurrence_id);
120
+ }
121
+ }
122
+ }
123
+
124
+ /**
125
+ * Retrieve event, location and recurring information via POST
126
+ * @return boolean
127
+ */
128
+ function get_post(){
129
+ //Build Event Array
130
+ $post = $_POST;
131
+ $this->name = stripslashes ( $_POST ["event_name"] );
132
+ $this->start_date = $_POST ["event_start_date"];
133
+ $this->end_date = ($_POST ['event_end_date'] == '') ? $this->start_date : $_POST ["event_end_date"];
134
+ $this->rsvp = ( $_POST ['event_rsvp'] == 1 ) ? 1:0;
135
+ $this->seats = ( is_numeric($_POST ['event_seats']) ) ? $_POST ['event_seats']:0;
136
+ $this->notes = stripslashes ( $_POST ['content'] ); //WP TinyMCE field
137
+ //Sort out time
138
+ //TODO make time handling less painful
139
+ $match = array();
140
+ if( preg_match ( '/^([01]\d|2[0-3]):([0-5]\d)(AM|PM)?$/', $_POST['event_start_time'], $match ) ){
141
+ $match[1] = ($match[3] == 'PM') ? 12+$match[1] : $match[1];
142
+ $this->start_time = $match[1].":".$match[2].":00";
143
+ }else{
144
+ $this->start_time = "00:00:00";
145
+ }
146
+ if( preg_match ( '/^([01]\d|2[0-3]):([0-5]\d)(AM|PM)?$/', $_POST['event_end_time'], $match ) ){
147
+ $match[1] = ($match[3] == 'PM') ? 12+$match[1] : $match[1];
148
+ $this->end_time = $match[1].":".$match[2].":00";
149
+ }else{
150
+ $this->end_time = $this->start_time;
151
+ }
152
+ //Contact Person
153
+ if ( is_numeric($_POST['event_contactperson_id']) ) {
154
+ //TODO contactperson choices needs limiting depending on role
155
+ $this->contactperson_id = $_POST ['event_contactperson_id'];
156
+ }
157
+ //category
158
+ if( is_numeric($_POST ['event_category_id']) ){
159
+ $this->category_id = $_POST ['event_category_id'];
160
+ }
161
+ //Attributes
162
+ $event_attributes = array();
163
+ for($i=1 ; trim($_POST["mtm_{$i}_ref"])!='' ; $i++ ){
164
+ if(trim($_POST["mtm_{$i}_name"]) != ''){
165
+ $event_attributes[$_POST["mtm_{$i}_ref"]] = stripslashes($_POST["mtm_{$i}_name"]);
166
+ }
167
+ }
168
+ $this->attributes = $event_attributes;
169
+ //Recurrence data
170
+ $this->recurrence_id = ( is_numeric($_POST ['recurrence_id']) ) ? $_POST ['recurrence_id'] : 0 ;
171
+ if($_POST ['repeated_event']){
172
+ $this->recurrence = 1;
173
+ $this->freq = $_POST ['recurrence_freq'];
174
+ $this->byday = ($this->freq == 'weekly') ? implode ( ",", $_POST ['recurrence_bydays'] ) : $_POST ['recurrence_bydays'];
175
+ $this->interval = ($_POST ['recurrence_interval'] == "") ? 1 : $_POST ['recurrence_interval'];
176
+ $this->byweekno = $_POST ['recurrence_byweekno'];
177
+ }
178
+
179
+ //Add location information, or just link to previous location, this is a requirement...
180
+ if( isset($_POST['location-select-id']) && $_POST['location-select-id'] != "" ) {
181
+ $this->location = new EM_Location($_POST['location-select-id']);
182
+ } else {
183
+ $this->location = new EM_Location($_POST);
184
+ $this->location->load_similar($_POST);
185
+ }
186
+ return $this->validate();
187
+ }
188
+
189
+ /**
190
+ * Will save the current instance into the database, along with location information if a new one was created and return true if successful, false if not.
191
+ * Will automatically detect what type of event it is (recurrent, recurrence or normal) and whether it's a new or existing event.
192
+ * @return boolean
193
+ */
194
+ function save(){
195
+ //FIXME Event doesn't save title when inserting first time
196
+ global $wpdb, $current_user;
197
+ get_currentuserinfo();;
198
+ $events_table = $wpdb->prefix.EVENTS_TBNAME;
199
+ //First let's save the location, no location no event!
200
+ if ( !$this->location->id && !$this->location->save() ){ //shouldn't try to save if location exists
201
+ $this->errors[] = __ ( 'There was a problem saving the location so event was not saved.', 'dbem' );
202
+ return false;
203
+ }
204
+ $this->location_id = $this->location->id;
205
+ //TODO make contactperson_id NULL if not used
206
+ $this->contactperson_id = ( $this->contactperson_id > 0 ) ? $this->contactperson_id:0;
207
+ //Now save the event
208
+ if ( !$this->id ) {
209
+ // Insert New Event
210
+ $this->author = $current_user->ID; //Record creator of event
211
+ $event = $this->to_array(false, true);
212
+ $event['event_attributes'] = serialize($this->attributes);
213
+ $event['recurrence_id'] = ( is_numeric($this->recurrence_id) ) ? $this->recurrence_id : 0;
214
+ $result = $wpdb->insert ( $events_table, $event, $this->get_types($event) );
215
+ if($result !== false){
216
+ $this->id = $wpdb->insert_id;
217
+ //Deal with recurrences
218
+ if ( $this->is_recurring() ) {
219
+ //Recurrence master event saved, now Save Events & check errors
220
+ if( !$this->save_events() ){
221
+ $this->errors[] = __ ( 'Something went wrong with the recurrence update...', 'dbem' ).
222
+ __ ( 'There was a problem saving the recurring events.', 'dbem' );
223
+ $this->delete();
224
+ return false;
225
+ }
226
+ //All good! Event Saved
227
+ $this->feedback_message = __ ( 'New recurrent event inserted!', 'dbem' );
228
+ return true;
229
+ }
230
+ //Successful individual save
231
+ $this->feedback_message = __ ( 'New event successfully inserted!', 'dbem' );
232
+ return true;
233
+ }else{
234
+ $this->errors[] = __ ( 'Could not save the event details due to a database error.', 'dbem' );
235
+ }
236
+ } else {
237
+ // Update Event
238
+ //TODO event privacy protection, only authors and authorized users can edit events
239
+ //$this->author = $current_user->ID; //Record creator of event
240
+ //FIXME Saving recurrence and disabling recurrence doesn't work
241
+ $this->recurrence_id = 0; // If it's saved here, it becomes individual
242
+ $event = $this->to_array();
243
+ $event['event_attributes'] = serialize($event['event_attributes']);
244
+ $result = $wpdb->update ( $events_table, $event, array('event_id' => $this->id), $this->get_types($event) );
245
+ if($result !== false){ //Can't just do $result since if you don't make an actual record details change, it'll return 0 for no changes made
246
+ //Deal with recurrences
247
+ if ( $this->is_recurring() ) {
248
+ if( !$this->save_events() ){
249
+ $this->errors[] = __ ( 'Something went wrong with the recurrence update...', 'dbem' ).
250
+ __ ( 'There was a problem saving the recurring events.', 'dbem' );
251
+ return false;
252
+ }
253
+ $this->feedback_message = __ ( 'Recurrence updated!', 'dbem' );
254
+ return true;
255
+ }
256
+ }else{
257
+ $this->errors[] = __('Could not save the event details due to a database error.', 'dbem');
258
+ return false;
259
+ }
260
+ //Successful individual or recurrence save
261
+ $this->feedback_message = "'{$this->name}' " . __ ( 'updated', 'dbem' ) . "!";
262
+ if($this->rsvp == 0){
263
+ $this->delete_bookings();
264
+ }
265
+ return true;
266
+ }
267
+ }
268
+
269
+ /**
270
+ * Delete whole event, including recurrence and recurring data
271
+ * @param $recurrence_id
272
+ * @return null
273
+ */
274
+ function delete(){
275
+ global $wpdb;
276
+ if( $this->is_recurring() ){
277
+ //Delete the recurrences then this recurrence event
278
+ $this->delete_events();
279
+ }
280
+ $bookings_result = $this->delete_bookings();
281
+ $result = $wpdb->query ( $wpdb->prepare("DELETE FROM ". $wpdb->prefix . EVENTS_TBNAME ." WHERE event_id=%d", $this->id) );
282
+ }
283
+
284
+ /**
285
+ * Duplicates this event and returns the duplicated event. Will return false if there is a problem with duplication.
286
+ * @return EM_Event
287
+ */
288
+ function duplicate(){
289
+ global $wpdb, $EZSQL_ERROR;
290
+ //First, duplicate.
291
+ $event_table_name = $wpdb->prefix . EVENTS_TBNAME;
292
+ $eventArray = $this->to_array();
293
+ unset($eventArray['event_id']);
294
+ $result = $wpdb->insert($event_table_name, $eventArray);
295
+ if($result !== false){
296
+ //Get the ID of the new item
297
+ $event_ID = $wpdb->insert_id;
298
+ $EM_Event = new EM_Event( $event_ID );
299
+ return $EM_Event;
300
+ }else{
301
+ //TODO add error notifications for duplication failures.
302
+ return false;
303
+ }
304
+ }
305
+
306
+
307
+ /**
308
+ * Validates the event. Should be run during any form submission or saving operation.
309
+ * @return boolean
310
+ */
311
+ function validate() {
312
+ $missing_fields = Array ();
313
+ foreach ( $this->required_fields as $field ) {
314
+ $true_field = $this->fields[$field]['name'];
315
+ if ( $this->$true_field == "") {
316
+ $missing_fields[] = $field;
317
+ }
318
+ }
319
+ if ( count($missing_fields) > 0){
320
+ // TODO Create friendly equivelant names for missing fields notice in validation
321
+ $this->errors[] = __ ( 'Missing fields: ' ) . implode ( ", ", $missing_fields ) . ". ";
322
+ }
323
+ if ( $_POST ['repeated_event'] == "1" && $this->end_date == "" ){
324
+ $this->errors[] = __ ( 'Since the event is repeated, you must specify an event date.', 'dbem' );
325
+ }
326
+ if( !$this->location->validate() ){
327
+ $this->errors = array_merge($this->errors, $this->location->errors);
328
+ }
329
+ //TODO validate recurrence during event validate
330
+ return ( count($this->errors) == 0 );
331
+ }
332
+
333
+
334
+ /**
335
+ * Returns an array with category id and name (in that order) of the EM_Event instance.
336
+ * @return array
337
+ */
338
+ function get_category() {
339
+ global $wpdb;
340
+ $sql = "SELECT category_id, category_name FROM ".$wpdb->prefix.EVENTS_TBNAME." LEFT JOIN ".$wpdb->prefix.DBEM_CATEGORIES_TBNAME." ON category_id=event_category_id WHERE event_id ='".$this->id."'";
341
+ $category = $wpdb->get_row($sql, ARRAY_A);
342
+ return $category;
343
+ }
344
+
345
+ /**
346
+ * Shortcut function for $this->bookings->delete(), because using the EM_Bookings requires loading previous bookings, which isn't neceesary.
347
+ */
348
+ function delete_bookings(){
349
+ global $wpdb;
350
+ return $wpdb->query( $wpdb->prepare("DELETE FROM ".$wpdb->prefix.BOOKINGS_TBNAME." WHERE event_id=%d", $this->id) );
351
+ }
352
+
353
+ /**
354
+ * Retrieve and save the bookings belonging to instance. If called again will return cached version, set $force_reload to true to create a new EM_Bookings object.
355
+ * @param boolean $force_reload
356
+ * @return EM_Bookings
357
+ */
358
+ function get_bookings( $force_reload = false ){
359
+ if( get_option('dbem_rsvp_enabled') ){
360
+ if( (!$this->bookings || $force_reload) ){
361
+ $this->bookings = new EM_Bookings($this);
362
+ }
363
+ }
364
+ return $this->bookings;
365
+ }
366
+
367
+ /**
368
+ * Will output a single event format of this event.
369
+ * Equivalent of calling EM_Event::output( get_option ( 'dbem_single_event_format' ) )
370
+ * @param string $target
371
+ * @return string
372
+ */
373
+ function output_single($target='html'){
374
+ $format = get_option ( 'dbem_single_event_format' );
375
+ return $this->output($format, $target);
376
+ }
377
+
378
+ /**
379
+ * Will output a event list item format of this event.
380
+ * Equivalent of calling EM_Event::output( get_option ( 'dbem_event_list_item_format' ) )
381
+ * @param string $target
382
+ * @return string
383
+ */
384
+ function output_list($target='html'){
385
+ $format = get_option ( 'dbem_event_list_item_format' );
386
+ return $this->output($format, $target);
387
+ }
388
+
389
+ /**
390
+ * Will output a event in the format passed in $format by replacing placeholders within the format.
391
+ * @param string $format
392
+ * @param string $target
393
+ * @return string
394
+ */
395
+ function output($format, $target="html") {
396
+ $event_string = $format;
397
+ preg_match_all("/#@?_?[A-Za-z0-9]+/", $format, $placeholders);
398
+ foreach($placeholders[0] as $result) {
399
+ if (preg_match('/#_EDITEVENTLINK/', $result)) {
400
+ $link = "";
401
+ if(is_user_logged_in()){
402
+ $link = "<a href=' ".get_bloginfo('wpurl')."/wp-admin/edit.php?page=events-manager/events-manager.php&action=edit_event&event_id=".$this->id."'>".__('Edit').' '.__('Event', 'dbem')."</a>";
403
+
404
+ }
405
+ $event_string = str_replace($result, $link , $event_string );
406
+ }
407
+ if (preg_match('/#_24HSTARTTIME/', $result)) {
408
+ $time = substr($this->start_time, 0,5);
409
+ $event_string = str_replace($result, $time , $event_string );
410
+ }
411
+ if (preg_match('/#_24HENDTIME/', $result)) {
412
+ $time = substr($this->end_time, 0,5);
413
+ $event_string = str_replace($result, $time , $event_string );
414
+ }
415
+ if (preg_match('/#_12HSTARTTIME/', $result)) {
416
+ $AMorPM = "AM";
417
+ $hour = substr($this->start_time, 0,2);
418
+ $minute = substr($this->start_time, 3,2);
419
+ if ($hour > 12) {
420
+ $hour = $hour -12;
421
+ $AMorPM = "PM";
422
+ }
423
+ $time = "$hour:$minute $AMorPM";
424
+ $event_string = str_replace($result, $time , $event_string );
425
+ }
426
+ if (preg_match('/#_12HENDTIME/', $result)) {
427
+ $AMorPM = "AM";
428
+ $hour = substr($this->end_time, 0,2);
429
+ $minute = substr($this->end_time, 3,2);
430
+ if ($hour > 12) {
431
+ $hour = $hour -12;
432
+ $AMorPM = "PM";
433
+ }
434
+ $time = "$hour:$minute $AMorPM";
435
+ $event_string = str_replace($result, $time , $event_string );
436
+ }
437
+ if (preg_match('/#_ADDBOOKINGFORM/', $result)) {
438
+ $rsvp_is_active = get_option('dbem_rsvp_enabled');
439
+ if ($this->rsvp) {
440
+ $rsvp_add_module .= em_add_booking_form();
441
+ } else {
442
+ $rsvp_add_module .= "";
443
+ }
444
+ $event_string = str_replace($result, $rsvp_add_module , $event_string );
445
+ }
446
+ if (preg_match('/#_REMOVEBOOKINGFORM/', $result)) {
447
+ $rsvp_is_active = get_option('dbem_rsvp_enabled');
448
+ if ($this->rsvp) {
449
+ $rsvp_delete_module .= em_delete_booking_form();
450
+ } else {
451
+ $rsvp_delete_module .= "";
452
+ }
453
+ $event_string = str_replace($result, $rsvp_delete_module , $event_string );
454
+ }
455
+ if (preg_match('/#_AVAILABLESEATS/', $result)) {
456
+ $rsvp_is_active = get_option('dbem_rsvp_enabled');
457
+ $this->get_bookings();
458
+ if ($this->rsvp) {
459
+ $availble_seats = $this->bookings->get_available_seats();
460
+ } else {
461
+ $availble_seats = "0";
462
+ }
463
+ $event_string = str_replace($result, $availble_seats , $event_string );
464
+ }
465
+ if (preg_match('/#_LINKEDNAME/', $result)) {
466
+ $events_page_id = get_option('dbem_events_page');
467
+ $event_page_link = get_permalink($events_page_id);
468
+ if (stristr($event_page_link, "?"))
469
+ $joiner = "&amp;";
470
+ else
471
+ $joiner = "?";
472
+ $event_string = str_replace($result, "<a href='".get_permalink($events_page_id).$joiner."event_id=".$this->id."' title='".$this->name."'>".$this->name."</a>" , $event_string );
473
+ }
474
+ if (preg_match('/#_EVENTPAGEURL(\[(.+\)]))?/', $result)) {
475
+ $events_page_id = get_option('dbem_events_page');
476
+ if (stristr($event_page_link, "?"))
477
+ $joiner = "&amp;";
478
+ else
479
+ $joiner = "?";
480
+ $event_string = str_replace($result, get_permalink($events_page_id).$joiner."event_id=".$this->id , $event_string );
481
+ }
482
+
483
+ if (preg_match('/#_(NAME|NOTES|SEATS|EXCERPT)/', $result)) {
484
+ $field = ltrim(strtolower($result), "#_");
485
+ $field_value = $this->$field;
486
+
487
+ if ($field == "notes" || $field == "excerpt") {
488
+ if ($target == "html"){
489
+ //If excerpt, we use more link text
490
+ if($field == "event_excerpt"){
491
+ $matches = explode('<!--more-->', $this->notes);
492
+ $field_value = $matches[0];
493
+ $field_value = apply_filters('dbem_notes_excerpt', $field_value);
494
+ }else{
495
+ $field_value = apply_filters('dbem_notes', $field_value);
496
+ }
497
+ //$field_value = apply_filters('the_content', $field_value); - chucks a wobbly if we do this.
498
+ }else{
499
+ if ($target == "map"){
500
+ $field_value = apply_filters('dbem_notes_map', $field_value);
501
+ } else {
502
+ if($field == "excerpt"){
503
+ $matches = explode('<!--more-->', $this->notes);
504
+ $field_value = htmlentities($matches[0]);
505
+ $field_value = apply_filters('dbem_notes_rss', $field_value);
506
+ }else{
507
+ $field_value = apply_filters('dbem_notes_rss', $field_value);
508
+ }
509
+ $field_value = apply_filters('the_content_rss', $field_value);
510
+ }
511
+ }
512
+ } else {
513
+ if ($target == "html"){
514
+ $field_value = apply_filters('dbem_general', $field_value);
515
+ }else{
516
+ $field_value = apply_filters('dbem_general_rss', $field_value);
517
+ }
518
+ }
519
+ $event_string = str_replace($result, $field_value , $event_string );
520
+ }
521
+ if (preg_match('/#_(CONTACTNAME|CONTACTPERSON)$/', $result)) {
522
+ $event_string = str_replace($result, $this->contact->display_name, $event_string );
523
+ }
524
+ if (preg_match('/#_CONTACTEMAIL$/', $result)) {
525
+ $event_string = str_replace($result, dbem_ascii_encode($this->contact->user_email), $event_string );
526
+ }
527
+ if (preg_match('/#_CONTACTPHONE$/', $result)) {
528
+ if( $this->contact->phone == ''){ $phone = __('N/A', 'dbem'); }
529
+ $event_string = str_replace($result, $phone, $event_string );
530
+ }
531
+
532
+ // matches all PHP START date placeholders
533
+ if (preg_match('/^#[dDjlNSwzWFmMntLoYy]$/', $result)) {
534
+ $event_string = str_replace($result, mysql2date(ltrim($result, "#"), $this->start_date),$event_string );
535
+ }
536
+ // matches all PHP END time placeholders for endtime
537
+ if (preg_match('/^#@[dDjlNSwzWFmMntLoYy]$/', $result)) {
538
+ $event_string = str_replace($result, mysql2date(ltrim($result, "#@"), $this->end_date), $event_string );
539
+ }
540
+ // matches all PHP START time placeholders
541
+ if (preg_match('/^#[aABgGhHisueIOPTZcrU]$/', $result)) {
542
+ $event_string = str_replace($result, mysql2date(ltrim($result, "#"), "2000-10-10 ".$this->start_time),$event_string );
543
+ }
544
+ // matches all PHP END time placeholders
545
+ if (preg_match('/^#@[aABgGhHisueIOPTZcrU]$/', $result)) {
546
+ $event_string = str_replace($result, mysql2date(ltrim($result, "#@"), "2000-10-10 ".$this->end_time),$event_string );
547
+ }
548
+ //Add a placeholder for categories
549
+ if (preg_match('/^#_CATEGORY$/', $result)) {
550
+ $category = EM_Category::get($this->category_id);
551
+ $event_string = str_replace($result, $category['category_name'], $event_string );
552
+ }
553
+
554
+ }
555
+ //Time place holder that doesn't show if empty.
556
+ preg_match_all('/#@?_\{[A-Za-z0-9 -\/,\.\\\]+\}/', $format, $results);
557
+ foreach($results[0] as $result) {
558
+ if(substr($result, 0, 3 ) == "#@_"){
559
+ $date = 'end_date';
560
+ $offset = 4;
561
+ }else{
562
+ $date = 'start_date';
563
+ $offset = 3;
564
+ }
565
+ if( $date == 'event_end_date' && $this->$date == $this->start_date ){
566
+ $event_string = str_replace($result, '', $event_string);
567
+ }else{
568
+ $event_string = str_replace($result, mysql2date(substr($result, $offset, (strlen($result)-($offset+1)) ), $this->$date),$event_string );
569
+ }
570
+ }
571
+ //This is for the custom attributes
572
+ preg_match_all('/#_ATT\{.+?\}(\{.+?\})?/', $format, $results);
573
+ foreach($results[0] as $resultKey => $result) {
574
+ //Strip string of placeholder and just leave the reference
575
+ $attRef = substr( substr($result, 0, strpos($result, '}')), 6 );
576
+ $attString = $this->attributes[$attRef];
577
+ if( trim($attString) == '' && $results[1][$resultKey] != '' ){
578
+ //Check to see if we have a second set of braces;
579
+ $attString = substr( $results[1][$resultKey], 1, strlen(trim($results[1][$resultKey]))-2 );
580
+ }
581
+ $event_string = str_replace($result, $attString ,$event_string );
582
+ }
583
+
584
+ //Now do dependent objects
585
+ $event_string = $this->location->output($event_string, $target);
586
+ return $event_string;
587
+ }
588
+
589
+ /**********************************************************
590
+ * RECURRENCE METHODS
591
+ ***********************************************************/
592
+
593
+ /**
594
+ * Saves events and replaces old ones. Returns true if sucecssful or false if not.
595
+ * @return boolean
596
+ */
597
+ function save_events() {
598
+ if( $this->is_recurring() ){
599
+ global $wpdb;
600
+ $event_saves = array();
601
+ $matching_days = $this->get_recurrence_days(); //Get days where events recur
602
+ $this->delete_events(); //Delete old events beforehand
603
+ //Make template event (and we just change dates)
604
+ $event = $this->to_array();
605
+ unset($event['event_id']); //remove id and we have a event template to feed to wpdb insert
606
+ $event['event_attributes'] = serialize($event['event_attributes']);
607
+ foreach($event as $key => $value ){ //remove recurrence information
608
+ if( substr($key, 0, 10) == 'recurrence' ){
609
+ unset($event[$key]);
610
+ }
611
+ }
612
+ $event['recurrence_id'] = $this->id;
613
+ //Save event template with different dates
614
+ foreach( $matching_days as $day ) {
615
+ $event['event_start_date'] = date("Y-m-d", $day);
616
+ $event['event_end_date'] = $event['event_start_date'];
617
+ $event_saves[] = $wpdb->insert($wpdb->prefix.EVENTS_TBNAME, $event, $this->get_types($event));
618
+ if( DEBUG ){ echo "Entering recurrence " . date("D d M Y", $day)."<br/>"; }
619
+ }
620
+ return !in_array(false, $event_saves);
621
+ }
622
+ return false;
623
+ }
624
+
625
+ /**
626
+ * Removes all reoccurring events.
627
+ * @param $recurrence_id
628
+ * @return null
629
+ */
630
+ function delete_events(){
631
+ global $wpdb;
632
+ EM_Events::delete( EM_Events::get( array('recurrence_id'=>$this->id) ) );
633
+ }
634
+
635
+ /**
636
+ * Returns true if this event is a recurring event, meaning that it's not an individual event,
637
+ * but an event that defines many events that recur over a span of time.
638
+ * For checking if a specific event is part of a greater set of recurring events, use is_recurrence()
639
+ * @return boolean
640
+ */
641
+ function is_recurring(){
642
+ return ( $this->recurrence );
643
+ }
644
+ /**
645
+ * Will return true if this individual event is part of a set of events that recur
646
+ * For checking if this is the "master recurring event", see is_recurring()
647
+ * @return boolean
648
+ */
649
+ function is_recurrence(){
650
+ return ( $this->id > 0 && $this->recurrence_id > 0 );
651
+ }
652
+ /**
653
+ * Returns if this is an individual event and is not recurring or a recurrence
654
+ * @return boolean
655
+ */
656
+ function is_individual(){
657
+ return ( !$this->is_recurring() && !$this->is_recurrence() );
658
+ }
659
+
660
+ /**
661
+ * Returns the days that match the recurrance array passed
662
+ * @param array $recurrence
663
+ * @return array
664
+ */
665
+ function get_recurrence_days(){
666
+ if( $this->is_recurring() ){
667
+ $start_date = mktime(0, 0, 0, substr($this->start_date,5,2), substr($this->start_date,8,2), substr($this->start_date,0,4));
668
+ $end_date = mktime(0, 0, 0, substr($this->end_date,5,2), substr($this->end_date,8,2), substr($this->end_date,0,4));
669
+
670
+ $last_week_start = array(25, 22, 25, 24, 25, 24, 25, 25, 24, 25, 24, 25);
671
+ $weekdays = explode(",", $this->byday);
672
+
673
+ $weekcounter = 0;
674
+ $daycounter = 0;
675
+ $counter = 0;
676
+ $cycle_date = $start_date;
677
+ $matching_days = array();
678
+ $aDay = 86400; // a day in seconds
679
+
680
+
681
+ while (date("d-M-Y", $cycle_date) != date('d-M-Y', $end_date + $aDay)) {
682
+ //echo (date("d-M-Y", $cycle_date));
683
+ $style = "";
684
+ $monthweek = floor(((date("d", $cycle_date)-1)/7))+1;
685
+ if($this->freq == 'daily') {
686
+
687
+ if($counter % $this->interval == 0 )
688
+ array_push($matching_days, $cycle_date);
689
+ $counter++;
690
+ }
691
+ $weekday_num = date("w", $cycle_date); if ($weekday_num == 0) { $weekday_num = 7; }
692
+ if (in_array( $weekday_num, $weekdays )) {
693
+ $monthday = date("j", $cycle_date);
694
+ $month = date("n", $cycle_date);
695
+
696
+ if($this->freq == 'weekly') {
697
+
698
+ if($counter % $this->interval == 0 )
699
+ array_push($matching_days, $cycle_date);
700
+ $counter++;
701
+ }
702
+ if($this->freq == 'monthly') {
703
+
704
+ if(($this->byweekno == -1) && ($monthday >= $last_week_start[$month-1])) {
705
+ if ($counter % $this->interval == 0)
706
+ array_push($matching_days, $cycle_date);
707
+ $counter++;
708
+ } elseif($this->byweekno == $monthweek) {
709
+ if ($counter % $this->interval == 0)
710
+ array_push($matching_days, $cycle_date);
711
+ $counter++;
712
+ }
713
+ }
714
+ $weekcounter++;
715
+ }
716
+ $daycounter++;
717
+ $cycle_date = $cycle_date + $aDay; //adding a day
718
+
719
+ }
720
+
721
+ return $matching_days ;
722
+ }
723
+ }
724
+
725
+ /**
726
+ * Returns a string representation of this recurrence. Will return false if not a recurrence
727
+ * @return string
728
+ */
729
+ function get_recurrence_description() {
730
+ //FIXME Recurrence description not working for recurrence
731
+ global $EM_Recurrences;
732
+ if( $this->is_individual() ) return false;
733
+ $recurrence = $EM_Recurrences[$this->recurrence_id]->to_array();
734
+ $weekdays_name = array(__('Monday'),__('Tuesday'),__('Wednesday'),__('Thursday'),__('Friday'),__('Saturday'),__('Sunday'));
735
+ $monthweek_name = array('1' => __('the first %s of the month', 'dbem'),'2' => __('the second %s of the month', 'dbem'), '3' => __('the third %s of the month', 'dbem'), '4' => __('the fourth %s of the month', 'dbem'), '-1' => __('the last %s of the month', 'dbem'));
736
+ $output = sprintf (__('From %1$s to %2$s', 'dbem'), $recurrence['event_start_date'], $recurrence['event_end_date']).", ";
737
+ if ($recurrence['recurrence_freq'] == 'daily') {
738
+
739
+ $freq_desc =__('everyday', 'dbem');
740
+ if ($recurrence['recurrence_interval'] > 1 ) {
741
+ $freq_desc = sprintf (__("every %s days", 'dbem'), $recurrence['recurrence_interval']);
742
+ }
743
+ }
744
+ if ($recurrence['recurrence_freq'] == 'weekly') {
745
+ $weekday_array = explode(",", $recurrence['recurrence_byday']);
746
+ $natural_days = array();
747
+ foreach($weekday_array as $day)
748
+ array_push($natural_days, $weekdays_name[$day-1]);
749
+ $output .= implode(" and ", $natural_days);
750
+ if ($recurrence['recurrence_interval'] > 1 ) {
751
+ $freq_desc = ", ".sprintf (__("every %s weeks", 'dbem'), $recurrence['recurrence_interval']);
752
+ }
753
+
754
+ }
755
+ if ($recurrence['recurrence_freq'] == 'monthly') {
756
+ $weekday_array = explode(",", $recurrence['recurrence_byday']);
757
+ $natural_days = array();
758
+ foreach($weekday_array as $day)
759
+ array_push($natural_days, $weekdays_name[$day-1]);
760
+ $freq_desc = sprintf (($monthweek_name[$recurrence['recurrence_byweekno']]), implode(" and ", $natural_days));
761
+ if ($recurrence['recurrence_interval'] > 1 ) {
762
+ $freq_desc .= ", ".sprintf (__("every %s months",'dbem'), $recurrence['recurrence_interval']);
763
+ }
764
+
765
+ }
766
+ $output .= $freq_desc;
767
+ return $output;
768
+ }
769
+
770
+ /**********************************************************
771
+ * UTILITIES
772
+ ***********************************************************/
773
+
774
+ /**
775
+ * Returns this object in the form of an array, useful for saving directly into the wp_dbem_events table.
776
+ * @param boolean $location
777
+ * @param boolean $for_database
778
+ * @return array
779
+ */
780
+ function to_array($location = false, $for_database = false){
781
+ $event = array();
782
+ //Core Event Data
783
+ foreach ( $this->fields as $key => $val ) {
784
+ //TODO does it matter if it's for db or not... shouldn't it just not include blanks?
785
+ if( !$for_database || $for_database && $this->$val['name'] ){
786
+ $event[$key] = $this->$val['name'];
787
+ }
788
+ }
789
+ //Location Data
790
+ if($location && is_object($this->location)){
791
+ $location = $this->location->to_array();
792
+ $event = array_merge($event, $location);
793
+ }
794
+ return $event;
795
+ }
796
+ }
797
+ ?>
classes/events.php ADDED
@@ -0,0 +1,249 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Use this class to query and manipulate sets of events. If dealing with more than one event, you probably want to use this class in some way.
4
+ *
5
+ */
6
+ class EM_Events extends EM_Object {
7
+
8
+ /**
9
+ * Returns an array of EM_Events that match the given specs in the argument, or returns a list of future evetnts in future
10
+ * (see EM_Events::get_default_search() ) for explanation of possible search array values. You can also supply a numeric array
11
+ * containing the ids of the events you'd like to obtain
12
+ *
13
+ * @param array $args
14
+ * @return EM_Event array()
15
+ */
16
+ function get( $args = array() ) {
17
+ global $wpdb;
18
+ $events_table = $wpdb->prefix . EVENTS_TBNAME;
19
+ $locations_table = $wpdb->prefix . LOCATIONS_TBNAME;
20
+
21
+ //Quick version, we can accept an array of IDs, which is easy to retrieve
22
+ if( self::array_is_numeric($args) && count() ){ //Array of numbers, assume they are event IDs to retreive
23
+ //We can just get all the events here and return them
24
+ $sql = "
25
+ SELECT * FROM $events_table
26
+ LEFT JOIN $locations_table ON {$locations_table}.location_id={$events_table}.location_id
27
+ WHERE event_id=".implode(" OR event_id=", $args)."
28
+ ";
29
+ $results = $wpdb->get_results($sql);
30
+ $events = array();
31
+ foreach($results as $result){
32
+ $events[$result['event_id']] = new EM_Event($result);
33
+ }
34
+ return $events; //We return all the events matched as an EM_Event array.
35
+ }
36
+
37
+ //Format the arguments passed on
38
+ //We assume it's either an empty array or array of search arguments to merge with defaults
39
+ $args = self::get_default_search($args);
40
+ $scope = $args['scope'];//undefined variable warnings in ZDE, could just delete this (but dont pls!)
41
+ $offset = $args['offset'];
42
+ $recurring = $args['recurring'];
43
+ $recurrence = $args['recurrence'];
44
+ $category = $args['category'];
45
+ $location = $args['location'];
46
+ $day = $args['day'];
47
+ $month = $args['month'];
48
+ $year = $args['year'];
49
+ extract($args, EXTR_SKIP);
50
+ $today = date( 'Y-m-d' );
51
+ $limit = ( $limit && is_numeric($limit)) ? "LIMIT $limit" : '';
52
+ $offset = ( $limit != "" && is_numeric($offset) ) ? "OFFSET $offset" : '';
53
+ //TODO order by?
54
+ $order = ($order == "DESC") ? "DESC" : "ASC";
55
+
56
+ //Create the WHERE statement
57
+
58
+ //Recurrences
59
+ if( $recurring ){
60
+ $conditions = array("`recurrence`=1");
61
+ }elseif( $recurrence > 0 ){
62
+ $conditions = array("`recurrence_id`=$recurrence");
63
+ }else{
64
+ $conditions = array("`recurrence`=0");
65
+ }
66
+ //Dates - first check 'month', and 'year'
67
+ if( !($month=='' && $year=='') ){
68
+ //Sort out month range, if supplied an array of array(month,month), it'll check between these two months
69
+ if( self::array_is_numeric($month) ){
70
+ $date_month_start = $month[0];
71
+ $date_month_end = $month[1];
72
+ }else{
73
+ $date_month_start = $date_month_end = $month;
74
+ }
75
+ //Sort out year range, if supplied an array of array(year,year), it'll check between these two years
76
+ if( self::array_is_numeric($year) ){
77
+ $date_year_start = $year[0];
78
+ $date_year_end = $year[1];
79
+ }else{
80
+ $date_year_start = $date_year_end = $year;
81
+ }
82
+ $date_start = date('Y-m-d', mktime(0,0,0,$date_month_start,1,$date_year_start));
83
+ $date_end = date('Y-m-t', mktime(0,0,0,$date_month_end,1,$date_year_end));
84
+ $conditions[] = " ((event_start_date BETWEEN CAST('$date_start' AS DATE) AND CAST('$date_end' AS DATE)) OR (event_end_date BETWEEN CAST('$date_start' AS DATE) AND CAST('$date_end' AS DATE)))";
85
+ $search_by_date = true;
86
+ }
87
+ if( !isset($search_by_date) ){
88
+ //No date requested, so let's look at scope
89
+ if ( preg_match ( "/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/", $scope ) ) {
90
+ //Scope can also be a specific date. However, if 'day', 'month', or 'year' are set, that will take precedence
91
+ $conditions [] = " ( (event_start_date = CAST('$scope' AS DATE)) OR (event_start_date <= CAST('$scope' AS DATE) AND event_end_date >= CAST('$scope' AS DATE)) )";
92
+ } else {
93
+ if ($scope == "past"){
94
+ $conditions [] = " event_start_date < '$today'";
95
+ }elseif ($scope == "today"){
96
+ $conditions [] = " ( (event_start_date = CAST('$today' AS DATE)) OR (event_start_date <= CAST('$today' AS DATE) AND event_end_date >= CAST('$today' AS DATE)) )";
97
+ }elseif ($scope == "future" || $scope != 'all'){
98
+ $conditions [] = " (event_start_date >= CAST('$today' AS DATE) OR (event_end_date >= CAST('$today' AS DATE) AND event_end_date != '0000-00-00' AND event_end_date IS NOT NULL))";
99
+ }
100
+ }
101
+ }
102
+
103
+ //Filter by Location - can be object, array, or id
104
+ if ( is_numeric($location) && $location > 0 ) { //Location ID takes precedence
105
+ $conditions [] = " {$locations_table}.location_id = $location";
106
+ }elseif ( self::array_is_numeric($location) ){
107
+ $conditions [] = "( {$locations_table}.location_id = " . implode(" OR {$locations_table}.location_id = ", $location) .' )';
108
+ }elseif ( is_object($location) && get_class($location)=='EM_Location' ){ //Now we deal with objects
109
+ $conditions [] = " {$locations_table}.location_id = $location->id";
110
+ }elseif ( is_array($location) && @get_class(current($location)=='EM_Location') ){ //we can accept array of ids or EM_Location objects
111
+ foreach($location as $EM_Location){
112
+ $location_ids[] = $EM_Location->id;
113
+ }
114
+ $conditions[] = "( {$locations_table}.location_id=". implode(" {$locations_table}.location_id=", $location_ids) ." )";
115
+ }
116
+
117
+ //Add conditions for category selection
118
+ //Filter by category, can be id or comma seperated ids
119
+ //TODO create an exclude category option
120
+ if ( $category != '' && is_numeric($category) ){
121
+ $conditions [] = " event_category_id = $category";
122
+ }elseif( self::array_is_numeric($category) ){
123
+ $conditions [] = "( event_category_id = ". implode(' OR event_category_id = ', $category).")";
124
+ }
125
+
126
+ //Put it all together
127
+ $where = ( count($conditions) > 0 ) ? " WHERE " . implode ( " AND ", $conditions ):'';
128
+
129
+ //Create the SQL statement and execute
130
+ $sql = "
131
+ SELECT * FROM $events_table
132
+ LEFT JOIN $locations_table ON {$locations_table}.location_id={$events_table}.location_id
133
+ $where
134
+ ORDER BY event_start_date $order , event_start_time $order
135
+ $limit $offset
136
+ ";
137
+ $results = $wpdb->get_results ( $sql, ARRAY_A );
138
+
139
+ //Make returned results EM_Event objects
140
+ $events = array();
141
+ foreach ( $results as $event ){
142
+ $events[] = new EM_Event($event);
143
+ }
144
+
145
+ return $events;
146
+ }
147
+
148
+ /**
149
+ * Returns the number of events on a given date
150
+ * @param $date
151
+ * @return int
152
+ */
153
+ function count_date($date){
154
+ global $wpdb;
155
+ $table_name = $wpdb->prefix . EVENTS_TBNAME;
156
+ $sql = "SELECT COUNT(*) FROM $table_name WHERE (event_start_date like '$date') OR (event_start_date <= '$date' AND event_end_date >= '$date');";
157
+ return $wpdb->get_var ( $sql );
158
+ }
159
+
160
+ /**
161
+ * Will delete given an array of event_ids or EM_Event objects
162
+ * @param unknown_type $id_array
163
+ */
164
+ function delete( $array ){
165
+ global $wpdb;
166
+ //Detect array type and generate SQL for event IDs
167
+ $event_ids = array();
168
+ if( @get_class(current($array)) == 'EM_Event' ){
169
+ foreach($array as $EM_Event){
170
+ $event_ids[] = $EM_Event->id;
171
+ }
172
+ }else{
173
+ $event_ids = $array;
174
+ }
175
+ if(self::array_is_numeric($event_ids)){
176
+ $condition = implode(" OR event_id=", $event_ids);
177
+ //Delete all the bookings
178
+ $result_bookings = $wpdb->query("DELETE FROM ". $wpdb->prefix . BOOKINGS_TBNAME ." WHERE event_id=$condition;");
179
+ //Now delete the events
180
+ $result = $wpdb->query ( "DELETE FROM ". $wpdb->prefix . EVENTS_TBNAME ." WHERE event_id=$condition;" );
181
+ }
182
+ return true;
183
+ }
184
+
185
+
186
+ /**
187
+ * Output a set of matched of events
188
+ * @param array $args
189
+ * @return string
190
+ */
191
+ function output( $args ){
192
+ global $EM_Event;
193
+ $old_EM_Event = $EM_Event; //When looping, we can replace EM_Event global with the current event in the loop
194
+ //Can be either an array for the get search or an array of EM_Event objects
195
+ if( is_object(current($args)) && get_class((current($args))) == 'EM_Event' ){
196
+ $events = $args;
197
+ }else{
198
+ $events = self::get( $args );
199
+ }
200
+ //What format shall we output this to, or use default
201
+ $format = ( $args['format'] == '') ? get_option( 'dbem_event_list_item_format' ) : $args['format'] ;
202
+
203
+ $output = "";
204
+ if ( count($events) > 0 ) {
205
+ foreach ( $events as $event ) {
206
+ $EM_Event = $event;
207
+ /* @var EM_Event $event */
208
+ $output .= $event->output($format);
209
+ }
210
+ //Add headers and footers to output
211
+ if( $format == get_option ( 'dbem_event_list_item_format' ) ){
212
+ $single_event_format_header = get_option ( 'dbem_event_list_item_format_header' );
213
+ $single_event_format_header = ( $single_event_format_header != '' ) ? $single_event_format_header : "<ul class='dbem_events_list'>";
214
+ $single_event_format_footer = get_option ( 'dbem_event_list_item_format_footer' );
215
+ $single_event_format_footer = ( $single_event_format_footer != '' ) ? $single_event_format_footer : "</ul>";
216
+ $output = $single_event_format_header . $output . $single_event_format_footer;
217
+ }
218
+ } else {
219
+ $output = get_option ( 'dbem_no_events_message' );
220
+ }
221
+ //TODO check if reference is ok when restoring object, due to changes in php5 v 4
222
+ $old_EM_Event = $EM_Event;
223
+ return $output;
224
+ }
225
+
226
+ /**
227
+ * Takes the array and provides a clean array of search parameters, along with details
228
+ * @param array $array
229
+ * @return array
230
+ */
231
+ function get_default_search($array = array()){
232
+ //TODO trim these defaults, the EM_Object will have some of these already
233
+ $defaults = array(
234
+ 'limit' => false,
235
+ 'scope' => 'all',
236
+ 'order' => 'ASC',
237
+ 'format' => '',
238
+ 'category' => 0,
239
+ 'location' => 0,
240
+ 'offset'=>0,
241
+ 'recurrence'=>0,
242
+ 'recurring'=>false ,
243
+ 'month'=>'', //If this is set, month must be set
244
+ 'year'=>'' //If this is set, takes precedence over scope
245
+ );
246
+ return parent::get_default_search($defaults, $array);
247
+ }
248
+ }
249
+ ?>
classes/location.php ADDED
@@ -0,0 +1,279 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Object that holds location info and related functions
4
+ * @author marcus
5
+ */
6
+ class EM_Location extends EM_Object {
7
+ //DB Fields
8
+ var $id = '';
9
+ var $name = '';
10
+ var $address = '';
11
+ var $town = '';
12
+ var $latitude = '';
13
+ var $longitude = '';
14
+ var $description = '';
15
+ var $image_url = '';
16
+ //Other Vars
17
+ var $fields = array(
18
+ 'location_id' => array('name'=>'id','type'=>'%d'),
19
+ 'location_name' => array('name'=>'name','type'=>'%s'),
20
+ 'location_address' => array('name'=>'address','type'=>'%s'),
21
+ 'location_town' => array('name'=>'town','type'=>'%s'),
22
+ //Not Used - 'location_province' => array('name'=>'province','type'=>'%s'),
23
+ 'location_latitude' => array('name'=>'latitude','type'=>'%f'),
24
+ 'location_longitude' => array('name'=>'longitude','type'=>'%f'),
25
+ 'location_description' => array('name'=>'description','type'=>'%s')
26
+ );
27
+ var $required_fields;
28
+ var $feedback_message = "";
29
+ var $mime_types = array(1 => 'gif', 2 => 'jpg', 3 => 'png');
30
+ var $errors = array();
31
+
32
+ /**
33
+ * Gets data from POST (default), supplied array, or from the database if an ID is supplied
34
+ * @param $location_data
35
+ * @return null
36
+ */
37
+ function EM_Location( $location_data = 0 ) {
38
+ //Initialize
39
+ $this->required_fields = array("name" => __('The location name', 'dbem'), "address" => __('The location address', 'dbem'), "town" => __('The location town', 'dbem'));
40
+ if( $location_data != 0 ){
41
+ //Load location data
42
+ if( is_array($location_data) && isset($location_data['location_name']) ){
43
+ $location = $location_data;
44
+ }elseif( $location_data > 0 ){
45
+ //Retreiving from the database
46
+ global $wpdb;
47
+ $sql = "SELECT * FROM ". $wpdb->prefix.LOCATIONS_TBNAME ." WHERE location_id ='{$location_data}'";
48
+ $location = $wpdb->get_row($sql, ARRAY_A);
49
+ }
50
+ //If gmap is turned off, values may not be returned and set, so we set it here
51
+ if(empty($location['location_latitude'])) {
52
+ $location['location_latitude'] = 0;
53
+ $location['location_longitude'] = 0;
54
+ }
55
+ //Save into the object
56
+ $this->to_object($location, true);
57
+ $this->get_image_url();
58
+ }
59
+ }
60
+
61
+ function get_post(){
62
+ //We are getting the values via POST or GET
63
+ $location = array();
64
+ $location['location_id'] = $_POST['location_id'];
65
+ $location['location_name'] = stripslashes($_POST['location_name']);
66
+ $location['location_address'] = stripslashes($_POST['location_address']);
67
+ $location['location_town'] = stripslashes($_POST['location_town']);
68
+ $location['location_latitude'] = $_POST['location_latitude'];
69
+ $location['location_longitude'] = $_POST['location_longitude'];
70
+ $location['location_description'] = stripslashes($_POST['content']);
71
+ $this->to_object($location);
72
+ }
73
+
74
+ function save(){
75
+ //FIXME location images not working
76
+ global $wpdb;
77
+ $table = $wpdb->prefix.LOCATIONS_TBNAME;
78
+ $data = $this->to_array();
79
+ unset($data['location_id']);
80
+ unset($data['location_image_url']);
81
+ if($this->id != ''){
82
+ $where = array( 'location_id' => $this->id );
83
+ $wpdb->update($table, $data, $where, $this->get_types($data));
84
+ }else{
85
+ $wpdb->insert($table, $data, $this->get_types($data));
86
+ $this->id = $wpdb->insert_id;
87
+ }
88
+ $image_upload = $this->image_upload();
89
+ return ( $this->id > 0 && $image_upload );
90
+ }
91
+
92
+ function delete(){
93
+ global $wpdb;
94
+ $table_name = $wpdb->prefix.LOCATIONS_TBNAME;
95
+ $sql = "DELETE FROM $table_name WHERE location_id = '{$this->id}';";
96
+ $wpdb->query($sql);
97
+ $this->image_delete();
98
+ }
99
+
100
+ function get_image_url(){
101
+ if($this->image_url == ''){
102
+ foreach($this->mime_types as $type) {
103
+ $file_path = "/".IMAGE_UPLOAD_DIR."/location-{$this->id}.$type";
104
+ if( file_exists( ABSPATH . $file_path) ) {
105
+ $result = get_bloginfo('wpurl').$file_path;
106
+ $this->image_url = $result;
107
+ }
108
+ }
109
+ }
110
+ return $this->image_url;
111
+ }
112
+
113
+ function image_delete() {
114
+ $file_name= ABSPATH.IMAGE_UPLOAD_DIR."/location-".$this->id;
115
+ foreach($this->mime_types as $type) {
116
+ if (file_exists($file_name.".".$type))
117
+ unlink($file_name.".".$type);
118
+ }
119
+ }
120
+
121
+ function image_upload(){
122
+ //TODO better image upload error handling
123
+ if ($_FILES['location_image']['size'] > 0 ) {
124
+ if( !file_exists(ABSPATH.IMAGE_UPLOAD_DIR) ){
125
+ mkdir(ABSPATH.IMAGE_UPLOAD_DIR, 0777);
126
+ }
127
+ $this->image_delete();
128
+ list($width, $height, $type, $attr) = getimagesize($_FILES['location_image']['tmp_name']);
129
+ $image_path = ABSPATH.IMAGE_UPLOAD_DIR."/location-".$this->id.".".$this->mime_types[$type];
130
+ if (!move_uploaded_file($_FILES['location_image']['tmp_name'], $image_path)){
131
+ $this->errors = __('The image could not be loaded','dbem');
132
+ return false;
133
+ }else{
134
+ return true;
135
+ }
136
+ }
137
+ return true;
138
+ }
139
+
140
+ function load_similar($criteria){
141
+ global $wpdb;
142
+ $locations_table = $wpdb->prefix.LOCATIONS_TBNAME;
143
+ $prepared_sql = $wpdb->prepare("SELECT * FROM $locations_table WHERE location_name = %s AND location_address = %s AND location_town = %s", stripcslashes($criteria['location_name']), stripcslashes($criteria['location_address']), stripcslashes($criteria['location_town']) );
144
+ //$wpdb->show_errors(true);
145
+ $location = $wpdb->get_row($prepared_sql, ARRAY_A);
146
+ if( is_array($location) ){
147
+ $this->to_object($location);
148
+ }
149
+ return $location;
150
+ }
151
+
152
+ /**
153
+ * Validates the location. Should be run during any form submission or saving operation.
154
+ * @return boolean
155
+ */
156
+ function validate(){
157
+ foreach ( $this->required_fields as $field => $description) {
158
+ if ( $this->$field == "" ) {
159
+ $this->errors[] = $description.__(" is missing!", "dbem");
160
+ }
161
+ }
162
+ if ($_FILES['location_image']['size'] > 0 ) {
163
+ if (is_uploaded_file($_FILES['location_image']['tmp_name'])) {
164
+ $mime_types = array(1 => 'gif', 2 => 'jpg', 3 => 'png');
165
+ $maximum_size = get_option('dbem_image_max_size');
166
+ if ($_FILES['location_image']['size'] > $maximum_size){
167
+ $this->errors[] = __('The image file is too big! Maximum size:', 'dbem')." $maximum_size";
168
+ }
169
+ list($width, $height, $type, $attr) = getimagesize($_FILES['location_image']['tmp_name']);
170
+ $maximum_width = get_option('dbem_image_max_width');
171
+ $maximum_height = get_option('dbem_image_max_height');
172
+ if (($width > $maximum_width) || ($height > $maximum_height)) {
173
+ $this->errors[] = __('The image is too big! Maximum size allowed:')." $maximum_width x $maximum_height";
174
+ }
175
+ if (($type!=1) && ($type!=2) && ($type!=3)){
176
+ $this->errors[] = __('The image is in a wrong format!');
177
+ }
178
+ }
179
+ }
180
+ return ( count($this->errors) == 0 );
181
+ }
182
+
183
+ function has_events(){
184
+ global $wpdb;
185
+ $events_table = $wpdb->prefix.EVENTS_TBNAME;
186
+ $sql = "SELECT event_id FROM $events_table WHERE location_id = {$this->id}";
187
+ $affected_events = $wpdb->get_results($sql);
188
+ return (count($affected_events) > 0);
189
+ }
190
+
191
+ function output_single($target = 'html'){
192
+ $format = get_option ( 'dbem_single_location_format' );
193
+ return $this->output($format, $target);
194
+ }
195
+
196
+ function output($format, $target="html") {
197
+ $location_string = $format;
198
+ preg_match_all("/#@?_?[A-Za-z]+/", $format, $placeholders);
199
+ foreach($placeholders[0] as $result) {
200
+ // matches alla fields placeholder
201
+ if (preg_match('/#_MAP/', $result)) {
202
+ $map_div = EM_Map::get_single( array('location' => $this) );
203
+ $location_string = str_replace($result, $map_div , $location_string );
204
+ }
205
+ if ( preg_match('/#_(LOC)?(NOTES|EXCERPT)/', $result) ) {
206
+ if ($target == "html"){
207
+ //If excerpt, we use more link text
208
+ if($result == "#_LOCEXCERPT" || $result == "#_EXCERPT"){
209
+ $matches = explode('<!--more-->', $this->notes);
210
+ $field_value = apply_filters('dbem_notes_excerpt', $matches[0]);
211
+ }else{
212
+ $field_value = apply_filters('dbem_notes', $this->description);
213
+ }
214
+ //$field_value = apply_filters('the_content', $field_value); - chucks a wobbly if we do this.
215
+ }else{
216
+ if ($target == "map"){
217
+ $field_value = apply_filters('dbem_notes_map', $field_value);
218
+ } else {
219
+ if($result == "#_LOCEXCERPT" || $result == "#_EXCERPT"){
220
+ $matches = explode('<!--more-->', $this->notes);
221
+ $field_value = htmlentities($matches[0]);
222
+ $field_value = apply_filters('dbem_notes_rss', $field_value);
223
+ }else{
224
+ $field_value = apply_filters('dbem_notes_rss', $field_value);
225
+ }
226
+ }
227
+ $field_value = apply_filters('the_content_rss', $field_value);
228
+ }
229
+ $location_string = str_replace($result, $field_value , $location_string );
230
+ }
231
+ if (preg_match('/#_(LOCATION|NAME)$/', $result)) {
232
+ if ($target == "html"){
233
+ $field_value = apply_filters('dbem_general', $this->name);
234
+ }else{
235
+ $field_value = apply_filters('dbem_general_rss', $this->name);
236
+ }
237
+ $location_string = str_replace($result, $field_value , $location_string );
238
+ }
239
+ if (preg_match('/#_(PASTEVENTS|NEXTEVENTS|ALLEVENTS)/', $result)) {
240
+ if ($result == '#_PASTEVENTS'){ $scope = 'past'; }
241
+ elseif ( $result == '#_NEXTEVENTS' ){ $scope = 'future'; }
242
+ else{ $scope = 'all'; }
243
+ $events = EM_Events::get( array('location'=>$this->id, 'scope'=>$scope) );
244
+ $list = '';
245
+ if ( count($events) > 0 ){
246
+ foreach($events as $event){
247
+ $list .= $event->output(get_option('dbem_location_event_list_item_format'));
248
+ }
249
+ } else {
250
+ $list = get_option('dbem_location_no_events_message');
251
+ }
252
+ $location_string = str_replace($result, $list , $location_string );
253
+ }
254
+ if (preg_match('/#_IMAGE$/', $result)) {
255
+ if($this->image_url != ''){
256
+ $location_image = "<img src='".$this->image_url."' alt='".$this->name."'/>";
257
+ }else{
258
+ $location_image = "";
259
+ }
260
+ $location_string = str_replace($result, $location_image , $location_string );
261
+ }
262
+ if (preg_match('/#_(LOCATIONPAGEURL)/', $result)) {
263
+ $joiner = (stristr(EM_URI, "?")) ? "&amp;" : "?";
264
+ $venue_page_link = EM_URI.$joiner."location_id=".$this->id;
265
+ $location_string = str_replace($result, $venue_page_link , $location_string );
266
+ }
267
+ if (preg_match('/#_(ADDRESS|TOWN|PROVINCE)/', $result)) { //TODO province in location is not being used
268
+ $field = ltrim(strtolower($result), "#_");
269
+ if ($target == "html") {
270
+ $field_value = apply_filters('dbem_general', $this->$field);
271
+ } else {
272
+ $field_value = apply_filters('dbem_general_rss', $this->$field);
273
+ }
274
+ $location_string = str_replace($result, $field_value , $location_string );
275
+ }
276
+ }
277
+ return $location_string;
278
+ }
279
+ }
classes/locations.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Static class which will help bulk add/edit/retrieve/manipulate arrays of EM_Location objects
4
+ * @author marcus
5
+ *
6
+ */
7
+ class EM_Locations extends EM_Object {
8
+ /**
9
+ * Returns an array of EM_Location objects
10
+ * @param boolean $eventful
11
+ * @param boolean $return_objects
12
+ * @return array
13
+ */
14
+ function get( $eventful = false, $return_objects = true ){
15
+ global $wpdb;
16
+ $locations_table = $wpdb->prefix.LOCATIONS_TBNAME;
17
+ $events_table = $wpdb->prefix.EVENTS_TBNAME;
18
+ if ($eventful == 'true') {
19
+ $sql = "SELECT * from $locations_table JOIN $events_table ON $locations_table.location_id = $events_table.location_id";
20
+ } else {
21
+ $sql = "SELECT location_id, location_address, location_name, location_town,location_latitude, location_longitude
22
+ FROM $locations_table ORDER BY location_name";
23
+ }
24
+ $locations = $wpdb->get_results($sql, ARRAY_A);
25
+ if( true == $return_objects ){
26
+ $location_objects = array();
27
+ foreach ($locations as $location){
28
+ $location_objects[] = new EM_Location($location);
29
+ }
30
+ $locations = $location_objects;
31
+ }
32
+ return $locations;
33
+ }
34
+
35
+ //TODO for the static plural classes like this one, we might benefit from bulk actions like delete/add/save etc.... just a random thought.
36
+ }
37
+ ?>
classes/mailer.php ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * phpmailer support
4
+ *
5
+ */
6
+ class EM_Mailer {
7
+
8
+ /**
9
+ * if any errors crop up, here they are
10
+ * @var array
11
+ */
12
+ var $errors = array();
13
+
14
+ /**
15
+ * @param $subject
16
+ * @param $body
17
+ * @param $receiver
18
+ */
19
+ function send($subject="no title",$body="No message specified", $receiver='') {
20
+ //TODO add an EM_Error global object, for this sort of error reporting. (@marcus like StatusNotice)
21
+ global $smtpsettings, $phpmailer, $cformsSettings;
22
+
23
+ if( preg_match('/^[_.0-9a-z-]+@([0-9a-z][0-9a-z-]+.)+[a-z]{2,3}$/i', $receiver) ){
24
+ $this->load_phpmailer();
25
+ $mail = new PHPMailer();
26
+ //$mail->SMTPDebug = true;
27
+ $mail->ClearAllRecipients();
28
+ $mail->ClearAddresses();
29
+ $mail->ClearAttachments();
30
+ $mail->CharSet = 'utf-8';
31
+ $mail->SetLanguage('en', dirname(__FILE__).'/');
32
+ $mail->PluginDir = dirname(__FILE__).'/phpmailer/';
33
+ $mail->Host = get_option('dbem_smtp_host');
34
+ $mail->port = get_option('dbem_rsvp_mail_port');
35
+ $mail->Username = get_option('dbem_smtp_username');
36
+ $mail->Password = get_option('dbem_smtp_password');
37
+ $mail->From = get_option('dbem_mail_sender_address');
38
+
39
+ //Protocols
40
+ if( get_option('dbem_rsvp_mail_send_method') == 'qmail' ){
41
+ $mail->IsQmail();
42
+ } else {
43
+ $mail->Mailer = get_option('dbem_rsvp_mail_send_method');
44
+ }
45
+ if(get_option('dbem_rsvp_mail_SMTPAuth') == '1'){
46
+ $mail->SMTPAuth = TRUE;
47
+ }
48
+
49
+ $mail->FromName = get_option('dbem_mail_sender_name'); // This is the from name in the email, you can put anything you like here
50
+ $mail->Body = $body;
51
+ $mail->Subject = $subject;
52
+ $mail->AddAddress($receiver);
53
+
54
+ if(!$mail->Send()){
55
+ $this->errors[] = $mail->ErrorInfo;
56
+ return false;
57
+ }else{
58
+ return true;
59
+ }
60
+ }else{
61
+ $this->errors = __('Please supply a valid email format.', 'dbem');
62
+ return false;
63
+ }
64
+ }
65
+
66
+ /**
67
+ * load phpmailer classes
68
+ */
69
+ function load_phpmailer(){
70
+ require_once(dirname(__FILE__) . '/phpmailer/class.phpmailer.php');
71
+ require_once(dirname(__FILE__) . '/phpmailer/class.smtp.php');
72
+ }
73
+ }
74
+ ?>
classes/map.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Obtains the html required to display a google map for given location(s)
4
+ *
5
+ */
6
+ class EM_Map extends EM_Object {
7
+ /**
8
+ * Shortcode for producing a google map with all the locations. Unfinished and undocumented.
9
+ * @param array $atts
10
+ * @return string
11
+ */
12
+ function get_global($atts) {
13
+ //TODO Finish and document this feature, need to add balloons here
14
+ if (get_option('dbem_gmap_is_active') == '1') {
15
+ ob_start();
16
+ ?>
17
+ <div id='em-locations-map' style='width:<?php echo $atts['width']; ?>px; height:<?php echo $atts['height']; ?>px'><em><?php _e('Loading Map....', 'dbem'); ?></em></div>
18
+ <script src='<?php echo bloginfo('wpurl') ?>/wp-content/plugins/events-manager/includes/js/em_maps.js' type='text/javascript'></script>
19
+ <script type='text/javascript'>
20
+ <!--//
21
+ var eventful = <?php echo ($atts['eventful']) ? 'true':'false'; ?>;
22
+ var scope = '<?php echo $atts['scope']; ?>';
23
+ em_load_map('em_map_global');
24
+ //-->
25
+ </script>
26
+ <?php
27
+ return ob_get_clean();
28
+ }
29
+ return '';
30
+ }
31
+
32
+
33
+ /**
34
+ * Returns th HTML and JS required to produce a google map in for this location.
35
+ * @param EM_Location $location
36
+ * @return string
37
+ */
38
+ function get_single($args) {
39
+ //TODO do some validation here of defaults
40
+ $location = $args['location'];
41
+ if ( get_option('dbem_gmap_is_active') && ( is_object($location) && $location->latitude != 0 && $location->longitude != 0 ) ) {
42
+ $width = (isset($args['width'])) ? $args['width']:'400';
43
+ $height = (isset($args['height'])) ? $args['height']:'300';
44
+ ob_start();
45
+ ?>
46
+ <div id='em-location-map' style='background: #CDCDCD; width: <?php echo $width ?>px; height: <?php echo $height ?>px'><?php _e('Loading Map....', 'dbem'); ?></div>
47
+ <div id='em-location-map-info' style="display:none; visibility:hidden;"><div id="em-map-balloon" style="font-size:12px;"><div id="content"><?php echo $location->output(get_option('dbem_location_baloon_format')); ?></div></div></div>
48
+ <script src='<?php bloginfo('wpurl'); ?>/wp-content/plugins/events-manager/includes/js/em_maps.js' type='text/javascript'></script>
49
+ <script type='text/javascript'>
50
+ <!--//
51
+ var latitude = parseFloat('<?php echo $location->latitude; ?>');
52
+ var longitude = parseFloat('<?php echo $location->longitude; ?>');
53
+ em_load_map('em_map_single');
54
+ //-->
55
+ </script>
56
+ <?php
57
+ return ob_get_clean();
58
+ }
59
+ return '<i>'. __('Map Unavailable', 'dbem') .'</i>';
60
+ }
61
+ }
classes/object.php ADDED
@@ -0,0 +1,224 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Base class which others extend on. Contains functions shared across all EM objects.
4
+ *
5
+ */
6
+ class EM_Object {
7
+
8
+ var $fields = array();
9
+
10
+ /**
11
+ * Takes the array and provides a clean array of search parameters, along with details
12
+ * @param array $defaults
13
+ * @param array $array
14
+ * @return array
15
+ */
16
+ function get_default_search($defaults=array(), $array = array()){
17
+ //Create minimal defaults array, merge it with supplied defaults array
18
+ $super_defaults = array(
19
+ 'limit' => false,
20
+ 'scope' => 'all',
21
+ 'order' => 'DESC',
22
+ 'format' => '',
23
+ 'category' => 0,
24
+ 'location' => 0,
25
+ 'offset'=>0,
26
+ 'recurrence'=>0,
27
+ 'recurring'=>false,
28
+ 'month'=>'',
29
+ 'year'=>''
30
+ );
31
+ //TODO decide on search defaults shared across all objects and then validate here
32
+ $defaults = array_merge($super_defaults, $defaults);
33
+
34
+ //TODO accept all objects as search options as well as ids (e.g. location vs. location_id, person vs. person_id)
35
+ //If there's a location, then remove it and turn it into location_id
36
+ if( array_key_exists('location', $array)){
37
+ if ( is_numeric($array['location']) ) {
38
+ $array['location'] = (int) $array['location'];
39
+ } elseif( preg_match('/^([0-9],?)+$/', $array['location']) ) {
40
+ $array['location'] = explode(',', $array['location']);
41
+ }else{
42
+ //No format we accept
43
+ unset($array['location']);
44
+ }
45
+ }
46
+ //Category - for now we just make both keys have an id number
47
+ if( array_key_exists('category', $array)){
48
+ if ( is_numeric($array['category']) ) {
49
+ $array['category'] = (int) $array['category'];
50
+ } elseif( preg_match('/^([0-9],?)+$/', $array['category']) ) {
51
+ $array['category'] = explode(',', $array['category']);
52
+ }else{
53
+ //No format we accept
54
+ unset($array['category']);
55
+ }
56
+ }
57
+ //TODO validate search query array
58
+ //Clean the supplied array, so we only have allowed keys
59
+ if(is_array($array)){
60
+ foreach( array_keys($array) as $key){
61
+ if( !array_key_exists($key, $defaults) ) unset($array[$key]);
62
+ }
63
+ //return clean array
64
+ return array_merge ( $defaults, $array ); //No point using WP's cleaning function, we're doing it already.
65
+ }
66
+ return $defaults;
67
+ }
68
+
69
+
70
+ /**
71
+ * Save an array into this class.
72
+ * If you provide a record from the database table corresponding to this class type it will add the data to this object.
73
+ * @param array $array
74
+ * @return null
75
+ */
76
+ function to_object( $array = array(), $addslashes = false ){
77
+ //Save core data
78
+ foreach ( $this->fields as $key => $val ) {
79
+ if(array_key_exists($key, $array)){
80
+ if( !is_object($array[$key]) && !is_array($array[$key]) ){
81
+ $array[$key] = ($addslashes) ? stripslashes($array[$key]):$array[$key];
82
+ }
83
+ $this->$val['name'] = $array[$key];
84
+ }
85
+ }
86
+ }
87
+
88
+ /**
89
+ * Returns this object in the form of an array, useful for saving directly into a database table.
90
+ * @return array
91
+ */
92
+ function to_array(){
93
+ $array = array();
94
+ foreach ( $this->fields as $key => $val ) {
95
+ $array[$key] = $this->$val['name'];
96
+ }
97
+ return $array;
98
+ }
99
+
100
+
101
+ /**
102
+ * Function to retreive wpdb types for all fields, or if you supply an assoc array with field names as keys it'll return an equivalent array of wpdb types
103
+ * @param array $array
104
+ * @return array:
105
+ */
106
+ function get_types($array = array()){
107
+ $types = array();
108
+ if( count($array)>0 ){
109
+ //So we look at assoc array and find equivalents
110
+ foreach ($array as $key => $val){
111
+ $types[] = $this->fields[$key]['type'];
112
+ }
113
+ }else{
114
+ //Blank array, let's assume we're getting a standard list of types
115
+ foreach ($this->fields as $field){
116
+ $types[] = $field['type'];
117
+ }
118
+ }
119
+ return $types;
120
+ }
121
+
122
+ /**
123
+ * Sanitize text before inserting into database
124
+ * @param string $value
125
+ * @return string
126
+ */
127
+ function sanitize( $value ) {
128
+ if( get_magic_quotes_gpc() )
129
+ $value = stripslashes( $value );
130
+
131
+ //check if this function exists
132
+ if( function_exists( "mysql_real_escape_string" ) ) {
133
+ $value = mysql_real_escape_string( $value );
134
+ //for PHP version < 4.3.0 use addslashes
135
+ } else {
136
+ $value = addslashes( $value );
137
+ }
138
+ return $value;
139
+ }
140
+
141
+ /**
142
+ * Will return true if this is a simple (non-assoc) numeric array, meaning it has at one or more numeric entries and nothing else
143
+ * @param mixed $array
144
+ * @return boolean
145
+ */
146
+ function array_is_numeric($array){
147
+ $results = array();
148
+ if(is_array($array)){
149
+ foreach($array as $key => $item){
150
+ $results[] = (is_numeric($item)&&is_numeric($key));
151
+ }
152
+ }
153
+ return ( !in_array(false, $results) && count($results) > 0 );
154
+ }
155
+
156
+ /**
157
+ * Converts an array to JSON format, useful for outputting data for AJAX calls. Uses a PHP4 fallback function, given it doesn't support json_encode().
158
+ * @param array $array
159
+ * @return string
160
+ */
161
+ function json_encode($array){
162
+ if( function_exists("json_encode") ){
163
+ $return = json_encode($array);
164
+ }else{
165
+ $return = self::array_to_json($array);
166
+ }
167
+ if( isset($_GET['callback']) ){
168
+ $return = $_GET['callback']."($return)";
169
+ }
170
+ return $return;
171
+ }
172
+
173
+ /**
174
+ * Compatible json encoder function for PHP4
175
+ * @param array $array
176
+ * @return string
177
+ */
178
+ function array_to_json($array){
179
+ //PHP4 Comapatability - This encodes the array into JSON. Thanks go to Andy - http://www.php.net/manual/en/function.json-encode.php#89908
180
+ if( !is_array( $array ) ){
181
+ $array = array();
182
+ }
183
+ $associative = count( array_diff( array_keys($array), array_keys( array_keys( $array )) ));
184
+ if( $associative ){
185
+ $construct = array();
186
+ foreach( $array as $key => $value ){
187
+ // We first copy each key/value pair into a staging array,
188
+ // formatting each key and value properly as we go.
189
+ // Format the key:
190
+ if( is_numeric($key) ){
191
+ $key = "key_$key";
192
+ }
193
+ $key = "'".addslashes($key)."'";
194
+ // Format the value:
195
+ if( is_array( $value )){
196
+ $value = $this->array_to_json( $value );
197
+ }else if( is_bool($value) ) {
198
+ $value = ($value) ? "true" : "false";
199
+ }else if( !is_numeric( $value ) || is_string( $value ) ){
200
+ $value = "'".addslashes($value)."'";
201
+ }
202
+ // Add to staging array:
203
+ $construct[] = "$key: $value";
204
+ }
205
+ // Then we collapse the staging array into the JSON form:
206
+ $result = "{ " . implode( ", ", $construct ) . " }";
207
+ } else { // If the array is a vector (not associative):
208
+ $construct = array();
209
+ foreach( $array as $value ){
210
+ // Format the value:
211
+ if( is_array( $value )){
212
+ $value = $this->array_to_json( $value );
213
+ } else if( !is_numeric( $value ) || is_string( $value ) ){
214
+ $value = "'".addslashes($value)."'";
215
+ }
216
+ // Add to staging array:
217
+ $construct[] = $value;
218
+ }
219
+ // Then we collapse the staging array into the JSON form:
220
+ $result = "[ " . implode( ", ", $construct ) . " ]";
221
+ }
222
+ return $result;
223
+ }
224
+ }
classes/people.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class EM_People extends EM_Object {
3
+
4
+ /**
5
+ * Gets all users, if $return_people false an array associative arrays will be returned. If $return_people is true this will return an array of EM_Person objects
6
+ * @param $return_people
7
+ * @return array
8
+ */
9
+ function get( $return_people = true ) {
10
+ global $wpdb;
11
+ $sql = "SELECT * FROM ". $wpdb->prefix.PEOPLE_TBNAME ;
12
+ $result = $wpdb->get_results($sql, ARRAY_A);
13
+ if( $return_people ){
14
+ //Return people as EM_Person objects
15
+ $people = array();
16
+ foreach ($result as $person){
17
+ $people[] = new EM_Person($person);
18
+ }
19
+ return $people;
20
+ }
21
+ return $result;
22
+ }
23
+
24
+ }
25
+ ?>
classes/person.php ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // TODO make person details more secure and integrate with WP user data
3
+ class EM_Person extends EM_Object{
4
+ //DB Fields
5
+ var $id = '';
6
+ var $name = '';
7
+ var $email = '';
8
+ var $phone = '';
9
+ //Other Vars
10
+ var $fields = array(
11
+ 'person_id' => array('name'=>'id','type'=>'%d'),
12
+ 'person_name' => array('name'=>'name','type'=>'%s'),
13
+ 'person_email' => array('name'=>'email','type'=>'%s'),
14
+ 'person_phone' => array('name'=>'phone','type'=>'%s')
15
+ );
16
+ var $required_fields = array('person_id', 'person_name', 'person_email', 'person_phone');
17
+ var $feedback_message = "";
18
+ var $errors = array();
19
+
20
+ function EM_Person( $person_data = false ){
21
+ if( $person_data != 0 ){
22
+ //Load person data
23
+ $person = array();
24
+ if( is_array($person_data) ){
25
+ $person = $person_data;
26
+ }elseif( $person_data > 0 ){
27
+ //Retreiving from the database
28
+ global $wpdb;
29
+ $sql = "SELECT * FROM ". $wpdb->prefix . PEOPLE_TBNAME ." WHERE person_id ='$person_data'";
30
+ $person = $wpdb->get_row($sql, ARRAY_A);
31
+ }
32
+ //Save into the object
33
+ $this->to_object($person);
34
+ }
35
+ }
36
+
37
+ /**
38
+ * Load an record into this object by passing an associative array of table criterie to search for.
39
+ * Returns boolean depending on whether a record is found or not.
40
+ * @param $search
41
+ * @return boolean
42
+ */
43
+ function get($search) {
44
+ global $wpdb;
45
+ $conds = array();
46
+ foreach($search as $key => $value) {
47
+ if( array_key_exists($key, $this->fields) ){
48
+ $conds[] = "`$key`='$value'";
49
+ }
50
+ }
51
+ $sql = "SELECT * FROM ". $wpdb->prefix.PEOPLE_TBNAME ." WHERE " . implode(' AND ', $conds) ;
52
+ $result = $wpdb->get_row($sql, ARRAY_A);
53
+ if($result){
54
+ $this->to_object($result);
55
+ return true;
56
+ }else{
57
+ return false;
58
+ }
59
+ }
60
+
61
+ function save(){
62
+ global $wpdb;
63
+ if($this->validate()){
64
+ //Does this person already exist?
65
+ $this->load_similar();
66
+ $table = $wpdb->prefix.PEOPLE_TBNAME;
67
+ $data = $this->to_array();
68
+ unset($data['person_id']);
69
+ if($this->id != ''){
70
+ $where = array( 'person_id' => $this->id );
71
+ $wpdb->update($table, $data, $where);
72
+ }else{
73
+ $wpdb->insert($table, $data);
74
+ $this->id = $wpdb->insert_id;
75
+ }
76
+ return ($wpdb->insert_id);
77
+ }else{
78
+ return false;
79
+ }
80
+ }
81
+
82
+ function validate(){
83
+ if( !preg_match('/^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/', $this->email) ){
84
+ $this->errors[] = __('Please provide a valid email address.', 'dbem');
85
+ return false;
86
+ }
87
+ return true;
88
+ }
89
+
90
+ /**
91
+ * Checks agains the database to see if this user exists already
92
+ * @return boolean|int
93
+ */
94
+ function find_similar(){
95
+ global $wpdb;
96
+ $sql = "SELECT * FROM ". $wpdb->prefix.PEOPLE_TBNAME ." WHERE person_name='%s' AND person_email='%s' AND person_phone='%s'";
97
+ $row = $wpdb->get_row( $wpdb->prepare($sql, array($this->name, $this->email, $this->phone)), ARRAY_A );
98
+ if( is_array($row) ){
99
+ return $row['person_id'];
100
+ }
101
+ return false;
102
+ }
103
+
104
+ /**
105
+ * Checks if a similar record exists (same name, email and phone) and if so it loads
106
+ * @return boolean
107
+ */
108
+ function load_similar(){
109
+ $return = $this->find_similar();
110
+ if( is_numeric($return) ){
111
+ $this->id = $return;
112
+ return true;
113
+ }
114
+ return false;
115
+ }
116
+ }
117
+ ?>
{phpmailer → classes/phpmailer}/class.phpmailer.php RENAMED
File without changes
{phpmailer → classes/phpmailer}/class.smtp.php RENAMED
File without changes
{phpmailer → classes/phpmailer}/language/phpmailer.lang-br.php RENAMED
File without changes
{phpmailer → classes/phpmailer}/language/phpmailer.lang-ca.php RENAMED
File without changes
{phpmailer → classes/phpmailer}/language/phpmailer.lang-cz.php RENAMED
File without changes
{phpmailer → classes/phpmailer}/language/phpmailer.lang-de.php RENAMED
File without changes
{phpmailer → classes/phpmailer}/language/phpmailer.lang-dk.php RENAMED
File without changes
{phpmailer → classes/phpmailer}/language/phpmailer.lang-en.php RENAMED
File without changes
{phpmailer → classes/phpmailer}/language/phpmailer.lang-es.php RENAMED
File without changes
{phpmailer → classes/phpmailer}/language/phpmailer.lang-fi.php RENAMED
File without changes
{phpmailer → classes/phpmailer}/language/phpmailer.lang-fo.php RENAMED
File without changes
{phpmailer → classes/phpmailer}/language/phpmailer.lang-fr.php RENAMED
File without changes
{phpmailer → classes/phpmailer}/language/phpmailer.lang-hu.php RENAMED
File without changes
{phpmailer → classes/phpmailer}/language/phpmailer.lang-it.php RENAMED
File without changes
{phpmailer → classes/phpmailer}/language/phpmailer.lang-ja.php RENAMED
File without changes
{phpmailer → classes/phpmailer}/language/phpmailer.lang-nl.php RENAMED
File without changes
{phpmailer → classes/phpmailer}/language/phpmailer.lang-no.php RENAMED
File without changes
{phpmailer → classes/phpmailer}/language/phpmailer.lang-pl.php RENAMED
File without changes
{phpmailer → classes/phpmailer}/language/phpmailer.lang-ro.php RENAMED
File without changes
{phpmailer → classes/phpmailer}/language/phpmailer.lang-ru.php RENAMED
File without changes
{phpmailer → classes/phpmailer}/language/phpmailer.lang-se.php RENAMED
File without changes
{phpmailer → classes/phpmailer}/language/phpmailer.lang-tr.php RENAMED
File without changes
classes/recurrence.php ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Object that holds event recurrence info
4
+ * The EM_Event objects will handle adding / editing / deleting recurrences, this just holds the recurring info
5
+ * and provides extra functions to obtain related events.
6
+ * @author marcus
7
+ */
8
+ class EM_Recurrence extends EM_Object{
9
+ //TODO We NEED to add an author and rsvp to this recurrence.....
10
+ var $fields = array(
11
+ 'recurrence_id' => 'id',
12
+ 'recurrence_author' => 'author',
13
+ 'recurrence_name' => 'name',
14
+ 'recurrence_start_time' => 'start_time',
15
+ 'recurrence_end_time' => 'end_time',
16
+ 'recurrence_start_date' => 'start_date',
17
+ 'recurrence_end_date' => 'end_date',
18
+ 'recurrence_notes' => 'notes',
19
+ 'recurrence_rsvp' => 'rsvp',
20
+ 'recurrence_seats' => 'seats',
21
+ 'recurrence_contactperson_id' => 'contactperson_id',
22
+ 'location_id' => 'location_id',
23
+ 'recurrence_id' => 'recurrence_id',
24
+ 'recurrence_category_id' => 'category_id',
25
+ 'recurrence_attributes' => 'attributes',
26
+ 'recurrence_interval' => 'interval',
27
+ 'recurrence_freq' => 'freq',
28
+ 'recurrence_byday' => 'byday',
29
+ 'recurrence_byweekno' => 'byweekno',
30
+ );
31
+ /**
32
+ * Array of EM_Event objects
33
+ * @var array
34
+ */
35
+ var $events = array();
36
+
37
+ /**
38
+ * Initialize object. You can provide event data in an associative array (using database table field names), an id number, or false (default) to create empty event.
39
+ * If you provide an event array or object, it will convert it into a recurrence (useful if you want to change event data into recurrence).
40
+ * @param mixed $event_data
41
+ * @return null
42
+ */
43
+ function EM_Recurrence($event_data = false) {
44
+ global $wpdb;
45
+ if( $event_data !== false ){
46
+ $recurrence = array();
47
+ if( is_array($event_data) && isset($event_data['recurrence_name']) ){
48
+ //Directly inserting array of recurrence data
49
+ $recurrence = $event_data;
50
+ }elseif( is_numeric($event_data) || isset($event_data['recurrence_id']) ){
51
+ //$event_data is recurrence_id - Retreiving from the database
52
+ $recurrence_id = (is_array($event_data)) ? $event_data['recurrence_id']:$event_data;
53
+ $sql = "SELECT * FROM ". $wpdb->prefix . RECURRENCE_TBNAME ." WHERE recurrence_id = $recurrence_id";
54
+ $result = $wpdb->get_row( $sql, ARRAY_A );
55
+ if($result){
56
+ $this->location = new EM_Location ( $recurrence ['location_id'] );
57
+ $recurrence = $result;
58
+ }
59
+ }
60
+ $this->to_object($recurrence);
61
+ }
62
+ }
63
+
64
+ /**
65
+ * Removes recurrence record.
66
+ * @param $recurrence_id
67
+ * @return null
68
+ */
69
+ function delete() {
70
+ global $wpdb;
71
+ $sql = "DELETE FROM ".$wpdb->prefix.RECURRENCE_TBNAME." WHERE recurrence_id = '{$this->id}';";
72
+ $wpdb->query($sql);
73
+ }
74
+
75
+ /**
76
+ * Save an array into this class
77
+ * @param $array
78
+ * @return null
79
+ */
80
+ function to_object( $array = array() ){
81
+ //Save event core data
82
+ parent::to_object($array);
83
+ //Save location info
84
+ $this->location = new EM_Location($array['location_id']);
85
+ //Save contact person info
86
+ }
87
+
88
+ }
89
+ ?>
dbem-recurrence.php DELETED
@@ -1,267 +0,0 @@
1
- <?php
2
-
3
-
4
-
5
- function dbem_recurrence_test() {
6
- echo "<h2>Recurrence iCalendar</h2>";
7
-
8
- echo "<h3>Daily, every other day</h3>";
9
- $recurrence = array('recurrence_start_date' => '2009-02-10', 'recurrence_end_date' => '2009-03-10', 'recurrence_freq'=>'daily' , 'recurrence_interval' => 2);
10
- $matching_days = dbem_get_recurrence_events($recurrence);
11
-
12
- print_r($recurrence);
13
- //echo "<br/>every_N = $every_N - month_position = $month_position";
14
- echo "<br/>";
15
- echo "<ul>";
16
- foreach($matching_days as $day) {
17
- echo"<li>".date("D d M Y", $day)."</li>";
18
- }
19
- echo "</ul>";
20
-
21
- echo "<h3>Weekly</h3>";
22
- $recurrence = array('recurrence_start_date' => '2009-02-10', 'recurrence_end_date' => '2009-04-24', 'recurrence_freq'=>'weekly', 'recurrence_byday'=>7 , 'recurrence_interval' => 3);
23
- $matching_days = dbem_get_recurrence_events($recurrence);
24
-
25
- print_r($recurrence);
26
- //echo "<br/>every_N = $every_N - month_position = $month_position";
27
- echo "<br/>";
28
- echo "<ul>";
29
- foreach($matching_days as $day) {
30
- echo"<li>".date("D d M Y", $day)."</li>";
31
- }
32
- echo "</ul>";
33
-
34
- echo "<h3>Monthly, second week</h3>";
35
- $recurrence = array('recurrence_start_date' => '2009-02-10', 'recurrence_end_date' => '2009-04-24', 'recurrence_freq'=>'monthly', 'recurrence_byday' => 7, 'recurrence_byweekno'=>2 , 'recurrence_interval' => 1);
36
- $matching_days = dbem_get_recurrence_events($recurrence);
37
-
38
- print_r($recurrence);
39
- //echo "<br/>every_N = $every_N - month_position = $month_position";
40
- echo "<br/>";
41
- echo "<ul>";
42
- foreach($matching_days as $day) {
43
- echo"<li>".date("D d M Y", $day)."</li>";
44
- }
45
- echo "</ul>";
46
-
47
- echo "<h3>Last week of the month</h3>";
48
- $recurrence = array('recurrence_start_date' => '2009-02-10', 'recurrence_end_date' => '2009-04-24', 'recurrence_freq'=>'monthly', 'recurrence_byday' => 7, 'recurrence_byweekno'=> -1 , 'recurrence_interval' => 1);
49
- $matching_days = dbem_get_recurrence_events($recurrence);
50
-
51
- print_r($recurrence);
52
- //echo "<br/>every_N = $every_N - month_position = $month_position";
53
- echo "<br/>";
54
- echo "<ul>";
55
- foreach($matching_days as $day) {
56
- echo"<li>".date("D d M Y", $day)."</li>";
57
- }
58
- echo "</ul>";
59
- }
60
-
61
- function dbem_get_recurrence_events($recurrence){
62
-
63
- //print_r($recurrence);
64
- $start_date = mktime(0, 0, 0, substr($recurrence['recurrence_start_date'],5,2), substr($recurrence['recurrence_start_date'],8,2), substr($recurrence['recurrence_start_date'],0,4));
65
- $end_date = mktime(0, 0, 0, substr($recurrence['recurrence_end_date'],5,2), substr($recurrence['recurrence_end_date'],8,2), substr($recurrence['recurrence_end_date'],0,4));
66
-
67
- $every_keys = array('every' => 1, 'every_second' => 2, 'every_third' => 3, 'every_fourth' => 4);
68
- $every_N = $every_keys[$recurrence['recurrence_modifier']];
69
-
70
- $month_position_keys = array('first_of_month'=>1, 'second_of_month' => 2, 'third_of_month' => 3, 'fourth_of_month' => 4);
71
- $month_position = $month_position_keys[$recurrence['recurrence_modifier']];
72
-
73
- $last_week_start = array(25, 22, 25, 24, 25, 24, 25, 25, 24, 25, 24, 25);
74
-
75
- $weekdays = explode(",", $recurrence['recurrence_byday']);
76
- //print_r($weekdays);
77
-
78
- $weekcounter = 0;
79
- $daycounter = 0;
80
- $counter = 0;
81
- $cycle_date = $start_date;
82
- $matching_days = array();
83
- $aDay = 86400; // a day in seconds
84
-
85
-
86
- while (date("d-M-Y", $cycle_date) != date('d-M-Y', $end_date + $aDay)) {
87
- //echo (date("d-M-Y", $cycle_date));
88
- $style = "";
89
- $monthweek = floor(((date("d", $cycle_date)-1)/7))+1;
90
- if($recurrence['recurrence_freq'] == 'daily') {
91
-
92
- if($counter % $recurrence['recurrence_interval'] == 0 )
93
- array_push($matching_days, $cycle_date);
94
- $counter++;
95
- }
96
-
97
- if (in_array(dbem_iso_N_date_value($cycle_date), $weekdays )) {
98
- $monthday = date("j", $cycle_date);
99
- $month = date("n", $cycle_date);
100
-
101
- if($recurrence['recurrence_freq'] == 'weekly') {
102
-
103
- if($counter % $recurrence['recurrence_interval'] == 0 )
104
- array_push($matching_days, $cycle_date);
105
- $counter++;
106
- }
107
- if($recurrence['recurrence_freq'] == 'monthly') {
108
-
109
- if(($recurrence['recurrence_byweekno'] == -1) && ($monthday >= $last_week_start[$month-1])) {
110
- if ($counter % $recurrence['recurrence_interval'] == 0)
111
- array_push($matching_days, $cycle_date);
112
- $counter++;
113
- } elseif($recurrence['recurrence_byweekno'] == $monthweek) {
114
- if ($counter % $recurrence['recurrence_interval'] == 0)
115
- array_push($matching_days, $cycle_date);
116
- $counter++;
117
- }
118
- }
119
- $weekcounter++;
120
- }
121
- $daycounter++;
122
- $cycle_date = $cycle_date + $aDay; //adding a day
123
-
124
- }
125
-
126
- // print_r($matching_days);
127
-
128
- return $matching_days ;
129
-
130
- }
131
-
132
-
133
-
134
- ///////////////////////////////////////////////
135
-
136
-
137
- function dbem_insert_recurrent_event($event, $recurrence ){
138
-
139
- global $wpdb;
140
- $recurrence_table = $wpdb->prefix.RECURRENCE_TBNAME;
141
-
142
- if (true) {//TODO add recurrence validation
143
- //$wpdb->show_errors(true);
144
-
145
- $wpdb->insert($recurrence_table, $recurrence);
146
- //print_r($recurrence);
147
- $recurrence['recurrence_id'] = mysql_insert_id();
148
- $output = "<h2>Recurring</h2>";
149
- //echo "recurrence_id = $recurrence_id<br/>";
150
- dbem_insert_events_for_recurrence($recurrence);
151
-
152
-
153
- }
154
- }
155
- function dbem_insert_events_for_recurrence($recurrence) {
156
- global $wpdb;
157
- $events_table = $wpdb->prefix.EVENTS_TBNAME;
158
- $matching_days = dbem_get_recurrence_events($recurrence);
159
- //print_r($matching_days);
160
- sort($matching_days);
161
-
162
- foreach($matching_days as $day) {
163
- $new_event['event_name'] = $recurrence['recurrence_name'];
164
- $new_event['event_notes'] = $recurrence['recurrence_notes'];
165
- $new_event['event_start_time'] = $recurrence['recurrence_start_time'];
166
- $new_event['event_end_time'] = $recurrence['recurrence_end_time'];
167
- $new_event['event_rsvp'] = $recurrence['recurrence_rsvp'];
168
- $new_event['event_seats'] = $recurrence['recurrence_seats'];
169
- $new_event['location_id'] = $recurrence['location_id'];
170
- $new_event['recurrence_id'] = $recurrence['recurrence_id'];
171
- $new_event['event_start_date'] = date("Y-m-d", $day);
172
- //print_r($new_event);
173
- echo "<br/>";
174
- $wpdb->insert($events_table, $new_event);
175
- if(DEBUG)
176
- echo date("D d M Y", $day)."<br/>";
177
- }
178
- }
179
- function dbem_update_recurrence($recurrence) {
180
- global $wpdb;
181
- $recurrence_table = $wpdb->prefix.RECURRENCE_TBNAME;
182
- $where = array('recurrence_id' => $recurrence['recurrence_id']);
183
- if (true) {
184
- $wpdb->print_error(true);
185
- $wpdb->update($recurrence_table, $recurrence, $where);
186
- dbem_remove_events_for_recurrence_id($recurrence['recurrence_id']);
187
- dbem_insert_events_for_recurrence($recurrence);
188
- return true;
189
- }
190
- return false;
191
-
192
- }
193
- function dbem_remove_events_for_recurrence_id($recurrence_id) {
194
- global $wpdb;
195
- $events_table = $wpdb->prefix.EVENTS_TBNAME;
196
- $sql = "DELETE FROM $events_table WHERE recurrence_id = '$recurrence_id';";
197
- $wpdb->query($sql);
198
-
199
- }
200
- function dbem_get_recurrence($recurrence_id) {
201
- global $wpdb;
202
- $recurrence_table = $wpdb->prefix.RECURRENCE_TBNAME;
203
- $sql = "SELECT *,
204
- DATE_FORMAT(recurrence_start_time, '%k') AS 'recurrence_hh',
205
- DATE_FORMAT(recurrence_start_time, '%i') AS 'recurrence_mm',
206
- DATE_FORMAT(recurrence_start_time, '%h:%i%p') AS 'recurrence_start_12h_time',
207
- DATE_FORMAT(recurrence_start_time, '%H:%i') AS 'recurrence_start_24h_time',
208
- DATE_FORMAT(recurrence_end_time, '%Y-%m-%e') AS 'event_end_date',
209
- DATE_FORMAT(recurrence_end_time, '%k') AS 'recurrence_end_hh',
210
- DATE_FORMAT(recurrence_end_time, '%i') AS 'recurrence_end_mm',
211
- DATE_FORMAT(recurrence_end_time, '%h:%i%p') AS 'recurrence_end_12h_time',
212
- DATE_FORMAT(recurrence_end_time, '%H:%i') AS 'recurrence_end_24h_time'
213
- FROM $recurrence_table WHERE recurrence_id = $recurrence_id;";
214
- $recurrence = $wpdb->get_row($sql, ARRAY_A);
215
- $location = dbem_get_location($recurrence['location_id']);
216
- $recurrence['location_name'] = $location['location_name'];
217
- $recurrence['location_address'] = $location['location_address'];
218
- $recurrence['location_town'] = $location['location_town'];
219
- $recurrence['recurrence_description'] = dbem_build_recurrence_description($recurrence);
220
- return $recurrence;
221
- }
222
-
223
- function dbem_build_recurrence_description($recurrence) {
224
-
225
- $weekdays_name = array(__('Monday'),__('Tuesday'),__('Wednesday'),__('Thursday'),__('Friday'),__('Saturday'),__('Sunday'));
226
- $monthweek_name = array('1' => __('the first %s of the month', 'dbem'),'2' => __('the second %s of the month', 'dbem'), '3' => __('the third %s of the month', 'dbem'), '4' => __('the fourth %s of the month', 'dbem'), '-1' => __('the last %s of the month', 'dbem'));
227
- $output = sprintf (__('From %1$s to %2$s', 'dbem'), $recurrence['recurrence_start_date'], $recurrence['recurrence_end_date']).", ";
228
- if ($recurrence['recurrence_freq'] == 'daily') {
229
-
230
- $freq_desc =__('everyday', 'dbem');
231
- if ($recurrence['recurrence_interval'] > 1 ) {
232
- $freq_desc = sprintf (__("every %s days", 'dbem'), $recurrence['recurrence_interval']);
233
- }
234
- }
235
- if ($recurrence['recurrence_freq'] == 'weekly') {
236
- $weekday_array = explode(",", $recurrence['recurrence_byday']);
237
- $natural_days = array();
238
- foreach($weekday_array as $day)
239
- array_push($natural_days, $weekdays_name[$day-1]);
240
- $output .= implode(" and ", $natural_days);
241
- if ($recurrence['recurrence_interval'] > 1 ) {
242
- $freq_desc = ", ".sprintf (__("every %s weeks", 'dbem'), $recurrence['recurrence_interval']);
243
- }
244
-
245
- }
246
- if ($recurrence['recurrence_freq'] == 'monthly') {
247
- $weekday_array = explode(",", $recurrence['recurrence_byday']);
248
- $natural_days = array();
249
- foreach($weekday_array as $day)
250
- array_push($natural_days, $weekdays_name[$day-1]);
251
- $freq_desc = sprintf (($monthweek_name[$recurrence['recurrence_byweekno']]), implode(" and ", $natural_days));
252
- if ($recurrence['recurrence_interval'] > 1 ) {
253
- $freq_desc .= ", ".sprintf (__("every %s months",'dbem'), $recurrence['recurrence_interval']);
254
- }
255
-
256
- }
257
- $output .= $freq_desc;
258
- return $output;
259
- }
260
- function dbem_iso_N_date_value($date) {
261
- // date("N", $cycle_date)
262
- $n = date("w", $date);
263
- if ($n == 0)
264
- $n = 7;
265
- return $n;
266
- }
267
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
dbem.js DELETED
@@ -1,86 +0,0 @@
1
- $j=jQuery.noConflict();
2
-
3
- function remove_booking() {
4
- eventId = ($j(this).parents('table:first').attr('id').split("-"))[3];
5
- idToRemove = ($j(this).parents('tr:first').attr('id').split("-"))[1];
6
- $j.ajax({
7
- type: "POST",
8
- url: "admin.php?page=people&action=remove_booking",
9
- data: "booking_id="+ idToRemove,
10
- success: function(){
11
-
12
- $j('tr#booking-' + idToRemove).fadeOut('slow');
13
- update_booking_data();
14
- }
15
- });
16
-
17
-
18
- }
19
-
20
- function update_booking_data () {
21
- $j.getJSON("admin.php?page=people&dbem_ajax_action=booking_data",{id: eventId, ajax: 'true'}, function(data){
22
- booked = data[0].bookedSeats;
23
- available = data[0].availableSeats;
24
- $j('td#booked-seats').text(booked);
25
- $j('td#available-seats').text(available);
26
- });
27
- }
28
-
29
- $j(document).ready( function() {
30
- // Managing bookings delete operations
31
- $j('a.bookingdelbutton').click(remove_booking);
32
- });
33
-
34
- jQuery(document).ready( function($) {
35
- jQuery('#mtm_add_tag').click( function(event){
36
- event.preventDefault();
37
- //Get All meta rows
38
- var metas = jQuery('#mtm_body').children();
39
- //Copy first row and change values
40
- var metaCopy = jQuery(metas[0]).clone(true);
41
- newId = metas.length + 1;
42
- metaCopy.attr('id', 'mtm_'+newId);
43
- metaCopy.find('a').attr('rel', newId);
44
- metaCopy.find('[name=mtm_1_ref]').attr({
45
- name:'mtm_'+newId+'_ref' ,
46
- value:''
47
- });
48
- metaCopy.find('[name=mtm_1_content]').attr({
49
- name:'mtm_'+newId+'_content' ,
50
- value:''
51
- });
52
- metaCopy.find('[name=mtm_1_name]').attr({
53
- name:'mtm_'+newId+'_name' ,
54
- value:''
55
- });
56
- //Insert into end of file
57
- jQuery('#mtm_body').append(metaCopy);
58
- //Duplicate the last entry, remove values and rename id
59
- });
60
-
61
- jQuery('#mtm_body a').click( function(event){
62
- event.preventDefault();
63
- //Only remove if there's more than 1 meta tag
64
- if(jQuery('#mtm_body').children().length > 1){
65
- //Remove the item
66
- jQuery(jQuery(this).parent().parent().get(0)).remove();
67
- //Renumber all the items
68
- jQuery('#mtm_body').children().each( function(i){
69
- metaCopy = jQuery(this);
70
- oldId = metaCopy.attr('id').replace('mtm_','');
71
- newId = i+1;
72
- metaCopy.attr('id', 'mtm_'+newId);
73
- metaCopy.find('a').attr('rel', newId);
74
- metaCopy.find('[name=mtm_'+ oldId +'_ref]').attr('name', 'mtm_'+newId+'_ref');
75
- metaCopy.find('[name=mtm_'+ oldId +'_content]').attr('name', 'mtm_'+newId+'_content');
76
- metaCopy.find('[name=mtm_'+ oldId +'_name]').attr( 'name', 'mtm_'+newId+'_name');
77
- });
78
- }else{
79
- metaCopy = jQuery(jQuery(this).parent().parent().get(0));
80
- metaCopy.find('[name=mtm_1_ref]').attr('value', '');
81
- metaCopy.find('[name=mtm_1_content]').attr('value', '');
82
- metaCopy.find('[name=mtm_1_name]').attr( 'value', '');
83
- alert("If you don't want any meta tags, just leave the text boxes blank and submit");
84
- }
85
- });
86
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
dbem_UI_helpers.php DELETED
@@ -1,93 +0,0 @@
1
- <?php
2
- function dbem_option_items($array, $saved_value) {
3
- $output = "";
4
- foreach($array as $key => $item) {
5
- $selected ='';
6
- if ($key == $saved_value)
7
- $selected = "selected='selected'";
8
- $output .= "<option value='$key' $selected >$item</option>\n";
9
-
10
- }
11
- echo $output;
12
- }
13
-
14
- function dbem_checkbox_items($name, $array, $saved_values, $horizontal = true) {
15
- $output = "";
16
- foreach($array as $key => $item) {
17
-
18
- $checked = "";
19
- if (in_array($key, $saved_values))
20
- $checked = "checked='checked'";
21
- $output .= "<input type='checkbox' name='$name' value='$key' $checked /> $item ";
22
- if(!$horizontal)
23
- $output .= "<br/>\n";
24
- }
25
- echo $output;
26
-
27
- }
28
-
29
- function dbem_options_input_text($title, $name, $description) {
30
- ?>
31
- <tr valign="top" id='<?php echo $name;?>_row'>
32
- <th scope="row"><?php _e($title, 'dbem') ?></th>
33
- <td>
34
- <input name="<?php echo $name ?>" type="text" id="<?php echo $title ?>" style="width: 95%" value="<?php echo htmlspecialchars(get_option($name)); ?>" size="45" /><br />
35
- <?php _e($description, 'dbem') ?>
36
- </td>
37
- </tr>
38
- <?php
39
- }
40
- function dbem_options_input_password($title, $name, $description) {
41
- ?>
42
- <tr valign="top" id='<?php echo $name;?>_row'>
43
- <th scope="row"><?php _e($title, 'dbem') ?></th>
44
- <td>
45
- <input name="<?php echo $name ?>" type="password" id="<?php echo $title ?>" style="width: 95%" value="<?php echo get_option($name); ?>" size="45" /><br />
46
- <?php echo $description; ?>
47
- </td>
48
- </tr>
49
- <?php
50
- }
51
-
52
- function dbem_options_textarea($title, $name, $description) {
53
- ?>
54
- <tr valign="top" id='<?php echo $name;?>_row'>
55
- <th scope="row"><?php _e($title,'dbem')?></th>
56
- <td><textarea name="<?php echo $name ?>" id="<?php echo $name ?>" rows="6" cols="60"><?php echo (get_option($name));?></textarea><br/>
57
- <?php echo $description; ?></td>
58
- </tr>
59
- <?php
60
- }
61
-
62
- function dbem_options_radio_binary($title, $name, $description) {
63
- $list_events_page = get_option($name); ?>
64
-
65
- <tr valign="top" id='<?php echo $name;?>_row'>
66
- <th scope="row"><?php _e($title,'dbem'); ?></th>
67
- <td>
68
- <input id="<?php echo $name ?>_yes" name="<?php echo $name ?>" type="radio" value="1" <?php if($list_events_page) echo "checked='checked'"; ?> /><?php _e('Yes'); ?> <br />
69
- <input id="<?php echo $name ?>_no" name="<?php echo $name ?>" type="radio" value="0" <?php if(!$list_events_page) echo "checked='checked'"; ?> /><?php _e('No'); ?> <br />
70
- <?php echo $description; ?>
71
- </td>
72
- </tr>
73
- <?php
74
- }
75
- function dbem_options_select($title, $name, $list, $description) {
76
- $option_value = get_option($name); ?>
77
-
78
- <tr valign="top" id='<?php echo $name;?>_row'>
79
- <th scope="row"><?php _e($title,'dbem'); ?></th>
80
- <td>
81
- <select name="<?php echo $name; ?>" >
82
- <?php foreach($list as $key => $value) {
83
- "$key" == $option_value ? $selected = "selected='selected' " : $selected = '';
84
- echo "<option value='$key' $selected>$value</option>";
85
- } ?>
86
- </select> <br/>
87
- <?php echo $description; ?>
88
- </td>
89
- </tr>
90
- <?php
91
- }
92
-
93
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
dbem_calendar.php DELETED
@@ -1,496 +0,0 @@
1
- <?php
2
- function dbem_get_calendar_shortcode($atts) {
3
- extract(shortcode_atts(array(
4
- 'full' => 0,
5
- 'month' => '',
6
- 'year' => '',
7
- 'long_events' => 0
8
- ), $atts));
9
- $result = dbem_get_calendar("full={$full}&month={$month}&year={$year}&echo=0&long_events={$long_events}");
10
- return $result;
11
- }
12
- add_shortcode('events_calendar', 'dbem_get_calendar_shortcode');
13
-
14
- function dbem_get_calendar($args="") {
15
- $defaults = array(
16
- 'full' => 0,
17
- 'month' => '',
18
- 'echo' => 1,
19
- 'long_events' => 0
20
- );
21
- $r = wp_parse_args( $args, $defaults );
22
- extract( $r, EXTR_SKIP );
23
- $full = $r['full'];
24
- $month = $r['month'];
25
- $echo = $r['echo'];
26
-
27
- $week_starts_on_sunday = get_option('dbem_week_starts_sunday');
28
- $start_of_week = get_option('start_of_week');
29
-
30
- global $wpdb;
31
- if(isset($_GET['calmonth']) && $_GET['calmonth'] != '') {
32
- $month = dbem_sanitize_request($_GET['calmonth']) ;
33
- } else {
34
- if ($month == '')
35
- $month = date('m');
36
- }
37
- if(isset($_GET['calyear']) && $_GET['calyear'] != '') {
38
- $year = dbem_sanitize_request($_GET['calyear']) ;
39
- } else {
40
- if (!isset($year) || $year == '')
41
- $year = date('Y');
42
- }
43
- $date = mktime(0,0,0,$month, date('d'), $year);
44
- $day = date('d', $date);
45
- // $month = date('m', $date);
46
- // $year = date('Y', $date);
47
- // Get the first day of the month
48
- $month_start = mktime(0,0,0,$month, 1, $year);
49
- // Get friendly month name
50
-
51
- $month_name = mysql2date('M', "$year-$month-$day 00:00:00");
52
- // Figure out which day of the week
53
- // the month starts on.
54
- $month_start_day = date('D', $month_start);
55
-
56
- switch($month_start_day){
57
- case "Sun": $offset = 0; break;
58
- case "Mon": $offset = 1; break;
59
- case "Tue": $offset = 2; break;
60
- case "Wed": $offset = 3; break;
61
- case "Thu": $offset = 4; break;
62
- case "Fri": $offset = 5; break;
63
- case "Sat": $offset = 6; break;
64
- }
65
-
66
- $offset -= $start_of_week;
67
- if($offset<0)
68
- $offset += 7;
69
-
70
- // determine how many days are in the last month.
71
- if($month == 1) {
72
- $num_days_last = dbem_days_in_month(12, ($year -1));
73
- } else {
74
- $num_days_last = dbem_days_in_month(($month-1), $year);
75
- }
76
- // determine how many days are in the current month.
77
- $num_days_current = dbem_days_in_month($month, $year);
78
- // Build an array for the current days
79
- // in the month
80
- for($i = 1; $i <= $num_days_current; $i++){
81
- $num_days_array[] = mktime(0,0,0,$month, $i, $year);
82
- }
83
- // Build an array for the number of days
84
- // in last month
85
- for($i = 1; $i <= $num_days_last; $i++){
86
- $num_days_last_array[] = $i;
87
- }
88
- // If the $offset from the starting day of the
89
- // week happens to be Sunday, $offset would be 0,
90
- // so don't need an offset correction.
91
-
92
- if($offset > 0){
93
- $offset_correction = array_slice($num_days_last_array, -$offset, $offset);
94
- $new_count = array_merge($offset_correction, $num_days_array);
95
- $offset_count = count($offset_correction);
96
- }
97
-
98
- // The else statement is to prevent building the $offset array.
99
- else {
100
- $offset_count = 0;
101
- $new_count = $num_days_array;
102
- }
103
- // count how many days we have with the two
104
- // previous arrays merged together
105
- $current_num = count($new_count);
106
-
107
- // Since we will have 5 HTML table rows (TR)
108
- // with 7 table data entries (TD)
109
- // we need to fill in 35 TDs
110
- // so, we will have to figure out
111
- // how many days to appened to the end
112
- // of the final array to make it 35 days.
113
-
114
-
115
- if($current_num > 35){
116
- $num_weeks = 6;
117
- $outset = (42 - $current_num);
118
- } elseif($current_num < 35){
119
- $num_weeks = 5;
120
- $outset = (35 - $current_num);
121
- }
122
- if($current_num == 35){
123
- $num_weeks = 5;
124
- $outset = 0;
125
- }
126
- // Outset Correction
127
- for($i = 1; $i <= $outset; $i++){
128
- $new_count[] = $i;
129
- }
130
- // Now let's "chunk" the $all_days array
131
- // into weeks. Each week has 7 days
132
- // so we will array_chunk it into 7 days.
133
- $weeks = array_chunk($new_count, 7);
134
-
135
-
136
-
137
- // Build Previous and Next Links
138
- $base_link = "?".$_SERVER['QUERY_STRING']."&amp;";
139
-
140
- if($month == 1){
141
- $back_month = 12;
142
- $back_year = $year-1;
143
- } else {
144
- $back_month = $month -1;
145
- $back_year = $year;
146
- }
147
- $full ? $link_extra_class = "full-link" : $link_extra_class = '';
148
- $previous_link = "<a class='prev-month $link_extra_class' href=\"".$base_link."calmonth={$back_month}&amp;calyear={$back_year} \">&lt;&lt;</a>";
149
-
150
- if($month == 12){
151
- $next_month = 1;
152
- $next_year = $year+1;
153
- } else {
154
- $next_month = $month + 1;
155
- $next_year = $year;
156
- }
157
- $next_link = "<a class='next-month $link_extra_class' href=\"".$base_link."calmonth={$next_month}&amp;calyear={$next_year} \">&gt;&gt;</a>";
158
- $random = (rand(100,200));
159
- $full ? $class = 'dbem-calendar-full' : $class='dbem-calendar';
160
- $calendar="<div class='$class' id='dbem-calendar-$random'><div style='display:none' class='month_n'>$month</div><div class='year_n' style='display:none' >$year</div>";
161
-
162
- $weekdays = array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
163
- $n = 0 ;
164
- while( $n < $start_of_week ) {
165
- $last_day = array_shift($weekdays);
166
- $weekdays[]= $last_day;
167
- $n++;
168
- }
169
-
170
- $days_initials = "";
171
- foreach($weekdays as $weekday) {
172
- $days_initials .= "<td>".dbem_translate_and_trim($weekday)."</td>";
173
- }
174
- $full ? $fullclass = 'fullcalendar' : $fullclass='';
175
- // Build the heading portion of the calendar table
176
- $calendar .= "<table class='dbem-calendar-table $fullclass'>\n".
177
- "<thead>\n<tr>\n".
178
- "<td>$previous_link</td><td class='month_name' colspan='5'>$month_name $year</td><td>$next_link</td>\n".
179
- "</tr>\n</thead>\n".
180
- "<tr class='days-names'>\n".
181
- $days_initials.
182
- "</tr>\n";
183
-
184
- // Now we break each key of the array
185
- // into a week and create a new table row for each
186
- // week with the days of that week in the table data
187
-
188
- $i = 0;
189
- foreach($weeks as $week){
190
- $calendar .= "<tr>\n";
191
- foreach($week as $d){
192
- if($i < $offset_count){ //if it is PREVIOUS month
193
- $calendar .= "<td class='eventless-pre'>$d</td>\n";
194
- }
195
- if(($i >= $offset_count) && ($i < ($num_weeks * 7) - $outset)){ // if it is THIS month
196
- $fullday=$d;
197
- $d=date('j', $d);
198
- $day_link = "$d";
199
- // original :
200
- //if($date == mktime(0,0,0,$month,$d,$year)){
201
- // proposed patch (http://davidebenini.it/events-manager-forum/topic.php?id=73 )
202
- // if(($date == mktime(0,0,0,$month,$d,$year)) && (date('F') == $month_name)) {
203
- // my solution:
204
- if($d == date('j') && $month == date('m') && $year == date('Y')) {
205
- $calendar .= "<td class='eventless-today'>$d</td>\n";
206
- } else {
207
- $calendar .= "<td class='eventless'>$day_link</td>\n";
208
- }
209
- } elseif(($outset > 0)) { //if it is NEXT month
210
- if(($i >= ($num_weeks * 7) - $outset)){
211
- $calendar .= "<td class='eventless-post'>$d</td>\n";
212
- }
213
- }
214
- $i++;
215
- }
216
- $calendar .= "</tr>\n";
217
- }
218
-
219
- $calendar .= " </table>\n</div>";
220
-
221
- // query the database for events in this time span
222
- if ($month == 1) {
223
- $month_pre=12;
224
- $month_post=2;
225
- $year_pre=$year-1;
226
- $year_post=$year;
227
- } elseif($month == 12) {
228
- $month_pre=11;
229
- $month_post=1;
230
- $year_pre=$year;
231
- $year_post=$year+1;
232
- } else {
233
- $month_pre=$month-1;
234
- $month_post=$month+1;
235
- $year_pre=$year;
236
- $year_post=$year;
237
- }
238
- $limit_pre=date("Y-m-d", mktime(0,0,0,$month_pre, 1 , $year_pre));
239
- $limit_post=date("Y-m-d", mktime(0,0,0,$month_post, 30 , $year_post));
240
- $events_table = $wpdb->prefix.EVENTS_TBNAME;
241
- $sql = "SELECT event_id,
242
- event_name,
243
- event_start_date,
244
- event_start_time,
245
- event_end_date,
246
- DATE_FORMAT(event_start_date, '%w') AS 'event_weekday_n',
247
- DATE_FORMAT(event_start_date, '%e') AS 'event_day',
248
- DATE_FORMAT(event_start_date, '%c') AS 'event_month_n',
249
- DATE_FORMAT(event_start_time, '%Y') AS 'event_year',
250
- DATE_FORMAT(event_start_time, '%k') AS 'event_hh',
251
- DATE_FORMAT(event_start_time, '%i') AS 'event_mm'
252
- FROM $events_table
253
- WHERE (event_start_date BETWEEN '$limit_pre' AND '$limit_post') OR (event_end_date BETWEEN '$limit_pre' AND '$limit_post') ORDER BY event_start_date";
254
-
255
- $events=$wpdb->get_results($sql, ARRAY_A);
256
-
257
- //----- DEBUG ------------
258
- //foreach($events as $event) { //DEBUG
259
- // $calendar .= ("$event->event_day / $event->event_month_n - $event->event_name<br/>");
260
- //}
261
- // ------------------
262
-
263
- $eventful_days= array();
264
- if($events){
265
- //Go through the events and slot them into the right d-m index
266
- foreach($events as $event) {
267
- if( $long_events ){
268
- //If $long_events is set then show a date as eventful if there is an multi-day event which runs during that day
269
- $event_start_date = strtotime($event['event_start_date']);
270
- $event_end_date = strtotime($event['event_end_date']);
271
- while( $event_start_date <= $event_end_date ){
272
- $event_eventful_date = date('Y-m-d', $event_start_date);
273
- //Only show events on the day that they start
274
- if( is_array($eventful_days[$event_eventful_date]) ){
275
- $eventful_days[$event_eventful_date][] = $event;
276
- } else {
277
- $eventful_days[$event_eventful_date] = array($event);
278
- }
279
- $event_start_date += (60*60*24);
280
- }
281
- }else{
282
- //Only show events on the day that they start
283
- if( isset($eventful_days[$event['event_start_date']]) && is_array($eventful_days[$event['event_start_date']]) ){
284
- $eventful_days[$event['event_start_date']][] = $event;
285
- } else {
286
- $eventful_days[$event['event_start_date']] = array($event);
287
- }
288
- }
289
- }
290
- }
291
-
292
- $event_format = get_option('dbem_full_calendar_event_format');
293
- $event_title_format = get_option('dbem_small_calendar_event_title_format');
294
- $event_title_separator_format = get_option('dbem_small_calendar_event_title_separator');
295
- $cells = array() ;
296
- foreach($eventful_days as $day_key => $events) {
297
- //Set the date into the key
298
- $event_date = explode('-', $day_key);
299
- $cells[$day_key]['day'] = ltrim($event_date[2],'0');
300
- $cells[$day_key]['month'] = $event_date[1];
301
- $events_titles = array();
302
- foreach($events as $event) {
303
- $events_titles[] = dbem_replace_placeholders($event_title_format, $event);
304
- }
305
- $link_title = implode($event_title_separator_format,$events_titles);
306
-
307
- $events_page_id = get_option('dbem_events_page');
308
- $event_page_link = get_permalink($events_page_id);
309
- if (stristr($event_page_link, "?"))
310
- $joiner = "&amp;";
311
- else
312
- $joiner = "?";
313
-
314
-
315
- $cells[$day_key]['cell'] = "<a title='$link_title' href='".$event_page_link.$joiner."calendar_day={$day_key}'>{$cells[$day_key]['day']}</a>";
316
- if ($full) {
317
- $cells[$day_key]['cell'] .= "<ul>";
318
-
319
- foreach($events as $event) {
320
- $cells[$day_key]['cell'] .= dbem_replace_placeholders($event_format, $event);
321
- }
322
- $cells[$day_key]['cell'] .= "</ul>";
323
- }
324
- }
325
-
326
- // print_r($cells);
327
-
328
- if($events){
329
- foreach($cells as $cell) {
330
- if ($cell['month'] == $month_pre) {
331
- $calendar=str_replace("<td class='eventless-pre'>".$cell['day']."</td>","<td class='eventful-pre'>".$cell['cell']."</td>",$calendar);
332
- } elseif($cell['month'] == $month_post) {
333
- $calendar=str_replace("<td class='eventless-post'>".$cell['day']."</td>","<td class='eventful-post'>".$cell['cell']."</td>",$calendar);
334
- } elseif($cell['day'] == $day && $cell['month'] == date('m')) {
335
- $calendar=str_replace("<td class='eventless-today'>".$cell['day']."</td>","<td class='eventful-today'>".$cell['cell']."</td>",$calendar);
336
- } elseif( $cell['month'] == $month ){
337
- $calendar=str_replace("<td class='eventless'>".$cell['day']."</td>","<td class='eventful'>".$cell['cell']."</td>",$calendar);
338
- }
339
- }
340
- }
341
-
342
- $output=$calendar;
343
- if ($echo)
344
- echo $output;
345
- else
346
- return $output;
347
- }
348
-
349
- function dbem_days_in_month($month, $year) {
350
- switch ($month) {
351
- case (2):
352
- if ($year % 4 == 0 && ($year % 100 != 0 || $year % 400 == 0)) {
353
- return 29;
354
- } else {
355
- return 28;
356
- }
357
- break;
358
- case (4):
359
- return 30;
360
- break;
361
- case (6):
362
- return 30;
363
- break;
364
- case (9):
365
- return 30;
366
- break;
367
- case (11):
368
- return 30;
369
- break;
370
- default:
371
- return 31;
372
- break;
373
- }
374
- }
375
-
376
- function dbem_calendar_style() {
377
- ?>
378
- <style type="text/css">
379
- table.dbem-calendar-table td {
380
- padding: 2px 4px;
381
- text-align: center;
382
- }
383
- table.dbem-calendar.table tr.days-names {
384
- font-weight: bold;
385
- }
386
- table.dbem-calendar-table td.eventless-pre, .dbem-calendar td.eventless-post {
387
- color: #ccc;
388
- }
389
- table.dbem-calendar-table td.eventful a {
390
- font-weight: bold;
391
- color: #FD7E29;
392
- }
393
- table.dbem-calendar-table td.eventless-today {
394
- background-color: #CFCFCF;
395
- }
396
- table.dbem-calendar-table thead {
397
- font-size: 120%;
398
- font-weight: bold;
399
- }
400
- </style>
401
- <?php
402
- }
403
- //add_action('wp_head', 'dbem_calendar_style');
404
-
405
- function dbem_translate_and_trim($string, $length = 1) {
406
- return substr(__($string), 0, $length);
407
- }
408
-
409
- function dbem_ajaxize_calendar()
410
- { ?>
411
- <script type='text/javascript'>
412
- $j=jQuery.noConflict();
413
-
414
-
415
- $j(document).ready( function() {
416
- initCalendar();
417
- });
418
-
419
- function initCalendar() {
420
- $j('a.prev-month').click(function(e){
421
- e.preventDefault();
422
- tableDiv = $j(this).parents('table').parent();
423
- ($j(this).hasClass('full-link')) ? fullcalendar = 1 : fullcalendar = 0;
424
- prevMonthCalendar(tableDiv, fullcalendar);
425
- } );
426
- $j('a.next-month').click(function(e){
427
- e.preventDefault();
428
- tableDiv = $j(this).parents('table').parent();
429
- ($j(this).hasClass('full-link')) ? fullcalendar = 1 : fullcalendar = 0;
430
- nextMonthCalendar(tableDiv, fullcalendar);
431
- } );
432
- }
433
- function prevMonthCalendar(tableDiv, fullcalendar) {
434
- if (fullcalendar === undefined) {
435
- fullcalendar = 0;
436
- }
437
- month_n = tableDiv.children('div.month_n').html();
438
- year_n = tableDiv.children('div.year_n').html();
439
- parseInt(month_n) == 1 ? prevMonth = 12 : prevMonth = parseInt(month_n,10) - 1 ;
440
- if (parseInt(month_n,10) == 1)
441
- year_n = parseInt(year_n,10) -1;
442
- $j.get("<?php bloginfo('wpurl'); ?>", {ajaxCalendar: 'true', calmonth: prevMonth, calyear: year_n, full: fullcalendar}, function(data){
443
- tableDiv.html(data);
444
- initCalendar();
445
- });
446
- }
447
- function nextMonthCalendar(tableDiv, fullcalendar) {
448
- if (fullcalendar === undefined) {
449
- fullcalendar = 0;
450
- }
451
- month_n = tableDiv.children('div.month_n').html();
452
- year_n = tableDiv.children('div.year_n').html();
453
- parseInt(month_n,10) == 12 ? nextMonth = 1 : nextMonth = parseInt(month_n,10) + 1 ;
454
- if (parseInt(month_n,10) == 12)
455
- year_n = parseInt(year_n,10) + 1;
456
- $j.get("<?php bloginfo('wpurl'); ?>", {ajaxCalendar: 'true', calmonth: nextMonth, calyear: year_n, full : fullcalendar}, function(data){
457
- tableDiv.html(data);
458
- initCalendar();
459
- });
460
- }
461
-
462
- // function reloadCalendar(e) {
463
- // // e.preventDefault();
464
- // console.log($j(this).parents('table'));
465
- // $j.get("<?php bloginfo('wpurl'); ?>", {ajax: 'true'}, function(data){
466
- // tableDiv = table.parent();
467
- // tableDiv.html(data);
468
- // });
469
- // }
470
- //
471
-
472
- </script>
473
-
474
- <?php
475
- }
476
- add_action('wp_head', 'dbem_ajaxize_calendar');
477
-
478
- function dbem_filter_calendar_ajax() {
479
- if(isset($_GET['ajaxCalendar']) && $_GET['ajaxCalendar'] == true) {
480
- (isset($_GET['full']) && $_GET['full'] == 1) ? $full = 1 : $full = 0;
481
- // $month = dbem_sanitize_request($_GET['month']);
482
- // $year = dbem_sanitize_request($_GET['year']);
483
- dbem_get_calendar('echo=1&full='.$full);
484
- die();
485
- }
486
- }
487
- add_action('init','dbem_filter_calendar_ajax');
488
-
489
- function dbem_full_calendar() {
490
- echo "<p>Demo di <code>dbem_full_calendar</code></p>" ;
491
- echo '<div id="jMonthCalendar"></div>';
492
- dbem_get_calendar("full=1");
493
- }
494
-
495
-
496
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
dbem_events.php DELETED
@@ -1,2358 +0,0 @@
1
- <?php
2
-
3
- function dbem_new_event_page() {
4
-
5
- $title = __ ( "Insert New Event", 'dbem' );
6
- dbem_event_form ( $event, $title, $element );
7
-
8
- }
9
-
10
- function dbem_events_subpanel() {
11
- global $wpdb;
12
- $action = $_GET ['action'];
13
- $action2 = $_GET ['action2'];
14
- $event_ID = $_GET ['event_id'];
15
- $recurrence_ID = $_GET ['recurrence_id'];
16
- $scope = $_GET ['scope'];
17
- $offset = $_GET ['offset'];
18
- $order = $_GET ['order'];
19
- $selectedEvents = $_GET ['events'];
20
-
21
- // Disable Hello to new user if requested
22
- if (isset ( $_GET ['disable_hello_to_user'] ) && $_GET ['disable_hello_to_user'] == 'true')
23
- update_option ( 'dbem_hello_to_user', 0 );
24
-
25
- if ($order == "")
26
- $order = "ASC";
27
- if ($offset == "")
28
- $offset = "0";
29
- $event_table_name = $wpdb->prefix . EVENTS_TBNAME;
30
- // Debug code, to make sure I get the correct page
31
-
32
-
33
- // DELETE action
34
- if ($action == 'deleteEvents') {
35
- // $sql="DELETE FROM ".$event_table_name." WHERE event_id='"."$event_ID"."'";
36
-
37
-
38
- // TODO eventual error if ID in non-existant
39
- //$wpdb->query($sql);
40
- foreach ( $selectedEvents as $event_ID ) {
41
- dbem_delete_event ( $event_ID );
42
- }
43
-
44
- $events = dbem_get_events ( "", "future" );
45
- dbem_events_table ( $events, 10, "Future events" );
46
- }
47
- // UPDATE or CREATE action
48
- if ($action == 'update_event' || $action == 'update_recurrence') {
49
-
50
- $event = array ();
51
- $location = array ();
52
- $event ['event_name'] = stripslashes ( $_POST ["event_name"] );
53
- // Set event end time to event time if not valid
54
- // if (!_dbem_is_date_valid($event['event_end_date']))
55
- // $event['event_end_date'] = $event['event-date'];
56
- $event ['event_start_date'] = $_POST ["event_date"];
57
- $event ['event_end_date'] = $_POST ["event_end_date"];
58
- // Trying to fix Alex's trouble
59
- if ($event ['event_end_date'] == '')
60
- $event['event_end_date'] = $event['event_start_date'];
61
- // End of Alex's fix
62
- //$event['event_start_time'] = $_POST[event_hh].":".$_POST[event_mm].":00";
63
- //$event['event_end_time'] = $_POST[event_end_hh].":".$_POST[event_end_mm].":00";
64
- $event ['event_start_time'] = date ( "G:i:00", strtotime ( $_POST ['event_start_time'] ) );
65
- $event ['event_end_time'] = date ( "G:i:00", strtotime ( $_POST ['event_end_time'] ) );
66
- $recurrence ['recurrence_name'] = $event ['event_name'];
67
- $recurrence ['recurrence_start_date'] = $event ['event_start_date'];
68
- $recurrence ['recurrence_end_date'] = $event ['event_end_date'];
69
- $recurrence ['recurrence_start_time'] = $event ['event_start_time'];
70
- $recurrence ['recurrence_end_time'] = $event ['event_end_time'];
71
- $recurrence ['recurrence_id'] = $_POST [recurrence_id];
72
- $recurrence ['recurrence_freq'] = $_POST [recurrence_freq];
73
- $recurrence ['recurrence_freq'] == 'weekly' ? $recurrence [recurrence_byday] = implode ( ",", $_POST ['recurrence_bydays'] ) : $recurrence ['recurrence_byday'] = $_POST [recurrence_byday];
74
- $_POST ['recurrence_interval'] == "" ? $recurrence ['recurrence_interval'] = 1 : $recurrence ['recurrence_interval'] = $_POST ['recurrence_interval'];
75
- $recurrence ['recurrence_byweekno'] = $_POST [recurrence_byweekno];
76
-
77
- $event ['event_rsvp'] = (is_numeric($_POST ['event_rsvp'])) ? $_POST ['event_rsvp']:0;
78
- $event ['event_seats'] = (is_numeric($_POST ['event_seats'])) ? $_POST ['event_seats']:0;
79
-
80
- if (isset ( $_POST ['event_contactperson_id'] ) && $_POST ['event_contactperson_id'] != '' && $_POST ['event_contactperson_id'] != '-1') {
81
-
82
- $event ['event_contactperson_id'] = $_POST ['event_contactperson_id'];
83
- $recurrence ['event_contactperson_id'] = $_POST ['event_contactperson_id'];
84
- }
85
-
86
- if (! _dbem_is_time_valid ( $event_end_time ))
87
- $event_end_time = $event_time;
88
-
89
- $location ['location_name'] = $_POST [location_name];
90
- $location ['location_address'] = $_POST [location_address];
91
- $location ['location_town'] = $_POST [location_town];
92
- $location ['location_latitude'] = $_POST [location_latitude];
93
- $location ['location_longitude'] = $_POST [location_longitude];
94
- $location ['location_description'] = "";
95
- /* Marcus Begin Edit */
96
- //switched to WP TinyMCE field
97
- //$event ['event_notes'] = stripslashes ( $_POST [event_notes] );
98
- $event ['event_notes'] = stripslashes ( $_POST ['content'] );
99
- /* Marcus End Edit */
100
- $recurrence ['recurrence_notes'] = $event ['event_notes'];
101
- $validation_result = dbem_validate_event ( $event );
102
-
103
- /* Marcus Begin Edit */
104
- $event_attributes = array();
105
- for($i=1 ; trim($_POST["mtm_{$i}_ref"])!='' ; $i++ ){
106
- if(trim($_POST["mtm_{$i}_name"]) != ''){
107
- $event_attributes[$_POST["mtm_{$i}_ref"]] = $_POST["mtm_{$i}_name"];
108
- }
109
- }
110
- $event['event_attributes'] = serialize($event_attributes);
111
- /* Marcus End Edit */
112
-
113
- if ($validation_result == "OK") {
114
- // validation successful
115
- if(isset($_POST['location-select-id']) && $_POST['location-select-id'] != "") {
116
- $event ['location_id'] = $_POST['location-select-id'];
117
- $recurrence ['location_id'] = $_POST['location-select-id'];
118
- } else {
119
- $related_location = dbem_get_identical_location ( $location );
120
- // print_r($related_location);
121
- if ($related_location) {
122
- $event ['location_id'] = $related_location ['location_id'];
123
- $recurrence ['location_id'] = $related_location ['location_id'];
124
- } else {
125
-
126
- $new_location = dbem_insert_location ( $location );
127
- $event ['location_id'] = $new_location ['location_id'];
128
- $recurrence ['location_id'] = $new_location ['location_id'];
129
- //print_r($new_location);
130
-
131
- }
132
- }
133
- if (! $event_ID && ! $recurrence_ID) {
134
- // there isn't anything
135
- if ($_POST ['repeated_event']) {
136
-
137
- //insert new recurrence
138
- dbem_insert_recurrent_event ( $event, $recurrence );
139
- $feedback_message = __ ( 'New recurrent event inserted!', 'dbem' );
140
- } else {
141
- // INSERT new event
142
- $wpdb->insert ( $event_table_name, $event );
143
- $feedback_message = __ ( 'New event successfully inserted!', 'dbem' );
144
- }
145
- } else {
146
- // something exists
147
- if ($recurrence_ID) {
148
- // UPDATE old recurrence
149
- $recurrence ['recurrence_id'] = $recurrence_ID;
150
- //print_r($recurrence);
151
- if (dbem_update_recurrence ( $recurrence ))
152
- $feedback_message = __ ( 'Recurrence updated!', 'dbem' );
153
- else
154
- $feedback_message = __ ( 'Something went wrong with the recurrence update...', 'dbem' );
155
-
156
- } else {
157
- // UPDATE old event
158
- // unlink from recurrence in case it was generated by one
159
- //$event ['recurrence_id'] = null;
160
- if( isset($event ['recurrence_id']) ) unset($event ['recurrence_id']);
161
- $where ['event_id'] = $event_ID;
162
- $result = $wpdb->update ( $event_table_name, $event, $where );
163
- $feedback_message = "'" . $event ['event_name'] . "' " . __ ( 'updated', 'dbem' ) . "!";
164
- }
165
- }
166
-
167
- /* Marcus Begin Edit */
168
- //Save the category if selected
169
- if( is_numeric($_POST['event_category_id']) ){
170
- $insert_id = (! $event_ID && ! $recurrence_ID) ? $wpdb->insert_id : $event_ID;
171
- $wpdb->update ( $event_table_name, array("event_category_id" => $_POST['event_category_id']), array('event_id' => $insert_id) );
172
- }
173
- /* Marcus End Edit */
174
-
175
- //$wpdb->query($sql);
176
- echo "<div id='message' class='updated fade'>
177
- <p>$feedback_message</p>
178
- </div>";
179
- $events = dbem_get_events ( "", "future" );
180
- dbem_events_table ( $events, 10, "Future events" );
181
- } else {
182
- // validation unsuccessful
183
-
184
- echo "<div id='message' class='error '>
185
- <p>" . __ ( "Ach, there's a problem here:", "dbem" ) . " $validation_result</p>
186
- </div>";
187
- dbem_event_form ( $event, "Edit event $event_ID", $event_ID );
188
-
189
- }
190
- }
191
- if ($action == 'edit_event') {
192
- if (! $event_ID) {
193
- $title = __ ( "Insert New Event", 'dbem' );
194
- } else {
195
- $event = dbem_get_event ( $event_ID );
196
- $title = __ ( "Edit Event", 'dbem' ) . " '" . $event ['event_name'] . "'";
197
- }
198
-
199
- //$event=$wpdb->get_row($sql, ARRAY_A);
200
- // Enter new events and updates old ones
201
- // DEBUG: echo"Nome: $event->event_name";
202
-
203
-
204
- dbem_event_form ( $event, $title, $event_ID );
205
-
206
- }
207
- /* Marcus Begin Edit */
208
- //Add duplicate event if requested
209
- if ($action == 'duplicate_event') {
210
- dbem_duplicate_event ( $event_ID );
211
- }
212
- /* Marcus End Edit */
213
- if ($action == 'edit_recurrence') {
214
-
215
- $event_ID = $_GET ['recurrence_id'];
216
- $recurrence = dbem_get_recurrence ( $event_ID );
217
- $title = __ ( "Reschedule", 'dbem' ) . " '" . $recurrence ['recurrence_name'] . "'";
218
- dbem_event_form ( $recurrence, $title, $event_ID );
219
-
220
- }
221
-
222
- if ($action == 'update_recurrence') {
223
- //print_r($recurrence);
224
- //die('update recurrence!');
225
- }
226
-
227
- if ($action == "-1" || $action == "") {
228
- // No action, only showing the events list
229
-
230
-
231
- switch ($scope) {
232
- case "past" :
233
- $title = __ ( 'Past Events', 'dbem' );
234
- break;
235
- case "all" :
236
- $title = __ ( 'All Events', 'dbem' );
237
- break;
238
- default :
239
- $title = __ ( 'Future Events', 'dbem' );
240
- $scope = "future";
241
- }
242
- $limit = 20;
243
- $events = dbem_get_events ( $limit, $scope, $order, $offset );
244
-
245
- dbem_events_table ( $events, $limit, $title );
246
-
247
- }
248
-
249
- }
250
- // array of all pages, bypasses the filter I set up :)
251
- function dbem_get_all_pages() {
252
- global $wpdb;
253
- $query = "SELECT id, post_title FROM " . $wpdb->prefix . "posts WHERE post_type = 'page';";
254
- $pages = $wpdb->get_results ( $query, ARRAY_A );
255
- $output = array ();
256
- foreach ( $pages as $page ) {
257
- $output [$page ['id']] = $page ['post_title'];
258
- }
259
- return $output;
260
- }
261
-
262
- // Function composing the options subpanel
263
- function dbem_options_subpanel() {
264
- // dbem_options_register();
265
-
266
-
267
- ?>
268
- <div class="wrap">
269
- <div id='icon-options-general' class='icon32'><br />
270
- </div>
271
- <h2><?php
272
- _e ( 'Event Manager Options', 'dbem' );
273
- ?></h2>
274
- <form id="dbem_options_form" method="post" action="options.php">
275
- <h3><?php
276
- _e ( 'General options', 'dbem' );
277
- ?></h3>
278
- <table class="form-table">
279
- <?php
280
- dbem_options_radio_binary ( __ ( 'Use dropdown for locations?' ), 'dbem_use_select_for_locations', __ ( 'Select yes to select location from a drow-down menu; location selection will be faster, but you will lose the ability to insert locations with events','dbem' ) );
281
- dbem_options_radio_binary ( __ ( 'Use recurrence?' ), 'dbem_recurrence_enabled', __ ( 'Select yes to enable the recurrence features feature','dbem' ) );
282
- dbem_options_radio_binary ( __ ( 'Use RSVP?' ), 'dbem_rsvp_enabled', __ ( 'Select yes to enable the recurrence features feature','dbem' ) );
283
- dbem_options_radio_binary ( __ ( 'Use categories?' ), 'dbem_categories_enabled', __ ( 'Select yes to enable the category features','dbem' ) );
284
- dbem_options_radio_binary ( __ ( 'Use attributes?' ), 'dbem_attributes_enabled', __ ( 'Select yes to enable the attributes feature','dbem' ) );
285
- ?>
286
- </table>
287
- <h3><?php
288
- _e ( 'Events page', 'dbem' );
289
- ?></h3>
290
- <table class="form-table">
291
- <?php
292
- dbem_options_select ( __ ( 'Events page' ), 'dbem_events_page', dbem_get_all_pages (), __ ( 'This option allows you to select which page to use as an events page','dbem' ) );
293
- dbem_options_radio_binary ( __ ( 'Show events page in lists?', 'dbem' ), 'dbem_list_events_page', __ ( 'Check this option if you want the events page to appear together with other pages in pages lists.', 'dbem' ) );
294
- dbem_options_radio_binary ( __ ( 'Display calendar in events page?', 'dbem' ), 'dbem_display_calendar_in_events_page', __ ( 'This options allows to display the calendar in the events page, instead of the default list. It is recommended not to display both the calendar widget and a calendar page.','dbem' ) )?>
295
- </table>
296
- <h3><?php
297
- _e ( 'Events format', 'dbem' );
298
- ?></h3>
299
- <table class="form-table">
300
- <?php
301
- /* Marcus Begin Edit */
302
- dbem_options_textarea ( __ ( 'Default event list format header', 'dbem' ), 'dbem_event_list_item_format_header', __( 'This content will appear just above your code for the default event list format. Default is blank', 'dbem' ) );
303
- dbem_options_textarea ( __ ( 'Default event list format', 'dbem' ), 'dbem_event_list_item_format', __ ( 'The format of any events in a list.<br/>Insert one or more of the following placeholders: <code>#_NAME</code>, <code>#_LOCATION</code>, <code>#_ADDRESS</code>, <code>#_TOWN</code>, <code>#_NOTES</code>.<br/> Use <code>#_EXCERPT</code> to show <code>#_NOTES</code> until you place a &lt;!&ndash;&ndash; more &ndash;&ndash;&gt; marker.<br/> Use <code>#_LINKEDNAME</code> for the event name with a link to the given event page.<br/> Use <code>#_EVENTPAGEURL</code> to print the event page URL and make your own customised links.<br/> Use <code>#_LOCATIONPAGEURL</code> to print the location page URL and make your own customised links.<br/>Use <code>#_EDITEVENTLINK</code> to add add a link to edit page for the event, which will appear only when a user is logged in.<br/>To insert date and time values, use <a href="http://www.php.net/manual/en/function.date.php">PHP time format characters</a> with a <code>#</code> symbol before them, i.e. <code>#m</code>, <code>#M</code>, <code>#j</code>, etc.<br/> For the end time, put <code>#@</code> in front of the character, ie. <code>#@h</code>, <code>#@i</code>, etc.<br/> You can also create a date format without prepending <code>#</code> by wrapping it in #_{} or #@_{} (e.g. <code>#_{d/m/Y}</code>). If there is no end date, the value is not shown.<br/>Feel free to use HTML tags as <code>li</code>, <code>br</code> and so on.<br/>For custom attributes, you use <code>#_ATT{key}{alternative text}</code>, the second braces are optional and will appear if the attribute is not defined or left blank for that event. This key will appear as an option when adding attributes to your event.', 'dbem' ) );
304
- dbem_options_textarea ( __ ( 'Default event list format footer', 'dbem' ), 'dbem_event_list_item_format_footer', __ ( 'This content will appear just below your code for the default event list format. Default is blank', 'dbem' ) );
305
-
306
- /* Marcus End Edit */
307
- dbem_options_input_text ( __ ( 'Single event page title format', 'dbem' ), 'dbem_event_page_title_format', __ ( 'The format of a single event page title. Follow the previous formatting instructions.', 'dbem' ) );
308
- dbem_options_textarea ( __ ( 'Default single event format', 'dbem' ), 'dbem_single_event_format', __ ( 'The format of a single event page.<br/>Follow the previous formatting instructions. <br/>Use <code>#_MAP</code> to insert a map.<br/>Use <code>#_CONTACTNAME</code>, <code>#_CONTACTEMAIL</code>, <code>#_CONTACTPHONE</code> to insert respectively the name, e-mail address and phone number of the designated contact person. <br/>Use <code>#_ADDBOOKINGFORM</code> to insert a form to allow the user to respond to your events reserving one or more places (RSVP).<br/> Use <code>#_REMOVEBOOKINGFORM</code> to insert a form where users, inserting their name and e-mail address, can remove their bookings.', 'dbem' ) );
309
- dbem_options_input_text ( __ ( 'Events page title', 'dbem' ), 'dbem_events_page_title', __ ( 'The title on the multiple events page.', 'dbem' ) );
310
- dbem_options_input_text ( __ ( 'No events message', 'dbem' ), 'dbem_no_events_message', __ ( 'The message displayed when no events are available.', 'dbem' ) );?>
311
-
312
- </table>
313
- <h3><?php _e ( 'Calendar format', 'dbem' ); ?></h3>
314
- <table class="form-table">
315
- <?php
316
- dbem_options_input_text ( __ ( 'Small calendar title', 'dbem' ), 'dbem_small_calendar_event_title_format', __ ( 'The format of the title, corresponding to the text that appears when hovering on an eventful calendar day.', 'dbem' ) );
317
- dbem_options_input_text ( __ ( 'Small calendar title separator', 'dbem' ), 'dbem_small_calendar_event_title_separator', __ ( 'The separator appearing on the above title when more than one events are taking place on the same day.', 'dbem' ) );
318
- dbem_options_input_text ( __ ( 'Full calendar events format', 'dbem' ), 'dbem_full_calendar_event_format', __ ( 'The format of each event when displayed in the full calendar. Remember to include <code>li</code> tags before and after the event.', 'dbem' ) );
319
-
320
- ?>
321
- </table>
322
-
323
- <h3><?php
324
- _e ( 'Locations format', 'dbem' );
325
- ?></h3>
326
- <table class="form-table"><?php
327
- dbem_options_input_text ( __ ( 'Single location page title format', 'dbem' ), 'dbem_location_page_title_format', __ ( 'The format of a single location page title.<br/>Follow the previous formatting instructions.', 'dbem' ) );
328
- dbem_options_textarea ( __ ( 'Default single location page format', 'dbem' ), 'dbem_single_location_format', __ ( 'The format of a single location page.<br/>Insert one or more of the following placeholders: <code>#_NAME</code>, <code>#_ADDRESS</code>, <code>#_TOWN</code>, <code>#_DESCRIPTION</code>.<br/> Use <code>#_MAP</code> to display a map of the event location, and <code>#_IMAGE</code> to display an image of the location.<br/> Use <code>#_NEXTEVENTS</code> to insert a list of the upcoming events, <code>#_PASTEVENTS</code> for a list of past events, <code>#_ALLEVENTS</code> for a list of all events taking place in this location.', 'dbem' ) );
329
- dbem_options_textarea ( __ ( 'Default location baloon format', 'dbem' ), 'dbem_location_baloon_format', __ ( 'The format of of the text appearing in the baloon describing the location in the map.<br/>Insert one or more of the following placeholders: <code>#_NAME</code>, <code>#_ADDRESS</code>, <code>#_TOWN</code>, <code>#_DESCRIPTION</code> or <code>#_IMAGE</code>.', 'dbem' ) );
330
- dbem_options_textarea ( __ ( 'Default location event list format', 'dbem' ), 'dbem_location_event_list_item_format', __ ( 'The format of the events the list inserted in the location page through the <code>#_NEXTEVENTS</code>, <code>#_PASTEVENTS</code> and <code>#_ALLEVENTS</code> element. <br/> Follow the events formatting instructions', 'dbem' ) );
331
- dbem_options_textarea ( __ ( 'Default no events message', 'dbem' ), 'dbem_location_no_events_message', __ ( 'The message to be displayed in the list generated by <code>#_NEXTEVENTS</code>, <code>#_PASTEVENTS</code> and <code>#_ALLEVENTS</code> when no events are available.', 'dbem' ) );
332
-
333
- ?>
334
- </table>
335
-
336
- <h3><?php
337
- _e ( 'RSS feed format', 'dbem' );
338
- ?></h3>
339
- <table class="form-table"><?php
340
-
341
- dbem_options_input_text ( __ ( 'RSS main title', 'dbem' ), 'dbem_rss_main_title', __ ( 'The main title of your RSS events feed.', 'dbem' ) );
342
- dbem_options_input_text ( __ ( 'RSS main description', 'dbem' ), 'dbem_rss_main_description', __ ( 'The main description of your RSS events feed.', 'dbem' ) );
343
- dbem_options_input_text ( __ ( 'RSS title format', 'dbem' ), 'dbem_rss_title_format', __ ( 'The format of the title of each item in the events RSS feed.', 'dbem' ) );
344
- dbem_options_input_text ( __ ( 'RSS description format', 'dbem' ), 'dbem_rss_description_format', __ ( 'The format of the description of each item in the events RSS feed. Follow the previous formatting instructions.', 'dbem' ) );
345
- ?>
346
- </table>
347
-
348
- <h3><?php
349
- _e ( 'Maps and geotagging', 'dbem' );
350
- ?></h3>
351
- <table class='form-table'>
352
- <?php
353
- $gmap_is_active = get_option ( 'dbem_gmap_is_active' );
354
- ?>
355
-
356
- <tr valign="top">
357
- <th scope="row"><?php
358
- _e ( 'Enable Google Maps integration?', 'dbem' );
359
- ?></th>
360
- <td><input id="dbem_gmap_is_active_yes" name="dbem_gmap_is_active"
361
- type="radio" value="1"
362
- <?php
363
- if ($gmap_is_active)
364
- echo "checked='checked'";
365
- ?> /><?php
366
- _e ( 'Yes' );
367
- ?> <br />
368
- <input name="dbem_gmap_is_active" type="radio" value="0"
369
- <?php
370
- if (! $gmap_is_active)
371
- echo "checked='checked'";
372
- ?> /> <?php
373
- _e ( 'No' );
374
- ?> <br />
375
- <?php
376
- _e ( 'Check this option to enable Goggle Map integration.', 'dbem' )?>
377
- </td>
378
- </tr>
379
- <?php
380
- dbem_options_input_text ( __ ( 'Google Maps API Key', 'dbem' ), 'dbem_gmap_key', sprintf ( __ ( "To display Google Maps you need a Google Maps API key. Don't worry, it's free, you can get one <a href='%s'>here</a>.", 'dbem' ), 'http://code.google.com/apis/maps/signup.html' ) );
381
-
382
- dbem_options_textarea ( __ ( 'Map text format', 'dbem' ), 'dbem_map_text_format', __ ( 'The format the text appearing in the event page map cloud.<br/>Follow the previous formatting instructions.', 'dbem' ) );
383
- ?>
384
- </table>
385
-
386
- <h3><?php
387
- _e ( 'RSVP and bookings', 'dbem' );
388
- ?></h3>
389
- <table class='form-table'>
390
- <?php
391
- dbem_options_select ( __ ( 'Default contact person', 'dbem' ), 'dbem_default_contact_person', dbem_get_indexed_users (), __ ( 'Select the default contact person. This user will be employed whenever a contact person is not explicitly specified for an event', 'dbem' ) );
392
- dbem_options_radio_binary ( __ ( 'Enable the RSVP e-mail notifications?', 'dbem' ), 'dbem_rsvp_mail_notify_is_active', __ ( 'Check this option if you want to receive an email when someone books places for your events.', 'dbem' ) );
393
- dbem_options_textarea ( __ ( 'Contact person email format', 'dbem' ), 'dbem_contactperson_email_body', __ ( 'The format or the email which will be sent to the contact person. Follow the events formatting instructions. <br/>Use <code>#_RESPNAME</code>, <code>#_RESPEMAIL</code> and <code>#_RESPPHONE</code> to display respectively the name, e-mail, address and phone of the respondent.<br/>Use <code>#_SPACES</code> to display the number of spaces reserved by the respondent. Use <code>#_COMMENT</code> to display the respondent\'s comment. <br/> Use <code>#_BOOKEDSEATS</code> and <code>#_AVAILABLESEATS</code> to display respectively the number of booked and available seats.', 'dbem' ) );
394
- dbem_options_textarea ( __ ( 'Contact person email format', 'dbem' ), 'dbem_respondent_email_body', __ ( 'The format or the email which will be sent to reposdent. Follow the events formatting instructions. <br/>Use <code>#_RESPNAME</code> to display the name of the respondent.<br/>Use <code>#_CONTACTNAME</code> and <code>#_CONTACTMAIL</code> a to display respectively the name and e-mail of the contact person.<br/>Use <code>#_SPACES</code> to display the number of spaces reserved by the respondent. Use <code>#_COMMENT</code> to display the respondent\'s comment.', 'dbem' ) );
395
- dbem_options_input_text ( __ ( 'Notification sender name', 'dbem' ), 'dbem_mail_sender_name', __ ( "Insert the display name of the notification sender.", 'dbem' ) );
396
- dbem_options_input_text ( __ ( 'Notification sender address', 'dbem' ), 'dbem_mail_sender_address', __ ( "Insert the address of the notification sender. It must corresponds with your gmail account user", 'dbem' ) );
397
- dbem_options_input_text ( __ ( 'Default notification receiver address', 'dbem' ), 'dbem_mail_receiver_address', __ ( "Insert the address of the receiver of your notifications", 'dbem' ) );
398
- dbem_options_input_text ( 'Mail sending port', 'dbem_rsvp_mail_port', __ ( "The port through which you e-mail notifications will be sent. Make sure the firewall doesn't block this port", 'dbem' ) );
399
- dbem_options_select ( __ ( 'Mail sending method', 'dbem' ), 'dbem_rsvp_mail_send_method', array ('smtp' => 'SMTP', 'mail' => __ ( 'PHP mail function', 'dbem' ), 'sendmail' => 'Sendmail', 'qmail' => 'Qmail' ), __ ( 'Select the method to send email notification.', 'dbem' ) );
400
- dbem_options_radio_binary ( __ ( 'Use SMTP authentication?', 'dbem' ), 'dbem_rsvp_mail_SMTPAuth', __ ( 'SMTP authenticatio is often needed. If you use GMail, make sure to set this parameter to Yes', 'dbem' ) );
401
- dbem_options_input_text ( 'SMTP host', 'dbem_smtp_host', __ ( "The SMTP host. Usually it corresponds to 'localhost'. If you use GMail, set this value to 'ssl://smtp.gmail.com:465'.", 'dbem' ) );
402
- dbem_options_input_text ( __ ( 'SMTP username', 'dbem' ), 'dbem_smtp_username', __ ( "Insert the username to be used to access your SMTP server.", 'dbem' ) );
403
- dbem_options_input_password ( __ ( 'SMTP password', 'dbem' ), "dbem_smtp_password", __ ( "Insert the password to be used to access your SMTP server", 'dbem' ) );
404
- ?>
405
-
406
-
407
-
408
- </table>
409
-
410
- <h3><?php
411
- _e ( 'Images size', 'dbem' );
412
- ?></h3>
413
- <table class='form-table'> <?php
414
- dbem_options_input_text ( __ ( 'Maximum width (px)', 'dbem' ), 'dbem_image_max_width', __ ( 'The maximum allowed width for images uploades', 'dbem' ) );
415
- dbem_options_input_text ( __ ( 'Maximum height (px)', 'dbem' ), 'dbem_image_max_height', __ ( "The maximum allowed width for images uploaded, in pixels", 'dbem' ) );
416
- dbem_options_input_text ( __ ( 'Maximum size (bytes)', 'dbem' ), 'dbem_image_max_size', __ ( "The maximum allowed size for images uploaded, in pixels", 'dbem' ) );
417
- ?>
418
- </table>
419
-
420
-
421
-
422
- <p class="submit"><input type="submit" id="dbem_options_submit"
423
- name="Submit" value="<?php
424
- _e ( 'Save Changes' )?>" /></p>
425
-
426
-
427
- <?php
428
- settings_fields ( 'dbem-options' );
429
- ?>
430
- </form>
431
- </div>
432
- <?php
433
-
434
- }
435
-
436
- //This is the content of the event page
437
- function dbem_events_page_content() {
438
- global $wpdb;
439
- if (isset ( $_REQUEST ['location_id'] ) && $_REQUEST ['location_id'] |= '') {
440
-
441
- $location = dbem_get_location ( dbem_sanitize_request($_REQUEST ['location_id']));
442
- $single_location_format = get_option ( 'dbem_single_location_format' );
443
- $page_body = dbem_replace_locations_placeholders ( $single_location_format, $location );
444
- return $page_body;
445
-
446
- }
447
- if (isset ( $_REQUEST ['event_id'] ) && $_REQUEST ['event_id'] != '') {
448
- // single event page
449
- $event_ID = dbem_sanitize_request($_REQUEST ['event_id']);
450
- // measure against blind sql attack suggested by Danilo Massa
451
- settype($event_ID, "int");
452
- $event = dbem_get_event ( $event_ID );
453
- $single_event_format = get_option ( 'dbem_single_event_format' );
454
- $page_body = dbem_replace_placeholders ( $single_event_format, $event, 'stop' );
455
- return $page_body;
456
- } elseif (isset ( $_REQUEST ['calendar_day'] ) && $_REQUEST ['calendar_day'] != '') {
457
- $date = dbem_sanitize_request($_REQUEST ['calendar_day']);
458
- $events_N = dbem_events_count_for ( $date );
459
- // $_GET['scope'] ? $scope = dbem_sanitize_request($_GET['scope']): $scope = "future";
460
- // $stored_format = get_option('dbem_event_list_item_format');
461
- // $events_body = dbem_get_events_list(10, $scope, "ASC", $stored_format, $false);
462
- if ($events_N > 1) {
463
- $_GET ['calendar_day'] ? dbem_sanitize_request($scope = $_GET ['calendar_day']) : $scope = "future";
464
- $stored_format = get_option ( 'dbem_event_list_item_format' );
465
- //Add headers and footers to the events list
466
- $single_event_format_header = get_option ( 'dbem_event_list_item_format_header' );
467
- $single_event_format_header = ( $single_event_format_header != '' ) ? $single_event_format_header : "<ul class='dbem_events_list'>";
468
- $single_event_format_footer = get_option ( 'dbem_event_list_item_format_footer' );
469
- $single_event_format_footer = ( $single_event_format_footer != '' ) ? $single_event_format_footer : "</ul>";
470
- return $single_event_format_header . dbem_get_events_list ( 10, $scope, "ASC", $stored_format, $false ) . $single_event_format_footer;
471
- } else {
472
- $events = dbem_get_events ( "", dbem_sanitize_request($_REQUEST['calendar_day']) );
473
- $event = $events [0];
474
- $single_event_format = get_option ( 'dbem_single_event_format' );
475
- $page_body = dbem_replace_placeholders ( $single_event_format, $event );
476
- return $page_body;
477
- }
478
- return $events_body;
479
- } else {
480
- // Multiple events page
481
- $_GET ['scope'] ? $scope = dbem_sanitize_request($_GET ['scope']) : $scope = "future";
482
- $stored_format = get_option ( 'dbem_event_list_item_format' );
483
- if (get_option ( 'dbem_display_calendar_in_events_page' )){
484
- $events_body = dbem_get_calendar ('full=1');
485
- }else{
486
- $single_event_format_header = get_option ( 'dbem_event_list_item_format_header' );
487
- $single_event_format_header = ( $single_event_format_header != '' ) ? $single_event_format_header : "<ul class='dbem_events_list'>";
488
- $single_event_format_footer = get_option ( 'dbem_event_list_item_format_footer' );
489
- $single_event_format_footer = ( $single_event_format_footer != '' ) ? $single_event_format_footer : "</ul>";
490
- $events_body = $single_event_format_header . dbem_get_events_list ( 10, $scope, "ASC", $stored_format, $false ) . $single_event_format_footer;
491
- }
492
- return $events_body;
493
-
494
- }
495
- }
496
- function dbem_events_count_for($date) {
497
- global $wpdb;
498
- $table_name = $wpdb->prefix . EVENTS_TBNAME;
499
- $sql = "SELECT COUNT(*) FROM $table_name WHERE (event_start_date like '$date') OR (event_start_date <= '$date' AND event_end_date >= '$date');";
500
- return $wpdb->get_var ( $sql );
501
- }
502
-
503
- // filter function to call the event page when appropriate
504
- function dbem_filter_events_page($data) {
505
-
506
- // $table_name = $wpdb->prefix .EVENTS_TBNAME;
507
- // $start = strpos($data, DBEM_PAGE);
508
-
509
-
510
- $is_events_post = (get_the_ID () == get_option ( 'dbem_events_page' ));
511
- $events_page_id = get_option ( 'dbem_events_page' );
512
- if (is_page ( $events_page_id ) && $is_events_post) {
513
- return dbem_events_page_content ();
514
- } else {
515
- return $data;
516
- }
517
- }
518
- add_filter ( 'the_content', 'dbem_filter_events_page' );
519
-
520
- function dbem_events_page_title($data) {
521
- $events_page_id = get_option ( 'dbem_events_page' );
522
- $events_page = get_page ( $events_page_id );
523
- $events_page_title = $events_page->post_title;
524
-
525
- if (($data == $events_page_title) && (is_page ( $events_page_id ))) {
526
- if (isset ( $_REQUEST ['calendar_day'] ) && $_REQUEST ['calendar_day'] != '') {
527
-
528
- $date = dbem_sanitize_request($_REQUEST ['calendar_day']);
529
- $events_N = dbem_events_count_for ( $date );
530
-
531
- if ($events_N == 1) {
532
- $events = dbem_get_events ( "", dbem_sanitize_request($_REQUEST ['calendar_day']));
533
- $event = $events [0];
534
- $stored_page_title_format = get_option ( 'dbem_event_page_title_format' );
535
- $page_title = dbem_replace_placeholders ( $stored_page_title_format, $event );
536
- return $page_title;
537
- }
538
-
539
- }
540
-
541
- if (isset ( $_REQUEST ['location_id'] ) && $_REQUEST ['location_id'] |= '') {
542
- $location = dbem_get_location ( dbem_sanitize_request($_REQUEST ['location_id']) );
543
- $stored_page_title_format = get_option ( 'dbem_location_page_title_format' );
544
- $page_title = dbem_replace_locations_placeholders ( $stored_page_title_format, $location );
545
- return $page_title;
546
- }
547
- if (isset ( $_REQUEST ['event_id'] ) && $_REQUEST ['event_id'] != '') {
548
- // single event page
549
- $event_ID = dbem_sanitize_request($_REQUEST ['event_id']);
550
- // measure against blind sql attack suggested by Danilo Massa
551
- settype($event_ID, "int");
552
- $event = dbem_get_event ( $event_ID );
553
- $stored_page_title_format = get_option ( 'dbem_event_page_title_format' );
554
- $page_title = dbem_replace_placeholders ( $stored_page_title_format, $event );
555
- return $page_title;
556
- } else {
557
- // Multiple events page
558
- $page_title = get_option ( 'dbem_events_page_title' );
559
- return $page_title;
560
-
561
- }
562
-
563
- } else {
564
- return $data;
565
- }
566
-
567
- }
568
- // to make sure that in pages lists the title is dbem_events_page_title, and not overwritten by the previous filter
569
- add_filter ( 'the_title', 'dbem_events_page_title' );
570
- add_filter ( 'single_post_title', 'dbem_events_page_title' );
571
-
572
- function dbem_filter_get_pages($data) {
573
- $output = array ();
574
- $events_page_id = get_option ( 'dbem_events_page' );
575
- for($i = 0; $i < count ( $data ); ++ $i) {
576
- if(isset($data [$i])) {
577
- if ($data [$i]->ID == $events_page_id) {
578
- $list_events_page = get_option ( 'dbem_list_events_page' );
579
- if ($list_events_page) {
580
- $data [$i]->post_title = get_option ( 'dbem_events_page_title' ) . "&nbsp;";
581
- $output [] = $data [$i];
582
- }
583
- } else {
584
- $output [] = $data [$i];
585
- }
586
- }
587
- }
588
- return $output;
589
- }
590
- add_filter ( 'get_pages', 'dbem_filter_get_pages' );
591
-
592
- //
593
- // TODO: ROBA NUOVA DA RIORDINARE
594
- // ADMIN CSS for debug
595
- function dbem_admin_css() {
596
- $css = "
597
- <style type='text/css'>
598
- .debug{
599
- color: green;
600
- background: #B7F98C;
601
- margin: 15px;
602
- padding: 10px;
603
- border: 1px solid #629948;
604
- }
605
- .switch-tab {
606
- background: #aaa;
607
- width: 100px;
608
- float: right;
609
- text-align: center;
610
- margin: 3px 1px 0 5px;
611
- padding: 2px;
612
- }
613
- .switch-tab a {
614
- color: #fff;
615
- text-decoration: none;
616
- }
617
- .switch-tab a:hover {
618
- color: #D54E21;
619
-
620
- }
621
- #events-pagination {
622
- text-align: center;
623
-
624
- }
625
- #events-pagination a {
626
- margin: 0 20px 0 20px;
627
- text-decoration: none;
628
- width: 80px;
629
- padding: 3px 0;
630
- background: #FAF4B7;
631
- border: 1px solid #ccc;
632
- border-top: none;
633
- }
634
- #new-event {
635
- float: left;
636
-
637
- }
638
- </style>";
639
- echo $css;
640
- }
641
-
642
- add_action ( 'admin_print_scripts', 'dbem_admin_css' );
643
-
644
- // TEMPLATE TAGS
645
-
646
-
647
- // exposed function, for theme makers
648
- /* Marcus Begin Edit */
649
- //Added a category option to the get events list method and shortcode
650
- function dbem_get_events_list($limit = "10", $scope = "future", $order = "ASC", $format = '', $echo = 1, $category = '') {
651
- if (strpos ( $limit, "=" )) {
652
- // allows the use of arguments without breaking the legacy code
653
- $defaults = array ('limit' => 10, 'scope' => 'future', 'order' => 'ASC', 'format' => '', 'echo' => 1 , 'category' => '');
654
-
655
- $r = wp_parse_args ( $limit, $defaults );
656
- extract ( $r, EXTR_SKIP );
657
- $limit = $r ['limit'];
658
- $scope = $r ['scope'];
659
- $order = $r ['order'];
660
- $format = $r ['format'];
661
- $echo = $r ['echo'];
662
- $category = ( preg_match('/^([0-9],?)+$/', $r ['category'] ) ) ? $r ['category'] : '' ;
663
- }
664
- if ($scope == "")
665
- $scope = "future";
666
- if ($order != "DESC")
667
- $order = "ASC";
668
- if ($format == ''){
669
- $orig_format = true;
670
- $format = get_option ( 'dbem_event_list_item_format' );
671
- }
672
- $events = dbem_get_events ( $limit, $scope, $order, '', '', $category );
673
- $output = "";
674
- if (! empty ( $events )) {
675
- foreach ( $events as $event ) {
676
- // $localised_date = mysql2date("j M Y", $event->event_time);
677
- $output .= dbem_replace_placeholders ( $format, $event );
678
- }
679
- //Add headers and footers to output
680
- if( $orig_format ){
681
- $single_event_format_header = get_option ( 'dbem_event_list_item_format_header' );
682
- $single_event_format_header = ( $single_event_format_header != '' ) ? $single_event_format_header : "<ul class='dbem_events_list'>";
683
- $single_event_format_footer = get_option ( 'dbem_event_list_item_format_footer' );
684
- $single_event_format_footer = ( $single_event_format_footer != '' ) ? $single_event_format_footer : "</ul>";
685
- $output = $single_event_format_header . $output . $single_event_format_footer;
686
- }
687
- } else {
688
- $output = "<li class='dbem-no-events'>" . get_option ( 'dbem_no_events_message' ) . "</li>";
689
- }
690
- if ($echo)
691
- echo $output;
692
- else
693
- return $output;
694
- }
695
-
696
- function dbem_get_events_list_shortcode($atts) {
697
- extract ( shortcode_atts ( array ('limit' => 3, 'scope' => 'future', 'order' => 'ASC', 'format' => '', 'category' => '' ), $atts ) );
698
- $result = dbem_get_events_list ( "limit=$limit&scope=$scope&order=$order&format=$format&echo=0&category=$category" );
699
- return $result;
700
- }
701
- add_shortcode ( 'events_list', 'dbem_get_events_list_shortcode' );
702
- /* Marcus End Edit*/
703
-
704
- function dbem_get_events_page($justurl = 0, $echo = 1, $text = '') {
705
- if (strpos ( $justurl, "=" )) {
706
- // allows the use of arguments without breaking the legacy code
707
- $defaults = array ('justurl' => 0, 'text' => '', 'echo' => 1 );
708
-
709
- $r = wp_parse_args ( $justurl, $defaults );
710
- extract ( $r, EXTR_SKIP );
711
- $justurl = $r ['justurl'];
712
- $text = $r ['text'];
713
- $echo = $r ['echo'];
714
- }
715
-
716
- $page_link = get_permalink ( get_option ( "dbem_events_page" ) );
717
- if ($justurl) {
718
- $result = $page_link;
719
- } else {
720
- if ($text == '')
721
- $text = get_option ( "dbem_events_page_title" );
722
- $result = "<a href='$page_link' title='$text'>$text</a>";
723
- }
724
- if ($echo)
725
- echo $result;
726
- else
727
- return $result;
728
-
729
- }
730
- function dbem_get_events_page_shortcode($atts) {
731
- extract ( shortcode_atts ( array ('justurl' => 0, 'text' => '' ), $atts ) );
732
- $result = dbem_get_events_page ( "justurl=$justurl&text=$text&echo=0" );
733
- return $result;
734
- }
735
- add_shortcode ( 'events_page', 'dbem_get_events_page_shortcode' );
736
-
737
- function dbem_are_events_available($scope = "future") {
738
- if ($scope == "")
739
- $scope = "future";
740
- $events = dbem_get_events ( 1, $scope );
741
-
742
- if (empty ( $events ))
743
- return FALSE;
744
- else
745
- return TRUE;
746
- }
747
-
748
- // Returns true if the page in question is the events page
749
- function dbem_is_events_page() {
750
- $events_page_id = get_option ( 'dbem_events_page' );
751
- return is_page ( $events_page_id );
752
- }
753
-
754
- function dbem_is_single_event_page() {
755
- return (dbem_is_events_page () && (isset ( $_REQUEST ['event_id'] ) && $_REQUEST ['event_id'] != ''));
756
- }
757
-
758
- function dbem_is_multiple_events_page() {
759
- return (dbem_is_events_page () && ! (isset ( $_REQUEST ['event_id'] ) && $_REQUEST ['event_id'] != ''));
760
- }
761
-
762
- // main function querying the database event table
763
- /* Marcus Begin Edit */
764
- //Added extra method option for category
765
- function dbem_get_events($limit = "", $scope = "future", $order = "ASC", $offset = "", $location_id = "", $category = '') {
766
- /* Marcus End Edit */
767
- global $wpdb;
768
-
769
- $events_table = $wpdb->prefix . EVENTS_TBNAME;
770
- if ($limit != "")
771
- $limit = "LIMIT $limit";
772
- if ($offset != "")
773
- $offset = "OFFSET $offset";
774
- if ($order == "")
775
- $order = "ASC";
776
-
777
- $timestamp = time ();
778
- $date_time_array = getdate ( $timestamp );
779
- $hours = $date_time_array ['hours'];
780
- $minutes = $date_time_array ['minutes'];
781
- $seconds = $date_time_array ['seconds'];
782
- $month = $date_time_array ['mon'];
783
- $day = $date_time_array ['mday'];
784
- $year = $date_time_array ['year'];
785
- $today = strftime ( '%Y-%m-%d', mktime ( $hours, $minutes, $seconds, $month, $day, $year ) );
786
-
787
- $conditions = array ();
788
- if (preg_match ( "/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/", $scope )) {
789
- //$conditions [] = " event_start_date like '$scope'";
790
- $conditions [] = " (event_start_date like '$scope') OR (event_start_date <= '$scope' AND event_end_date >= '$scope')";
791
- } else {
792
- if (($scope != "past") && ($scope != "all") && ($scope != "today"))
793
- $scope = "future";
794
- if ($scope == "future")
795
- /* Marcus Begin Edit */
796
- //This is so events with future dates are counted too
797
- $conditions [] = " (event_start_date >= '$today' OR (event_end_date >= '$today' AND event_end_date != '0000-00-00' AND event_end_date IS NOT NULL))";
798
- /* Marcus End Edit */
799
- if ($scope == "past")
800
- $conditions [] = " event_start_date < '$today'";
801
- if ($scope == "today")
802
- $conditions [] = " (event_start_date like '$today') OR (event_start_date <= '$today' AND event_end_date >= '$today')";
803
- }
804
-
805
- if ($location_id != "")
806
- $conditions [] = " location_id = $location_id";
807
-
808
- /* Marcus Begin Edit */
809
- if ($category != '' && is_numeric($category)){
810
- $conditions [] = " event_category_id = $category";
811
- }elseif( preg_match('/^([0-9],?)+$/', $category) ){
812
- $category = explode(',', $category);
813
- $category_conditions = array();
814
- foreach($category as $cat){
815
- $category_conditions[] = " event_category_id = $cat";
816
- }
817
- $conditions [] = "(".implode(' OR', $category_conditions).")";
818
- }
819
- /* Marcus End Edit */
820
-
821
- $where = implode ( " AND ", $conditions );
822
- if ($where != "")
823
- $where = " WHERE " . $where;
824
-
825
- $sql = "SELECT event_id,
826
- event_name,
827
- DATE_FORMAT(event_start_time, '%e') AS 'event_day',
828
- DATE_FORMAT(event_start_time, '%Y') AS 'event_year',
829
- DATE_FORMAT(event_start_time, '%k') AS 'event_hh',
830
- DATE_FORMAT(event_start_time, '%i') AS 'event_mm',
831
- DATE_FORMAT(event_end_time, '%e') AS 'event_end_day',
832
- DATE_FORMAT(event_end_time, '%Y') AS 'event_end_year',
833
- DATE_FORMAT(event_end_time, '%k') AS 'event_end_hh',
834
- DATE_FORMAT(event_end_time, '%i') AS 'event_end_mm',
835
- event_start_date,
836
- event_end_date,
837
- event_start_time,
838
- event_end_time,
839
- event_notes,
840
- event_rsvp,
841
- recurrence_id,
842
- location_id,
843
- event_contactperson_id,
844
- event_category_id,
845
- event_attributes
846
- FROM $events_table
847
- $where
848
- ORDER BY event_start_date $order , event_start_time $order
849
- $limit
850
- $offset";
851
- $wpdb->show_errors = true;
852
- $events = $wpdb->get_results ( $sql, ARRAY_A );
853
- if (! empty ( $events )) {
854
- //$wpdb->print_error();
855
- $inflated_events = array ();
856
- foreach ( $events as $this_event ) {
857
-
858
- $this_location = dbem_get_location ( $this_event ['location_id'] );
859
- $this_event ['location_name'] = $this_location ['location_name'];
860
- $this_event ['location_address'] = $this_location ['location_address'];
861
- $this_event ['location_town'] = $this_location ['location_town'];
862
- /* Marcus Begin Edit */
863
- //I also edited the SQL
864
- $this_event ['event_attributes'] = @unserialize($this_event ['event_attributes']);
865
- $this_event ['event_attributes'] = (!is_array($this_event ['event_attributes'])) ? array() : $this_event ['event_attributes'] ;
866
- /* Marcus End Edit */
867
- array_push ( $inflated_events, $this_event );
868
- }
869
- return $inflated_events;
870
- } else {
871
- return null;
872
- }
873
- }
874
-
875
- function dbem_get_event($event_id) {
876
- global $wpdb;
877
- $events_table = $wpdb->prefix . EVENTS_TBNAME;
878
- $sql = "SELECT event_id,
879
- event_name,
880
- DATE_FORMAT(event_start_date, '%Y-%m-%e') AS 'event_date',
881
- DATE_FORMAT(event_start_date, '%e') AS 'event_day',
882
- DATE_FORMAT(event_start_date, '%m') AS 'event_month',
883
- DATE_FORMAT(event_start_date, '%Y') AS 'event_year',
884
- DATE_FORMAT(event_start_time, '%k') AS 'event_hh',
885
- DATE_FORMAT(event_start_time, '%i') AS 'event_mm',
886
- DATE_FORMAT(event_start_time, '%h:%i%p') AS 'event_start_12h_time',
887
- DATE_FORMAT(event_start_time, '%H:%i') AS 'event_start_24h_time',
888
- DATE_FORMAT(event_end_time, '%Y-%m-%e') AS 'event_end_date',
889
- DATE_FORMAT(event_end_time, '%e') AS 'event_end_day',
890
- DATE_FORMAT(event_end_time, '%m') AS 'event_end_month',
891
- DATE_FORMAT(event_end_time, '%Y') AS 'event_end_year',
892
- DATE_FORMAT(event_end_time, '%k') AS 'event_end_hh',
893
- DATE_FORMAT(event_end_time, '%i') AS 'event_end_mm',
894
- DATE_FORMAT(event_end_time, '%h:%i%p') AS 'event_end_12h_time',
895
- DATE_FORMAT(event_end_time, '%H:%i') AS 'event_end_24h_time',
896
- event_start_date,
897
- event_end_date,
898
- event_start_time,
899
- event_end_time,
900
- event_notes,
901
- event_rsvp,
902
- event_seats,
903
- recurrence_id,
904
- location_id,
905
- event_contactperson_id,
906
- event_attributes
907
- FROM $events_table
908
- WHERE event_id = $event_id";
909
-
910
- //$wpdb->show_errors(true);
911
- $event = $wpdb->get_row ( $sql, ARRAY_A );
912
- //$wpdb->print_error();
913
- $location = dbem_get_location ( $event ['location_id'] );
914
- $event ['location_name'] = $location ['location_name'];
915
- $event ['location_address'] = $location ['location_address'];
916
- $event ['location_town'] = $location ['location_town'];
917
- $event ['location_latitude'] = $location ['location_latitude'];
918
- $event ['location_longitude'] = $location ['location_longitude'];
919
- $event ['location_image_url'] = $location ['location_image_url'];
920
- /* Marcus Begin Edit */
921
- //I also edited the SQL
922
- $event ['event_attributes'] = @unserialize($event ['event_attributes']);
923
- $event ['event_attributes'] = (!is_array($event ['event_attributes'])) ? array() : $event ['event_attributes'] ;
924
- /* Marcus End Edit */
925
- return $event;
926
- }
927
-
928
- function dbem_hello_to_new_user() {
929
- $current_user = wp_get_current_user ();
930
- $advice = sprintf ( __ ( "<p>Hey, <strong>%s</strong>, welcome to <strong>Events Manager</strong>! We hope you like it around here.</p>
931
- <p>Now it's time to insert events lists through <a href='%s' title='Widgets page'>widgets</a>, <a href='%s' title='Template tags documentation'>template tags</a> or <a href='%s' title='Shortcodes documentation'>shortcodes</a>.</p>
932
- <p>By the way, have you taken a look at the <a href='%s' title='Change settings'>Settings page</a>? That's where you customize the way events and locations are displayed.</p>
933
- <p>What? Tired of seeing this advice? I hear you, <a href='%s' title='Don't show this advice again'>click here</a> and you won't see this again!</p>", 'dbem' ), $current_user->display_name, get_bloginfo ( 'url' ) . '/wp-admin/widgets.php', 'http://davidebenini.it/wordpress-plugins/events-manager#template-tags', 'http://davidebenini.it/wordpress-plugins/events-manager#shortcodes', get_bloginfo ( 'url' ) . '/wp-admin/admin.php?page=events-manager-options', get_bloginfo ( 'url' ) . '/wp-admin/admin.php?page=events-manager/events-manager.php&disable_hello_to_user=true' );
934
- ?>
935
- <div id="message" class="updated">
936
- <?php
937
- echo $advice;
938
- ?>
939
- </div>
940
- <?php
941
- }
942
-
943
- function dbem_events_table($events, $limit, $title) {
944
- if (isset ( $_GET ['scope'] ))
945
- $scope = $_GET ['scope'];
946
- else
947
- $scope = "future";
948
- if (($scope != "past") && ($scope != "all"))
949
- $scope = "future";
950
- $events_count = count ( dbem_get_events ( "", $scope ) );
951
-
952
- if (isset ( $_GET ['offset'] ))
953
- $offset = $_GET ['offset'];
954
-
955
- $use_events_end = get_option ( 'dbem_use_event_end' );
956
-
957
- ?>
958
-
959
- <div class="wrap">
960
- <div id="icon-events" class="icon32"><br />
961
- </div>
962
- <h2><?php
963
- echo $title;
964
- ?></h2>
965
-
966
- <?php
967
- $say_hello = get_option ( 'dbem_hello_to_user' );
968
- if ($say_hello == 1)
969
- dbem_hello_to_new_user ();
970
-
971
- ?>
972
- <!--<div id='new-event' class='switch-tab'><a href="<?php
973
- bloginfo ( 'wpurl' )?>/wp-admin/edit.php?page=events-manager/events-manager.php&amp;action=edit_event"><?php
974
- _e ( 'New Event ...', 'dbem' );
975
- ?></a></div>-->
976
- <?php
977
-
978
- $link = array ();
979
- $link ['past'] = "<a href='" . get_bloginfo ( 'wpurl' ) . "/wp-admin/edit.php?page=events-manager/events-manager.php&amp;scope=past&amp;order=desc'>" . __ ( 'Past events', 'dbem' ) . "</a>";
980
- $link ['all'] = " <a href='" . get_bloginfo ( 'wpurl' ) . "/wp-admin/edit.php?page=events-manager/events-manager.php&amp;scope=all&amp;order=desc'>" . __ ( 'All events', 'dbem' ) . "</a>";
981
- $link ['future'] = " <a href='" . get_bloginfo ( 'wpurl' ) . "/wp-admin/edit.php?page=events-manager/events-manager.php&amp;scope=future'>" . __ ( 'Future events', 'dbem' ) . "</a>";
982
-
983
- $scope_names = array ();
984
- $scope_names ['past'] = __ ( 'Past events', 'dbem' );
985
- $scope_names ['all'] = __ ( 'All events', 'dbem' );
986
- $scope_names ['future'] = __ ( 'Future events', 'dbem' );
987
-
988
- ?>
989
-
990
- <form id="posts-filter" action="" method="get"><input type='hidden'
991
- name='page' value='events-manager/events-manager.php' />
992
- <ul class="subsubsub">
993
- <li><a href='edit.php' class="current"><?php
994
- _e ( 'Total', 'dbem' );
995
- ?> <span
996
- class="count">(<?php
997
- echo (count ( $events ));
998
- ?>)</span></a></li>
999
- </ul>
1000
-
1001
-
1002
- <div class="tablenav">
1003
-
1004
- <div class="alignleft actions"><select name="action">
1005
- <option value="-1" selected="selected"><?php
1006
- _e ( 'Bulk Actions' );
1007
- ?></option>
1008
- <option value="deleteEvents"><?php
1009
- _e ( 'Delete selected','dbem' );
1010
- ?></option>
1011
-
1012
- </select> <input type="submit" value="<?php
1013
- _e ( 'Apply' );
1014
- ?>"
1015
- name="doaction2" id="doaction2" class="button-secondary action" /> <select
1016
- name="scope">
1017
-
1018
- <?php
1019
- foreach ( $scope_names as $key => $value ) {
1020
- $selected = "";
1021
- if ($key == $scope)
1022
- $selected = "selected='selected'";
1023
- echo "<option value='$key' $selected>$value</option> ";
1024
- }
1025
- ?>
1026
- </select> <input id="post-query-submit" class="button-secondary"
1027
- type="submit" value="<?php
1028
- _e ( 'Filter' )?>" /></div>
1029
- <div class="clear"></div>
1030
- <?php
1031
- if (empty ( $events )) {
1032
- // TODO localize
1033
- echo "no events";
1034
- } else {
1035
- ?>
1036
-
1037
- <table class="widefat">
1038
- <thead>
1039
- <tr>
1040
- <th class='manage-column column-cb check-column' scope='col'><input
1041
- class='select-all' type="checkbox" value='1' /></th>
1042
- <th><?php
1043
- _e ( 'Name', 'dbem' );
1044
- ?></th>
1045
- <?php /* Marcus Begin Edit */ ?>
1046
- <th></th>
1047
- <?php /* Marcus End Edit */ ?>
1048
- <th><?php
1049
- _e ( 'Location', 'dbem' );
1050
- ?></th>
1051
- <th colspan="2"><?php
1052
- _e ( 'Date and time', 'dbem' );
1053
- ?></th>
1054
- </tr>
1055
- </thead>
1056
- <tbody>
1057
- <?php
1058
- $i = 1;
1059
- foreach ( $events as $event ) {
1060
- $class = ($i % 2) ? ' class="alternate"' : '';
1061
- // FIXME set to american
1062
- $localised_date = mysql2date ( __ ( 'D d M Y' ), $event ['event_start_date'] );
1063
- $style = "";
1064
- $today = date ( "Y-m-d" );
1065
-
1066
- $location_summary = "<b>" . $event ['location_name'] . "</b><br/>" . $event ['location_address'] . " - " . $event ['location_town'];
1067
-
1068
- if ($event ['event_start_date'] < $today)
1069
- $style = "style ='background-color: #FADDB7;'";
1070
- ?>
1071
- <tr <?php
1072
- echo "$class $style";
1073
- ?>>
1074
-
1075
- <td><input type='checkbox' class='row-selector'
1076
- value='<?php
1077
- echo $event ['event_id'];
1078
- ?>' name='events[]' /></td>
1079
- <td><strong><a class="row-title"
1080
- href="<?php
1081
- bloginfo ( 'wpurl' )?>/wp-admin/edit.php?page=events-manager/events-manager.php&amp;action=edit_event&amp;event_id=<?php
1082
- echo $event ['event_id'];
1083
- ?>"><?php
1084
- echo ($event ['event_name']);
1085
- ?></a></strong>
1086
- <?
1087
- $category = dbem_get_category($event ['event_id']);
1088
- if($category)
1089
- echo "<br/><span title='".__ ( 'Category', 'dbem' ).": ".$category['category_name']."'>".$category['category_name']."</span>";
1090
- ?>
1091
- </td>
1092
- <td>
1093
- <?php /* Marcus Begin Edit */ ?>
1094
- <a
1095
- href="<?php
1096
- bloginfo ( 'wpurl' )?>/wp-admin/edit.php?page=events-manager/events-manager.php&amp;action=duplicate_event&amp;event_id=<?php
1097
- echo $event ['event_id'];
1098
- ?>"
1099
- title="<?php
1100
- _e ( 'Duplicate this event', 'dbem' );
1101
- ?>"><strong>+</strong></a>
1102
- <?php /* Marcus End Edit */ ?>
1103
- </td>
1104
- <td>
1105
-
1106
- <?php
1107
- echo $location_summary;
1108
- ?>
1109
-
1110
- </td>
1111
-
1112
- <td>
1113
- <?php
1114
- echo $localised_date;
1115
- ?><br />
1116
-
1117
- <?php
1118
- echo substr ( $event ['event_start_time'], 0, 5 ) . " - " . substr ( $event ['event_end_time'], 0, 5 );
1119
- ?>
1120
- </td>
1121
- <td>
1122
- <?php
1123
- if ($event ['recurrence_id']) {
1124
- $recurrence = dbem_get_recurrence ( $event [recurrence_id] );
1125
- ?>
1126
-
1127
- <b><?php
1128
- echo $recurrence ['recurrence_description'];
1129
- ?> <br />
1130
- <a
1131
- href="<?php
1132
- bloginfo ( 'wpurl' )?>/wp-admin/edit.php?page=events-manager/events-manager.php&amp;action=edit_recurrence&amp;recurrence_id=<?php
1133
- echo $recurrence ['recurrence_id'];
1134
- ?>"><?php
1135
- _e ( 'Reschedule', 'dbem' );
1136
- ?></a></b>
1137
-
1138
-
1139
- <?php
1140
- }
1141
- ?>
1142
- </td>
1143
-
1144
-
1145
- <?php
1146
- echo '</tr>';
1147
- $i ++;
1148
- }
1149
- ?>
1150
-
1151
-
1152
-
1153
-
1154
-
1155
- </tbody>
1156
- </table>
1157
- <?php
1158
- } // end of table ?>
1159
-
1160
- <div class='tablenav'>
1161
- <div class="alignleft actions"><br class='clear' />
1162
- </div>
1163
- <br class='clear' />
1164
- </div>
1165
-
1166
- </form>
1167
- </div>
1168
- </div>
1169
-
1170
- <?php
1171
- if ($events_count > $limit) {
1172
- $backward = $offset + $limit;
1173
- $forward = $offset - $limit;
1174
- if (DEBUG)
1175
- echo "COUNT = $count BACKWARD = $backward FORWARD = $forward<br> -- OFFSET = $offset";
1176
- echo "<div id='events-pagination'> ";
1177
- if ($backward < $events_count)
1178
- echo "<a style='float: left' href='" . get_bloginfo ( 'wpurl' ) . "/wp-admin/edit.php?page=events-manager/events-manager.php&amp;scope=$scope&offset=$backward'>&lt;&lt;</a>";
1179
- if ($forward >= 0)
1180
- echo "<a style='float: right' href='" . get_bloginfo ( 'wpurl' ) . "/wp-admin/edit.php?page=events-manager/events-manager.php&amp;scope=$scope&offset=$forward'>&gt;&gt;</a>";
1181
- echo "</div>";
1182
- }
1183
- ?>
1184
-
1185
- </div>
1186
- <?php
1187
- }
1188
- function dbem_event_form($event, $title, $element) {
1189
-
1190
- global $localised_date_formats;
1191
- $use_select_for_locations = get_option('dbem_use_select_for_locations');
1192
- // change prefix according to event/recurrence
1193
- $_GET ['action'] == "edit_recurrence" ? $pref = "recurrence_" : $pref = "event_";
1194
-
1195
- $_GET ['action'] == "edit_recurrence" ? $form_destination = "edit.php?page=events-manager/events-manager.php&amp;action=update_recurrence&amp;recurrence_id=" . $element : $form_destination = "edit.php?page=events-manager/events-manager.php&amp;action=update_event&amp;event_id=" . $element;
1196
-
1197
- $locale_code = substr ( get_locale (), 0, 2 );
1198
- $localised_date_format = $localised_date_formats [$locale_code];
1199
-
1200
- $hours_locale = "24";
1201
- // Setting 12 hours format for those countries using it
1202
- if (preg_match ( "/en|sk|zh|us|uk/", $locale_code ))
1203
- $hours_locale = "12";
1204
-
1205
- $localised_example = str_replace ( "yy", "2008", str_replace ( "mm", "11", str_replace ( "dd", "28", $localised_date_format ) ) );
1206
- $localised_end_example = str_replace ( "yy", "2008", str_replace ( "mm", "11", str_replace ( "dd", "28", $localised_date_format ) ) );
1207
-
1208
- if ($event [$pref . 'start_date'] != "") {
1209
- preg_match ( "/(\d{4})-(\d{2})-(\d{2})/", $event [$pref . 'start_date'], $matches );
1210
- $year = $matches [1];
1211
- $month = $matches [2];
1212
- $day = $matches [3];
1213
- $localised_date = str_replace ( "yy", $year, str_replace ( "mm", $month, str_replace ( "dd", $day, $localised_date_format ) ) );
1214
- } else {
1215
- $localised_date = "";
1216
- }
1217
- if ($event [$pref . 'end_date'] != "") {
1218
- preg_match ( "/(\d{4})-(\d{2})-(\d{2})/", $event [$pref . 'end_date'], $matches );
1219
- $end_year = $matches [1];
1220
- $end_month = $matches [2];
1221
- $end_day = $matches [3];
1222
- $localised_end_date = str_replace ( "yy", $end_year, str_replace ( "mm", $end_month, str_replace ( "dd", $end_day, $localised_date_format ) ) );
1223
- } else {
1224
- $localised_end_date = "";
1225
- }
1226
- // if($event[$pref.'rsvp'])
1227
- // echo (dbem_bookings_table($event[$pref.'id']));
1228
-
1229
-
1230
- $freq_options = array ("daily" => __ ( 'Daily', 'dbem' ), "weekly" => __ ( 'Weekly', 'dbem' ), "monthly" => __ ( 'Monthly', 'dbem' ) );
1231
- $days_names = array (1 => __ ( 'Mon' ), 2 => __ ( 'Tue' ), 3 => __ ( 'Wed' ), 4 => __ ( 'Thu' ), 5 => __ ( 'Fri' ), 6 => __ ( 'Sat' ), 7 => __ ( 'Sun' ) );
1232
- $saved_bydays = explode ( ",", $event ['recurrence_byday'] );
1233
- $weekno_options = array ("1" => __ ( 'first', 'dbem' ), '2' => __ ( 'second', 'dbem' ), '3' => __ ( 'third', 'dbem' ), '4' => __ ( 'fourth', 'dbem' ), '-1' => __ ( 'last', 'dbem' ) );
1234
-
1235
- $event [$pref . 'rsvp'] ? $event_RSVP_checked = "checked='checked'" : $event_RSVP_checked = '';
1236
-
1237
- ?>
1238
- <form id="eventForm" method="post" action="<?php echo $form_destination; ?>">
1239
- <div class="wrap">
1240
- <div id="icon-events" class="icon32"><br /></div>
1241
- <h2><?php echo $title; ?></h2>
1242
- <?php
1243
- if ($event ['recurrence_id']) {
1244
- ?>
1245
- <p id='recurrence_warning'>
1246
- <?php
1247
- if (isset ( $_GET ['action'] ) && ($_GET ['action'] == 'edit_recurrence')) {
1248
- _e ( 'WARNING: This is a recurrence.', 'dbem' )?>
1249
- <br />
1250
- <?php
1251
- _e ( 'Modifying these data all the events linked to this recurrence will be rescheduled', 'dbem' );
1252
-
1253
- } else {
1254
- _e ( 'WARNING: This is a recurring event.', 'dbem' );
1255
- _e ( 'If you change these data and save, this will become an independent event.', 'dbem' );
1256
- }
1257
- ?>
1258
- </p>
1259
- <?php
1260
- }
1261
- ?>
1262
- <?php
1263
- /* Marcus Begin Edit */
1264
- //This is an edit for WP 2.8 for styling fix
1265
- ?>
1266
- <div id="poststuff" class="metabox-holder has-right-sidebar">
1267
- <!-- SIDEBAR -->
1268
- <div id="side-info-column" class='inner-sidebar'>
1269
- <div id='side-sortables'>
1270
- <? if(get_option('dbem_recurrence_enabled')) : ?>
1271
- <!-- recurrence postbox -->
1272
- <div class="postbox ">
1273
- <div class="handlediv" title="Fare clic per cambiare."><br />
1274
- </div>
1275
- <h3 class='hndle'><span>
1276
- <?php
1277
- _e ( "Recurrence", 'dbem' );
1278
- ?>
1279
- </span></h3>
1280
- <div class="inside">
1281
- <?php
1282
- if (! $event ['event_id']) {
1283
- ?>
1284
- <?php
1285
- if ($event ['recurrence_id'] != "")
1286
- $recurrence_YES = "checked='checked'";
1287
-
1288
- ?>
1289
- <p>
1290
- <input id="event-recurrence" type="checkbox"
1291
- name="repeated_event" value="1" <?php
1292
- echo $recurrence_YES;
1293
- ?> />
1294
- <?php
1295
- _e ( 'Repeated event', 'dbem' );
1296
- ?>
1297
- </p>
1298
- <div id="event_recurrence_pattern">
1299
- <p>Frequency:
1300
- <select id="recurrence-frequency" name="recurrence_freq">
1301
- <?php
1302
- dbem_option_items ( $freq_options, $event [$pref . 'freq'] );
1303
- ?>
1304
- </select>
1305
- </p>
1306
- <p>
1307
- <?php
1308
- _e ( 'Every', 'dbem' )?>
1309
- <input id="recurrence-interval" name='recurrence_interval'
1310
- size='2' value='<?php
1311
- echo $event ['recurrence_interval'];
1312
- ?>' />
1313
- <span class='interval-desc' id="interval-daily-singular">
1314
- <?php _e ( 'day', 'dbem' )?>
1315
- </span> <span class='interval-desc' id="interval-daily-plural">
1316
- <?php _e ( 'days', 'dbem' ) ?>
1317
- </span> <span class='interval-desc' id="interval-weekly-singular">
1318
- <?php _e ( 'week', 'dbem' )?>
1319
- </span> <span class='interval-desc' id="interval-weekly-plural">
1320
- <?php _e ( 'weeks', 'dbem' )?>
1321
- </span> <span class='interval-desc' id="interval-monthly-singular">
1322
- <?php _e ( 'month', 'dbem' )?>
1323
- </span> <span class='interval-desc' id="interval-monthly-plural">
1324
- <?php _e ( 'months', 'dbem' )?>
1325
- </span> </p>
1326
- <p class="alternate-selector" id="weekly-selector">
1327
- <?php dbem_checkbox_items ( 'recurrence_bydays[]', $days_names, $saved_bydays );
1328
- ?>
1329
- </p>
1330
- <p class="alternate-selector" id="monthly-selector">
1331
- <?php
1332
- _e ( 'Every', 'dbem' )?>
1333
- <select id="monthly-modifier" name="recurrence_byweekno">
1334
- <?php
1335
- dbem_option_items ( $weekno_options, $event ['recurrence_byweekno'] );
1336
- ?>
1337
- </select>
1338
- <select id="recurrence-weekday"
1339
- name="recurrence_byday">
1340
- <?php
1341
- dbem_option_items ( $days_names, $event ['recurrence_byday'] );
1342
- ?>
1343
- </select>
1344
- &nbsp;</p>
1345
- </div>
1346
- <p id="recurrence-tip">
1347
- <?php
1348
- _e ( 'Check if your event happens more than once according to a regular pattern', 'dbem' )?>
1349
- </p>
1350
- <?php
1351
- } else {
1352
-
1353
- if (! $event ['recurrence_id']) {
1354
- echo "<p>" . __ ( 'This is\'t a recurrent event', 'dbem' ) . ".</p>";
1355
- } else {
1356
-
1357
- $recurrence = dbem_get_recurrence ( $event ['recurrence_id'] );
1358
- ?>
1359
- <p>
1360
- <?php
1361
- echo $recurrence ['recurrence_description'];
1362
- ?>
1363
- <br />
1364
- <a
1365
- href="<?php
1366
- bloginfo ( 'wpurl' )?>/wp-admin/edit.php?page=events-manager/events-manager.php&amp;action=edit_recurrence&amp;recurrence_id=<?php
1367
- echo $recurrence ['recurrence_id'];
1368
- ?>">
1369
- <?php
1370
- _e ( 'Reschedule', 'dbem' );
1371
- ?>
1372
- </a></p>
1373
- <?php
1374
- }
1375
- ?>
1376
- <?php
1377
- }
1378
- ?>
1379
- </div>
1380
- </div>
1381
- <? endif; ?>
1382
- <?php if(get_option('dbem_rsvp_enabled')) : ?>
1383
- <div class="postbox ">
1384
- <div class="handlediv" title="Fare clic per cambiare."><br />
1385
- </div>
1386
- <h3 class='hndle'><span>
1387
- <?php
1388
- _e ( 'Contact Person', 'dbem' );
1389
- ?>
1390
- </span></h3>
1391
- <div class="inside">
1392
- <p><?php _e('Contact','dbem'); ?>
1393
- <?php
1394
- wp_dropdown_users ( array ('name' => 'event_contactperson_id', 'show_option_none' => __ ( "Select...", 'dbem' ), 'selected' => $event ['event_contactperson_id'] ) );
1395
- ?>
1396
- </p>
1397
- </div>
1398
- </div>
1399
- <div class="postbox ">
1400
- <div class="handlediv" title="Fare clic per cambiare."><br />
1401
- </div>
1402
- <h3 class='hndle'><span><?php _e('RSVP','dbem'); ?></span></h3>
1403
- <div class="inside">
1404
- <p>
1405
- <input id="rsvp-checkbox" name='event_rsvp' value='1' type='checkbox'
1406
- <?php
1407
- echo $event_RSVP_checked?> />
1408
- <?php
1409
- _e ( 'Enable registration for this event', 'dbem' )?>
1410
- </p>
1411
- <div id='rsvp-data'>
1412
- <?php
1413
- if ($event ['event_contactperson_id'] != NULL)
1414
- $selected = $event ['event_contactperson_id'];
1415
- else
1416
- $selected = '0';
1417
- ?>
1418
- <p>
1419
- <?php
1420
- _e ( 'Spaces','dbem' );
1421
- ?>
1422
- :
1423
- <input id="seats-input" type="text"
1424
- name="event_seats" size='5' value="<?php
1425
- echo $event [$pref . 'seats']?>" />
1426
- </p>
1427
- <?php
1428
- if ($event ['event_rsvp']) {
1429
- ?>
1430
- <?php
1431
- dbem_bookings_compact_table ( $event [$pref . 'id'] );
1432
- ?>
1433
- <?php
1434
- }
1435
- ?>
1436
- </div>
1437
- </div>
1438
- </div>
1439
- <?php
1440
- /* Marcus Begin Edit */
1441
- //adding the category selection box
1442
- ?> <? endif; ?>
1443
- <? if(get_option('dbem_categories_enabled')) :?>
1444
- <div class="postbox ">
1445
- <div class="handlediv" title="Fare clic per cambiare."><br />
1446
- </div>
1447
- <h3 class='hndle'><span>
1448
- <?php _e ( 'Category', 'dbem' ); ?>
1449
- </span></h3>
1450
- <div class="inside">
1451
- <p><?php _e ( 'Category:', 'dbem' ); ?>
1452
- <select name="event_category_id">
1453
- <?php
1454
- $categories = dbem_get_categories();
1455
- ?>
1456
- <option value=""><?php _e ( 'Select...', 'dbem' ); ?> </option>
1457
- <?php
1458
- foreach ( $categories as $category ){
1459
- $event_category = dbem_get_event_category($event['event_id']);
1460
- $selected = ($category['category_id'] == $event_category['category_id']) ? "selected='selected'": '';
1461
- ?>
1462
- <option value="<?php echo $category['category_id'] ?>" <?php echo $selected ?>>
1463
- <?php echo $category['category_name'] ?>
1464
- </option>
1465
- <?
1466
- }
1467
- ?>
1468
- </select>
1469
- </p>
1470
- </div>
1471
- </div>
1472
- <? endif; ?>
1473
- </div>
1474
- <?php/* Marcus End Edit */ ?>
1475
- </div>
1476
- <!-- END OF SIDEBAR -->
1477
- <div id="post-body">
1478
- <div id="post-body-content">
1479
- <?php/* Marcus End Edit */ ?>
1480
- <div id="event_name" class="stuffbox">
1481
- <h3>
1482
- <?php
1483
- _e ( 'Name', 'dbem' );
1484
- ?>
1485
- </h3>
1486
- <div class="inside">
1487
- <input type="text" name="event_name"
1488
- value="<?php
1489
- echo $event [$pref . 'name']?>" />
1490
- <br />
1491
- <?php
1492
- _e ( 'The event name. Example: Birthday party', 'dbem' )?>
1493
- </div>
1494
- </div>
1495
- <div id="event_start_date" class="stuffbox">
1496
- <h3 id='event-date-title'>
1497
- <?php
1498
- _e ( 'Event date', 'dbem' );
1499
- ?>
1500
- </h3>
1501
- <h3 id='recurrence-dates-title'>
1502
- <?php
1503
- _e ( 'Recurrence dates', 'dbem' );
1504
- ?>
1505
- </h3>
1506
- <div class="inside">
1507
- <input id="localised-date" type="text"
1508
- name="localised_event_date" value="<?php
1509
- echo $localised_date?>"
1510
- style="display: none;" />
1511
- <input id="date-to-submit" type="text"
1512
- name="event_date" value="<?php
1513
- echo $event [$pref . 'start_date']?>"
1514
- style="background: #FCFFAA" />
1515
- <input id="localised-end-date"
1516
- type="text" name="localised_event_end_date"
1517
- value="<?php
1518
- echo $localised_end_date?>" style="display: none;" />
1519
- <input
1520
- id="end-date-to-submit" type="text" name="event_end_date"
1521
- value="<?php
1522
- echo $event [$pref . 'end_date']?>"
1523
- style="background: #FCFFAA" />
1524
- <br />
1525
- <span id='event-date-explanation'>
1526
- <?php
1527
- _e ( 'The event date.', 'dbem' );
1528
- /* Marcus Begin Edit */
1529
- echo " ";
1530
- _e ( 'When not reoccurring, this event spans between the beginning and end date.', 'dbem' );
1531
- /* Marcus End Edit */
1532
- ?>
1533
- </span><span
1534
- id='recurrence-dates-explanation'>
1535
- <?php
1536
- _e ( 'The recurrence beginning and end date.', 'dbem' );
1537
- ?>
1538
- </span> </div>
1539
- </div>
1540
- <div id="event_end_day" class="stuffbox">
1541
- <h3>
1542
- <?php
1543
- _e ( 'Event time', 'dbem' );
1544
- ?>
1545
- </h3>
1546
- <div class="inside">
1547
- <input id="start-time" type="text" size="8"
1548
- maxlength="8" name="event_start_time"
1549
- value="<?php
1550
- echo $event [$pref . 'start_' . $hours_locale . "h_time"];
1551
- ?>" />
1552
- -
1553
- <input id="end-time" type="text" size="8" maxlength="8"
1554
- name="event_end_time"
1555
- value="<?php
1556
- echo $event [$pref . 'end_' . $hours_locale . "h_time"];
1557
- ?>" />
1558
- <br />
1559
- <?php
1560
- _e ( 'The time of the event beginning and end', 'dbem' )?>
1561
- . </div>
1562
- </div>
1563
- <div id="location_coordinates" class="stuffbox" style='display: none;'>
1564
- <h3>
1565
- <?php
1566
- _e ( 'Coordinates', 'dbem' );
1567
- ?>
1568
- </h3>
1569
- <div class="inside">
1570
- <input id='location-latitude'
1571
- name='location_latitude' type='text'
1572
- value='<?php
1573
- echo $event ['location_latitude'];
1574
- ?>' size='15' />
1575
- -
1576
- <input
1577
- id='location-longitude' name='location_longitude' type='text'
1578
- value='<?php
1579
- echo $event ['location_longitude'];
1580
- ?>' size='15' />
1581
- </div>
1582
- </div>
1583
- <div id="location_name" class="stuffbox">
1584
- <h3>
1585
- <?php
1586
- _e ( 'Location', 'dbem' );
1587
- ?>
1588
- </h3>
1589
- <div class="inside">
1590
- <table id="dbem-location-data">
1591
- <tr>
1592
- <?php if($use_select_for_locations) : ?>
1593
- <?
1594
- $locations = dbem_get_locations();
1595
-
1596
-
1597
- ?>
1598
- <th><?php _e('Location:','dbem') ?></th>
1599
- <td>
1600
- <select name="location-select-id" id='location-select-id' size="1">
1601
- <?php foreach($locations as $location) :
1602
- $selected = "";
1603
- if(isset($event['location_id'])) {
1604
- $location_id = $event['location_id'];
1605
- if ($location_id == $location['location_id'])
1606
- $selected = "selected='selected' ";
1607
- }
1608
-
1609
- ?>
1610
- <option value="<?php echo $location['location_id'] ?>" <?php echo $selected ?>><?php echo $location['location_name'] ?></option>
1611
- <?php endforeach; ?>
1612
- </select>
1613
- <input type='hidden' name='location-select-name' value='<?php echo $event['location_name']?>'/>
1614
- <input type='hidden' name='location-select-town' value='<?php echo $event['location_town']?>'/>
1615
- <input type='hidden' name='location-select-address' value='<?php echo $event['location_address']?>'/>
1616
- </td>
1617
- <?php else : ?>
1618
- <th><?php _e ( 'Name:' )?>
1619
- &nbsp;</th>
1620
- <td><input id="location-name" type="text" name="location_name"
1621
- value="<?php
1622
- echo $event ['location_name']?>" /></td>
1623
- <?php endif; ?>
1624
- <?php
1625
- $gmap_is_active = get_option ( 'dbem_gmap_is_active' );
1626
- ?>
1627
- <?php
1628
- if ($gmap_is_active) {
1629
- ?>
1630
- <td rowspan='6'><div id='map-not-found'
1631
- style='width: 400px; font-size: 140%; text-align: center; margin-top: 100px; display: hide'>
1632
- <p>
1633
- <?php
1634
- _e ( 'Map not found' );
1635
- ?>
1636
- </p>
1637
- </div>
1638
- <div id='event-map'
1639
- style='width: 400px; height: 300px; background: green; display: hide; margin-right: 8px'></div></td>
1640
- <?php
1641
- }
1642
- ; // end of IF_GMAP_ACTIVE ?>
1643
- </tr>
1644
- <?php if(!$use_select_for_locations) : ?>
1645
- <tr>
1646
- <td colspan='2'>
1647
- <p><?php
1648
- _e ( 'The name of the location where the event takes place. You can use the name of a venue, a square, etc', 'dbem' )?></p>
1649
- </td>
1650
- </tr>
1651
- <?php else: ?>
1652
- <tr >
1653
- <td colspan='2' rowspan='5' style='vertical-align: top'>
1654
- <p><?php
1655
- _e ( 'Select a location for your event', 'dbem' )?></p>
1656
- </td>
1657
- </tr>
1658
- <?php endif; ?>
1659
- <?php if(!$use_select_for_locations) : ?>
1660
- <tr>
1661
- <th><?php
1662
- _e ( 'Address:' )?>
1663
- &nbsp;</th>
1664
- <td><input id="location-address" type="text" name="location_address"
1665
- value="<?php
1666
- echo $event ['location_address'];
1667
- ?>" /></td>
1668
- </tr>
1669
- <tr>
1670
- <td colspan='2'><p>
1671
- <?php
1672
- _e ( 'The address of the location where the event takes place. Example: 21, Dominick Street', 'dbem' )?>
1673
- </p></td>
1674
- </tr>
1675
- <tr>
1676
- <th><?php
1677
- _e ( 'Town:' )?>
1678
- &nbsp;</th>
1679
- <td><input id="location-town" type="text" name="location_town"
1680
- value="<?php
1681
- echo $event ['location_town']?>" /></td>
1682
- </tr>
1683
- <tr>
1684
- <td colspan='2'><p>
1685
- <?php
1686
- _e ( 'The town where the location is located. If you\'re using the Google Map integration and want to avoid geotagging ambiguities include the country in the town field. Example: Verona, Italy.', 'dbem' )?>
1687
- </p></td>
1688
- </tr>
1689
- <?php endif; ?>
1690
- </table>
1691
- </div>
1692
- </div>
1693
- <div id="event_notes" class="postbox">
1694
- <h3>
1695
- <?php
1696
- _e ( 'Details', 'dbem' );
1697
- ?>
1698
- </h3>
1699
- <div class="inside">
1700
- <?php/* Marcus Begin Edit */ ?>
1701
- <div id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>" class="postarea">
1702
- <?php the_editor($event [$pref . 'notes']); ?>
1703
- </div>
1704
- <?php/* Marcus End Edit */ ?>
1705
- <br />
1706
- <?php
1707
- _e ( 'Details about the event', 'dbem' )?>
1708
- </div>
1709
- </div>
1710
- <?php if(get_option('dbem_attributes_enabled')) : ?>
1711
- <?php/* Marcus Begin Edit */ ?>
1712
- <div id="event_attributes" class="postbox">
1713
- <h3>
1714
- <?php
1715
- _e ( 'Attributes', 'dbem' );
1716
- ?>
1717
- </h3>
1718
- <div class="inside">
1719
- <?php dbem_attributes_form($event) ?>
1720
- </div>
1721
- </div>
1722
- <?php/* Marcus End Edit */ ?>
1723
- <?php endif; ?>
1724
- </div>
1725
- <p class="submit">
1726
- <input type="submit" name="events_update"
1727
- value="<?php
1728
- _e ( 'Submit Event', 'dbem' );
1729
- ?> &raquo;" />
1730
- </p>
1731
- </div>
1732
- </div>
1733
- </div>
1734
- </form>
1735
- <?php
1736
- }
1737
-
1738
- function dbem_validate_event($event) {
1739
- // Only for emergencies, when JS is disabled
1740
- // TODO make it fully functional without JS
1741
- global $required_fields;
1742
- $errors = Array ();
1743
- foreach ( $required_fields as $field ) {
1744
- if ($event [$field] == "") {
1745
- $errors [] = $field;
1746
- }
1747
- }
1748
- $error_message = "";
1749
- if (count ( $errors ) > 0)
1750
- $error_message = __ ( 'Missing fields: ' ) . implode ( ", ", $errors ) . ". ";
1751
- if ($_POST ['repeated_event'] == "1" && $_POST ['event_end_date'] == "")
1752
- $error_message .= __ ( 'Since the event is repeated, you must specify an event date.', 'dbem' );
1753
- if ($error_message != "")
1754
- return $error_message;
1755
- else
1756
- return "OK";
1757
-
1758
- }
1759
-
1760
- function _dbem_is_date_valid($date) {
1761
- $year = substr ( $date, 0, 4 );
1762
- $month = substr ( $date, 5, 2 );
1763
- $day = substr ( $date, 8, 2 );
1764
- return (checkdate ( $month, $day, $year ));
1765
- }
1766
- function _dbem_is_time_valid($time) {
1767
- $result = preg_match ( "/([01]\d|2[0-3])(:[0-5]\d)/", $time );
1768
-
1769
- return ($result);
1770
- }
1771
- // Enqueing jQuery script to make sure it's loaded
1772
- function dbem_enque_scripts() {
1773
- wp_enqueue_script ( 'jquery' );
1774
- // wp_enqueue_script('datepicker','/wp-content/plugins/events-manager/jquery-ui-datepicker/jquery-ui-personalized-1.6b.js', array('jquery') );
1775
- }
1776
- add_action ( 'template_redirect', 'dbem_enque_scripts' );
1777
-
1778
- function url_exists($url) {
1779
-
1780
- if ((strpos ( $url, "http" )) === false)
1781
- $url = "http://" . $url;
1782
- // FIXME ripristina la linea seguente e VEDI DI SISTEMARE!!!!
1783
- // if (is_array(@get_headers($url))) {
1784
- if (true)
1785
- return true;
1786
- else
1787
- return false;
1788
- }
1789
-
1790
- // General script to make sure hidden fields are shown when containing data
1791
- function dbem_admin_general_script() {
1792
- ?>
1793
- <script
1794
- src="<?php
1795
- bloginfo ( 'wpurl' );
1796
- ?>/wp-content/plugins/events-manager/dbem.js"
1797
- type="text/javascript"></script>
1798
- <script
1799
- src="<?php
1800
- bloginfo ( 'wpurl' );
1801
- ?>/wp-content/plugins/events-manager/js/jquery-ui-datepicker/ui.datepicker.js"
1802
- type="text/javascript"></script>
1803
- <script
1804
- src="<?php
1805
- bloginfo ( 'wpurl' );
1806
- ?>/wp-content/plugins/events-manager/js/timeentry/jquery.timeentry.js"
1807
- type="text/javascript"></script>
1808
- <?php
1809
-
1810
- // Check if the locale is there and loads it
1811
- $locale_code = substr ( get_locale (), 0, 2 );
1812
-
1813
- $show24Hours = 'true';
1814
- // Setting 12 hours format for those countries using it
1815
- if (preg_match ( "/en|sk|zh|us|uk/", $locale_code ))
1816
- $show24Hours = 'false';
1817
-
1818
- $locale_file = get_bloginfo ( 'wpurl' ) . "/wp-content/plugins/events-manager/js/jquery-ui-datepicker/i18n/ui.datepicker-$locale_code.js";
1819
- if (url_exists ( $locale_file )) {
1820
- ?>
1821
- <script
1822
- src="<?php
1823
- bloginfo ( 'wpurl' );
1824
- ?>/wp-content/plugins/events-manager/js/jquery-ui-datepicker/i18n/ui.datepicker-<?php
1825
- echo $locale_code;
1826
- ?>.js"
1827
- type="text/javascript"></script>
1828
- <?php
1829
- }
1830
- ?>
1831
-
1832
-
1833
- <style type='text/css' media='all'>
1834
- @import
1835
- "<?php
1836
- bloginfo ( 'wpurl' );
1837
- ?>/wp-content/plugins/events-manager/js/jquery-ui-datepicker/ui.datepicker.css"
1838
- ;
1839
- </style>
1840
- <script type="text/javascript">
1841
- //<![CDATA[
1842
- // TODO: make more general, to support also latitude and longitude (when added)
1843
- $j=jQuery.noConflict();
1844
-
1845
- function updateIntervalDescriptor () {
1846
- $j(".interval-desc").hide();
1847
- var number = "-plural";
1848
- if ($j('input#recurrence-interval').val() == 1 || $j('input#recurrence-interval').val() == "")
1849
- number = "-singular"
1850
- var descriptor = "span#interval-"+$j("select#recurrence-frequency").val()+number;
1851
- $j(descriptor).show();
1852
- }
1853
- function updateIntervalSelectors () {
1854
- $j('p.alternate-selector').hide();
1855
- $j('p#'+ $j('select#recurrence-frequency').val() + "-selector").show();
1856
- //$j('p.recurrence-tip').hide();
1857
- //$j('p#'+ $j(this).val() + "-tip").show();
1858
- }
1859
- function updateShowHideRecurrence () {
1860
- if($j('input#event-recurrence').attr("checked")) {
1861
- $j("#event_recurrence_pattern").fadeIn();
1862
- /* Marcus Begin Edit */
1863
- //Edited this and the one below so dates always can have an end date
1864
- //$j("input#localised-end-date").fadeIn();
1865
- /* Marcus End Edit */
1866
- $j("#event-date-explanation").hide();
1867
- $j("#recurrence-dates-explanation").show();
1868
- $j("h3#recurrence-dates-title").show();
1869
- $j("h3#event-date-title").hide();
1870
- } else {
1871
- $j("#event_recurrence_pattern").hide();
1872
- /* Marcus Begin Edit */
1873
- //$j("input#localised-end-date").hide();
1874
- /* Marcus End Edit */
1875
- $j("#recurrence-dates-explanation").hide();
1876
- $j("#event-date-explanation").show();
1877
- $j("h3#recurrence-dates-title").hide();
1878
- $j("h3#event-date-title").show();
1879
- }
1880
- }
1881
-
1882
- function updateShowHideRsvp () {
1883
- if($j('input#rsvp-checkbox').attr("checked")) {
1884
- $j("div#rsvp-data").fadeIn();
1885
- } else {
1886
- $j("div#rsvp-data").hide();
1887
- }
1888
- }
1889
-
1890
- $j(document).ready( function() {
1891
- locale_format = "ciao";
1892
-
1893
- $j("#recurrence-dates-explanation").hide();
1894
- $j("#localised-date").show();
1895
- /* Marcus Begin Edit */
1896
- $j("#localised-end-date").show();
1897
- /* Marcus End Edit */
1898
-
1899
- $j("#date-to-submit").hide();
1900
- $j("#end-date-to-submit").hide();
1901
- $j("#localised-date").datepicker($j.extend({},
1902
- ($j.datepicker.regional["it"],
1903
- {altField: "#date-to-submit",
1904
- altFormat: "yy-mm-dd"})));
1905
- $j("#localised-end-date").datepicker($j.extend({},
1906
- ($j.datepicker.regional["it"],
1907
- {altField: "#end-date-to-submit",
1908
- altFormat: "yy-mm-dd"})));
1909
-
1910
-
1911
-
1912
-
1913
-
1914
-
1915
- $j("#start-time").timeEntry({spinnerImage: '', show24Hours: <?php
1916
- echo $show24Hours;
1917
- ?> });
1918
- $j("#end-time").timeEntry({spinnerImage: '', show24Hours: <?php
1919
- echo $show24Hours;
1920
- ?>});
1921
-
1922
-
1923
-
1924
-
1925
-
1926
- $j('input.select-all').change(function(){
1927
- if($j(this).is(':checked'))
1928
- $j('input.row-selector').attr('checked', true);
1929
- else
1930
- $j('input.row-selector').attr('checked', false);
1931
- });
1932
- // TODO: NOT WORKING FOR SOME REASON, val() gives me 2 instead of 'smtp'...
1933
- // console.log($j('select[name:dbem_rsvp_mail_send_method]').val());
1934
- // if ($j('select[name:dbem_rsvp_mail_send_method]').val() != "smtp") {
1935
- // $j('tr#dbem_smtp_host_row').hide();
1936
- // $j('tr#dbem_rsvp_mail_SMTPAuth_row').hide();
1937
- // $j('tr#dbem_smtp_username_row').hide();
1938
- // $j('tr#dbem_smtp_password_row').hide();
1939
- // }
1940
- //
1941
- // $j('select[name:dbem_rsvp_mail_send_method]').change(function() {
1942
- // console.log($j(this).val());
1943
- // if($j(this).val() == "smtp") {
1944
- // $j('tr#dbem_smtp_host_row').show();
1945
- // $j('tr#dbem_rsvp_mail_SMTPAuth_row').show();
1946
- // $j('tr#dbem_smtp_username_row').show();
1947
- // $j('tr#dbem_smtp_password_row').show();
1948
- // } else {
1949
- // $j('tr#dbem_smtp_host_row').hide();
1950
- // $j('tr#dbem_rsvp_mail_SMTPAuth_row').hide();
1951
- // $j('tr#dbem_smtp_username_row').hide();
1952
- // $j('tr#dbem_smtp_password_row').hide();
1953
- // }
1954
-
1955
- //});
1956
- updateIntervalDescriptor();
1957
- updateIntervalSelectors();
1958
- updateShowHideRecurrence();
1959
- updateShowHideRsvp();
1960
- $j('input#event-recurrence').change(updateShowHideRecurrence);
1961
- $j('input#rsvp-checkbox').change(updateShowHideRsvp);
1962
- // recurrency elements
1963
- $j('input#recurrence-interval').keyup(updateIntervalDescriptor);
1964
- $j('select#recurrence-frequency').change(updateIntervalDescriptor);
1965
- $j('select#recurrence-frequency').change(updateIntervalSelectors);
1966
-
1967
- // hiding or showing notes according to their content
1968
- jQuery('.postbox h3').prepend('<a class="togbox">+</a> ');
1969
- // if(jQuery("textarea[@name=event_notes]").val()!="") {
1970
- // jQuery("textarea[@name=event_notes]").parent().parent().removeClass('closed');
1971
- // }
1972
- jQuery('#event_notes h3').click( function() {
1973
- jQuery(jQuery(this).parent().get(0)).toggleClass('closed');
1974
- });
1975
-
1976
- // users cannot submit the event form unless some fields are filled
1977
- function validateEventForm(){
1978
- errors = "";
1979
- var recurring = $j("input[@name=repeated_event]:checked").val();
1980
- requiredFields= new Array('event_name', 'localised_event_date', 'location_name','location_address','location_town');
1981
- var localisedRequiredFields = {'event_name':"<?php
1982
- _e ( 'Name', 'dbem' )?>", 'localised_event_date':"<?php
1983
- _e ( 'Date', 'dbem' )?>", 'location_name':"<?php
1984
- _e ( 'Location', 'dbem' )?>",'location_address':"<?php
1985
- _e ( 'Address', 'dbem' )?>",'location_town':"<?php
1986
- _e ( 'Town', 'dbem' )?>"};
1987
-
1988
- missingFields = new Array;
1989
- for (var i in requiredFields) {
1990
- if ($j("input[@name=" + requiredFields[i]+ "]").val() == 0) {
1991
- missingFields.push(localisedRequiredFields[requiredFields[i]]);
1992
- $j("input[@name=" + requiredFields[i]+ "]").css('border','2px solid red');
1993
- } else {
1994
- $j("input[@name=" + requiredFields[i]+ "]").css('border','1px solid #DFDFDF');
1995
-
1996
- }
1997
-
1998
- }
1999
-
2000
- // alert('ciao ' + recurring+ " end: " + $j("input[@name=localised_event_end_date]").val());
2001
- if (missingFields.length > 0) {
2002
-
2003
- errors = "<?php
2004
- echo _e ( 'Some required fields are missing:', 'dbem' )?> " + missingFields.join(", ") + ".\n";
2005
- }
2006
- if(recurring && $j("input[@name=localised_event_end_date]").val() == "") {
2007
- errors = errors + "<?php
2008
- _e ( 'Since the event is repeated, you must specify an end date', 'dbem' )?>.";
2009
- $j("input[@name=localised_event_end_date]").css('border','2px solid red');
2010
- } else {
2011
- $j("input[@name=localised_event_end_date]").css('border','1px solid #DFDFDF');
2012
- }
2013
- if(errors != "") {
2014
- alert(errors);
2015
- return false;
2016
- }
2017
- return true;
2018
- }
2019
-
2020
- $j('#eventForm').bind("submit", validateEventForm);
2021
-
2022
-
2023
- });
2024
- //]]>
2025
- </script>
2026
-
2027
- <?php
2028
- }
2029
-
2030
- function dbem_admin_map_script() {
2031
- if ((isset ( $_REQUEST ['event_id'] ) && $_REQUEST ['event_id'] != '') || (isset ( $_REQUEST ['page'] ) && $_REQUEST ['page'] == 'locations') || (isset ( $_REQUEST ['page'] ) && $_REQUEST ['page'] == 'new_event') || (isset ( $_REQUEST ['action'] ) && $_REQUEST ['action'] == 'edit_recurrence')) {
2032
- if (! (isset ( $_REQUEST ['action'] ) && $_REQUEST ['action'] == 'dbem_delete')) {
2033
- // single event page
2034
-
2035
-
2036
- $event_ID = $_REQUEST ['event_id'];
2037
- $event = dbem_get_event ( $event_ID );
2038
-
2039
- if ($event ['location_town'] != '' || (isset ( $_REQUEST ['page'] ) && $_REQUEST ['page'] = 'locations')) {
2040
- $gmap_key = get_option ( 'dbem_gmap_key' );
2041
- if ($event ['location_address'] != "") {
2042
- $search_key = $event ['location_address'] . ", " . $event ['location_town'];
2043
- } else {
2044
- $search_key = $event ['location_name'] . ", " . $event ['location_town'];
2045
- }
2046
-
2047
- ?>
2048
- <style type="text/css">
2049
- /* div#location_town, div#location_address, div#location_name {
2050
- width: 480px;
2051
- }
2052
- table.form-table {
2053
- width: 50%;
2054
- } */
2055
- </style>
2056
- <script
2057
- src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=<?php
2058
- echo $gmap_key;
2059
- ?>"
2060
- type="text/javascript"></script>
2061
- <script type="text/javascript">
2062
- //<![CDATA[
2063
- $j=jQuery.noConflict();
2064
-
2065
- function loadMap(location, town, address) {
2066
- if (GBrowserIsCompatible()) {
2067
- var map = new GMap2(document.getElementById("event-map"));
2068
- // map.addControl(new GScaleControl());
2069
- //map.setCenter(new GLatLng(37.4419, -122.1419), 13);
2070
- var geocoder = new GClientGeocoder();
2071
- if (address !="") {
2072
- searchKey = address + ", " + town;
2073
- } else {
2074
- searchKey = location + ", " + town;
2075
- }
2076
-
2077
- var search = "<?php
2078
- echo $search_key?>" ;
2079
- geocoder.getLatLng(
2080
- searchKey,
2081
- function(point) {
2082
- if (!point) {
2083
- $j("#event-map").hide();
2084
- $j('#map-not-found').show();
2085
- } else {
2086
- mapCenter= new GLatLng(point.lat()+0.01, point.lng()+0.005);
2087
- map.setCenter(mapCenter, 13);
2088
- var marker = new GMarker(point);
2089
- map.addOverlay(marker);
2090
- marker.openInfoWindowHtml('<strong>' + location +'</strong><p>' + address + '</p><p>' + town + '</p>');
2091
- $j('input#location-latitude').val(point.y);
2092
- $j('input#location-longitude').val(point.x);
2093
- $j("#event-map").show();
2094
- $j('#map-not-found').hide();
2095
- }
2096
- }
2097
- );
2098
- // map.addControl(new GSmallMapControl());
2099
- // map.addControl(new GMapTypeControl());
2100
-
2101
- }
2102
- }
2103
-
2104
- $j(document).ready(function() {
2105
- <?php if(get_option('dbem_use_select_for_locations')) : ?>
2106
- eventLocation = $j("input[name='location-select-name']").val();
2107
- eventTown = $j("input[name='location-select-town']").val();
2108
- eventAddress = $j("input[name='location-select-address']").val();
2109
-
2110
- <?php else: ?>
2111
- eventLocation = $j("input#location-name").val();
2112
- eventTown = $j("input#location-town").val();
2113
- eventAddress = $j("input#location-address").val();
2114
- <?php endif; ?>
2115
-
2116
- loadMap(eventLocation, eventTown, eventAddress);
2117
-
2118
- $j("input#location-name").blur(function(){
2119
- newEventLocation = $j("input#location-name").val();
2120
- if (newEventLocation !=eventLocation) {
2121
- loadMap(newEventLocation, eventTown, eventAddress);
2122
- eventLocation = newEventLocation;
2123
-
2124
- }
2125
- });
2126
- $j("input#location-town").blur(function(){
2127
- newEventTown = $j("input#location-town").val();
2128
- if (newEventTown !=eventTown) {
2129
- loadMap(eventLocation, newEventTown, eventAddress);
2130
- eventTown = newEventTown;
2131
- }
2132
- });
2133
- $j("input#location-address").blur(function(){
2134
- newEventAddress = $j("input#location-address").val();
2135
- if (newEventAddress != eventAddress) {
2136
- loadMap(eventLocation, eventTown, newEventAddress);
2137
- eventAddress = newEventAddress;
2138
- }
2139
- });
2140
-
2141
-
2142
-
2143
- });
2144
- $j(document).unload(function() {
2145
- GUnload();
2146
- });
2147
- //]]>
2148
- </script>
2149
- <?php
2150
- }
2151
- }
2152
- }
2153
- }
2154
- $gmap_is_active = get_option ( 'dbem_gmap_is_active' );
2155
- if ($gmap_is_active) {
2156
- add_action ( 'admin_head', 'dbem_admin_map_script' );
2157
-
2158
- }
2159
-
2160
- // Script to validate map options
2161
- function dbem_admin_options_script() {
2162
- if (isset ( $_REQUEST ['page'] ) && $_REQUEST ['page'] == 'events-manager-options') {
2163
- ?>
2164
- <script type="text/javascript">
2165
- //<![CDATA[
2166
- $j=jQuery.noConflict();
2167
-
2168
- $j(document).ready(function() {
2169
-
2170
- // users cannot enable Google Maps without an api key
2171
- function verifyOptionsForm(){
2172
- var gmap_is_active = $j("input[@name=dbem_gmap_is_active]:checked").val();
2173
- var gmap_key = $j("input[@name=dbem_gmap_key]").val();
2174
- if(gmap_is_active == '1' && (gmap_key == '')){
2175
- alert("<?php
2176
- _e ( 'You cannot enable Google Maps integration without setting an appropriate API key.' );
2177
- ?>");
2178
- $j("input[@name='dbem_gmap_is_active']:nth(1)").attr("checked","checked");
2179
-
2180
- return false;
2181
- } else {
2182
- return true;
2183
- }
2184
- }
2185
-
2186
- $j('#dbem_options_form').bind("submit", verifyOptionsForm);
2187
-
2188
-
2189
- });
2190
-
2191
-
2192
- //]]>
2193
- </script>
2194
-
2195
- <?php
2196
-
2197
- }
2198
-
2199
- }
2200
- add_action ( 'admin_head', 'dbem_admin_options_script' );
2201
-
2202
- function dbem_rss_link($justurl = 0, $echo = 1, $text = "RSS") {
2203
- if (strpos ( $justurl, "=" )) {
2204
- // allows the use of arguments without breaking the legacy code
2205
- $defaults = array ('justurl' => 0, 'echo' => 1, 'text' => 'RSS' );
2206
-
2207
- $r = wp_parse_args ( $justurl, $defaults );
2208
- extract ( $r, EXTR_SKIP );
2209
- $justurl = $r ['justurl'];
2210
- $echo = $r ['echo'];
2211
- $text = $r ['text'];
2212
- }
2213
- if ($text == '')
2214
- $text = "RSS";
2215
- $rss_title = get_option ( 'dbem_events_page_title' );
2216
- $url = get_bloginfo ( 'wpurl' ) . "/?dbem_rss=main";
2217
- $link = "<a href='$url'>$text</a>";
2218
-
2219
- if ($justurl)
2220
- $result = $url;
2221
- else
2222
- $result = $link;
2223
- if ($echo)
2224
- echo $result;
2225
- else
2226
- return $result;
2227
- }
2228
-
2229
- function dbem_rss_link_shortcode($atts) {
2230
- extract ( shortcode_atts ( array ('justurl' => 0, 'text' => 'RSS' ), $atts ) );
2231
- $result = dbem_rss_link ( "justurl=$justurl&echo=0&text=$text" );
2232
- return $result;
2233
- }
2234
- add_shortcode ( 'events_rss_link', 'dbem_rss_link_shortcode' );
2235
-
2236
- function dbem_rss() {
2237
- if (isset ( $_REQUEST ['dbem_rss'] ) && $_REQUEST ['dbem_rss'] == 'main') {
2238
- header ( "Content-type: text/xml" );
2239
- echo "<?xml version='1.0'?>\n";
2240
-
2241
- $events_page_id = get_option ( 'dbem_events_page' );
2242
- $events_page_link = get_permalink ( $events_page_id );
2243
- if (stristr ( $events_page_link, "?" ))
2244
- $joiner = "&amp;";
2245
- else
2246
- $joiner = "?";
2247
-
2248
- ?>
2249
- <rss version="2.0">
2250
- <channel>
2251
- <title><?php
2252
- echo get_option ( 'dbem_rss_main_title' );
2253
- ?></title>
2254
- <link><?php
2255
- echo $events_page_link;
2256
- ?></link>
2257
- <description><?php
2258
- echo get_option ( 'dbem_rss_main_description' );
2259
- ?></description>
2260
- <docs>
2261
- http://blogs.law.harvard.edu/tech/rss
2262
- </docs>
2263
- <generator>
2264
- Weblog Editor 2.0
2265
- </generator>
2266
- <?php
2267
- $title_format = get_option ( 'dbem_rss_title_format' );
2268
- $description_format = str_replace ( ">", "&gt;", str_replace ( "<", "&lt;", get_option ( 'dbem_rss_description_format' ) ) );
2269
- $events = dbem_get_events ( 5 );
2270
- foreach ( $events as $event ) {
2271
- $title = dbem_replace_placeholders ( $title_format, $event, "rss" );
2272
- $description = dbem_replace_placeholders ( $description_format, $event, "rss" );
2273
- echo "<item>";
2274
- echo "<title>$title</title>\n";
2275
- echo "<link>$events_page_link" . $joiner . "event_id=" . $event ['event_id'] . "</link>\n ";
2276
- echo "<description>$description </description>\n";
2277
- echo "</item>";
2278
- }
2279
- ?>
2280
-
2281
- </channel>
2282
- </rss>
2283
-
2284
- <?php
2285
- die ();
2286
- }
2287
- }
2288
- add_action ( 'init', 'dbem_rss' );
2289
- function substitute_rss($data) {
2290
- if (isset ( $_REQUEST ['event_id'] ))
2291
- return get_bloginfo ( 'wpurl' ) . "/?dbem_rss=main";
2292
- else
2293
- return $data;
2294
- }
2295
- function dbem_general_css() {
2296
- $base_url = get_bloginfo ( 'wpurl' );
2297
- echo "<link rel='stylesheet' href='$base_url/wp-content/plugins/events-manager/events_manager.css' type='text/css'/>";
2298
-
2299
- }
2300
- add_action ( 'wp_head', 'dbem_general_css' );
2301
- add_action ( 'admin_head', 'dbem_general_css' );
2302
- //add_filter('feed_link','substitute_rss')
2303
-
2304
-
2305
- // TODO roba da mettere nell'ordine giusto
2306
- function dbem_delete_event($event_id) {
2307
- global $wpdb;
2308
- $table_name = $wpdb->prefix . EVENTS_TBNAME;
2309
- $sql = "DELETE FROM $table_name WHERE event_id = '$event_id';";
2310
- $wpdb->query ( $sql );
2311
-
2312
- }
2313
- add_filter ( 'favorite_actions', 'dbem_favorite_menu' );
2314
-
2315
- function dbem_favorite_menu($actions) {
2316
- // add quick link to our favorite plugin
2317
- $actions ['admin.php?page=new_event'] = array (__ ( 'Add an event', 'dbem' ), MIN_CAPABILITY );
2318
- return $actions;
2319
- }
2320
-
2321
- ////////////////////////////////////
2322
- // WP 2.7 options registration
2323
- function dbem_options_register() {
2324
- $options = array ('dbem_events_page', 'dbem_display_calendar_in_events_page', 'dbem_use_event_end', 'dbem_event_list_item_format_header', 'dbem_event_list_item_format', 'dbem_event_list_item_format_footer', 'dbem_event_page_title_format', 'dbem_single_event_format', 'dbem_list_events_page', 'dbem_events_page_title', 'dbem_no_events_message', 'dbem_location_page_title_format', 'dbem_location_baloon_format', 'dbem_single_location_format', 'dbem_location_event_list_item_format', 'dbem_location_no_events_message', 'dbem_gmap_is_active', 'dbem_rss_main_title', 'dbem_rss_main_description', 'dbem_rss_title_format', 'dbem_rss_description_format', 'dbem_gmap_key', 'dbem_map_text_format', 'dbem_rsvp_mail_notify_is_active', 'dbem_contactperson_email_body', 'dbem_respondent_email_body', 'dbem_mail_sender_name', 'dbem_smtp_username', 'dbem_smtp_password', 'dbem_default_contact_person', 'dbem_mail_sender_address', 'dbem_mail_receiver_address', 'dbem_smtp_host', 'dbem_rsvp_mail_send_method', 'dbem_rsvp_mail_port', 'dbem_rsvp_mail_SMTPAuth', 'dbem_image_max_width', 'dbem_image_max_height', 'dbem_image_max_size', 'dbem_full_calendar_event_format', 'dbem_use_select_for_locations', 'dbem_attributes_enabled', 'dbem_recurrence_enabled','dbem_rsvp_enabled','dbem_categories_enabled');
2325
- foreach ( $options as $opt ) {
2326
- register_setting ( 'dbem-options', $opt, '' );
2327
- }
2328
-
2329
- }
2330
- add_action ( 'admin_init', 'dbem_options_register' );
2331
-
2332
- function dbem_alert_events_page() {
2333
- $events_page_id = get_option ( 'dbem_events_page' );
2334
- if (strpos ( $_SERVER ['SCRIPT_NAME'], 'page.php' ) && isset ( $_GET ['action'] ) && $_GET ['action'] == 'edit' && isset ( $_GET ['post'] ) && $_GET ['post'] == "$events_page_id") {
2335
- $message = sprintf ( __ ( "This page corresponds to <strong>Events Manager</strong> events page. Its content will be overriden by <strong>Events Manager</strong>. If you want to display your content, you can can assign another page to <strong>Events Manager</strong> in the the <a href='%s'>Settings</a>. ", 'dbem' ), 'admin.php?page=events-manager-options' );
2336
- $notice = "<div class='error'><p>$message</p></div>";
2337
- echo $notice;
2338
- }
2339
-
2340
- }
2341
- add_action ( 'admin_notices', 'dbem_alert_events_page' );
2342
-
2343
- /* Marcus Begin Edit */
2344
- //This adds the tinymce editor
2345
- function dbem_tinymce(){
2346
- add_action( 'admin_print_footer_scripts', 'wp_tiny_mce', 25 );
2347
- wp_enqueue_script('post');
2348
- if ( user_can_richedit() )
2349
- wp_enqueue_script('editor');
2350
- add_thickbox();
2351
- wp_enqueue_script('media-upload');
2352
- wp_enqueue_script('word-count');
2353
- wp_enqueue_script('quicktags');
2354
- }
2355
- add_action ( 'admin_init', 'dbem_tinymce' );
2356
- /* Marcus End Edit */
2357
-
2358
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
dbem_global_map.js DELETED
@@ -1,108 +0,0 @@
1
- $j=jQuery.noConflict();
2
- // console.log("eventful: " + eventful + " scope " + scope);
3
-
4
- $j(document.body).unload(function() {
5
- if (GBrowserIsCompatible()) {
6
- GUnload();
7
- }
8
- });
9
-
10
-
11
- $j(document).ready(function() {
12
- loadMapScript(GMapsKey);
13
- });
14
-
15
-
16
-
17
- function loadGMap() {
18
- if (GBrowserIsCompatible()) {
19
-
20
- var locations;
21
- $j.getJSON(document.URL,{ajax: 'true', query:'GlobalMapData', eventful:eventful}, function(data){
22
- locations = data.locations;
23
- var latitudes = new Array();
24
- var longitudes = new Array();
25
- var max_latitude = -500.1;
26
- var min_latitude = 500.1;
27
- var max_longitude = -500.1;
28
- var min_longitude = 500.1;
29
-
30
- map = new GMap2(document.getElementById("dbem_global_map"));
31
- map.setCenter(new GLatLng(45.4213477,10.952397), 3);
32
-
33
- $j.each(locations, function(i, item){
34
- latitudes.push(item.location_latitude);
35
- longitudes.push(item.location_longitude);
36
- if (parseFloat(item.location_latitude) > max_latitude)
37
- max_latitude = parseFloat(item.location_latitude);
38
- if (parseFloat(item.location_latitude) < min_latitude)
39
- min_latitude = parseFloat(item.location_latitude);
40
- if (parseFloat(item.location_longitude) > max_longitude)
41
- max_longitude = parseFloat(item.location_longitude);
42
- if (parseFloat(item.location_longitude) < min_longitude)
43
- min_longitude = parseFloat(item.location_longitude);
44
-
45
-
46
- });
47
-
48
- //console.log("Latitudes: " + latitudes + " MAX: " + max_latitude + " MIN: " + min_latitude);
49
- //console.log("Longitudes: " + longitudes + " MAX: " + max_longitude + " MIN: " + min_longitude);
50
-
51
- center_lat = min_latitude + (max_latitude - min_latitude)/2;
52
- center_lon = min_longitude + (max_longitude - min_longitude)/2;
53
- //console.log("center: " + center_lat + " - " + center_lon) + min_longitude;
54
-
55
- lat_interval = max_latitude - min_latitude;
56
-
57
- //vertical compensation to fit in the markers
58
- vertical_compensation = lat_interval * 0.1;
59
-
60
- var locationsBound = new GLatLngBounds(new GLatLng(max_latitude + vertical_compensation,min_longitude),new GLatLng(min_latitude,max_longitude) );
61
- //console.log(locationsBound);
62
- var locationsZoom = map.getBoundsZoomLevel(locationsBound);
63
- map.setCenter(new GLatLng(center_lat + vertical_compensation,center_lon), locationsZoom);
64
- var letters = new Array('A','B','C','D','E','F','G','H');
65
- var customIcon = new GIcon(G_DEFAULT_ICON);
66
-
67
- $j.each(locations, function(i, item){
68
- var letter = letters[i];
69
-
70
- customIcon.image = "http://www.google.com/mapfiles/marker" + letter + ".png";
71
-
72
- markerOption = { icon:customIcon };
73
- var point = new GLatLng(parseFloat(item.location_latitude), parseFloat(item.location_longitude));
74
- var marker = new GMarker(point, markerOption);
75
- map.addOverlay(marker);
76
- var li_element = "<li id='location-"+item.location_id+"' style='list-style-type: upper-alpha'><a >"+ item.location_name+"</a></li>";
77
- $j('ol#dbem_locations_list').append(li_element);
78
- $j('li#location-'+item.location_id+' a').click(function(){
79
- displayLocationInfo(marker, item);
80
- });
81
- GEvent.addListener(marker, "click", function() {
82
- displayLocationInfo(marker, item);
83
-
84
- });
85
-
86
-
87
- });
88
-
89
-
90
-
91
- });
92
-
93
-
94
- }
95
- }
96
-
97
-
98
- function loadMapScript(key) {
99
- var script = document.createElement("script");
100
- script.setAttribute("src", "http://maps.google.com/maps?file=api&v=2.x&key=" + key + "&c&async=2&callback=loadGMap");
101
- script.setAttribute("type", "text/javascript");
102
- document.documentElement.firstChild.appendChild(script);
103
- }
104
-
105
- function displayLocationInfo(marker, location) {
106
- var location_infos = "<strong>"+ location.location_name +"</strong><br/>" + location.location_address + ", " + location.location_town + "<br/><small><a href='" + events_page + "&location_id=" + location.location_id + "'>Details<a>";
107
- window.map.openInfoWindowHtml(marker.getLatLng(),location.location_baloon, {pixelOffset: new GSize(0,-32)});
108
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
dbem_locations.php DELETED
@@ -1,726 +0,0 @@
1
- <?php
2
- $feedback_message = "";
3
-
4
- $location_required_fields = array("location_name" => __('The location name', 'dbem'), "location_address" => __('The location address', 'dbem'), "location_town" => __('The location town', 'dbem'));
5
-
6
-
7
- add_action('init', 'dbem_intercept_locations_actions');
8
- function dbem_intercept_locations_actions() {
9
- if(isset($_GET['page']) && $_GET['page'] == "locations") {
10
- if(isset($_GET['doaction2']) && $_GET['doaction2'] == "Delete") {
11
- if(isset($_GET['action2']) && $_GET['action2'] == "delete") {
12
- $locations = $_GET['locations'];
13
- foreach($locations as $location_ID) {
14
- dbem_delete_location($location_ID);
15
- }
16
- }
17
- }
18
- }
19
- }
20
-
21
- function dbem_locations_page() {
22
-
23
- if(isset($_GET['action']) && $_GET['action'] == "edit") {
24
- // edit location
25
- $location_id = $_GET['location_ID'];
26
- $location = dbem_get_location($location_id);
27
- dbem_locations_edit_layout($location);
28
- } else {
29
- if(isset($_POST['action']) && $_POST['action'] == "editedlocation") {
30
-
31
- // location update required
32
- $location = array();
33
- $location['location_id'] = $_POST['location_ID'];
34
- $location['location_name'] = $_POST['location_name'];
35
- $location['location_address'] = $_POST['location_address'];
36
- $location['location_town'] = $_POST['location_town'];
37
- $location['location_latitude'] = $_POST['location_latitude'];
38
- $location['location_longitude'] = $_POST['location_longitude'];
39
- $location['location_description'] = $_POST['content'];
40
-
41
- if(empty($location['location_latitude'])) {
42
- $location['location_latitude'] = 0;
43
- $location['location_longitude'] = 0;
44
- }
45
-
46
- $validation_result = dbem_validate_location($location);
47
- if ($validation_result == "OK") {
48
-
49
- dbem_update_location($location);
50
-
51
- if ($_FILES['location_image']['size'] > 0 )
52
- dbem_upload_location_picture($location);
53
- $message = __('The location has been updated.', 'dbem');
54
-
55
- $locations = dbem_get_locations();
56
- dbem_locations_table_layout($locations, $message);
57
- } else {
58
- $message = $validation_result;
59
- dbem_locations_edit_layout($location, $message);
60
- }
61
- } elseif(isset($_POST['action']) && $_POST['action'] == "addlocation") {
62
- $location = array();
63
- $location['location_name'] = $_POST['location_name'];
64
- $location['location_address'] = $_POST['location_address'];
65
- $location['location_town'] = $_POST['location_town'];
66
- $location['location_latitude'] = $_POST['location_latitude'];
67
- $location['location_longitude'] = $_POST['location_longitude'];
68
- $location['location_description'] = $_POST['content'];
69
- $validation_result = dbem_validate_location($location);
70
- if ($validation_result == "OK") {
71
- $new_location = dbem_insert_location($location);
72
- // uploading the image
73
-
74
- if ($_FILES['location_image']['size'] > 0 ) {
75
- dbem_upload_location_picture($new_location);
76
- }
77
-
78
-
79
-
80
-
81
-
82
-
83
- // -------------
84
-
85
- //RESETME $message = __('The location has been added.', 'dbem');
86
- $locations = dbem_get_locations();
87
- dbem_locations_table_layout($locations, null,$message);
88
- } else {
89
- $message = $validation_result;
90
- $locations = dbem_get_locations();
91
-
92
- dbem_locations_table_layout($locations, $location, $message);
93
- }
94
-
95
-
96
-
97
- } else {
98
- // no action, just a locations list
99
- $locations = dbem_get_locations();
100
- dbem_locations_table_layout($locations, $message);
101
- }
102
- }
103
- }
104
-
105
- function dbem_locations_edit_layout($location, $message = "") {
106
- ?>
107
- <div class='wrap'>
108
- <div id="poststuff">
109
- <div id='icon-edit' class='icon32'>
110
- <br/>
111
- </div>
112
-
113
- <h2><?php echo __('Edit location', 'dbem') ?></h2>
114
-
115
- <?php if($message != "") : ?>
116
- <div id='message' class='updated fade below-h2' style='background-color: rgb(255, 251, 204);'>
117
- <p><?php echo $message ?></p>
118
- </div>
119
- <?php endif; ?>
120
- <div id='ajax-response'></div>
121
-
122
- <form enctype='multipart/form-data' name='editcat' id='editcat' method='post' action='admin.php?page=locations' class='validate'>
123
- <input type='hidden' name='action' value='editedlocation' />
124
- <input type='hidden' name='location_ID' value='<?php echo $location['location_id'] ?>'/>
125
-
126
- <table class='form-table'>
127
- <tr class='form-field form-required'>
128
- <th scope='row' valign='top'><label for='location_name'><?php echo __('Location name', 'dbem') ?></label></th>
129
- <td><input name='location_name' id='location-name' type='text' value='<?php echo $location['location_name'] ?>' size='40' /><br />
130
- <?php echo __('The name of the location', 'dbem') ?></td>
131
- </tr>
132
-
133
- <tr class='form-field'>
134
- <th scope='row' valign='top'><label for='location_address'><?php echo __('Location address', 'dbem') ?></label></th>
135
- <td><input name='location_address' id='location-address' type='text' value='<?php echo $location['location_address'] ?>' size='40' /><br />
136
- <?php echo __('The address of the location', 'dbem') ?>.</td>
137
-
138
- </tr>
139
-
140
- <tr class='form-field'>
141
- <th scope='row' valign='top'> <label for='location_town'><?php echo __('Location town', 'dbem') ?></label></th>
142
- <td><input name='location_town' id='location-town' type='text' value='<?php echo $location['location_town'] ?>' size='40' /><br />
143
- <?php echo __('The town where the location is located', 'dbem') ?>.</td>
144
-
145
- </tr>
146
-
147
- <tr style='display:none;'>
148
- <td>Coordinates</td>
149
- <td><input id='location-latitude' name='location_latitude' id='location_latitude' type='text' value='<?php echo $location['location_latitude'] ?>' size='15' />
150
- <input id='location-longitude' name='location_longitude' id='location_longitude' type='text' value='<?php echo $location['location_longitude'] ?>' size='15' /></td>
151
- </tr>
152
-
153
- <?php
154
- $gmap_is_active = get_option('dbem_gmap_is_active');
155
- if ($gmap_is_active) {
156
- ?>
157
- <tr>
158
- <th scope='row' valign='top'><label for='location_map'><?php echo __('Location map', 'dbem') ?></label></th>
159
- <td>
160
- <div id='map-not-found' style='width: 450px; font-size: 140%; text-align: center; margin-top: 100px; display: hide'><p><?php echo __('Map not found') ?></p></div>
161
- <div id='event-map' style='width: 450px; height: 300px; background: green; display: hide; margin-right:8px'></div>
162
- </td>
163
- </tr>
164
- <?php
165
- }
166
- ?>
167
- <tr class='form-field'>
168
- <th scope='row' valign='top'><label for='location_description'><?php _e('Location description', 'dbem') ?></label></th>
169
- <td>
170
- <div class="inside">
171
- <div id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>" class="postarea">
172
- <?php the_editor($location['location_description']); ?>
173
- </div>
174
- <?php _e('A description of the Location. You may include any kind of info here.', 'dbem') ?>
175
- </div>
176
- </td>
177
- </tr>
178
- <tr class='form-field'>
179
- <th scope='row' valign='top'><label for='location_picture'><?php echo __('Location image', 'dbem') ?></label></th>
180
- <td>
181
- <?php if ($location['location_image_url'] != '') : ?>
182
- <img src='<?php echo $location['location_image_url'] ?>' alt='<?php echo $location['location_name'] ?>'/>
183
- <?php else : ?>
184
- <?php echo __('No image uploaded for this location yet', 'debm') ?>
185
- <?php endif; ?>
186
- </td>
187
- </tr>
188
- <tr>
189
- <th scope='row' valign='top'><label for='location_image'><?php echo __('Upload/change picture', 'dbem') ?></label></th>
190
- <td><input id='location-image' name='location_image' id='location_image' type='file' size='40' /></td>
191
- </tr>
192
- </table>
193
- <p class='submit'><input type='submit' class='button-primary' name='submit' value='<?php echo __('Update location', 'dbem') ?>' /></p>
194
- </form>
195
- </div>
196
- </div>
197
- <?php
198
- }
199
-
200
- function dbem_locations_table_layout($locations, $new_location, $message = "") {
201
- $destination = get_bloginfo('wpurl')."/wp-admin/admin.php";
202
- $new_location = (is_array($new_location)) ? $new_location : array();
203
- ob_start();
204
- ?>
205
- <div class='wrap nosubsub'>
206
- <div id='icon-edit' class='icon32'>
207
- <br/>
208
- </div>
209
- <h2><?php echo __('Locations', 'dbem') ?></h2>
210
-
211
- <?php if($message != "") : ?>
212
- <div id='message' class='updated fade below-h2' style='background-color: rgb(255, 251, 204);'>
213
- <p><?php echo $message ?></p>
214
- </div>
215
- <?php endif; ?>
216
- <div id='col-container'>
217
- <div id='col-right'>
218
- <div class='col-wrap'>
219
- <form id='bookings-filter' method='get' action='<?php echo $destination ?>'>
220
- <input type='hidden' name='page' value='locations'/>
221
- <input type='hidden' name='action' value='edit_location'/>
222
- <input type='hidden' name='event_id' value='<?php echo $event_id ?>'/>
223
-
224
- <?php if (count($locations)>0) : ?>
225
- <table class='widefat'>
226
- <thead>
227
- <tr>
228
- <th class='manage-column column-cb check-column' scope='col'><input type='checkbox' class='select-all' value='1'/></th>
229
- <th><?php echo __('Name', 'dbem') ?></th>
230
- <th><?php echo __('Address', 'dbem') ?></th>
231
- <th><?php echo __('Town', 'dbem') ?></th>
232
- </tr>
233
- </thead>
234
- <tfoot>
235
- <tr>
236
- <th class='manage-column column-cb check-column' scope='col'><input type='checkbox' class='select-all' value='1'/></th>
237
- <th><?php echo __('Name', 'dbem') ?></th>
238
- <th><?php echo __('Address', 'dbem') ?></th>
239
- <th><?php echo __('Town', 'dbem') ?></th>
240
- </tr>
241
- </tfoot>
242
- <tbody>
243
- <?php foreach ($locations as $this_location) : ?>
244
- <tr>
245
- <td><input type='checkbox' class ='row-selector' value='<?php echo $this_location['location_id'] ?>' name='locations[]'/></td>
246
- <td><a href='<?php echo get_bloginfo('wpurl') ?>/wp-admin/admin.php?page=locations&amp;action=edit&amp;location_ID=<?php echo $this_location['location_id'] ?>'><?php echo $this_location['location_name'] ?></a></td>
247
- <td><?php echo $this_location['location_address'] ?></td>
248
- <td><?php echo $this_location['location_town'] ?></td>
249
- </tr>
250
- <?php endforeach; ?>
251
- </tbody>
252
-
253
- </table>
254
-
255
- <div class='tablenav'>
256
- <div class='alignleft actions'>
257
- <input type='hidden' name='action2' value='delete'/>
258
- <input class='button-secondary action' type='submit' name='doaction2' value='Delete'/>
259
- <br class='clear'/>
260
- </div>
261
- <br class='clear'/>
262
- </div>
263
- <?php else: ?>
264
- <p><?php echo __('No venues have been inserted yet!', 'dbem') ?></p>
265
- <?php endif; ?>
266
- </form>
267
- </div>
268
- </div> <!-- end col-right -->
269
-
270
- <div id='col-left'>
271
- <div class='col-wrap'>
272
- <div class='form-wrap'>
273
- <div id='ajax-response'/>
274
- <h3><?php echo __('Add location', 'dbem') ?></h3>
275
- <form enctype='multipart/form-data' name='addlocation' id='addlocation' method='post' action='admin.php?page=locations' class='add:the-list: validate'>
276
-
277
- <input type='hidden' name='action' value='addlocation' />
278
- <div class='form-field form-required'>
279
- <label for='location_name'><?php echo __('Location name', 'dbem') ?></label>
280
- <input id='location-name' name='location_name' id='location_name' type='text' value='<?php echo $new_location['location_name'] ?>' size='40' />
281
- <p><?php echo __('The name of the location', 'dbem') ?>.</p>
282
- </div>
283
-
284
- <div class='form-field'>
285
- <label for='location_address'><?php echo __('Location address', 'dbem') ?></label>
286
- <input id='location-address' name='location_address' id='location_address' type='text' value='<?php echo $new_location['location_address'] ?>' size='40' />
287
- <p><?php echo __('The address of the location', 'dbem') ?>.</p>
288
- </div>
289
-
290
- <div class='form-field '>
291
- <label for='location_town'><?php echo __('Location town', 'dbem') ?></label>
292
- <input id='location-town' name='location_town' id='location_town' type='text' value='<?php echo $new_location['location_town'] ?>' size='40' />
293
- <p><?php echo __('The town of the location', 'dbem') ?>.</p>
294
- </div>
295
-
296
- <div class='form-field' style='display:none;'>
297
- <label for='location_latitude'>LAT</label>
298
- <input id='location-latitude' name='location_latitude' type='text' value='<?php echo $new_location['location_latitude'] ?>' size='40' />
299
- </div>
300
- <div class='form-field' style='display:none;'>
301
- <label for='location_longitude'>LONG</label>
302
- <input id='location-longitude' name='location_longitude' type='text' value='<?php echo $new_location['location_longitude'] ?>' size='40' />
303
- </div>
304
-
305
- <div class='form-field'>
306
- <label for='location_image'><?php echo __('Location image', 'dbem') ?></label>
307
- <input id='location-image' name='location_image' id='location_image' type='file' size='35' />
308
- <p><?php echo __('Select an image to upload', 'dbem') ?>.</p>
309
- </div>
310
- <?php
311
- $gmap_is_active = get_option('dbem_gmap_is_active');
312
- if ($gmap_is_active) :
313
- ?>
314
- <div id='map-not-found' style='width: 450px; font-size: 140%; text-align: center; margin-top: 20px; display: hide'><p><?php echo __('Map not found') ?></p></div>
315
- <div id='event-map' style='width: 450px; height: 300px; background: green; display: hide; margin-right:8px'></div>
316
- <br style='clear:both;' />
317
- <?php endif; ?>
318
- <div id="poststuff">
319
- <label for='location_description'><?php _e('Location description', 'dbem') ?></label>
320
- <div class="inside">
321
- <div id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>" class="postarea">
322
- <?php the_editor($new_location['location_description']); ?>
323
- </div>
324
- <?php _e('A description of the Location. You may include any kind of info here.', 'dbem') ?>
325
- </div>
326
- </div>
327
- <p class='submit'><input type='submit' class='button' name='submit' value='<?php echo __('Add location', 'dbem') ?>' /></p>
328
- </form>
329
-
330
- </div>
331
- </div>
332
- </div> <!-- end col-left -->
333
- </div>
334
- </div>
335
- <?php
336
- echo ob_get_clean();
337
- }
338
-
339
-
340
-
341
- function dbem_get_locations($eventful = false) {
342
- global $wpdb;
343
- $locations_table = $wpdb->prefix.LOCATIONS_TBNAME;
344
- $events_table = $wpdb->prefix.EVENTS_TBNAME;
345
- if ($eventful == 'true') {
346
- $sql = "SELECT * from $locations_table JOIN $events_table ON $locations_table.location_id = $events_table.location_id";
347
- } else {
348
- $sql = "SELECT location_id, location_address, location_name, location_town,location_latitude, location_longitude
349
- FROM $locations_table ORDER BY location_name";
350
- }
351
-
352
- $locations = $wpdb->get_results($sql, ARRAY_A);
353
- return $locations;
354
-
355
- }
356
-
357
- function dbem_get_location($location_id) {
358
- global $wpdb;
359
- $locations_table = $wpdb->prefix.LOCATIONS_TBNAME;
360
- $sql = "SELECT * FROM $locations_table WHERE location_id ='$location_id'";
361
- $location = $wpdb->get_row($sql, ARRAY_A);
362
- $location['location_image_url'] = dbem_image_url_for_location_id($location['location_id']);
363
- return $location;
364
-
365
- }
366
-
367
- function dbem_image_url_for_location_id($location_id) {
368
- $file_name= ABSPATH.IMAGE_UPLOAD_DIR."/location-".$location_id;
369
- $mime_types = array('gif','jpg','png');foreach($mime_types as $type) {
370
- $file_path = "$file_name.$type";
371
- if (file_exists($file_path)) {
372
- $result = get_bloginfo('wpurl')."/".IMAGE_UPLOAD_DIR."/location-$location_id.$type";
373
- return $result;
374
- }
375
- }
376
- return '';
377
- }
378
-
379
- function dbem_get_identical_location($location) {
380
- global $wpdb;
381
- $locations_table = $wpdb->prefix.LOCATIONS_TBNAME;
382
- //$sql = "SELECT * FROM $locations_table WHERE location_name ='".$location['location_name']."' AND location_address ='".$location['location_address']."' AND location_town ='".$location['location_town']."';";
383
- $prepared_sql=$wpdb->prepare("SELECT * FROM $locations_table WHERE location_name = %s AND location_address = %s AND location_town = %s", stripcslashes($location['location_name']), stripcslashes($location['location_address']), stripcslashes($location['location_town']) );
384
- //$wpdb->show_errors(true);
385
- $cached_location = $wpdb->get_row($prepared_sql, ARRAY_A);
386
- return $cached_location;
387
-
388
- }
389
-
390
- function dbem_validate_location($location) {
391
- global $location_required_fields;
392
- $troubles = "";
393
- foreach ($location_required_fields as $field => $description) {
394
- if ($location[$field] == "" ) {
395
- $troubles .= "<li>".$description.__(" is missing!", "dbem")."</li>";
396
- }
397
- }
398
- if ($_FILES['location_image']['size'] > 0 ) {
399
- if (is_uploaded_file($_FILES['location_image']['tmp_name'])) {
400
- $mime_types = array(1 => 'gif', 2 => 'jpg', 3 => 'png');
401
- $maximum_size = get_option('dbem_image_max_size');
402
- if ($_FILES['location_image']['size'] > $maximum_size)
403
- $troubles = "<li>".__('The image file is too big! Maximum size:', 'dbem')." $maximum_size</li>";
404
- list($width, $height, $type, $attr) = getimagesize($_FILES['location_image']['tmp_name']);
405
- $maximum_width = get_option('dbem_image_max_width');
406
- $maximum_height = get_option('dbem_image_max_height');
407
- if (($width > $maximum_width) || ($height > $maximum_height))
408
- $troubles .= "<li>". __('The image is too big! Maximum size allowed:')." $maximum_width x $maximum_height</li>";
409
- if (($type!=1) && ($type!=2) && ($type!=3))
410
- $troubles .= "<li>".__('The image is in a wrong format!')."</li>";
411
- }
412
- }
413
-
414
- if ($troubles == "")
415
- return "OK";
416
- else {
417
- $message = __('Ach, some problems here:', 'dbem')."<ul>\n$troubles</ul>";
418
- return $message;
419
- }
420
- }
421
-
422
- function dbem_update_location($location) {
423
- global $wpdb;
424
- $locations_table = $wpdb->prefix.LOCATIONS_TBNAME;
425
- $sql="UPDATE ".$locations_table.
426
- " SET location_name='".$location['location_name']."', ".
427
- "location_address='".$location['location_address']."',".
428
- "location_town='".$location['location_town']."', ".
429
- "location_latitude=".$location['location_latitude'].",".
430
- "location_longitude=".$location['location_longitude'].",".
431
- "location_description='".$location['location_description']."' ".
432
- "WHERE location_id='".$location['location_id']."';";
433
- $wpdb->query($sql);
434
-
435
- }
436
-
437
- function dbem_insert_location($location) {
438
-
439
- global $wpdb;
440
- $table_name = $wpdb->prefix.LOCATIONS_TBNAME;
441
- // if GMap is off the hidden fields are empty, so I add a custom value to make the query work
442
- if (empty($location['location_longitude']))
443
- $location['location_longitude'] = 0;
444
- if (empty($location['location_latitude']))
445
- $location['location_latitude'] = 0;
446
- $sql = "INSERT INTO ".$table_name." (location_name, location_address, location_town, location_latitude, location_longitude, location_description)
447
- VALUES ('".$location['location_name']."','".$location['location_address']."','".$location['location_town']."',".$location['location_latitude'].",".$location['location_longitude'].",'".$location['location_description']."')";
448
- $wpdb->query($sql);
449
- $new_location = dbem_get_location(mysql_insert_id());
450
-
451
- return $new_location;
452
- }
453
-
454
- function dbem_delete_location($location) {
455
- global $wpdb;
456
- $table_name = $wpdb->prefix.LOCATIONS_TBNAME;
457
- $sql = "DELETE FROM $table_name WHERE location_id = '$location';";
458
- $wpdb->query($sql);
459
- dbem_delete_image_files_for_location_id($location);
460
- }
461
-
462
- function dbem_location_has_events($location_id) {
463
- global $wpdb;
464
- $events_table = $wpdb->prefix.EVENTS_TBNAME;
465
- $sql = "SELECT event_id FROM $events_table WHERE location_id = $location_id";
466
- $affected_events = $wpdb->get_results($sql);
467
- return (count($affected_events) > 0);
468
- }
469
-
470
- function dbem_upload_location_picture($location) {
471
- if(!file_exists("../".IMAGE_UPLOAD_DIR))
472
- mkdir("../".IMAGE_UPLOAD_DIR, 0777);
473
- dbem_delete_image_files_for_location_id($location['location_id']);
474
- $mime_types = array(1 => 'gif', 2 => 'jpg', 3 => 'png');
475
- list($width, $height, $type, $attr) = getimagesize($_FILES['location_image']['tmp_name']);
476
- $image_path = "../".IMAGE_UPLOAD_DIR."/location-".$location['location_id'].".".$mime_types[$type];
477
- if (!move_uploaded_file($_FILES['location_image']['tmp_name'], $image_path))
478
- $msg = "<p>".__('The image could not be loaded','dbem')."</p>";
479
- }
480
- function dbem_delete_image_files_for_location_id($location_id) {
481
- $file_name= "../".IMAGE_UPLOAD_DIR."/location-".$location_id;
482
- $mime_types = array(1 => 'gif', 2 => 'jpg', 3 => 'png');
483
- foreach($mime_types as $type) {
484
- if (file_exists($file_name.".".$type))
485
- unlink($file_name.".".$type);
486
- }
487
- }
488
-
489
-
490
-
491
- function dbem_global_map($atts) {
492
- if (get_option('dbem_gmap_is_active') == '1') {
493
- extract(shortcode_atts(array(
494
- 'eventful' => "false",
495
- 'scope' => 'all',
496
- 'width' => 450,
497
- 'height' => 300
498
- ), $atts));
499
- $events_page = dbem_get_events_page(true, false);
500
- $gmaps_key = get_option('dbem_gmap_key');
501
- $result = "";
502
- $result .= "<div id='dbem_global_map' style='width: {$width}px; height: {$height}px'>map</div>";
503
- $result .= "<script type='text/javascript'>
504
- <!--//
505
- eventful = $eventful;
506
- scope = '$scope';
507
- events_page = '$events_page';
508
- GMapsKey = '$gmaps_key';
509
- location_infos = '$location_infos'
510
- //-->
511
- </script>";
512
- $result .= "<script src='".get_bloginfo('wpurl')."/wp-content/plugins/events-manager/dbem_global_map.js' type='text/javascript'></script>";
513
- $result .= "<ol id='dbem_locations_list'></ol>";
514
-
515
- } else {
516
- $result = "";
517
- }
518
- return $result;
519
- }
520
- add_shortcode('locations_map', 'dbem_global_map');
521
-
522
- function dbem_replace_locations_placeholders($format, $location, $target="html") {
523
- $location_string = $format;
524
- preg_match_all("/#@?_?[A-Za-z]+/", $format, $placeholders);
525
- foreach($placeholders[0] as $result) {
526
- // echo "RESULT: $result <br>";
527
- // matches alla fields placeholder
528
- if (preg_match('/#_MAP/', $result)) {
529
- $map_div = dbem_single_location_map($location);
530
- $location_string = str_replace($result, $map_div , $location_string );
531
-
532
- }
533
- if (preg_match('/#_PASTEVENTS/', $result)) {
534
- $list = dbem_events_in_location_list($location, "past");
535
- $location_string = str_replace($result, $list , $location_string );
536
- }
537
- if (preg_match('/#_NEXTEVENTS/', $result)) {
538
- $list = dbem_events_in_location_list($location);
539
- $location_string = str_replace($result, $list , $location_string );
540
- }
541
- if (preg_match('/#_ALLEVENTS/', $result)) {
542
- $list = dbem_events_in_location_list($location, "all");
543
- $location_string = str_replace($result, $list , $location_string );
544
- }
545
-
546
- if (preg_match('/#_(NAME|ADDRESS|TOWN|PROVINCE|DESCRIPTION)/', $result)) {
547
- $field = "location_".ltrim(strtolower($result), "#_");
548
- $field_value = $location[$field];
549
-
550
- if ($field == "location_description") {
551
- if ($target == "html")
552
- $field_value = apply_filters('dbem_notes', $field_value);
553
- else
554
- if ($target == "map")
555
- $field_value = apply_filters('dbem_notes_map', $field_value);
556
- else
557
- $field_value = apply_filters('dbem_notes_rss', $field_value);
558
- } else {
559
- if ($target == "html")
560
- $field_value = apply_filters('dbem_general', $field_value);
561
- else
562
- $field_value = apply_filters('dbem_general_rss', $field_value);
563
- }
564
- $location_string = str_replace($result, $field_value , $location_string );
565
- }
566
-
567
- if (preg_match('/#_(IMAGE)/', $result)) {
568
-
569
- if($location['location_image_url'] != '')
570
- $location_image = "<img src='".$location['location_image_url']."' alt='".$location['location_name']."'/>";
571
- else
572
- $location_image = "";
573
- $location_string = str_replace($result, $location_image , $location_string );
574
- }
575
- if (preg_match('/#_(LOCATIONPAGEURL)/', $result)) {
576
- $events_page_link = dbem_get_events_page(true, false);
577
- if (stristr($events_page_link, "?"))
578
- $joiner = "&amp;";
579
- else
580
- $joiner = "?";
581
- $venue_page_link = dbem_get_events_page(true, false).$joiner."location_id=".$location['location_id'];
582
- $location_string = str_replace($result, $venue_page_link , $location_string );
583
- }
584
-
585
- }
586
- return $location_string;
587
-
588
- }
589
- function dbem_single_location_map($location) {
590
- $gmap_is_active = get_option('dbem_gmap_is_active');
591
- $map_text = addslashes(dbem_replace_locations_placeholders(get_option('dbem_location_baloon_format'), $location));
592
- if ($gmap_is_active) {
593
- $gmaps_key = get_option('dbem_gmap_key');
594
- $map_div = "<div id='dbem-location-map' style=' background: green; width: 400px; height: 300px'></div>" ;
595
- $map_div .= "<script type='text/javascript'>
596
- <!--//
597
- latitude = parseFloat('".$location['location_latitude']."');
598
- longitude = parseFloat('".$location['location_longitude']."');
599
- GMapsKey = '$gmaps_key';
600
- map_text = '$map_text';
601
- //-->
602
- </script>";
603
- $map_div .= "<script src='".get_bloginfo('wpurl')."/wp-content/plugins/events-manager/dbem_single_location_map.js' type='text/javascript'></script>";
604
- } else {
605
- $map_div = "";
606
- }
607
- return $map_div;
608
- }
609
-
610
- function dbem_events_in_location_list($location, $scope = "") {
611
- $events = dbem_get_events("",$scope,"","",$location['location_id']);
612
- $list = "";
613
- if (count($events) > 0) {
614
- foreach($events as $event)
615
- $list .= dbem_replace_placeholders(get_option('dbem_location_event_list_item_format'), $event);
616
- } else {
617
- $list = get_option('dbem_location_no_events_message');
618
- }
619
- return $list;
620
- }
621
-
622
- add_action ('admin_head', 'dbem_locations_autocomplete');
623
-
624
- function dbem_locations_autocomplete() {
625
- if ((isset($_REQUEST['action']) && $_REQUEST['action'] == 'edit_event') || (isset($_GET['page']) && $_GET['page'] == 'new_event')) {
626
- ?>
627
- <link rel="stylesheet" href="../wp-content/plugins/events-manager/js/jquery-autocomplete/jquery.autocomplete.css" type="text/css"/>
628
-
629
-
630
- <script src="../wp-content/plugins/events-manager/js/jquery-autocomplete/lib/jquery.bgiframe.min.js" type="text/javascript"></script>
631
- <script src="../wp-content/plugins/events-manager/js/jquery-autocomplete/lib/jquery.ajaxQueue.js" type="text/javascript"></script>
632
-
633
- <script src="../wp-content/plugins/events-manager/js/jquery-autocomplete/jquery.autocomplete.min.js" type="text/javascript"></script>
634
-
635
- <script type="text/javascript">
636
- //<![CDATA[
637
- $j=jQuery.noConflict();
638
-
639
-
640
- $j(document).ready(function() {
641
- var gmap_enabled = <?php echo get_option('dbem_gmap_is_active'); ?>;
642
-
643
- <?php if(!get_option('dbem_use_select_for_locations')) :?>
644
- $j("input#location-name").autocomplete("../wp-content/plugins/events-manager/locations-search.php", {
645
- width: 260,
646
- selectFirst: false,
647
- formatItem: function(row) {
648
- item = eval("(" + row + ")");
649
- return item.name+'<br/><small>'+item.address+' - '+item.town+ '</small>';
650
- },
651
- formatResult: function(row) {
652
- item = eval("(" + row + ")");
653
- return item.name;
654
- }
655
-
656
- });
657
- $j('input#location-name').result(function(event,data,formatted) {
658
- item = eval("(" + data + ")");
659
- $j('input#location-address').val(item.address);
660
- $j('input#location-town').val(item.town);
661
- if(gmap_enabled) {
662
- eventLocation = $j("input#location-name").val();
663
- eventTown = $j("input#location-town").val();
664
- eventAddress = $j("input#location-address").val();
665
-
666
- loadMap(eventLocation, eventTown, eventAddress)
667
- }
668
- });
669
- <?php else : ?>
670
- $j('#location-select-id').change(function() {
671
- $j.getJSON("/../wp-content/plugins/events-manager/locations-search.php",{id: $j(this).val()}, function(data){
672
- eventLocation = data.name;
673
- eventAddress = data.address;
674
- eventTown = data.town;
675
- $j("input[name='location-select-name']").val(eventLocation);
676
- $j("input[name='location-select-address']").val(eventAddress);
677
- $j("input[name='location-select-town']").val(eventTown);
678
- loadMap(eventLocation, eventTown, eventAddress)
679
-
680
- })
681
- });
682
- <?php endif; ?>
683
-
684
- });
685
- //]]>
686
-
687
- </script>
688
-
689
- <?php
690
-
691
- }
692
- }
693
-
694
-
695
- function dbem_cache_location($event){
696
- $related_location = dbem_get_location_by_name($event['location_name']);
697
- if (!$related_location) {
698
- dbem_insert_location_from_event($event);
699
- return;
700
- }
701
- if ($related_location->location_address != $event['location_address'] || $related_location->location_town != $event['location_town'] ) {
702
- dbem_insert_location_from_event($event);
703
- }
704
-
705
- }
706
-
707
- function dbem_get_location_by_name($name) {
708
- global $wpdb;
709
- $sql = "SELECT location_id,
710
- location_name,
711
- location_address,
712
- location_town
713
- FROM ".$wpdb->prefix.LOCATIONS_TBNAME.
714
- " WHERE location_name = '$name'";
715
- $event = $wpdb->get_row($sql);
716
-
717
- return $event;
718
- }
719
-
720
- function dbem_insert_location_from_event($event) {
721
- global $wpdb;
722
- $table_name = $wpdb->prefix.LOCATIONS_TBNAME;
723
- $wpdb->query("INSERT INTO ".$table_name." (location_name, location_address, location_town)
724
- VALUES ('".$event['location_name']."', '".$event['location_address']."','".$event['location_town']."')");
725
-
726
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
dbem_people.php DELETED
@@ -1,223 +0,0 @@
1
- <?php
2
- function dbem_people_page() {
3
- // Managing AJAX booking removal
4
- if(isset($_GET['action']) && $_GET['action'] == 'remove_booking') {
5
- if(isset($_POST['booking_id']))
6
- dbem_delete_booking($_POST['booking_id']);
7
-
8
- }
9
- ?>
10
-
11
- <div class='wrap'>
12
- <div id="icon-users" class="icon32"><br/></div>
13
- <h2>People</h2>
14
-
15
- <?php dbem_people_table(); ?>
16
- </div>
17
-
18
- <?php
19
- }
20
-
21
-
22
-
23
- add_action('init','dbem_ajax_actions');
24
- function dbem_ajax_actions() {
25
- if(isset($_GET['dbem_ajax_action']) && $_GET['dbem_ajax_action'] == 'booking_data') {
26
- if(isset($_GET['id']))
27
- echo "[ {bookedSeats:".dbem_get_booked_seats($_GET['id']).", availableSeats:".dbem_get_available_seats($_GET['id'])."}]";
28
- die();
29
- }
30
- if(isset($_GET['action']) && $_GET['action'] == 'printable'){
31
- if(isset($_GET['event_id']))
32
- dbem_printable_booking_report($_GET['event_id']);
33
- }
34
-
35
- if(isset($_GET['query']) && $_GET['query'] == 'GlobalMapData') {
36
- dbem_global_map_json($_GET['eventful']);
37
- die();
38
- }
39
-
40
-
41
- }
42
-
43
- function dbem_global_map_json($eventful = false) {
44
-
45
- $json = '{"locations":[';
46
- $locations = dbem_get_locations($eventful);
47
- $json_locations = array();
48
- foreach($locations as $location) {
49
-
50
- $json_location = array();
51
- foreach($location as $key => $value) {
52
- $json_location[] = '"'.$key.'":"'.$value.'"';
53
-
54
- }
55
- $json_location[] = '"location_baloon":"'.dbem_replace_locations_placeholders(get_option('dbem_location_baloon_format'), $location).'"';
56
- $json_locations[] = "{".implode(",",$json_location)."}";
57
- }
58
- $json .= implode(",", $json_locations);
59
- $json .= "]}" ;
60
- echo $json;
61
- }
62
-
63
-
64
-
65
-
66
- function dbem_printable_booking_report($event_id) {
67
- $event = dbem_get_event($event_id);
68
- $bookings = dbem_get_bookings_for($event_id);
69
- $available_seats = dbem_get_available_seats($event_id);
70
- $booked_seats = dbem_get_booked_seats($event_id);
71
- $stylesheet = get_bloginfo('wpurl')."/wp-content/plugins/events-manager/events_manager.css";
72
- ?>
73
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
74
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
75
- <html>
76
- <head>
77
- <meta http-equiv="Content-type" content="text/html; charset=utf-8">
78
- <title>Bookings for <?php echo $event['event_name'];?></title>
79
- <link rel="stylesheet" href="<?php echo $stylesheet; ?>" type="text/css" media="screen" />
80
-
81
- </head>
82
- <body id="printable">
83
- <div id="container">
84
- <h1>Bookings for <?php echo $event['event_name'];?></h1>
85
- <p><?php echo dbem_replace_placeholders("#d #M #Y", $event)?></p>
86
- <p><?php echo dbem_replace_placeholders("#_LOCATION, #_ADDRESS, #_TOWN", $event)?></p>
87
- <h2><?php _e('Bookings data', 'dbem');?></h2>
88
- <table id="bookings-table">
89
- <tr>
90
- <th scope='col'><?php _e('Name', 'dbem')?></th>
91
- <th scope='col'><?php _e('E-mail', 'dbem')?></th>
92
- <th scope='col'><?php _e('Phone number', 'dbem')?></th>
93
- <th scope='col'><?php _e('Seats', 'dbem')?></th>
94
- <th scope='col'><?php _e('Comment', 'dbem')?></th>
95
- <?php
96
- foreach($bookings as $booking) { ?>
97
- <tr>
98
-
99
- <td><?php echo $booking['person_name']?></td>
100
- <td><?php echo $booking['person_email']?></td>
101
- <td><?php echo $booking['person_phone']?></td>
102
- <td class='seats-number'><?php echo $booking['booking_seats']?></td>
103
- <td><?=$booking['booking_comment'] ?></td>
104
- </tr>
105
- <?php } ?>
106
- <tr id='booked-seats'>
107
- <td colspan='3'>&nbsp;</td>
108
- <td class='total-label'><?php _e('Booked', 'dbem')?>:</td>
109
- <td class='seats-number'><?php echo $booked_seats; ?></td>
110
- </tr>
111
- <tr id='available-seats'>
112
- <td colspan='3'>&nbsp;</td>
113
- <td class='total-label'><?php _e('Available', 'dbem')?>:</td>
114
- <td class='seats-number'><?php echo $available_seats; ?></td>
115
- </tr>
116
- </table>
117
- </div>
118
- </body>
119
- </html>
120
- <?php
121
- die();
122
-
123
- }
124
-
125
- function dbem_people_table() {
126
- $people = dbem_get_people();
127
- if (count($people) < 1 ) {
128
- _e("No people have responded to your events yet!", 'dbem');
129
- } else {
130
- $table = "<p>".__('This table collects the data about the people who responded to your events', 'dbem')."</p>";
131
- $table .=" <table id='dbem-people-table' class='widefat post fixed'>\n
132
- <thead>
133
- <tr>
134
- <th class='manage-column column-cb check-column' scope='col'>&nbsp;</th>\n
135
- <th class='manage-column ' scope='col'>Name</th>\n
136
- <th scope='col'>E-mail</th>\n
137
- <th scope='col'>Phone number</th>\n
138
- </tr>\n
139
- </thead>\n
140
- <tfoot>
141
- <tr>
142
- <th class='manage-column column-cb check-column' scope='col'>&nbsp;</th>\n
143
- <th class='manage-column ' scope='col'>Name</th>\n
144
- <th scope='col'>E-mail</th>\n
145
- <th scope='col'>Phone number</th>\n
146
- </tr>\n
147
- </tfoot>\n
148
- " ;
149
- foreach ($people as $person) {
150
- $table .= "<tr> <td>&nbsp;</td>
151
- <td>".$person['person_name']."</td>
152
- <td>".$person['person_email']."</td>
153
- <td>".$person['person_phone']."</td></tr>";
154
- }
155
-
156
- $table .= "</table>";
157
- echo $table;
158
- }
159
- }
160
-
161
- function dbem_get_person_by_name_and_email($name, $email) {
162
- global $wpdb;
163
- $people_table = $wpdb->prefix.PEOPLE_TBNAME;
164
- $sql = "SELECT person_id, person_name, person_email, person_phone FROM $people_table WHERE person_name = '$name' AND person_email = '$email' ;" ;
165
- $result = $wpdb->get_row($sql, ARRAY_A);
166
- return $result;
167
- }
168
-
169
- function dbem_get_person($person_id) {
170
- global $wpdb;
171
- $people_table = $wpdb->prefix.PEOPLE_TBNAME;
172
- $sql = "SELECT person_id, person_name, person_email, person_phone FROM $people_table WHERE person_id = '$person_id';" ;
173
- $result = $wpdb->get_row($sql, ARRAY_A);
174
- return $result;
175
- }
176
-
177
- function dbem_get_people() {
178
- global $wpdb;
179
- $people_table = $wpdb->prefix.PEOPLE_TBNAME;
180
- $sql = "SELECT * FROM $people_table";
181
- $result = $wpdb->get_results($sql, ARRAY_A);
182
- return $result;
183
- }
184
-
185
- function dbem_add_person($name, $email, $phone = "") {
186
- global $wpdb;
187
- $people_table = $wpdb->prefix.PEOPLE_TBNAME;
188
- $sql = "INSERT INTO $people_table (person_name, person_email, person_phone) VALUES ('$name', '$email', '$phone');";
189
- $wpdb->query($sql);
190
- $new_person = dbem_get_person_by_name_and_email($name, $email);
191
- return ($new_person);
192
- }
193
- add_action('edit_user_profile', 'dbem_phone_field') ;
194
- function dbem_phone_field() {
195
- ?>
196
- <h3><?php _e('Phone number', 'dbem')?></h3>
197
- <table class='form-table'>
198
- <tr>
199
- <th><?php _e('Phone number','dbem');?></th>
200
- <td><input id="dbem_phone" class="regular-text" type="text" value="" name="dbem_phone"/> <br/>
201
- <?php _e('The phone number used by Events Manager when the user is indicated as the contact person for an event.','dbem');?></td>
202
- </tr>
203
- </table>
204
- <?php
205
- }
206
-
207
- add_action('profile_update','dbem_update_phone');
208
- function dbem_update_phone($user_ID) {
209
- if(isset($_POST['dbem_phone']) && $_POST['dbem_phone'] != '') {
210
- update_usermeta($user_ID,'dbem_phone', $_POST['dbem_phone']);
211
- }
212
-
213
- }
214
- function dbem_get_indexed_users() {
215
- global $wpdb;
216
- $sql = "SELECT display_name, ID FROM $wpdb->users";
217
- $users = $wpdb->get_results($sql, ARRAY_A);
218
- $indexed_users = array();
219
- foreach($users as $user)
220
- $indexed_users[$user['ID']] = $user['display_name'];
221
- return $indexed_users;
222
- }
223
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
dbem_rsvp.php DELETED
@@ -1,391 +0,0 @@
1
- <?php
2
- $form_add_message = "";
3
- $form_delete_message = "";
4
- function dbem_add_booking_form() {
5
- global $form_add_message;
6
- //$message = dbem_catch_rsvp();
7
-
8
- $destination = "?".$_SERVER['QUERY_STRING']."#dbem-rsvp-form";
9
- $module = "<h3>".__('Book now!','dbem')."</h3><br/>";
10
- if(!empty($form_add_message))
11
- $module .= "<div class='dbem-rsvp-message'>$form_add_message</div>";
12
- $booked_places_options = array();
13
- for ( $i = 1; $i <= 10; $i++)
14
- array_push($booked_places_options, "<option value='$i'>$i</option>");
15
-
16
- $module .= "<form id='dbem-rsvp-form' name='booking-form' method='post' action='$destination'>
17
- <table class='dbem-rsvp-form'>
18
- <tr><th scope='row'>".__('Name', 'dbem').":</th><td><input type='text' name='bookerName' value=''/></td></tr>
19
- <tr><th scope='row'>".__('E-Mail', 'dbem').":</th><td><input type='text' name='bookerEmail' value=''/></td></tr>
20
- <tr><th scope='row'>".__('Phone number', 'dbem').":</th><td><input type='text' name='bookerPhone' value=''/></td></tr>
21
- <tr><th scope='row'>".__('Seats', 'dbem').":</th><td><select name='bookedSeats' >";
22
- foreach($booked_places_options as $option) {
23
- $module .= $option."\n";
24
- }
25
- $module .= "</select></td></tr>
26
- <tr><th scope='row'>".__('Comment', 'dbem').":</th><td><textarea name='bookerComment'></textarea></td></tr>
27
- </table>
28
- <p><input type='submit' value='".__('Send your booking', 'dbem')."'/>
29
- <input type='hidden' name='eventAction' value='add_booking'/></p>
30
- </form>";
31
- // $module .= "dati inviati: ";
32
- // $module .= dbem_sanitize_request($_POST['bookerName']);
33
- //print_r($_SERVER);
34
-
35
- //$module .= dbem_delete_booking_form();
36
-
37
- return $module;
38
-
39
- }
40
-
41
- function dbem_delete_booking_form() {
42
- global $form_delete_message;
43
-
44
- $destination = "?".$_SERVER['QUERY_STRING'];
45
- $module = "<h3>".__('Cancel your booking', 'dbem')."</h3><br/>";
46
-
47
- if(!empty($form_delete_message))
48
- $module .= "<div class='dbem-rsvp-message'>$form_delete_message</div>";
49
-
50
-
51
- $module .= "<form name='booking-delete-form' method='post' action='$destination'>
52
- <table class='dbem-rsvp-form'>
53
- <tr><th scope='row'>".__('Name', 'dbem').":</th><td><input type='text' name='bookerName' value=''/></td></tr>
54
- <tr><th scope='row'>".__('E-Mail', 'dbem').":</th><td><input type='text' name='bookerEmail' value=''/></td></tr>
55
- <input type='hidden' name='eventAction' value='delete_booking'/>
56
- </table>
57
- <input type='submit' value='".__('Cancel your booking', 'dbem')."'/>
58
- </form>";
59
- // $module .= "dati inviati: ";
60
- // $module .= $_POST['bookerName'];
61
-
62
-
63
-
64
- return $module;
65
-
66
- }
67
-
68
-
69
- function dbem_catch_rsvp() {
70
- global $form_add_message;
71
- global $form_delete_message;
72
- $result = "";
73
- if (isset($_POST['eventAction']) && $_POST['eventAction'] == 'add_booking') {
74
- $result = dbem_book_seats();
75
- $form_add_message = $result;
76
-
77
-
78
- }
79
-
80
- if (isset($_POST['eventAction']) && $_POST['eventAction'] == 'delete_booking') {
81
-
82
- $bookerName = dbem_sanitize_request($_POST['bookerName']);
83
- $bookerEmail = dbem_sanitize_request($_POST['bookerEmail']);
84
- $booker = dbem_get_person_by_name_and_email($bookerName, $bookerEmail);
85
- if ($booker) {
86
- $booker_id = $booker['person_id'];
87
- $booking = dbem_get_booking_by_person_id($booker_id);
88
- $result = dbem_delete_booking($booking['booking_id']);
89
- } else {
90
- $result = __('There are no bookings associated to this name and e-mail', 'dbem');
91
- }
92
- $form_delete_message = $result;
93
- }
94
-
95
- return $result;
96
-
97
- }
98
- add_action('init','dbem_catch_rsvp');
99
-
100
-
101
-
102
- function dbem_book_seats() {
103
- $bookerName = dbem_sanitize_request($_POST['bookerName']);
104
- $bookerEmail = dbem_sanitize_request($_POST['bookerEmail']);
105
- $bookerPhone = dbem_sanitize_request($_POST['bookerPhone']);
106
- $bookedSeats = dbem_sanitize_request($_POST['bookedSeats']);
107
- $bookerComment = dbem_sanitize_request($_POST['bookerComment']);
108
- $event_id = dbem_sanitize_request($_GET['event_id']);
109
- $booker = dbem_get_person_by_name_and_email($bookerName, $bookerEmail);
110
- if (!$booker) {
111
- $booker = dbem_add_person($bookerName, $bookerEmail, $bookerPhone);
112
- }
113
- if (dbem_are_seats_available_for($event_id, $bookedSeats)) {
114
- dbem_record_booking($event_id, $booker['person_id'], $bookedSeats,$bookerComment);
115
-
116
- $result = __('Your booking has been recorded','dbem');
117
- $mailing_is_active = get_option('dbem_rsvp_mail_notify_is_active');
118
- if($mailing_is_active) {
119
- dbem_email_rsvp_booking();
120
- }
121
-
122
- } else {
123
- $result = __('Booking cannot be made – not enough seats available!', 'dbem');
124
- }
125
- return $result;
126
- }
127
-
128
-
129
-
130
- function dbem_get_booking_by_person_id($person_id) {
131
- global $wpdb;
132
- $bookings_table = $wpdb->prefix.BOOKINGS_TBNAME;
133
- $sql = "SELECT * FROM $bookings_table WHERE person_id = '$person_id';" ;
134
- $result = $wpdb->get_row($sql, ARRAY_A);
135
- return $result;
136
- }
137
-
138
- function dbem_record_booking($event_id, $person_id, $seats, $comment = "") {
139
- global $wpdb;
140
- $bookings_table = $wpdb->prefix.BOOKINGS_TBNAME;
141
- // checking whether the booker has already booked places
142
- $sql = "SELECT * FROM $bookings_table WHERE event_id = '$event_id' and person_id = '$person_id'; ";
143
- //echo $sql;
144
- $previously_booked = $wpdb->get_row($sql);
145
- if ($previously_booked) {
146
-
147
- $total_booked_seats = $previously_booked->booking_seats + $seats;
148
- $where = array();
149
- $where['booking_id'] =$previously_booked->booking_id;
150
- $fields['booking_seats'] = $total_booked_seats;
151
- $wpdb->update($bookings_table, $fields, $where);
152
-
153
- } else {
154
- if(true) {
155
- $sql = "INSERT INTO $bookings_table (event_id, person_id, booking_seats,booking_comment) VALUES ($event_id, $person_id, $seats,'$comment')";
156
- $wpdb->query($sql);
157
- }
158
- }
159
- }
160
- function dbem_delete_booking($booking_id) {
161
- global $wpdb;
162
- $bookings_table = $wpdb->prefix.BOOKINGS_TBNAME;
163
- $sql = "DELETE FROM $bookings_table WHERE booking_id = $booking_id";
164
- $wpdb->query($sql);
165
- return __('Booking deleted', 'dbem');
166
- }
167
-
168
- function dbem_get_available_seats($event_id) {
169
- global $wpdb;
170
- $bookings_table = $wpdb->prefix.BOOKINGS_TBNAME;
171
- $sql = "SELECT SUM(booking_seats) AS booked_seats FROM $bookings_table WHERE event_id = $event_id";
172
- $seats_row = $wpdb->get_row($sql, ARRAY_A);
173
- $booked_seats = $seats_row['booked_seats'];
174
- $event = dbem_get_event($event_id);
175
- $available_seats = $event['event_seats'] - $booked_seats;
176
- return ($available_seats);
177
- }
178
- function dbem_get_booked_seats($event_id) {
179
- global $wpdb;
180
- $bookings_table = $wpdb->prefix.BOOKINGS_TBNAME;
181
- $sql = "SELECT SUM(booking_seats) AS booked_seats FROM $bookings_table WHERE event_id = $event_id";
182
- $seats_row = $wpdb->get_row($sql, ARRAY_A);
183
- $booked_seats = $seats_row['booked_seats'];
184
- return $booked_seats;
185
- }
186
- function dbem_are_seats_available_for($event_id, $seats) {
187
- $event = dbem_get_event($event_id);
188
- $available_seats = dbem_get_available_seats($event_id);
189
- $remaning_seats = $available_seats - $seats;
190
- return ($remaning_seats >= 0);
191
- }
192
-
193
- function dbem_bookings_table($event_id) {
194
-
195
- $bookings = dbem_get_bookings_for($event_id);
196
- $destination = get_bloginfo('wpurl')."/wp-admin/edit.php";
197
- $table = "<form id='bookings-filter' method='get' action='$destination'>
198
- <input type='hidden' name='page' value='events-manager/events-manager.php'/>
199
- <input type='hidden' name='action' value='edit_event'/>
200
- <input type='hidden' name='event_id' value='$event_id'/>
201
- <input type='hidden' name='secondaryAction' value='delete_bookings'/>
202
- <div class='wrap'>
203
- <h2>Bookings</h2>\n
204
- <table id='dbem-bookings-table' class='widefat post fixed'>\n";
205
- $table .="<thead>\n
206
- <tr><th class='manage-column column-cb check-column' scope='col'>&nbsp;</th><th class='manage-column ' scope='col'>Booker</th><th scope='col'>E-mail</th><th scope='col'>Phone number</th><th scope='col'>Seats</th></tr>\n
207
- </thead>\n" ;
208
- foreach ($bookings as $booking) {
209
- $table .= "<tr> <td><input type='checkbox' value='".$booking['booking_id']."' name='bookings[]'/></td>
210
- <td>".$booking['person_name']."</td>
211
- <td>".$booking['person_email']."</td>
212
- <td>".$booking['person_phone']."</td>
213
- <td>".$booking['booking_seats']."</td></tr>";
214
- }
215
- $available_seats = dbem_get_available_seats($event_id);
216
- $booked_seats = dbem_get_booked_seats($event_id);
217
- $table .= "<tfoot><tr><th scope='row' colspan='4'>Booked seats:</th><td class='booking-result' id='booked-seats'>$booked_seats</td></tr>
218
- <tr><th scope='row' colspan='4'>Available seats:</th><td class='booking-result' id='available-seats'>$available_seats</td></tr></tfoot>
219
- </table></div>
220
- <div class='tablenav'>
221
- <div class='alignleft actions'>
222
- <input class=button-secondary action' type='submit' name='doaction2' value='Delete'/>
223
- <br class='clear'/>
224
- </div>
225
- <br class='clear'/>
226
- </div>
227
-
228
- </form>";
229
- echo $table;
230
- }
231
-
232
- function dbem_bookings_compact_table($event_id) {
233
- $bookings = dbem_get_bookings_for($event_id);
234
- $destination = get_bloginfo('wpurl')."/wp-admin/edit.php";
235
- $available_seats = dbem_get_available_seats($event_id);
236
- $booked_seats = dbem_get_booked_seats($event_id);
237
- $printable_address = get_bloginfo('wpurl')."/wp-admin/admin.php?page=people&action=printable&event_id=$event_id";
238
- if (count($bookings)>0) {
239
- $table =
240
- "<div class='wrap'>
241
- <h4>$booked_seats ".__('responses so far').":</h4>\n
242
-
243
- <table id='dbem-bookings-table-$event_id' class='widefat post fixed'>\n
244
- <thead>\n
245
- <tr>
246
- <th class='manage-column column-cb check-column' scope='col'>&nbsp;</th>\n
247
- <th class='manage-column ' scope='col'>".__('Responder', 'dbem')."</th>\n
248
- <th scope='col'>".__('Spaces', 'dbem')."</th>\n
249
- </tr>\n
250
- </thead>\n
251
- <tfoot>
252
- <tr>
253
- <th scope='row' colspan='2'>".__('Booked spaces','dbem').":</th><td class='booking-result' id='booked-seats'>$booked_seats</td></tr>
254
- <tr><th scope='row' colspan='2'>".__('Available spaces','dbem').":</th><td class='booking-result' id='available-seats'>$available_seats</td>
255
- </tr>
256
- </tfoot>
257
- <tbody>" ;
258
- foreach ($bookings as $booking) {
259
- ($booking['booking_comment']) ? $baloon = " <img src='../wp-content/plugins/events-manager/images/baloon.png' title='".__('Comment:','dbem')." ".$booking['booking_comment']."' alt='comment'/>" : $baloon = "";
260
- $table .=
261
- "<tr id='booking-".$booking['booking_id']."'>
262
- <td><a id='booking-check-".$booking['booking_id']."' class='bookingdelbutton'>X</a></td>
263
- <td><a title='".$booking['person_email']." - ".$booking['person_phone']."'>".$booking['person_name']."</a>$baloon</td>
264
- <td>".$booking['booking_seats']."</td>
265
- </tr>";
266
- }
267
-
268
- $table .= "</tbody>\n
269
-
270
- </table>
271
- </div>
272
-
273
- <br class='clear'/>
274
- <div id='major-publishing-actions'>
275
- <div id='publishing-action'>
276
- <a id='printable' target='' href='$printable_address'>".__('Printable view','dbem')."</a>
277
- <br class='clear'/>
278
-
279
-
280
- </div>
281
- <br class='clear'/>
282
- </div> ";
283
- } else {
284
- $table .= "<p><em>".__('No responses yet!')."</em></p>";
285
- }
286
-
287
- echo $table;
288
- }
289
-
290
- function dbem_get_bookings_for($event_id) {
291
- global $wpdb;
292
- $bookings_table = $wpdb->prefix.BOOKINGS_TBNAME;
293
- $sql = "SELECT * FROM $bookings_table WHERE event_id = $event_id";
294
- $bookings = $wpdb->get_results($sql, ARRAY_A);
295
- $booking_data = array();
296
- if ($bookings) {
297
- foreach ($bookings as $booking) {
298
- $booking;
299
- $person = dbem_get_person($booking['person_id']);
300
- $booking['person_name'] = $person['person_name'];
301
- $booking['person_email'] = $person['person_email'];
302
- $booking['person_phone'] = $person['person_phone'];
303
- array_push($booking_data, $booking);
304
- }
305
- return $booking_data;
306
- } else {
307
- return null;
308
- }
309
- }
310
-
311
- function dbem_intercept_bookings_delete() {
312
- //dbem_email_rsvp_booking();
313
- if(isset($_GET['bookings']))
314
- $bookings = $_GET['bookings'];
315
-
316
- if (isset($bookings)) {
317
- foreach($bookings as $booking_id) {
318
- dbem_delete_booking($booking_id);
319
- }
320
- }
321
- }
322
- add_action('init', 'dbem_intercept_bookings_delete');
323
-
324
- function dbem_email_rsvp_booking(){
325
- $booker = array();
326
- $bookerName = dbem_sanitize_request($_POST['bookerName']);
327
- $bookerEmail = dbem_sanitize_request($_POST['bookerEmail']);
328
- $bookerPhone = dbem_sanitize_request($_POST['bookerPhone']);
329
- $bookedSeats = dbem_sanitize_request($_POST['bookedSeats']);
330
- $bookerComment = dbem_sanitize_request($_POST['bookerComment']);
331
- $event_id = dbem_sanitize_request($_GET['event_id']);
332
-
333
-
334
- $event = dbem_get_event($event_id);
335
- $available_seats = dbem_get_available_seats($event_id);
336
- $reserved_seats = dbem_get_booked_seats($event_id);
337
-
338
- if($event['event_contactperson_id'] != "")
339
- $contact_id = $event['event_contactperson_id'];
340
- else
341
- $contact_id = get_option('dbem_default_contact_person');
342
-
343
- $contact_name = dbem_get_user_name($contact_id);
344
-
345
- $contact_body = dbem_replace_placeholders(get_option('dbem_contactperson_email_body'), $event);
346
- $booker_body = dbem_replace_placeholders(get_option('dbem_respondent_email_body'), $event);
347
-
348
- // email specific placeholders
349
- $placeholders = array('#_CONTACTPERSON'=> $contact_name, '#_RESPNAME' => $bookerName, '#_RESPEMAIL' => $bookerEmail, '#_RESPPHONE' => $bookerPhone, '#_SPACES' => $bookedSeats,'#_COMMENT' => $bookerComment, '#_RESERVEDSPACES' => $reserved_seats, '#_AVAILABLESPACES' => $available_seats);
350
-
351
- foreach($placeholders as $key => $value) {
352
- $contact_body= str_replace($key, $value, $contact_body);
353
- $booker_body= str_replace($key, $value, $booker_body);
354
- }
355
- $contact_email = dbem_get_user_email($contact_id);
356
- dbem_send_mail(__("New booking",'dbem'), $contact_body, $contact_email);
357
- dbem_send_mail(__('Reservation confirmed','dbem'),$booker_body, $bookerEmail);
358
-
359
- }
360
-
361
- function dbem_get_user_email($user_id) {
362
- global $wpdb;
363
- $sql = "SELECT user_email FROM $wpdb->users WHERE ID = $user_id";
364
- return $wpdb->get_var( $wpdb->prepare($sql) );
365
- }
366
- function dbem_get_user_name($user_id) {
367
- global $wpdb;
368
- $sql = "SELECT display_name FROM $wpdb->users WHERE ID = $user_id";
369
- return $wpdb->get_var( $wpdb->prepare($sql) );
370
- }
371
- function dbem_get_user_phone($user_id) {
372
- return get_usermeta($user_id, 'dbem_phone');
373
- }
374
-
375
- // got from http://davidwalsh.name/php-email-encode-prevent-spam
376
- function dbem_ascii_encode($e)
377
- {
378
- for ($i = 0; $i < strlen($e); $i++) { $output .= '&#'.ord($e[$i]).';'; }
379
- return $output;
380
- }
381
-
382
- function dbem_is_event_rsvpable() {
383
- if (dbem_is_single_event_page()) {
384
- $event = dbem_get_event(dbem_sanitize_request($_GET['event_id']));
385
- if($event)
386
- return $event['event_rsvp'];
387
- }
388
- return 0;
389
- }
390
-
391
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
dbem_single_location_map.js DELETED
@@ -1,32 +0,0 @@
1
- $j=jQuery.noConflict();
2
- //console.log("single location map");
3
-
4
- $j(document.body).unload(function() {
5
- if (GBrowserIsCompatible()) {
6
- GUnload();
7
- }
8
- });
9
-
10
-
11
- $j(document).ready(function() {
12
- loadMapScript(GMapsKey);
13
- });
14
-
15
- function loadMapScript(key) {
16
- var script = document.createElement("script");
17
- script.setAttribute("src", "http://maps.google.com/maps?file=api&v=2.x&key=" + key + "&c&async=2&callback=loadGMap");
18
- script.setAttribute("type", "text/javascript");
19
- document.documentElement.firstChild.appendChild(script);
20
- }
21
-
22
- function loadGMap() {
23
- if (GBrowserIsCompatible()) {
24
- map = new GMap2(document.getElementById("dbem-location-map"));
25
- point = new GLatLng(latitude, longitude);
26
- mapCenter= new GLatLng(point.lat()+0.005, point.lng()-0.003);
27
- map.setCenter(mapCenter, 14);
28
- var marker = new GMarker(point);
29
- map.addOverlay(marker);
30
- marker.openInfoWindowHtml(map_text);
31
- }
32
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
dbem_widgets.php DELETED
@@ -1,194 +0,0 @@
1
- <?php
2
- // List widget
3
- function widget_dbem_list($args) {
4
- extract($args);
5
-
6
- $options = get_option("widget_dbem_list");
7
- if (!is_array( $options ))
8
- {
9
- $options = array(
10
- 'title' => __('Events','dbem')
11
- );
12
- }
13
-
14
- echo $before_widget;
15
- echo $before_title;
16
- echo $options['title'];
17
- echo $after_title;
18
- $events_list = dbem_get_events_list($options['limit'],$options['scope'],$options['order'] ,$options['format'], false);
19
- if ($events_list == __('No events', 'dbem'))
20
- $events_list = "<li>$events_list</li>";
21
- echo "<ul>
22
- $events_list
23
- </ul>";
24
-
25
- echo $after_widget;
26
- }
27
-
28
- function dbem_list_control()
29
- {
30
- $options = get_option("widget_dbem_list");
31
-
32
- if (!is_array( $options ))
33
- {
34
- $options = array(
35
- 'title' => __('Events', 'dbem'),
36
- 'limit' => '5',
37
- 'scope' => 'future',
38
- 'order' => 'ASC',
39
- 'format' => DEFAULT_WIDGET_EVENT_LIST_ITEM_FORMAT
40
- );
41
- }
42
-
43
- if ($_POST['dbem_list-Submit'])
44
- {
45
- $options['title'] = htmlspecialchars($_POST['dbem_list-WidgetTitle']);
46
- $options['limit'] = $_POST['dbem_list-WidgetLimit'];
47
- $options['scope'] = $_POST['dbem_list-WidgetScope'];
48
- $options['order'] = $_POST['dbem_list-WidgetOrder'];
49
- $options['format'] = $_POST['dbem_list-WidgetFormat'];
50
- update_option("widget_dbem_list", $options);
51
- }
52
-
53
- if ($options['scope'] == "all" )
54
- $allSelected = "selected='selected'";
55
- else
56
- $allSelected = "";
57
- if ($options['scope'] == "past" )
58
- $pastSelected = "selected='selected'";
59
- else
60
- $pastSelected = "";
61
- if ($options['scope'] == "future" )
62
- $futureSelected = "selected='selected'";
63
- else
64
- $futureSelected = "";
65
-
66
- if ($options['order'] == "ASC" )
67
- $ASCSelected = "selected='selected'";
68
- else
69
- $ASCSelected = "";
70
- if ($options['order'] == "DESC" )
71
- $DESCSelected = "selected='selected'";
72
- else
73
- $DESCSelected = "";
74
-
75
-
76
- ?>
77
- <p>
78
- <label for="dbem_list-WidgetTitle"><?php _e('Title'); ?>: </label>
79
- <input type="text" id="dbem_list-WidgetTitle" name="dbem_list-WidgetTitle" value="<?php echo $options['title'];?>" />
80
- </p>
81
- <p>
82
- <label for="dbem_list-WidgetTitle"><?php _e('Number of events','dbem'); ?>: </label>
83
- <input type="text" id="dbem_list-WidgetLimit" name="dbem_list-WidgetLimit" value="<?php echo $options['limit'];?>" />
84
- </p>
85
- <p>
86
- <label for="dbem_list-WidgetScope"><?php _e('Scope of the events','dbem'); ?>:</label><br/>
87
- <select name="dbem_list-WidgetScope" >
88
- <option value="future" <?php echo $futureSelected; ?>><?php _e('Future events','dbem'); ?></option>
89
- <option value="all" <?php echo $allSelected; ?>><?php _e('All events','dbem'); ?></option>
90
- <option value="past" <?php echo $pastSelected; ?>><?php _e('Past events','dbem'); ?>:</option>
91
- </select>
92
- </p>
93
- <p>
94
- <label for="dbem_list-WidgetOrder"><?php _e('Order of the events','dbem'); ?>:</label><br/>
95
- <select name="dbem_list-WidgetOrder" >
96
- <option value="ASC" <?php echo $ASCSelected; ?>><?php _e('Ascendant','dbem'); ?></option>
97
- <option value="DESC" <?php echo $DESCSelected; ?>><?php _e('Descendant','dbem'); ?>:</option>
98
- </select>
99
- </p>
100
- <p>
101
- <label for="dbem_list-WidgetTitle"><?php _e('List item format','dbem'); ?>:</label>
102
- <textarea id="dbem_list-WidgetFormat" name="dbem_list-WidgetFormat" rows="5" cols="24"><?php echo $options['format'];?></textarea>
103
- </p>
104
- <input type="hidden" id="dbem_list-Submit" name="dbem_list-Submit" value="1" />
105
- <?php
106
- }
107
-
108
- // Calendar widget
109
-
110
-
111
-
112
-
113
-
114
-
115
- function widget_dbem_calendar($args) {
116
- extract($args);
117
-
118
- $options = get_option("widget_dbem_calendar");
119
-
120
- if (!is_array( $options )) {
121
- $options = array(
122
- 'title' => _e('calendar','dbem'),
123
- 'long_events' => 0
124
- );
125
- }
126
-
127
- echo $before_widget;
128
- echo $before_title;
129
- echo $options['title'];
130
- echo $after_title;
131
- //Our Widget Content
132
- $options['month'] = date("m");
133
- dbem_get_calendar($options);
134
- echo $after_widget;
135
- }
136
-
137
- function dbem_calendar_control()
138
- {
139
- $options = get_option("widget_dbem_calendar");
140
-
141
- if (!is_array( $options ))
142
- {
143
- $options = array(
144
- 'title' => 'Calendar',
145
- 'long_events' => 0
146
- );
147
- }
148
-
149
- if ($_POST['dbem_calendar-Submit'])
150
- {
151
- $options['title'] = htmlspecialchars($_POST['dbem_calendar-WidgetTitle']);
152
- $options['long_events'] = ($_POST['dbem_calendar-WidgetLongEvents'] == '1') ? 1:0;
153
- update_option("widget_dbem_calendar", $options);
154
- }
155
-
156
- ?>
157
- <p>
158
- <label for="dbem_calendar-WidgetTitle"><?php _e('Title'); ?>:</label>
159
- <input type="text" id="dbem_calendar-WidgetTitle" name="dbem_calendar-WidgetTitle" value="<?php echo $options['title'];?>" />
160
- <input type="hidden" id="dbem_calendar-Submit" name="dbem_calendar-Submit" value="1" />
161
- </p>
162
- <p>
163
- <label for="dbem_calendar-WidgetTitle"><?php _e('Show Long Events?', 'dbem'); ?>:</label>
164
- <input type="checkbox" id="dbem_calendar-WidgetLongEvents" name="dbem_calendar-WidgetLongEvents" value="1" <?php echo ($options['long_events']) ? 'checked="checked"':'' ;?>" />
165
- </p>
166
- <?php
167
- }
168
-
169
-
170
-
171
-
172
-
173
-
174
-
175
-
176
-
177
- // widgets registration
178
- function dbem_list_init()
179
- {
180
- // $widget_ops = array('classname' => 'widget_dbem_list', 'description' => __( "A list of the events") );
181
- // wp_register_sidebar_widget('widget_dbem_list', __('Events List'), 'widget_dbem_list', $widget_ops);
182
- register_sidebar_widget(__('Events List', 'dbem'), 'widget_dbem_list');
183
- register_widget_control(__('Events List', 'dbem'), 'dbem_list_control', 200, 200 );
184
- register_sidebar_widget(__('Events Calendar','dbem'), 'widget_dbem_calendar');
185
- register_widget_control(__('Events Calendar','dbem'), 'dbem_calendar_control', 300, 200 );
186
- }
187
- add_action("plugins_loaded", "dbem_list_init");
188
-
189
-
190
-
191
-
192
-
193
-
194
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
em-bugs.txt ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ http://davidebenini.it/events-manager-forum/topic.php?id=912&replies=2#post-2804
2
+ Map not working
3
+
4
+ location automcomplete, duplicates?
5
+ droipdorn or autocomplete, is it working?
6
+ Weekly view?
7
+
8
+
9
+ http://davidebenini.it/events-manager-forum/topic.php?id=916
10
+ Mail line endings
11
+
12
+ http://davidebenini.it/events-manager-forum/topic.php?id=917
13
+ "It seems since he last used the plug-in, he's lost the ability to assign a contact person to events. Has this option been removed in a recent update? Is there a way around this?"
14
+
15
+ http://davidebenini.it/events-manager-forum/topic.php?id=911&replies=2#post-2805
16
+ events with NO limit? Is it possible?
17
+
18
+ http://davidebenini.it/events-manager-forum/topic.php?id=910
19
+ Weekly view? Is it possible?
20
+
21
+
22
+ http://davidebenini.it/events-manager-forum/topic.php?id=898
23
+ confirmation email, RSVP problems
24
+
25
+ http://davidebenini.it/events-manager-forum/topic.php?id=918
26
+ table encoding bug
27
+ liebedex suggestion:
28
+ ALTER TABLE wp_dbem_events CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
29
+ ALTER TABLE wp_dbem_locations CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
30
+
31
+ #_NOTES problem and fix:
32
+ http://davidebenini.it/events-manager-forum/topic.php?id=597
33
+
34
+ http://davidebenini.it/events-manager-forum/topic.php?id=803
35
+ curious.... NSBP
36
+
37
+
38
+ http://davidebenini.it/events-manager-forum/topic.php?id=893
39
+ fields missing in the db?
40
+
41
+ http://davidebenini.it/events-manager-forum/topic.php?id=614
42
+ 130 seats limit
43
+
44
+ http://davidebenini.it/events-manager-forum/topic.php?id=896
45
+ Group of Events on not periodical dates
46
+
47
+ http://davidebenini.it/events-manager-forum/topic.php?id=913
48
+ PAge and vavbar MAJOR BUG?
49
+
50
+
51
+ http://davidebenini.it/events-manager-forum/topic.php?id=158
52
+ locations-map shortcode not working
53
+
54
+ PATCHES:
55
+ Location related bug
56
+ http://davidebenini.it/events-manager-forum/topic.php?id=31
57
+
58
+ Export to excel
59
+ http://davidebenini.it/events-manager-forum/topic.php?id=906
events-manager.php CHANGED
@@ -1,15 +1,15 @@
1
  <?php
2
  /*
3
  Plugin Name: Events Manager
4
- Version: 2.2.2
5
  Plugin URI: http://davidebenini.it/wordpress-plugins/events-manager/
6
  Description: Manage events specifying precise spatial data (Location, Town, Province, etc).
7
- Author: Davide Benini
8
  Author URI: http://www.davidebenini.it/blog
9
  */
10
 
11
  /*
12
- Copyright (c) 2009, Davide Benini. $Revision: 1 $
13
 
14
  This program is free software; you can redistribute it and/or
15
  modify it under the terms of the GNU General Public License
@@ -28,28 +28,86 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
 
29
  /*************************************************/
30
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  // Setting constants
32
- define('EVENTS_TBNAME','dbem_events'); //TABLE NAME
 
 
33
  define('RECURRENCE_TBNAME','dbem_recurrence'); //TABLE NAME
34
- define('LOCATIONS_TBNAME','dbem_locations'); //TABLE NAME
35
- define('BOOKINGS_TBNAME','dbem_bookings'); //TABLE NAME
36
- define('PEOPLE_TBNAME','dbem_people'); //TABLE NAME
37
- define('BOOKING_PEOPLE_TBNAME','dbem_bookings_people'); //TABLE NAME
38
  define('DEFAULT_EVENT_PAGE_NAME', 'Events');
39
  define('DBEM_PAGE','<!--DBEM_EVENTS_PAGE-->'); //EVENTS PAGE
40
  define('MIN_CAPABILITY', 'edit_posts'); // Minimum user level to access calendars
41
  define('SETTING_CAPABILITY', 'activate_plugins'); // Minimum user level to access calendars
 
42
  define('DEFAULT_EVENT_LIST_ITEM_FORMAT', '<li>#j #M #Y - #H:#i<br/> #_LINKEDNAME<br/>#_TOWN </li>');
43
  define('DEFAULT_SINGLE_EVENT_FORMAT', '<p>#j #M #Y - #H:#i</p><p>#_TOWN</p>');
44
  define('DEFAULT_EVENTS_PAGE_TITLE',__('Events','dbem') ) ;
45
- define('DEFAULT_EVENT_PAGE_TITLE_FORMAT', ' #_NAME');
46
  define('DEFAULT_RSS_DESCRIPTION_FORMAT',"#j #M #y - #H:#i <br/>#_LOCATION <br/>#_ADDRESS <br/>#_TOWN");
47
  define('DEFAULT_RSS_TITLE_FORMAT',"#_NAME");
48
  define('DEFAULT_MAP_TEXT_FORMAT', '<strong>#_LOCATION</strong><p>#_ADDRESS</p><p>#_TOWN</p>');
49
  define('DEFAULT_WIDGET_EVENT_LIST_ITEM_FORMAT','<li>#_LINKEDNAME<ul><li>#j #M #y</li><li>#_TOWN</li></ul></li>');
50
  define('DEFAULT_NO_EVENTS_MESSAGE', __('No events', 'dbem'));
51
  define('DEFAULT_SINGLE_LOCATION_FORMAT', '<p>#_ADDRESS</p><p>#_TOWN</p>');
52
- define('DEFAULT_LOCATION_PAGE_TITLE_FORMAT', ' #_NAME');
53
  define('DEFAULT_LOCATION_BALOON_FORMAT', "<strong>#_NAME</strong><br/>#_ADDRESS - #_TOWN<br/><a href='#_LOCATIONPAGEURL'>Details</a>");
54
  define('DEFAULT_LOCATION_EVENT_LIST_ITEM_FORMAT', "<li>#_NAME - #j #M #Y - #H:#i</li>");
55
  define('DEFAULT_LOCATION_NO_EVENTS_MESSAGE', __('<li>No events in this location</li>', 'dbem'));
@@ -61,42 +119,26 @@ define('DEFAULT_FULL_CALENDAR_EVENT_FORMAT', '<li>#_LINKEDNAME</li>');
61
  define('DEFAULT_SMALL_CALENDAR_EVENT_TITLE_FORMAT', "#_NAME" );
62
  define('DEFAULT_SMALL_CALENDAR_EVENT_TITLE_SEPARATOR', ", ");
63
  define('DEFAULT_USE_SELECT_FOR_LOCATIONS', false);
64
- define('DEFAULT_ATTRIBUTES_ENABLED', false);
65
- define('DEFAULT_RECURRENCE_ENABLED', false);
66
- define('DEFAULT_RSVP_ENABLED', false);
67
- define('DEFAULT_CATEGORIES_ENABLED', false);
 
 
 
 
 
 
 
 
 
 
68
 
69
  // DEBUG constant for developing
70
  // if you are hacking this plugin, set to TRUE, a log will show in admin pages
71
- define('DEBUG', false);
72
-
73
- // INCLUDES
74
- /* Marcus Begin Edit */
75
- include("marcus-extras.php");
76
- /* Marcus End Edit */
77
- include("dbem_events.php");
78
- include("dbem_calendar.php");
79
- include("dbem_widgets.php");
80
- include("dbem_rsvp.php");
81
- include("dbem_locations.php");
82
- include("dbem_people.php");
83
- include("dbem-recurrence.php");
84
- include("dbem_UI_helpers.php");
85
-
86
- require_once("phpmailer/dbem_phpmailer.php") ;
87
- //require_once("phpmailer/language/phpmailer.lang-en.php") ;
88
-
89
- // Localised date formats as in the jquery UI datepicker plugin
90
- $localised_date_formats = array("am" => "dd.mm.yy","ar" => "dd/mm/yy", "bg" => "dd.mm.yy", "ca" => "mm/dd/yy", "cs" => "dd.mm.yy", "da" => "dd-mm-yy", "de" =>"dd.mm.yy", "es" => "dd/mm/yy", "en" => "mm/dd/yy", "fi" => "dd.mm.yy", "fr" => "dd/mm/yy", "he" => "dd/mm/yy", "hu" => "yy-mm-dd", "hy" => "dd.mm.yy", "id" => "dd/mm/yy", "is" => "dd/mm/yy", "it" => "dd/mm/yy", "ja" => "yy/mm/dd", "ko" => "yy-mm-dd", "lt" => "yy-mm-dd", "lv" => "dd-mm-yy", "nl" => "dd.mm.yy", "no" => "yy-mm-dd", "pl" => "yy-mm-dd", "pt" => "dd/mm/yy", "ro" => "mm/dd/yy", "ru" => "dd.mm.yy", "sk" => "dd.mm.yy", "sv" => "yy-mm-dd", "th" => "dd/mm/yy", "tr" => "dd.mm.yy", "ua" => "dd.mm.yy", "uk" => "dd.mm.yy", "us" => "mm/dd/yy", "CN" => "yy-mm-dd", "TW" => "yy/mm/dd");
91
- //required fields
92
- $required_fields = array('event_name');
93
-
94
- $thisDir = dirname( plugin_basename( __FILE__ ) );
95
- load_plugin_textdomain('dbem', false, $thisDir.'/langs');
96
-
97
- // To enable activation through the activate function
98
- register_activation_hook(__FILE__,'dbem_install');
99
 
 
100
  // filters for general events field (corresponding to those of "the _title")
101
  add_filter('dbem_general', 'wptexturize');
102
  add_filter('dbem_general', 'convert_chars');
@@ -114,661 +156,145 @@ add_filter('dbem_general_rss', 'wp_specialchars');
114
  // RSS content filter
115
  add_filter('dbem_notes_rss', 'convert_chars', 8);
116
  add_filter('dbem_notes_rss', 'ent2ncr', 8);
117
-
118
  add_filter('dbem_notes_map', 'convert_chars', 8);
119
  add_filter('dbem_notes_map', 'js_escape');
120
-
121
-
122
-
123
- /* Creating the wp_events table to store event data*/
124
- function dbem_install() {
125
- // Creates the events table if necessary
126
- dbem_create_events_table();
127
- dbem_create_recurrence_table();
128
- dbem_create_locations_table();
129
- dbem_create_bookings_table();
130
- dbem_create_people_table();
131
- dbem_add_options();
132
- /* Marcus Begin Edit */
133
- dbem_create_categories_table();
134
- /* Marcus End Edit */
135
- // if ANY 1.0 option is there AND the version options hasn't been set yet THEN launch the updat script
136
-
137
- if (get_option('dbem_events_page') && !get_option('dbem_version'))
138
- dbem_migrate_old_events();
139
-
140
- update_option('dbem_version', 2);
141
- // Create events page if necessary
142
- $events_page_id = get_option('dbem_events_page') ;
143
- if ($events_page_id != "" ) {
144
- query_posts("page_id=$events_page_id");
145
- $count = 0;
146
- while(have_posts()) { the_post();
147
- $count++;
148
- }
149
- if ($count == 0)
150
- dbem_create_events_page();
151
- } else {
152
- dbem_create_events_page();
153
- }
154
- // wp-content must be chmodded 777. Maybe just wp-content.
155
- if(!file_exists("../".IMAGE_UPLOAD_DIR))
156
- mkdir("../".IMAGE_UPLOAD_DIR, 0777);
157
- }
158
-
159
- function dbem_create_events_table() {
160
- global $wpdb, $user_level;
161
- require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
162
-
163
- $old_table_name = $wpdb->prefix."events";
164
- $table_name = $wpdb->prefix.EVENTS_TBNAME;
165
-
166
- if(!($wpdb->get_var("SHOW TABLES LIKE '$old_table_name'") != $old_table_name)) {
167
- // upgrading from previous versions
168
-
169
- $sql = "ALTER TABLE $old_table_name RENAME $table_name;";
170
- $wpdb->query($sql);
171
-
172
- }
173
-
174
-
175
- if($wpdb->get_var("SHOW TABLES LIKE '$table_name'") != $table_name) {
176
- // check the user is allowed to make changes
177
- // get_currentuserinfo();
178
- // if ($user_level < 8) { return; }
179
-
180
- // Creating the events table
181
- /* Marcus Begin Edit*/
182
- //Added Category FK Field
183
- $sql = "CREATE TABLE ".$table_name." (
184
- event_id mediumint(9) NOT NULL AUTO_INCREMENT,
185
- event_author mediumint(9) DEFAULT NULL,
186
- event_name tinytext NOT NULL,
187
- event_start_time time NOT NULL,
188
- event_end_time time NOT NULL,
189
- event_start_date date NOT NULL,
190
- event_end_date date NULL,
191
- event_notes text DEFAULT NULL,
192
- event_rsvp bool NOT NULL DEFAULT 0,
193
- event_seats tinyint,
194
- event_contactperson_id mediumint(9) NULL,
195
- location_id mediumint(9) NOT NULL,
196
- recurrence_id mediumint(9) NULL,
197
- event_category_id int(11) default NULL,
198
- event_attributes text NULL,
199
- UNIQUE KEY (event_id)
200
- );";
201
- /* Marcus End Edit */
202
-
203
- dbDelta($sql);
204
- //-------------- DEBUG CODE to insert a few events n the new table
205
- // get the current timestamp into an array
206
- $timestamp = time();
207
- $date_time_array = getdate($timestamp);
208
-
209
- $hours = $date_time_array['hours'];
210
- $minutes = $date_time_array['minutes'];
211
- $seconds = $date_time_array['seconds'];
212
- $month = $date_time_array['mon'];
213
- $day = $date_time_array['mday'];
214
- $year = $date_time_array['year'];
215
 
216
- // use mktime to recreate the unix timestamp
217
- // adding 19 hours to $hours
218
- $in_one_week = strftime('%Y-%m-%d', mktime($hours,$minutes,$seconds,$month,$day+7,$year));
219
- $in_four_weeks = strftime('%Y-%m-%d',mktime($hours,$minutes,$seconds,$month,$day+28,$year));
220
- $in_one_year = strftime('%Y-%m-%d',mktime($hours,$minutes,$seconds,$month,$day,$year+1));
221
-
222
- $wpdb->query("INSERT INTO ".$table_name." (event_name, event_start_date, event_start_time, event_end_time, location_id)
223
- VALUES ('Orality in James Joyce Conference', '$in_one_week', '16:00:00', '18:00:00', 1)");
224
- $wpdb->query("INSERT INTO ".$table_name." (event_name, event_start_date, event_start_time, event_end_time, location_id)
225
- VALUES ('Traditional music session', '$in_four_weeks', '20:00:00', '22:00:00', 2)");
226
- $wpdb->query("INSERT INTO ".$table_name." (event_name, event_start_date, event_start_time, event_end_time, location_id)
227
- VALUES ('6 Nations, Italy VS Ireland', '$in_one_year','22:00:00', '24:00:00', 3)");
228
- } else {
229
- // eventual maybe_add_column() for later versions
230
- maybe_add_column($table_name, 'event_start_date', "alter table $table_name add event_start_date date NOT NULL;");
231
- maybe_add_column($table_name, 'event_end_date', "alter table $table_name add event_end_date date NULL;");
232
- maybe_add_column($table_name, 'event_start_time', "alter table $table_name add event_start_time time NOT NULL;");
233
- maybe_add_column($table_name, 'event_end_time', "alter table $table_name add event_end_time time NOT NULL;");
234
- maybe_add_column($table_name, 'event_rsvp', "alter table $table_name add event_rsvp BOOL NOT NULL;");
235
- maybe_add_column($table_name, 'event_seats', "alter table $table_name add event_seats tinyint NULL;");
236
- maybe_add_column($table_name, 'location_id', "alter table $table_name add location_id mediumint(9) NOT NULL;");
237
- maybe_add_column($table_name, 'recurrence_id', "alter table $table_name add recurrence_id mediumint(9) NULL;");
238
- maybe_add_column($table_name, 'event_contactperson_id', "alter table $table_name add event_contactperson_id mediumint(9) NULL;");
239
- maybe_add_column($table_name, 'event_attributes', "alter table $table_name add event_attributes text NULL;");
240
-
241
- // Fix buggy columns
242
- $wpdb->query("ALTER TABLE $table_name MODIFY event_notes text ;");
243
- $wpdb->query("ALTER TABLE $table_name MODIFY event_author mediumint(9);");
244
  }
 
 
 
245
  }
246
-
247
- function dbem_create_recurrence_table() {
248
-
249
- global $wpdb, $user_level;
250
- $table_name = $wpdb->prefix.RECURRENCE_TBNAME;
251
-
252
- if($wpdb->get_var("SHOW TABLES LIKE '$table_name'") != $table_name) {
253
-
254
- $sql = "CREATE TABLE ".$table_name." (
255
- recurrence_id mediumint(9) NOT NULL AUTO_INCREMENT,
256
- recurrence_name tinytext NOT NULL,
257
- recurrence_start_date date NOT NULL,
258
- recurrence_end_date date NOT NULL,
259
- recurrence_start_time time NOT NULL,
260
- recurrence_end_time time NOT NULL,
261
- recurrence_notes text NOT NULL,
262
- location_id mediumint(9) NOT NULL,
263
- recurrence_interval tinyint NOT NULL,
264
- recurrence_freq tinytext NOT NULL,
265
- recurrence_byday tinyint NOT NULL,
266
- recurrence_byweekno tinyint NOT NULL,
267
- event_contactperson_id mediumint(9) NULL,
268
- UNIQUE KEY (recurrence_id)
269
- );";
270
- require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
271
- dbDelta($sql);
272
-
273
  }
 
274
  }
275
-
276
- function dbem_create_locations_table() {
277
-
278
- global $wpdb, $user_level;
279
- $table_name = $wpdb->prefix.LOCATIONS_TBNAME;
280
-
281
- if($wpdb->get_var("SHOW TABLES LIKE '$table_name'") != $table_name) {
282
-
283
- // check the user is allowed to make changes
284
- // get_currentuserinfo();
285
- // if ($user_level < 8) { return; }
286
-
287
- // Creating the events table
288
- $sql = "CREATE TABLE ".$table_name." (
289
- location_id mediumint(9) NOT NULL AUTO_INCREMENT,
290
- location_name tinytext NOT NULL,
291
- location_address tinytext NOT NULL,
292
- location_town tinytext NOT NULL,
293
- location_province tinytext,
294
- location_latitude float DEFAULT NULL,
295
- location_longitude float DEFAULT NULL,
296
- location_description text DEFAULT NULL,
297
- UNIQUE KEY (location_id)
298
- );";
299
- require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
300
- dbDelta($sql);
301
-
302
- $wpdb->query("INSERT INTO ".$table_name." (location_name, location_address, location_town, location_latitude, location_longitude)
303
- VALUES ('Arts Millenium Building', 'Newcastle Road','Galway', 53.275, -9.06532)");
304
- $wpdb->query("INSERT INTO ".$table_name." (location_name, location_address, location_town, location_latitude, location_longitude)
305
- VALUES ('The Crane Bar', '2, Sea Road','Galway', 53.2692, -9.06151)");
306
- $wpdb->query("INSERT INTO ".$table_name." (location_name, location_address, location_town, location_latitude, location_longitude)
307
- VALUES ('Taaffes Bar', '19 Shop Street','Galway', 53.2725, -9.05321)");
308
- }
309
  }
 
310
 
311
- function dbem_create_bookings_table() {
312
-
313
- global $wpdb, $user_level;
314
- $table_name = $wpdb->prefix.BOOKINGS_TBNAME;
315
 
316
- if($wpdb->get_var("SHOW TABLES LIKE '$table_name'") != $table_name) {
317
-
318
- $sql = "CREATE TABLE ".$table_name." (
319
- booking_id mediumint(9) NOT NULL AUTO_INCREMENT,
320
- event_id tinyint NOT NULL,
321
- person_id tinyint NOT NULL,
322
- booking_seats tinyint NOT NULL,
323
- booking_comment text DEFAULT NULL,
324
- UNIQUE KEY (booking_id)
325
- );";
326
- require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
327
- dbDelta($sql);
328
- } else {
329
- maybe_add_column($table_name, 'booking_comment', "ALTER TABLE $table_name add booking_comment text DEFAULT NULL;");
330
- }
331
  }
332
-
333
- function dbem_create_people_table() {
334
-
335
- global $wpdb, $user_level;
336
- $table_name = $wpdb->prefix.PEOPLE_TBNAME;
337
-
338
- if($wpdb->get_var("SHOW TABLES LIKE '$table_name'") != $table_name) {
339
-
340
- $sql = "CREATE TABLE ".$table_name." (
341
- person_id mediumint(9) NOT NULL AUTO_INCREMENT,
342
- person_name tinytext NOT NULL,
343
- person_email tinytext NOT NULL,
344
- person_phone tinytext NOT NULL,
345
- UNIQUE KEY (person_id)
346
- );";
347
- require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
348
- dbDelta($sql);
349
-
350
- }
351
- }
352
-
353
- function dbem_migrate_old_events() {
354
-
355
-
356
- global $wpdb;
357
-
358
- $events_table = $wpdb->prefix.EVENTS_TBNAME;
359
- $sql = "SELECT event_id, event_time, event_venue, event_address, event_town FROM $events_table";
360
- //echo $sql;
361
- $events = $wpdb->get_results($sql, ARRAY_A);
362
- foreach($events as $event) {
363
-
364
- // Migrating location data to the location table
365
- $location = array('location_name' => $event['event_venue'], 'location_address' => $event['event_address'], 'location_town' => $event['event_town']);
366
- $related_location = dbem_get_identical_location($location);
367
-
368
- if ($related_location) {
369
- $event['location_id'] = $related_location['location_id'];
370
- }
371
- else {
372
- $new_location = dbem_insert_location($location);
373
- $event['location_id']= $new_location['location_id'];
374
- }
375
- // migrating event_time to event_start_date and event_start_time
376
- $event['event_start_date'] = substr($event['event_time'],0,10);
377
- $event['event_start_time'] = substr($event['event_time'],11,8);
378
- $event['event_end_time'] = substr($event['event_time'],11,8);
379
-
380
- $where = array('event_id' => $event['event_id']);
381
- $wpdb->update($events_table, $event, $where);
382
-
383
-
384
-
385
-
386
- }
387
-
388
-
389
  }
390
-
391
- function dbem_add_options() {
392
- $contact_person_email_body_localizable = __("#_RESPNAME (#_RESPEMAIL) will attend #_NAME on #m #d, #Y. He wants to reserve #_SPACES spaces.<br/> Now there are #_RESERVEDSPACES spaces reserved, #_AVAILABLESPACES are still available.<br/>Yours faithfully,<br/>Events Manager",'dbem') ;
393
- $respondent_email_body_localizable = __("Dear #_RESPNAME, <br/>you have successfully reserved #_SPACES space/spaces for #_NAME.<br/>Yours faithfully,<br/> #_CONTACTPERSON",'dbem');
394
-
395
- $dbem_options = array('dbem_event_list_item_format' => DEFAULT_EVENT_LIST_ITEM_FORMAT,
396
- 'dbem_display_calendar_in_events_page' => 0,
397
- 'dbem_single_event_format' => DEFAULT_SINGLE_EVENT_FORMAT,
398
- 'dbem_event_page_title_format' => DEFAULT_EVENT_PAGE_TITLE_FORMAT,
399
- 'dbem_list_events_page' => 0,
400
- 'dbem_events_page_title' => DEFAULT_EVENTS_PAGE_TITLE,
401
- 'dbem_no_events_message' => __('No events','dbem'),
402
- 'dbem_location_page_title_format' => DEFAULT_LOCATION_PAGE_TITLE_FORMAT,
403
- 'dbem_location_baloon_format' => DEFAULT_LOCATION_BALOON_FORMAT,
404
- 'dbem_location_event_list_item_format' => DEFAULT_LOCATION_EVENT_LIST_ITEM_FORMAT,
405
- 'dbem_location_no_events_message' => DEFAULT_LOCATION_NO_EVENTS_MESSAGE,
406
- 'dbem_single_location_format' => DEFAULT_SINGLE_LOCATION_FORMAT,
407
- 'dbem_map_text_format' => DEFAULT_MAP_TEXT_FORMAT,
408
- 'dbem_rss_main_title' => get_bloginfo('title')." - ".__('Events'),
409
- 'dbem_rss_main_description' => get_bloginfo('description')." - ".__('Events'),
410
- 'dbem_rss_description_format' => DEFAULT_RSS_DESCRIPTION_FORMAT,
411
- 'dbem_rss_title_format' => DEFAULT_RSS_TITLE_FORMAT,
412
- 'dbem_gmap_is_active'=>0,
413
- 'dbem_gmap_key' => '',
414
- 'dbem_default_contact_person' => 1,
415
- 'dbem_rsvp_mail_notify_is_active' => 0 ,
416
- 'dbem_contactperson_email_body' => __(str_replace("<br/>", "\n\r", $contact_person_email_body_localizable)),
417
- 'dbem_respondent_email_body' => __(str_replace("<br>", "\n\r", $respondent_email_body_localizable)),
418
- 'dbem_rsvp_mail_port' => 465,
419
- 'dbem_smtp_host' => 'localhost',
420
- 'dbem_mail_sender_name' => '',
421
- 'dbem_rsvp_mail_send_method' => 'smtp',
422
- 'dbem_rsvp_mail_SMTPAuth' => 1,
423
- 'dbem_image_max_width' => DEFAULT_IMAGE_MAX_WIDTH,
424
- 'dbem_image_max_height' => DEFAULT_IMAGE_MAX_HEIGHT,
425
- 'dbem_image_max_size' => DEFAULT_IMAGE_MAX_SIZE,
426
- 'dbem_full_calendar_event_format' => DEFAULT_FULL_CALENDAR_EVENT_FORMAT,
427
- 'dbem_small_calendar_event_title_format' => DEFAULT_SMALL_CALENDAR_EVENT_TITLE_FORMAT,
428
- 'dbem_small_calendar_event_title_separator' => DEFAULT_SMALL_CALENDAR_EVENT_TITLE_SEPARATOR,
429
- 'dbem_hello_to_user' => 1,
430
- 'dbem_use_select_for_locations' => DEFAULT_USE_SELECT_FOR_LOCATIONS,
431
- 'dbem_attributes_enabled', DEFAULT_ATTRIBUTES_ENABLED,
432
- 'dbem_recurrence_enabled', DEFAULT_RECURRENCE_ENABLED,
433
- 'dbem_rsvp_enabled', DEFAULT_RSVP_ENABLED,
434
- 'dbem_categories_enabled', DEFAULT_CATEGORIES_ENABLED);
435
-
436
- foreach($dbem_options as $key => $value){
437
- if(preg_match('/$dbem/', $key)){
438
- add_option($key, $value);
439
- }
440
- }
441
-
442
- }
443
- function dbem_add_option($key, $value) {
444
- $option = get_option($key);
445
- if (empty($option))
446
- update_option($key, $value);
447
- }
448
-
449
- function dbem_create_events_page(){
450
- echo "inserimento pagina";
451
- global $wpdb,$current_user;
452
- $page_name= DEFAULT_EVENT_PAGE_NAME;
453
- $sql= "INSERT INTO $wpdb->posts (post_author, post_date, post_date_gmt, post_type, post_content, post_title, post_name, post_modified, post_modified_gmt, comment_count) VALUES ($current_user->ID, '$now', '$now_gmt', 'page','CONTENTS', '$page_name', '".$wpdb->escape(__('events','dbem'))."', '$now', '$now_gmt', '0')";
454
- // echo($sql);
455
- $wpdb->query($sql);
456
-
457
- update_option('dbem_events_page', mysql_insert_id());
458
- }
459
-
460
- // Create the Manage Events and the Options submenus
461
- add_action('admin_menu','dbem_create_events_submenu');
462
- function dbem_create_events_submenu () {
463
- if(function_exists('add_submenu_page')) {
464
- add_object_page(__('Events', 'dbem'),__('Events', 'dbem'),MIN_CAPABILITY,__FILE__,'dbem_events_subpanel', '../wp-content/plugins/events-manager/images/calendar-16.png');
465
- // Add a submenu to the custom top-level menu:
466
- $plugin_page = add_submenu_page(__FILE__, __('Edit'),__('Edit'),MIN_CAPABILITY,__FILE__,'dbem_events_subpanel');
467
- add_action( 'admin_head-'. $plugin_page, 'dbem_admin_general_script' );
468
- $plugin_page = add_submenu_page(__FILE__, __('Add new', 'dbem'), __('Add new','dbem'), MIN_CAPABILITY, 'new_event', "dbem_new_event_page");
469
- add_action( 'admin_head-'. $plugin_page, 'dbem_admin_general_script' );
470
- $plugin_page = add_submenu_page(__FILE__, __('Locations', 'dbem'), __('Locations', 'dbem'), MIN_CAPABILITY, 'locations', "dbem_locations_page");
471
- add_action( 'admin_head-'. $plugin_page, 'dbem_admin_general_script' );
472
- $plugin_page = add_submenu_page(__FILE__, __('People', 'dbem'), __('People', 'dbem'), MIN_CAPABILITY, 'people', "dbem_people_page");
473
- add_action( 'admin_head-'. $plugin_page, 'dbem_admin_general_script' );
474
- //add_submenu_page(__FILE__, 'Test ', 'Test ', 8, 'test', 'dbem_recurrence_test');
475
- $plugin_page = add_submenu_page(__FILE__, __('Events Manager Settings','dbem'),__('Settings','dbem'), SETTING_CAPABILITY, "events-manager-options", 'dbem_options_subpanel');
476
- add_action( 'admin_head-'. $plugin_page, 'dbem_admin_general_script' );
477
- }
478
- }
479
-
480
- function dbem_replace_placeholders($format, $event, $target="html") {
481
- $event_string = $format;
482
- preg_match_all("/#@?_?[A-Za-z0-9]+/", $format, $placeholders);
483
- foreach($placeholders[0] as $result) {
484
- // echo "RESULT: $result <br>";
485
- // matches alla fields placeholder
486
- //TODO CUSTOM FIX FOR Brian
487
- // EVENTUALLY REMOVE
488
- if (preg_match('/#_JCCSTARTTIME/', $result)) {
489
- $time = substr($event['event_start_time'], 0,5);
490
- $event_string = str_replace($result, $time , $event_string );
491
- }
492
- // END of REMOVE
493
- if (preg_match('/#_EDITEVENTLINK/', $result)) {
494
- $link = "";
495
- if(is_user_logged_in())
496
- $link = "<a href=' ".get_bloginfo('url')."/wp-admin/edit.php?page=events-manager/events-manager.php&action=edit_event&event_id=".$event['event_id']."'>".__('Edit')."</a>";
497
- $event_string = str_replace($result, $link , $event_string );
498
- }
499
- if (preg_match('/#_24HSTARTTIME/', $result)) {
500
- $time = substr($event['event_start_time'], 0,5);
501
- $event_string = str_replace($result, $time , $event_string );
502
- }
503
- if (preg_match('/#_24HENDTIME/', $result)) {
504
- $time = substr($event['event_end_time'], 0,5);
505
- $event_string = str_replace($result, $time , $event_string );
506
- }
507
-
508
- if (preg_match('/#_12HSTARTTIME/', $result)) {
509
- $AMorPM = "AM";
510
- $hour = substr($event['event_start_time'], 0,2);
511
- $minute = substr($event['event_start_time'], 3,2);
512
- if ($hour > 12) {
513
- $hour = $hour -12;
514
- $AMorPM = "PM";
515
- }
516
- $time = "$hour:$minute $AMorPM";
517
- $event_string = str_replace($result, $time , $event_string );
518
- }
519
- if (preg_match('/#_12HENDTIME/', $result)) {
520
- $AMorPM = "AM";
521
- $hour = substr($event['event_end_time'], 0,2);
522
- $minute = substr($event['event_end_time'], 3,2);
523
- if ($hour > 12) {
524
- $hour = $hour -12;
525
- $AMorPM = "PM";
526
- }
527
- $time = "$hour:$minute $AMorPM";
528
- $event_string = str_replace($result, $time , $event_string );
529
- }
530
-
531
- if (preg_match('/#_MAP/', $result)) {
532
- $location = dbem_get_location($event['location_id']);
533
- $map_div = dbem_single_location_map($location);
534
- $event_string = str_replace($result, $map_div , $event_string );
535
-
536
- }
537
- if (preg_match('/#_ADDBOOKINGFORM/', $result)) {
538
- $rsvp_is_active = get_option('dbem_gmap_is_active');
539
- if ($event['event_rsvp']) {
540
- $rsvp_add_module .= dbem_add_booking_form();
541
- } else {
542
- $rsvp_add_module .= "";
543
- }
544
- $event_string = str_replace($result, $rsvp_add_module , $event_string );
545
- }
546
- if (preg_match('/#_REMOVEBOOKINGFORM/', $result)) {
547
- $rsvp_is_active = get_option('dbem_gmap_is_active');
548
- if ($event['event_rsvp']) {
549
- $rsvp_delete_module .= dbem_delete_booking_form();
550
- } else {
551
- $rsvp_delete_module .= "";
552
- }
553
- $event_string = str_replace($result, $rsvp_delete_module , $event_string );
554
- }
555
- if (preg_match('/#_AVAILABLESEATS/', $result)) {
556
- $rsvp_is_active = get_option('dbem_gmap_is_active');
557
- if ($event['event_rsvp']) {
558
- $availble_seats .= dbem_get_available_seats($event['event_id']);
559
- } else {
560
- $availble_seats .= "";
561
- }
562
- $event_string = str_replace($result, $availble_seats , $event_string );
563
- }
564
- if (preg_match('/#_LINKEDNAME/', $result)) {
565
- $events_page_id = get_option('dbem_events_page');
566
- $event_page_link = get_permalink($events_page_id);
567
- if (stristr($event_page_link, "?"))
568
- $joiner = "&amp;";
569
- else
570
- $joiner = "?";
571
- $event_string = str_replace($result, "<a href='".get_permalink($events_page_id).$joiner."event_id=".$event['event_id']."' title='".$event['event_name']."'>".$event['event_name']."</a>" , $event_string );
572
- }
573
- if (preg_match('/#_EVENTPAGEURL(\[(.+\)]))?/', $result)) {
574
- $events_page_id = get_option('dbem_events_page');
575
- if (stristr($event_page_link, "?"))
576
- $joiner = "&amp;";
577
- else
578
- $joiner = "?";
579
- $event_string = str_replace($result, get_permalink($events_page_id).$joiner."event_id=".$event['event_id'] , $event_string );
580
- }
581
- if (preg_match('/#_(NAME|NOTES|SEATS|EXCERPT)/', $result)) {
582
- $field = "event_".ltrim(strtolower($result), "#_");
583
- $field_value = $event[$field];
584
-
585
- if ($field == "event_notes" || $field == "event_excerpt") {
586
- /* Marcus Begin Edit */
587
- if ($target == "html"){
588
- //If excerpt, we use more link text
589
- if($field == "event_excerpt"){
590
- $matches = explode('<!--more-->', $event['event_notes']);
591
- $field_value = $matches[0];
592
- $field_value = apply_filters('dbem_notes_excerpt', $field_value);
593
- }else{
594
- $field_value = apply_filters('dbem_notes', $field_value);
595
- }
596
- //$field_value = apply_filters('the_content', $field_value); - chucks a wobbly if we do this.
597
- }else{
598
- if ($target == "map"){
599
- $field_value = apply_filters('dbem_notes_map', $field_value);
600
- } else {
601
- if($field == "event_excerpt"){
602
- $matches = explode('<!--more-->', $event['event_notes']);
603
- $field_value = htmlentities($matches[0]);
604
- $field_value = apply_filters('dbem_notes_rss', $field_value);
605
- }else{
606
- $field_value = apply_filters('dbem_notes_rss', $field_value);
607
- }
608
- $field_value = apply_filters('the_content_rss', $field_value);
609
- }
610
- }
611
- /* Marcus End Edit */
612
- } else {
613
- if ($target == "html"){
614
- $field_value = apply_filters('dbem_general', $field_value);
615
- }else{
616
- $field_value = apply_filters('dbem_general_rss', $field_value);
617
- }
618
- }
619
- $event_string = str_replace($result, $field_value , $event_string );
620
- }
621
-
622
- if (preg_match('/#_(ADDRESS|TOWN|PROVINCE)/', $result)) {
623
- $field = "location_".ltrim(strtolower($result), "#_");
624
- $field_value = $event[$field];
625
-
626
- if ($field == "event_notes") {
627
- if ($target == "html")
628
- $field_value = apply_filters('dbem_notes', $field_value);
629
- else
630
- if ($target == "map")
631
- $field_value = apply_filters('dbem_notes_map', $field_value);
632
- else
633
- $field_value = apply_filters('dbem_notes_rss', $field_value);
634
- } else {
635
- if ($target == "html")
636
- $field_value = apply_filters('dbem_general', $field_value);
637
- else
638
- $field_value = apply_filters('dbem_general_rss', $field_value);
639
- }
640
- $event_string = str_replace($result, $field_value , $event_string );
641
- }
642
-
643
- if (preg_match('/#_(LOCATION)$/', $result)) {
644
- $field = "location_name";
645
- $field_value = $event[$field];
646
- if ($target == "html")
647
- $field_value = apply_filters('dbem_general', $field_value);
648
- else
649
- $field_value = apply_filters('dbem_general_rss', $field_value);
650
-
651
- $event_string = str_replace($result, $field_value , $event_string );
652
- }
653
- if (preg_match('/#_CONTACTNAME$/', $result)) {
654
- $event['event_contactperson_id'] ? $user_id = $event['event_contactperson_id'] : $user_id = get_option('dbem_default_contact_person');
655
- $name = dbem_get_user_name($user_id);
656
- $event_string = str_replace($result, $name, $event_string );
657
- }
658
- if (preg_match('/#_CONTACTEMAIL$/', $result)) {
659
- $event['event_contactperson_id'] ? $user_id = $event['event_contactperson_id'] : $user_id = get_option('dbem_default_contact_person');
660
- $email = dbem_get_user_email($user_id);
661
- $event_string = str_replace($result, dbem_ascii_encode($email), $event_string );
662
- }
663
- if (preg_match('/#_CONTACTPHONE$/', $result)) {
664
- $event['event_contactperson_id'] ? $user_id = $event['event_contactperson_id'] : $user_id = get_option('dbem_default_contact_person');
665
- $phone = dbem_get_user_phone($user_id);
666
- $event_string = str_replace($result, dbem_ascii_encode($phone), $event_string );
667
- }
668
- if (preg_match('/#_(IMAGE)/', $result)) {
669
-
670
- if($event['location_image_url'] != '')
671
- $location_image = "<img src='".$event['location_image_url']."' alt='".$event['location_name']."'/>";
672
- else
673
- $location_image = "";
674
- $event_string = str_replace($result, $location_image , $event_string );
675
- }
676
-
677
- if (preg_match('/#_(LOCATIONPAGEURL)/', $result)) {
678
- $events_page_link = dbem_get_events_page(true, false);
679
- if (stristr($events_page_link, "?"))
680
- $joiner = "&amp;";
681
- else
682
- $joiner = "?";
683
- $venue_page_link = $events_page_link.$joiner."location_id=".$event['location_id'];
684
- $event_string = str_replace($result, $venue_page_link , $event_string );
685
- }
686
- // matches all PHP time placeholders for endtime
687
- if (preg_match('/^#@[dDjlNSwzWFmMntLoYy]$/', $result)) {
688
- $event_string = str_replace($result, mysql2date(ltrim($result, "#@"), $event['event_end_date']), $event_string );
689
- }
690
-
691
- // matches all PHP date placeholders
692
- if (preg_match('/^#[dDjlNSwzWFmMntLoYy]$/', $result)) {
693
- // echo "-inizio-";
694
- $event_string = str_replace($result, mysql2date(ltrim($result, "#"), $event['event_start_date']),$event_string );
695
- // echo $event_string;
696
- }
697
-
698
- // matches all PHP time placeholders
699
- if (preg_match('/^#@[aABgGhHisueIOPTZcrU]$/', $result)) {
700
- $event_string = str_replace($result, mysql2date(ltrim($result, "#@"), "2000-10-10 ".$event['event_end_time']),$event_string );
701
- // echo $event_string;
702
- }
703
-
704
- if (preg_match('/^#[aABgGhHisueIOPTZcrU]$/', $result)) {
705
- $event_string = str_replace($result, mysql2date(ltrim($result, "#"), "2000-10-10 ".$event['event_start_time']),$event_string );
706
- //echo $event['event_start_time'];
707
- //echo mysql2date('h:i A', '2010-10-10 23:35:00')."<br/>";
708
- // echo $event_string;
709
- }
710
-
711
- /* Marcus Begin Edit*/
712
- //Add a placeholder for categories
713
- if (preg_match('/^#_CATEGORY$/', $result)) {
714
- $category = (dbem_get_event_category($event['event_id']));
715
- $event_string = str_replace($result, $category['category_name'], $event_string );
716
- }
717
- /* Marcus End Edit */
718
-
719
- }
720
-
721
- /* Marcus Begin Edit */
722
- preg_match_all("/#@?_\{[A-Za-z0-9 -\/,\.\\\]+\}/", $format, $results);
723
- foreach($results[0] as $result) {
724
- if(substr($result, 0, 3 ) == "#@_"){
725
- $date = 'event_end_date';
726
- $offset = 4;
727
- }else{
728
- $date = 'event_start_date';
729
- $offset = 3;
730
- }
731
- if( $date == 'event_end_date' && $event[$date] == $event['event_start_date'] ){
732
- $event_string = str_replace($result, '', $event_string);
733
- }else{
734
- $event_string = str_replace($result, mysql2date(substr($result, $offset, (strlen($result)-($offset+1)) ), $event[$date]),$event_string );
735
  }
736
  }
737
- /* Marcus End Edit */
738
- /* Marcus Begin Edit */
739
- //This is for the custom attributes
740
- preg_match_all("/#_ATT\{.+?\}(\{.+?\})?/", $format, $results);
741
- foreach($results[0] as $resultKey => $result) {
742
- //Strip string of placeholder and just leave the reference
743
- $attRef = substr( substr($result, 0, strpos($result, '}')), 6 );
744
- $attString = $event['event_attributes'][$attRef];
745
- if( trim($attString) == '' && $results[1][$resultKey] != '' ){
746
- //Check to see if we have a second set of braces;
747
- $attString = substr( $results[1][$resultKey], 1, strlen(trim($results[1][$resultKey]))-2 );
 
748
  }
749
- $event_string = str_replace($result, $attString ,$event_string );
750
  }
751
- /* Marcus End Edit */
752
-
753
- return $event_string;
754
-
755
  }
 
756
 
757
- function dbem_date_to_unix_time($date) {
758
- $unix_time = mktime(0, 0, 0, substr($date,5,2), substr($date,8,2), substr($date,0,4));
759
- return $unix_time;
760
- }
761
- function dbem_sanitize_request( $value ) {
762
- if( get_magic_quotes_gpc() )
763
- $value = stripslashes( $value );
764
 
765
- //check if this function exists
766
- if( function_exists( "mysql_real_escape_string" ) ) {
767
- $value = mysql_real_escape_string( $value );
768
- //for PHP version < 4.3.0 use addslashes
769
- } else {
770
- $value = addslashes( $value );
771
- }
772
- return $value;
773
  }
 
774
  ?>
1
  <?php
2
  /*
3
  Plugin Name: Events Manager
4
+ Version: 3.0
5
  Plugin URI: http://davidebenini.it/wordpress-plugins/events-manager/
6
  Description: Manage events specifying precise spatial data (Location, Town, Province, etc).
7
+ Author: Davide Benini, Marcus Sykes
8
  Author URI: http://www.davidebenini.it/blog
9
  */
10
 
11
  /*
12
+ Copyright (c) 2010, Davide Benini and Marcus Sykes
13
 
14
  This program is free software; you can redistribute it and/or
15
  modify it under the terms of the GNU General Public License
28
 
29
  /*************************************************/
30
 
31
+ /*
32
+ * Some random notes
33
+ *
34
+ * - for consistency and easier modifications I propose we use a common coding practice Davide... ieally, $event and $EM_Event should always be only variables used to reference an EM_Event object, no others.
35
+ * $EM_Event is a global variable, $event has a local scope. same for $events and $EM_Events, they should be an array of EM_Event objects. what do u think?
36
+ * - Would be cool for functions where we pass a reference for something (event, location, category, etc) it could be either the ID, or the object itself. Makes things flexible, not hard to implement, am doing it already (see EM_Events::get)
37
+ */
38
+ //Features
39
+ //TODO Better data validation, both into database and outputting info (http://codex.wordpress.org/Data_Validation)
40
+ //Known Bugs
41
+ //FIXME admin panel showing future events shows event of day before
42
+ //FIXME when saving event, select screen has reversed order of events
43
+
44
+
45
+ // INCLUDES
46
+ include_once('classes/object.php'); //Base object, any files below may depend on this
47
+ //Template Tags & Template Logic
48
+ include_once("ajax.php");
49
+ include_once("events.php");
50
+ include_once("locations.php");
51
+ include_once("bookings.php");
52
+ include_once("functions.php");
53
+ include_once("shortcode.php");
54
+ include_once("template-tags.php");
55
+ include_once("template-tags-depreciated.php"); //To depreciate
56
+ //Widgets
57
+ include_once("widgets/events.php");
58
+ include_once("widgets/calendar.php");
59
+ //Classes
60
+ include_once('classes/booking.php');
61
+ include_once('classes/bookings.php');
62
+ include_once('classes/calendar.php');
63
+ include_once('classes/category.php');
64
+ include_once('classes/event.php');
65
+ include_once('classes/events.php');
66
+ include_once('classes/location.php');
67
+ include_once('classes/locations.php');
68
+ include_once("classes/mailer.php") ;
69
+ include_once('classes/map.php');
70
+ include_once('classes/people.php');
71
+ include_once('classes/person.php');
72
+ //Admin Files
73
+ if( is_admin() ){
74
+ include_once('admin/admin.php');
75
+ include_once('admin/bookings.php');
76
+ include_once('admin/categories.php');
77
+ include_once('admin/event.php');
78
+ include_once('admin/events.php');
79
+ include_once('admin/locations.php');
80
+ include_once('admin/functions.php');
81
+ include_once('admin/options.php');
82
+ include_once('admin/people.php');
83
+ include_once('admin/support.php');
84
+ }
85
+
86
+
87
  // Setting constants
88
+ define('EM_VERSION', 3); //self expanatory
89
+ define('DBEM_CATEGORIES_TBNAME', 'em_categories'); //TABLE NAME
90
+ define('EVENTS_TBNAME','em_events'); //TABLE NAME
91
  define('RECURRENCE_TBNAME','dbem_recurrence'); //TABLE NAME
92
+ define('LOCATIONS_TBNAME','em_locations'); //TABLE NAME
93
+ define('BOOKINGS_TBNAME','em_bookings'); //TABLE NAME
94
+ define('PEOPLE_TBNAME','em_people'); //TABLE NAME
 
95
  define('DEFAULT_EVENT_PAGE_NAME', 'Events');
96
  define('DBEM_PAGE','<!--DBEM_EVENTS_PAGE-->'); //EVENTS PAGE
97
  define('MIN_CAPABILITY', 'edit_posts'); // Minimum user level to access calendars
98
  define('SETTING_CAPABILITY', 'activate_plugins'); // Minimum user level to access calendars
99
+ define('DEFAULT_LIST_DATE_TITLE', __('Events', 'dbem').' - #j #M #y');
100
  define('DEFAULT_EVENT_LIST_ITEM_FORMAT', '<li>#j #M #Y - #H:#i<br/> #_LINKEDNAME<br/>#_TOWN </li>');
101
  define('DEFAULT_SINGLE_EVENT_FORMAT', '<p>#j #M #Y - #H:#i</p><p>#_TOWN</p>');
102
  define('DEFAULT_EVENTS_PAGE_TITLE',__('Events','dbem') ) ;
103
+ define('DEFAULT_EVENT_PAGE_TITLE_FORMAT', '#_NAME');
104
  define('DEFAULT_RSS_DESCRIPTION_FORMAT',"#j #M #y - #H:#i <br/>#_LOCATION <br/>#_ADDRESS <br/>#_TOWN");
105
  define('DEFAULT_RSS_TITLE_FORMAT',"#_NAME");
106
  define('DEFAULT_MAP_TEXT_FORMAT', '<strong>#_LOCATION</strong><p>#_ADDRESS</p><p>#_TOWN</p>');
107
  define('DEFAULT_WIDGET_EVENT_LIST_ITEM_FORMAT','<li>#_LINKEDNAME<ul><li>#j #M #y</li><li>#_TOWN</li></ul></li>');
108
  define('DEFAULT_NO_EVENTS_MESSAGE', __('No events', 'dbem'));
109
  define('DEFAULT_SINGLE_LOCATION_FORMAT', '<p>#_ADDRESS</p><p>#_TOWN</p>');
110
+ define('DEFAULT_LOCATION_PAGE_TITLE_FORMAT', '#_NAME');
111
  define('DEFAULT_LOCATION_BALOON_FORMAT', "<strong>#_NAME</strong><br/>#_ADDRESS - #_TOWN<br/><a href='#_LOCATIONPAGEURL'>Details</a>");
112
  define('DEFAULT_LOCATION_EVENT_LIST_ITEM_FORMAT', "<li>#_NAME - #j #M #Y - #H:#i</li>");
113
  define('DEFAULT_LOCATION_NO_EVENTS_MESSAGE', __('<li>No events in this location</li>', 'dbem'));
119
  define('DEFAULT_SMALL_CALENDAR_EVENT_TITLE_FORMAT', "#_NAME" );
120
  define('DEFAULT_SMALL_CALENDAR_EVENT_TITLE_SEPARATOR', ", ");
121
  define('DEFAULT_USE_SELECT_FOR_LOCATIONS', false);
122
+ define('DEFAULT_ATTRIBUTES_ENABLED', true);
123
+ define('DEFAULT_RECURRENCE_ENABLED', true);
124
+ define('DEFAULT_RSVP_ENABLED', true);
125
+ define('DEFAULT_CATEGORIES_ENABLED', true);
126
+
127
+ // obsolete tables
128
+ define('OLD_EVENTS_TBNAME','dbem_events') ;
129
+ define('OLD_RECURRENCE_TBNAME','dbem_recurrence'); //TABLE NAME
130
+ define('OLD_LOCATIONS_TBNAME','dbem_locations'); //TABLE NAME
131
+ define('OLD_BOOKINGS_TBNAME','dbem_bookings'); //TABLE NAME
132
+ define('OLD_PEOPLE_TBNAME','dbem_people'); //TABLE NAME
133
+ define('OLD_BOOKING_PEOPLE_TBNAME','dbem_bookings_people'); //TABLE NAME
134
+ define('OLD_CATEGORIES_TBNAME', 'dbem_categories'); //TABLE NAME
135
+
136
 
137
  // DEBUG constant for developing
138
  // if you are hacking this plugin, set to TRUE, a log will show in admin pages
139
+ define('DEBUG', false);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
140
 
141
+ // FILTERS
142
  // filters for general events field (corresponding to those of "the _title")
143
  add_filter('dbem_general', 'wptexturize');
144
  add_filter('dbem_general', 'convert_chars');
156
  // RSS content filter
157
  add_filter('dbem_notes_rss', 'convert_chars', 8);
158
  add_filter('dbem_notes_rss', 'ent2ncr', 8);
159
+ // Notes map filters
160
  add_filter('dbem_notes_map', 'convert_chars', 8);
161
  add_filter('dbem_notes_map', 'js_escape');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
162
 
163
+ // LOCALIZATION
164
+ // Localised date formats as in the jquery UI datepicker plugin
165
+ //TODO Sort out dates, (ref: output idea)
166
+ load_plugin_textdomain('dbem', false, dirname( plugin_basename( __FILE__ ) ).'/includes/langs');
167
+
168
+ /**
169
+ * This function will load an event into the global $EM_Event variable during page initialization, provided an event_id is given in the url via GET or POST.
170
+ * global $EM_Recurrences also holds global array of recurrence objects when loaded in this instance for performance
171
+ * All functions (admin and public) can now work off this object rather than it around via arguments.
172
+ * @return null
173
+ */
174
+ function em_load_event(){
175
+ global $EM_Event, $EM_Recurrences, $EM_Location, $EM_Mailer;
176
+ $EM_Recurrences = array();
177
+ if( isset( $_REQUEST['event_id'] ) && is_numeric($_REQUEST['event_id']) ){
178
+ $EM_Event = new EM_Event($_REQUEST['event_id']);
179
+ }elseif( $_REQUEST['recurrence_id'] && is_numeric($_REQUEST['recurrence_id']) ){
180
+ //Eventually we can just remove this.... each event has an event_id regardless of what it is.
181
+ $EM_Event = new EM_Event($_REQUEST['recurrence_id']);
182
+ }elseif( $_REQUEST['location_id'] && is_numeric($_REQUEST['location_id']) ){
183
+ $EM_Location = new EM_Location($_REQUEST['location_id']);
 
 
 
 
 
 
 
184
  }
185
+ $EM_Mailer = new EM_Mailer();
186
+ define('EM_URI', get_permalink(get_option("dbem_events_page"))); //PAGE URI OF EM
187
+ define('EM_RSS_URI', get_bloginfo('wpurl')."/?dbem_rss=main"); //RSS PAGE URI
188
  }
189
+ add_action('init', 'em_load_event', 1);
190
+
191
+ /**
192
+ * Settings link in the plugins page menu
193
+ * @param array $links
194
+ * @param string $file
195
+ * @return array
196
+ */
197
+ function em_set_plugin_meta($links, $file) {
198
+ $plugin = plugin_basename(__FILE__);
199
+ // create link
200
+ if ($file == $plugin) {
201
+ return array_merge(
202
+ $links,
203
+ array( sprintf( '<a href="admin.php?page=events-manager-options">%s</a>', __('Settings') ) )
204
+ );
 
 
 
 
 
 
 
 
 
 
 
205
  }
206
+ return $links;
207
  }
208
+ add_filter( 'plugin_row_meta', 'em_set_plugin_meta', 10, 2 );
209
+
210
+
211
+ // Create the Manage Events and the Options submenus
212
+ function em_create_events_submenu () {
213
+ if(function_exists('add_submenu_page')) {
214
+ //TODO Add flexible permissions
215
+ add_object_page(__('Events', 'dbem'),__('Events', 'dbem'),MIN_CAPABILITY,__FILE__,'dbem_events_subpanel', '../wp-content/plugins/events-manager/includes/images/calendar-16.png');
216
+ // Add a submenu to the custom top-level menu:
217
+ $plugin_pages = array();
218
+ $plugin_pages[] = add_submenu_page(__FILE__, __('Edit'),__('Edit'),MIN_CAPABILITY,__FILE__,'dbem_events_subpanel');
219
+ $plugin_pages[] = add_submenu_page(__FILE__, __('Add new', 'dbem'), __('Add new','dbem'), MIN_CAPABILITY, 'new_event', "dbem_new_event_page");
220
+ $plugin_pages[] = add_submenu_page(__FILE__, __('Locations', 'dbem'), __('Locations', 'dbem'), MIN_CAPABILITY, 'locations', "dbem_locations_page");
221
+ $plugin_pages[] = add_submenu_page(__FILE__, __('People', 'dbem'), __('People', 'dbem'), MIN_CAPABILITY, 'people', "dbem_people_page");
222
+ $plugin_pages[] = add_submenu_page(__FILE__, __('Event Categories','dbem'),__('Categories','dbem'), SETTING_CAPABILITY, "events-manager-categories", 'dbem_categories_subpanel');
223
+ $plugin_pages[] = add_submenu_page(__FILE__, __('Events Manager Settings','dbem'),__('Settings','dbem'), SETTING_CAPABILITY, "events-manager-options", 'dbem_options_subpanel');
224
+ $plugin_pages[] = add_submenu_page(__FILE__, __('Getting Help for Events Manager','dbem'),__('Help','dbem'), SETTING_CAPABILITY, "events-manager-support", 'em_admin_support');
225
+ foreach($plugin_pages as $plugin_page){
226
+ add_action( 'admin_print_scripts-'. $plugin_page, 'em_admin_load_scripts' );
227
+ add_action( 'admin_head-'. $plugin_page, 'em_admin_general_script' );
228
+ add_action( 'admin_print_styles-'. $plugin_page, 'em_admin_load_styles' );
229
+ }
230
+ }
 
 
 
 
 
 
 
 
 
 
 
231
  }
232
+ add_action('admin_menu','em_create_events_submenu');
233
 
 
 
 
 
234
 
235
+ /**
236
+ * Enqueing public scripts and styles
237
+ */
238
+ function em_enqueue_public() {
239
+ wp_enqueue_script ( 'jquery' ); //make sure we have jquery loaded
240
+ wp_enqueue_style('events-manager', WP_PLUGIN_URL.'/events-manager/includes/css/events_manager.css'); //main css
 
 
 
 
 
 
 
 
 
241
  }
242
+ add_action ( 'template_redirect', 'em_enqueue_public' );
243
+
244
+ /**
245
+ * Add a link to the favourites menu
246
+ * @param array $actions
247
+ * @return multitype:string
248
+ */
249
+ function em_favorite_menu($actions) {
250
+ // add quick link to our favorite plugin
251
+ $actions ['admin.php?page=new_event'] = array (__ ( 'Add an event', 'dbem' ), MIN_CAPABILITY );
252
+ return $actions;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
253
  }
254
+ add_filter ( 'favorite_actions', 'em_favorite_menu' );
255
+
256
+ /**
257
+ * Generate warnings and notices in the admin area
258
+ */
259
+ function em_admin_warnings() {
260
+ //If we're editing the events page show hello to new user
261
+ if (isset ( $_GET ['disable_hello_to_user'] ) && $_GET ['disable_hello_to_user'] == 'true'){
262
+ // Disable Hello to new user if requested
263
+ update_option ( 'dbem_hello_to_user', 0 );
264
+ }else{
265
+ $events_page_id = get_option ( 'dbem_events_page' );
266
+ if ( preg_match( '/(post|page).php/', $_SERVER ['SCRIPT_NAME']) && isset ( $_GET ['action'] ) && $_GET ['action'] == 'edit' && isset ( $_GET ['post'] ) && $_GET ['post'] == "$events_page_id") {
267
+ $message = sprintf ( __ ( "This page corresponds to <strong>Events Manager</strong> events page. Its content will be overriden by <strong>Events Manager</strong>. If you want to display your content, you can can assign another page to <strong>Events Manager</strong> in the the <a href='%s'>Settings</a>. ", 'dbem' ), 'admin.php?page=events-manager-options' );
268
+ $notice = "<div class='error'><p>$message</p></div>";
269
+ echo $notice;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
270
  }
271
  }
272
+ //If events page couldn't be created
273
+ if( $_GET['em_dismiss_events_page'] == '1' ){
274
+ update_option('dbem_dismiss_events_page',1);
275
+ }else{
276
+ if ( !get_page(get_option('dbem_events_page')) && !get_option('dbem_dismiss_events_page') ){
277
+ $dismiss_link_joiner = ( count($_GET) > 0 ) ? '&amp;':'?';
278
+ $advice = sprintf ( __( 'Uh Oh! For some reason wordpress could not create an events page for you (or you just deleted it). Not to worry though, all you have to do is create an empty page, name it whatever you want, and select it as your events page in your <a href="%s">options page</a>. Sorry for the extra step! If you know what you are doing, you may have done this on purpose, if so <a href="%s">ignore this message</a>', 'dbem'), get_bloginfo ( 'url' ) . '/wp-admin/admin.php?page=events-manager-options', $_SERVER['REQUEST_URI'].$dismiss_link_joiner.'em_dismiss_events_page=1' );
279
+ ?>
280
+ <div id="em_page_error" class="updated">
281
+ <p><?php echo $advice; ?></p>
282
+ </div>
283
+ <?php
284
  }
 
285
  }
 
 
 
 
286
  }
287
+ add_action ( 'admin_notices', 'em_admin_warnings' );
288
 
289
+ /* Creating the wp_events table to store event data*/
290
+ function em_activate() {
291
+ require_once(WP_PLUGIN_DIR.'/events-manager/install.php');
292
+ em_install();
293
+ }
294
+ register_activation_hook( __FILE__,'em_activate');
 
295
 
296
+ if( $_GET['em_reimport'] == '1' || get_option('dbem_import_fail') == '1' ){
297
+ require_once(WP_PLUGIN_DIR.'/events-manager/install.php');
 
 
 
 
 
 
298
  }
299
+
300
  ?>
events.php ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * This file contains the event related hooks in the front end, as well as some event template tags
4
+ */
5
+
6
+ /**
7
+ * Filters for page content and if an event replaces it with the relevant event data.
8
+ * @param $data
9
+ * @return string
10
+ */
11
+ function em_content($data) {
12
+ $events_page_id = get_option ( 'dbem_events_page' );
13
+ if ( get_the_ID() == $events_page_id && $events_page_id != 0 ) {
14
+ global $wpdb, $EM_Event;
15
+ //TODO any loop should put the current $EM_Event etc. into the global variable
16
+ if ( isset( $_REQUEST['calendar_day'] ) && $_REQUEST['calendar_day'] != '' ) {
17
+ //Events for a specific day
18
+ $events = EM_Events::get( array('limit'=>10,'scope'=>$_REQUEST['calendar_day'],'order'=>"ASC") );
19
+ if ( count($events) > 1) {
20
+ return EM_Events::output($events);
21
+ } else {
22
+ $EM_Event = $events[0];
23
+ return $EM_Event->output_single();
24
+ }
25
+ } elseif ( is_numeric($_REQUEST['location_id']) ) {
26
+ //Just a single location
27
+ $location = new EM_Location($_REQUEST['location_id']);
28
+ return $location->output_single();
29
+ } elseif ( is_numeric($_REQUEST['event_id']) ) {
30
+ // single event page
31
+ $event = new EM_Event( $_REQUEST['event_id'] );
32
+ return $event->output_single();
33
+ } else {
34
+ // Multiple events page
35
+ $scope = ($_REQUEST['scope']) ? EM_Object::sanitize($_REQUEST['scope']) : "future";
36
+ if (get_option ( 'dbem_display_calendar_in_events_page' )){
37
+ return EM_Calendar::get('full=1');
38
+ }else{
39
+ return EM_Events::output ( array('limit'=>10,'scope'=>$scope, 'order'=>"ASC") );
40
+ }
41
+ }
42
+ } else {
43
+ return $data;
44
+ }
45
+ }
46
+ add_filter ( 'the_content', 'em_content' );
47
+
48
+ /**
49
+ * Filter for titles when on event pages
50
+ * @param $data
51
+ * @return string
52
+ */
53
+ function em_events_page_title($data) {
54
+ global $EM_Event;
55
+ global $post;
56
+ $events_page_id = get_option ( 'dbem_events_page' );
57
+
58
+ if ( $post->ID == $events_page_id && $events_page_id != 0 ) {
59
+ if (isset ( $_REQUEST['calendar_day'] ) && $_REQUEST['calendar_day'] != '') {
60
+ $events = EM_Events::get(array('limit'=>2,'scope'=>$_REQUEST['calendar_day']));
61
+ $event = $events[0];
62
+ if ( count($events) > 1 ) {
63
+ return $event->output( get_option ('dbem_list_date_title') );
64
+ }else{
65
+ return $event->output( get_option('dbem_event_page_title_format') );
66
+ }
67
+ }
68
+ if (isset ( $_REQUEST ['location_id'] ) && $_REQUEST ['location_id'] |= '') {
69
+ $location = new EM_Location( EM_Object::sanitize($_REQUEST ['location_id']) );
70
+ return $location->output(get_option( 'dbem_location_page_title_format' ));;
71
+ }
72
+ if (isset ( $_REQUEST ['event_id'] ) && $_REQUEST ['event_id'] != '') {
73
+ // single event page
74
+ return $EM_Event->output ( get_option ( 'dbem_event_page_title_format' ) );
75
+ } else {
76
+ // Multiple events page
77
+ return get_option ( 'dbem_events_page_title' );
78
+ }
79
+ } else {
80
+ return $data;
81
+ }
82
+ }
83
+ add_filter ( 'single_post_title', 'em_events_page_title' ); //Filter for the wp_title of page, can directly reference page title function
84
+
85
+ /**
86
+ * Makes sure we're in "THE Loop", which is determinied by a flag set when the_post() (start) is first called, and when have_posts() (end) returns false.
87
+ * @param string $data
88
+ * @return string
89
+ */
90
+ function em_wp_the_title($data){
91
+ //This is set by the loop_start and loop_end actions
92
+ global $wp_query;
93
+ if ( $wp_query->in_the_loop ) {
94
+ return em_events_page_title($data) ;
95
+ }else{
96
+ return $data ;
97
+ }
98
+ }
99
+ add_filter ( 'the_title', 'em_wp_the_title' );
100
+
101
+ /**
102
+ * Filters the get_pages functions so it includes the event pages?
103
+ * @param $data
104
+ * @return array
105
+ */
106
+ function em_filter_get_pages($data) {
107
+ global $em_disable_filter; //Using a flag here instead
108
+ $show_events_menu = get_option ( 'dbem_list_events_page' );
109
+ if ( !$show_events_menu && $em_disable_filter !== true ) {
110
+ $output = array();
111
+ $events_page_id = get_option ( 'dbem_events_page' );
112
+ foreach( $data as $data_id => $page ) {
113
+ if($page->ID != $events_page_id){
114
+ $output[] = $page;
115
+ }
116
+ }
117
+ return $output;
118
+ }
119
+ return $data;
120
+ }
121
+ add_filter ( 'get_pages', 'em_filter_get_pages' );
122
+
123
+ ?>
functions.php ADDED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ function em_hello_to_new_user() {
3
+ if ( get_option ( 'dbem_hello_to_user' ) == 1 ) {
4
+ $current_user = wp_get_current_user ();
5
+ $advice = sprintf ( __ ( "<p>Hey, <strong>%s</strong>, welcome to <strong>Events Manager</strong>! We hope you like it around here.</p>
6
+ <p>Now it's time to insert events lists through <a href='%s' title='Widgets page'>widgets</a>, <a href='%s' title='Template tags documentation'>template tags</a> or <a href='%s' title='Shortcodes documentation'>shortcodes</a>.</p>
7
+ <p>By the way, have you taken a look at the <a href='%s' title='Change settings'>Settings page</a>? That's where you customize the way events and locations are displayed.</p>
8
+ <p>What? Tired of seeing this advice? I hear you, <a href='%s' title='Don't show this advice again'>click here</a> and you won't see this again!</p>", 'dbem' ), $current_user->display_name, get_bloginfo ( 'url' ) . '/wp-admin/widgets.php', 'http://davidebenini.it/wordpress-plugins/events-manager#template-tags', 'http://davidebenini.it/wordpress-plugins/events-manager#shortcodes', get_bloginfo ( 'url' ) . '/wp-admin/admin.php?page=events-manager-options', get_bloginfo ( 'url' ) . '/wp-admin/admin.php?page=events-manager/events-manager.php&disable_hello_to_user=true' );
9
+ ?>
10
+ <div id="message" class="updated">
11
+ <?php echo $advice; ?>
12
+ </div>
13
+ <?php
14
+ }
15
+ }
16
+
17
+
18
+ function url_exists($url) {
19
+
20
+ if ((strpos ( $url, "http" )) === false)
21
+ $url = "http://" . $url;
22
+ // FIXME ripristina la linea seguente e VEDI DI SISTEMARE!!!!
23
+ // if (is_array(@get_headers($url))) {
24
+ if (true)
25
+ return true;
26
+ else
27
+ return false;
28
+ }
29
+
30
+ /**
31
+ * Gets all WP users
32
+ * @return array
33
+ */
34
+ function em_get_wp_users() {
35
+ global $wpdb;
36
+ $sql = "SELECT display_name, ID FROM $wpdb->users";
37
+ $users = $wpdb->get_results($sql, ARRAY_A);
38
+ $indexed_users = array();
39
+ foreach($users as $user)
40
+ $indexed_users[$user['ID']] = $user['display_name'];
41
+ return $indexed_users;
42
+ }
43
+
44
+ /*
45
+ * UI Helpers
46
+ * previously dbem_UI_helpers.php functions
47
+ */
48
+
49
+ function dbem_option_items($array, $saved_value) {
50
+ $output = "";
51
+ foreach($array as $key => $item) {
52
+ $selected ='';
53
+ if ($key == $saved_value)
54
+ $selected = "selected='selected'";
55
+ $output .= "<option value='$key' $selected >$item</option>\n";
56
+
57
+ }
58
+ echo $output;
59
+ }
60
+
61
+ function dbem_checkbox_items($name, $array, $saved_values, $horizontal = true) {
62
+ $output = "";
63
+ foreach($array as $key => $item) {
64
+ $checked = "";
65
+ if (in_array($key, $saved_values))
66
+ $checked = "checked='checked'";
67
+ $output .= "<input type='checkbox' name='$name' value='$key' $checked /> $item ";
68
+ if(!$horizontal)
69
+ $output .= "<br/>\n";
70
+ }
71
+ echo $output;
72
+
73
+ }
74
+
75
+ function dbem_options_input_text($title, $name, $description) {
76
+ ?>
77
+ <tr valign="top" id='<?php echo $name;?>_row'>
78
+ <th scope="row"><?php _e($title, 'dbem') ?></th>
79
+ <td>
80
+ <input name="<?php echo $name ?>" type="text" id="<?php echo $title ?>" style="width: 95%" value="<?php echo htmlspecialchars(get_option($name), ENT_QUOTES); ?>" size="45" /><br />
81
+ <?php _e($description, 'dbem') ?>
82
+ </td>
83
+ </tr>
84
+ <?php
85
+ }
86
+ function dbem_options_input_password($title, $name, $description) {
87
+ ?>
88
+ <tr valign="top" id='<?php echo $name;?>_row'>
89
+ <th scope="row"><?php _e($title, 'dbem') ?></th>
90
+ <td>
91
+ <input name="<?php echo $name ?>" type="password" id="<?php echo $title ?>" style="width: 95%" value="<?php echo get_option($name); ?>" size="45" /><br />
92
+ <?php echo $description; ?>
93
+ </td>
94
+ </tr>
95
+ <?php
96
+ }
97
+
98
+ function dbem_options_textarea($title, $name, $description) {
99
+ ?>
100
+ <tr valign="top" id='<?php echo $name;?>_row'>
101
+ <th scope="row"><?php _e($title,'dbem')?></th>
102
+ <td><textarea name="<?php echo $name ?>" id="<?php echo $name ?>" rows="6" cols="60"><?php echo htmlspecialchars(get_option($name), ENT_QUOTES);?></textarea><br/>
103
+ <?php echo $description; ?></td>
104
+ </tr>
105
+ <?php
106
+ }
107
+
108
+ function dbem_options_radio_binary($title, $name, $description) {
109
+ $list_events_page = get_option($name); ?>
110
+
111
+ <tr valign="top" id='<?php echo $name;?>_row'>
112
+ <th scope="row"><?php _e($title,'dbem'); ?></th>
113
+ <td>
114
+ <input id="<?php echo $name ?>_yes" name="<?php echo $name ?>" type="radio" value="1" <?php if($list_events_page) echo "checked='checked'"; ?> /><?php _e('Yes'); ?> <br />
115
+ <input id="<?php echo $name ?>_no" name="<?php echo $name ?>" type="radio" value="0" <?php if(!$list_events_page) echo "checked='checked'"; ?> /><?php _e('No'); ?> <br />
116
+ <?php echo $description; ?>
117
+ </td>
118
+ </tr>
119
+ <?php
120
+ }
121
+ function dbem_options_select($title, $name, $list, $description) {
122
+ $option_value = get_option($name);
123
+ if( $name == 'dbem_events_page' && !is_object(get_page($option_value)) ){
124
+ $option_value = 0; //Special value
125
+ }
126
+ ?>
127
+ <tr valign="top" id='<?php echo $name;?>_row'>
128
+ <th scope="row"><?php _e($title,'dbem'); ?></th>
129
+ <td>
130
+ <select name="<?php echo $name; ?>" >
131
+ <?php foreach($list as $key => $value) : ?>
132
+ <option value='<?php echo $key ?>' <?php echo ("$key" == $option_value) ? "selected='selected' " : ''; ?>>
133
+ <?php echo $value; ?>
134
+ </option>
135
+ <?php endforeach; ?>
136
+ </select> <br/>
137
+ <?php echo $description; ?>
138
+ </td>
139
+ </tr>
140
+ <?php
141
+ }
142
+ // got from http://davidwalsh.name/php-email-encode-prevent-spam
143
+ function dbem_ascii_encode($e)
144
+ {
145
+ for ($i = 0; $i < strlen($e); $i++) { $output .= '&#'.ord($e[$i]).';'; }
146
+ return $output;
147
+ }
148
+ ?>
events_manager.css → includes/css/events_manager.css RENAMED
@@ -1,3 +1,6 @@
 
 
 
1
  table#dbem-bookings-table tfoot td.booking-result {
2
  font-weight: bold;
3
  background:#6D6D6D url(../../../wp-admin/images/menu-bits.gif) repeat-x scroll left top;
@@ -14,8 +17,8 @@ table.dbem-rsvp-form {
14
  width: 80%;
15
  }
16
  table.dbem-rsvp-form th {
17
- text-align: right;
18
- width: 35%;
19
  }
20
 
21
  table.dbem-rsvp-form td {
@@ -23,12 +26,30 @@ table.dbem-rsvp-form td {
23
  text-align: left;
24
  }
25
 
 
 
 
 
26
  div.dbem-rsvp-message {
27
  margin-bottom: 1em;
28
  background-color: #FDDD73;
29
  padding: 5px;
30
  border: 2px solid #FF9100;
31
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
 
33
  a.bookingdelbutton {
34
  background: url("../../../wp-admin/images/xit.gif") no-repeat;
@@ -90,7 +111,7 @@ p#recurrence_warning {
90
  padding: 5px;
91
  }
92
  div#icon-events{
93
- background:url('images/calendar-32.png') no-repeat center;
94
  }
95
 
96
  table#dbem-location-data th {
@@ -112,6 +133,10 @@ table.dbem-calendar.table tr.days-names {
112
  table.dbem-calendar-table td.eventless-pre, .dbem-calendar td.eventless-post {
113
  color: #ccc;
114
  }
 
 
 
 
115
  table.dbem-calendar-table td.eventful a, table.dbem-calendar-table td.eventful-today a {
116
  font-weight: bold;
117
  color: #FD7E29;
@@ -135,4 +160,7 @@ table.fullcalendar td {
135
  .dbem-calendar-full ul {
136
  font-size: 80%;
137
  list-style: none;
138
- }
 
 
 
1
+ #location_info td { vertical-align:top; text-align:left; }
2
+ #location_info th { vertical-align:top; text-align:left; padding:5px 10px 0 0; }
3
+
4
  table#dbem-bookings-table tfoot td.booking-result {
5
  font-weight: bold;
6
  background:#6D6D6D url(../../../wp-admin/images/menu-bits.gif) repeat-x scroll left top;
17
  width: 80%;
18
  }
19
  table.dbem-rsvp-form th {
20
+ text-align: left;
21
+ width: 30%;
22
  }
23
 
24
  table.dbem-rsvp-form td {
26
  text-align: left;
27
  }
28
 
29
+ table.dbem-rsvp-form td input {
30
+ margin:0px;
31
+ }
32
+
33
  div.dbem-rsvp-message {
34
  margin-bottom: 1em;
35
  background-color: #FDDD73;
36
  padding: 5px;
37
  border: 2px solid #FF9100;
38
+ }
39
+
40
+ div.dbem-rsvp-message-success {
41
+ margin-bottom: 1em;
42
+ background-color: #5BBF58;
43
+ padding: 5px;
44
+ border: 2px solid #499B47;
45
+ }
46
+
47
+ div.dbem-rsvp-message-error {
48
+ margin-bottom: 1em;
49
+ background-color: #DF9477;
50
+ padding: 5px;
51
+ border: 2px solid #C34F33;
52
+ }
53
 
54
  a.bookingdelbutton {
55
  background: url("../../../wp-admin/images/xit.gif") no-repeat;
111
  padding: 5px;
112
  }
113
  div#icon-events{
114
+ background:url('../images/calendar-32.png') no-repeat center;
115
  }
116
 
117
  table#dbem-location-data th {
133
  table.dbem-calendar-table td.eventless-pre, .dbem-calendar td.eventless-post {
134
  color: #ccc;
135
  }
136
+ table.dbem-calendar-table td.eventful-pre a, table.dbem-calendar-table td.eventful-post a{
137
+ color: #aaa;
138
+ text-decoration:underline;
139
+ }
140
  table.dbem-calendar-table td.eventful a, table.dbem-calendar-table td.eventful-today a {
141
  font-weight: bold;
142
  color: #FD7E29;
160
  .dbem-calendar-full ul {
161
  font-size: 80%;
162
  list-style: none;
163
+ }
164
+
165
+ /*Maps*/
166
+ #em-map-balloon #content { margin:0px; padding:0px; font-size:12px; }
includes/css/images/ui-bg_diagonals-thick_18_b81900_40x40.png ADDED
Binary file
includes/css/images/ui-bg_diagonals-thick_20_666666_40x40.png ADDED
Binary file
includes/css/images/ui-bg_flat_10_000000_40x100.png ADDED
Binary file
includes/css/images/ui-bg_glass_100_f6f6f6_1x400.png ADDED
Binary file
includes/css/images/ui-bg_glass_100_fdf5ce_1x400.png ADDED
Binary file
includes/css/images/ui-bg_glass_65_ffffff_1x400.png ADDED
Binary file
includes/css/images/ui-bg_gloss-wave_35_f6a828_500x100.png ADDED
Binary file
includes/css/images/ui-bg_highlight-soft_100_eeeeee_1x100.png ADDED
Binary file
includes/css/images/ui-bg_highlight-soft_75_ffe45c_1x100.png ADDED
Binary file
includes/css/images/ui-icons_222222_256x240.png ADDED
Binary file
includes/css/images/ui-icons_228ef1_256x240.png ADDED
Binary file
includes/css/images/ui-icons_ef8c08_256x240.png ADDED
Binary file
includes/css/images/ui-icons_ffd27a_256x240.png ADDED
Binary file
includes/css/images/ui-icons_ffffff_256x240.png ADDED
Binary file
includes/css/jquery-ui-1.7.3.custom.css ADDED
@@ -0,0 +1,344 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * jQuery UI CSS Framework
3
+ * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
4
+ * Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses.
5
+ */
6
+
7
+ .ac_results{}
8
+
9
+ /* Layout helpers
10
+ ----------------------------------*/
11
+ .ui-helper-hidden { display: none; }
12
+ .ui-helper-hidden-accessible { position: absolute; left: -99999999px; }
13
+ .ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
14
+ .ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
15
+ .ui-helper-clearfix { display: inline-block; }
16
+ /* required comment for clearfix to work in Opera \*/
17
+ * html .ui-helper-clearfix { height:1%; }
18
+ .ui-helper-clearfix { display:block; }
19
+ /* end clearfix */
20
+ .ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
21
+
22
+
23
+ /* Interaction Cues
24
+ ----------------------------------*/
25
+ .ui-state-disabled { cursor: default !important; }
26
+
27
+
28
+ /* Icons
29
+ ----------------------------------*/
30
+
31
+ /* states and images */
32
+ .ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
33
+
34
+
35
+ /* Misc visuals
36
+ ----------------------------------*/
37
+
38
+ /* Overlays */
39
+ .ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
40
+
41
+ /*
42
+ * jQuery UI CSS Framework
43
+ * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
44
+ * Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses.
45
+ * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Trebuchet%20MS,%20Tahoma,%20Verdana,%20Arial,%20sans-serif&fwDefault=bold&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=f6a828&bgTextureHeader=12_gloss_wave.png&bgImgOpacityHeader=35&borderColorHeader=e78f08&fcHeader=ffffff&iconColorHeader=ffffff&bgColorContent=eeeeee&bgTextureContent=03_highlight_soft.png&bgImgOpacityContent=100&borderColorContent=dddddd&fcContent=333333&iconColorContent=222222&bgColorDefault=f6f6f6&bgTextureDefault=02_glass.png&bgImgOpacityDefault=100&borderColorDefault=cccccc&fcDefault=1c94c4&iconColorDefault=ef8c08&bgColorHover=fdf5ce&bgTextureHover=02_glass.png&bgImgOpacityHover=100&borderColorHover=fbcb09&fcHover=c77405&iconColorHover=ef8c08&bgColorActive=ffffff&bgTextureActive=02_glass.png&bgImgOpacityActive=65&borderColorActive=fbd850&fcActive=eb8f00&iconColorActive=ef8c08&bgColorHighlight=ffe45c&bgTextureHighlight=03_highlight_soft.png&bgImgOpacityHighlight=75&borderColorHighlight=fed22f&fcHighlight=363636&iconColorHighlight=228ef1&bgColorError=b81900&bgTextureError=08_diagonals_thick.png&bgImgOpacityError=18&borderColorError=cd0a0a&fcError=ffffff&iconColorError=ffd27a&bgColorOverlay=666666&bgTextureOverlay=08_diagonals_thick.png&bgImgOpacityOverlay=20&opacityOverlay=50&bgColorShadow=000000&bgTextureShadow=01_flat.png&bgImgOpacityShadow=10&opacityShadow=20&thicknessShadow=5px&offsetTopShadow=-5px&offsetLeftShadow=-5px&cornerRadiusShadow=5px
46
+ */
47
+
48
+
49
+ /* Component containers
50
+ ----------------------------------*/
51
+ .ui-widget, .ac_results ul { font-family: Trebuchet MS, Tahoma, Verdana, Arial, sans-serif; font-size: 1.1em; }
52
+ .ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Trebuchet MS, Tahoma, Verdana, Arial, sans-serif; font-size: 1em; }
53
+ .ui-widget-content, .ac_results ul { border: 1px solid #dddddd; background: #eeeeee url(images/ui-bg_highlight-soft_100_eeeeee_1x100.png) 50% top repeat-x; color: #333333; }
54
+ .ui-widget-content a, .ac_results ul li { color: #333333; }
55
+ .ui-widget-header { border: 1px solid #e78f08; background: #f6a828 url(images/ui-bg_gloss-wave_35_f6a828_500x100.png) 50% 50% repeat-x; color: #ffffff; font-weight: bold; }
56
+ .ui-widget-header a { color: #ffffff; }
57
+
58
+ /* Interaction states
59
+ ----------------------------------*/
60
+ .ui-state-default, .ui-widget-content .ui-state-default { border: 1px solid #cccccc; background: #f6f6f6 url(images/ui-bg_glass_100_f6f6f6_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #1c94c4; outline: none; }
61
+ .ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #1c94c4; text-decoration: none; outline: none; }
62
+ .ui-state-hover, .ui-widget-content .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ac_results .ac_over { border: 1px solid #fbcb09; background: #fdf5ce url(images/ui-bg_glass_100_fdf5ce_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #c77405; outline: none; }
63
+ .ui-state-hover a, .ui-state-hover a:hover, .ac_results .ac_over { color: #c77405; text-decoration: none; outline: none; }
64
+ .ui-state-active, .ui-widget-content .ui-state-active { border: 1px solid #fbd850; background: #ffffff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #eb8f00; outline: none; }
65
+ .ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #eb8f00; outline: none; text-decoration: none; }
66
+
67
+ /* Interaction Cues
68
+ ----------------------------------*/
69
+ .ui-state-highlight, .ui-widget-content .ui-state-highlight {border: 1px solid #fed22f; background: #ffe45c url(images/ui-bg_highlight-soft_75_ffe45c_1x100.png) 50% top repeat-x; color: #363636; }
70
+ .ui-state-highlight a, .ui-widget-content .ui-state-highlight a { color: #363636; }
71
+ .ui-state-error, .ui-widget-content .ui-state-error {border: 1px solid #cd0a0a; background: #b81900 url(images/ui-bg_diagonals-thick_18_b81900_40x40.png) 50% 50% repeat; color: #ffffff; }
72
+ .ui-state-error a, .ui-widget-content .ui-state-error a { color: #ffffff; }
73
+ .ui-state-error-text, .ui-widget-content .ui-state-error-text { color: #ffffff; }
74
+ .ui-state-disabled, .ui-widget-content .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
75
+ .ui-priority-primary, .ui-widget-content .ui-priority-primary { font-weight: bold; }
76
+ .ui-priority-secondary, .ui-widget-content .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
77
+
78
+ /* Icons
79
+ ----------------------------------*/
80
+
81
+ /* states and images */
82
+ .ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png); }
83
+ .ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); }
84
+ .ui-widget-header .ui-icon {background-image: url(images/ui-icons_ffffff_256x240.png); }
85
+ .ui-state-default .ui-icon { background-image: url(images/ui-icons_ef8c08_256x240.png); }
86
+ .ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_ef8c08_256x240.png); }
87
+ .ui-state-active .ui-icon {background-image: url(images/ui-icons_ef8c08_256x240.png); }
88
+ .ui-state-highlight .ui-icon {background-image: url(images/ui-icons_228ef1_256x240.png); }
89
+ .ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_ffd27a_256x240.png); }
90
+
91
+ /* positioning */
92
+ .ui-icon-carat-1-n { background-position: 0 0; }
93
+ .ui-icon-carat-1-ne { background-position: -16px 0; }
94
+ .ui-icon-carat-1-e { background-position: -32px 0; }
95
+ .ui-icon-carat-1-se { background-position: -48px 0; }
96
+ .ui-icon-carat-1-s { background-position: -64px 0; }
97
+ .ui-icon-carat-1-sw { background-position: -80px 0; }
98
+ .ui-icon-carat-1-w { background-position: -96px 0; }
99
+ .ui-icon-carat-1-nw { background-position: -112px 0; }
100
+ .ui-icon-carat-2-n-s { background-position: -128px 0; }
101
+ .ui-icon-carat-2-e-w { background-position: -144px 0; }
102
+ .ui-icon-triangle-1-n { background-position: 0 -16px; }
103
+ .ui-icon-triangle-1-ne { background-position: -16px -16px; }
104
+ .ui-icon-triangle-1-e { background-position: -32px -16px; }
105
+ .ui-icon-triangle-1-se { background-position: -48px -16px; }
106
+ .ui-icon-triangle-1-s { background-position: -64px -16px; }
107
+ .ui-icon-triangle-1-sw { background-position: -80px -16px; }
108
+ .ui-icon-triangle-1-w { background-position: -96px -16px; }
109
+ .ui-icon-triangle-1-nw { background-position: -112px -16px; }
110
+ .ui-icon-triangle-2-n-s { background-position: -128px -16px; }
111
+ .ui-icon-triangle-2-e-w { background-position: -144px -16px; }
112
+ .ui-icon-arrow-1-n { background-position: 0 -32px; }
113
+ .ui-icon-arrow-1-ne { background-position: -16px -32px; }
114
+ .ui-icon-arrow-1-e { background-position: -32px -32px; }
115
+ .ui-icon-arrow-1-se { background-position: -48px -32px; }
116
+ .ui-icon-arrow-1-s { background-position: -64px -32px; }
117
+ .ui-icon-arrow-1-sw { background-position: -80px -32px; }
118
+ .ui-icon-arrow-1-w { background-position: -96px -32px; }
119
+ .ui-icon-arrow-1-nw { background-position: -112px -32px; }
120
+ .ui-icon-arrow-2-n-s { background-position: -128px -32px; }
121
+ .ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
122
+ .ui-icon-arrow-2-e-w { background-position: -160px -32px; }
123
+ .ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
124
+ .ui-icon-arrowstop-1-n { background-position: -192px -32px; }
125
+ .ui-icon-arrowstop-1-e { background-position: -208px -32px; }
126
+ .ui-icon-arrowstop-1-s { background-position: -224px -32px; }
127
+ .ui-icon-arrowstop-1-w { background-position: -240px -32px; }
128
+ .ui-icon-arrowthick-1-n { background-position: 0 -48px; }
129
+ .ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
130
+ .ui-icon-arrowthick-1-e { background-position: -32px -48px; }
131
+ .ui-icon-arrowthick-1-se { background-position: -48px -48px; }
132
+ .ui-icon-arrowthick-1-s { background-position: -64px -48px; }
133
+ .ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
134
+ .ui-icon-arrowthick-1-w { background-position: -96px -48px; }
135
+ .ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
136
+ .ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
137
+ .ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
138
+ .ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
139
+ .ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
140
+ .ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
141
+ .ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
142
+ .ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
143
+ .ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
144
+ .ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
145
+ .ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
146
+ .ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
147
+ .ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
148
+ .ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
149
+ .ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
150
+ .ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
151
+ .ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
152
+ .ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
153
+ .ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
154
+ .ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
155
+ .ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
156
+ .ui-icon-arrow-4 { background-position: 0 -80px; }
157
+ .ui-icon-arrow-4-diag { background-position: -16px -80px; }
158
+ .ui-icon-extlink { background-position: -32px -80px; }
159
+ .ui-icon-newwin { background-position: -48px -80px; }
160
+ .ui-icon-refresh { background-position: -64px -80px; }
161
+ .ui-icon-shuffle { background-position: -80px -80px; }
162
+ .ui-icon-transfer-e-w { background-position: -96px -80px; }
163
+ .ui-icon-transferthick-e-w { background-position: -112px -80px; }
164
+ .ui-icon-folder-collapsed { background-position: 0 -96px; }
165
+ .ui-icon-folder-open { background-position: -16px -96px; }
166
+ .ui-icon-document { background-position: -32px -96px; }
167
+ .ui-icon-document-b { background-position: -48px -96px; }
168
+ .ui-icon-note { background-position: -64px -96px; }
169
+ .ui-icon-mail-closed { background-position: -80px -96px; }
170
+ .ui-icon-mail-open { background-position: -96px -96px; }
171
+ .ui-icon-suitcase { background-position: -112px -96px; }
172
+ .ui-icon-comment { background-position: -128px -96px; }
173
+ .ui-icon-person { background-position: -144px -96px; }
174
+ .ui-icon-print { background-position: -160px -96px; }
175
+ .ui-icon-trash { background-position: -176px -96px; }
176
+ .ui-icon-locked { background-position: -192px -96px; }
177
+ .ui-icon-unlocked { background-position: -208px -96px; }
178
+ .ui-icon-bookmark { background-position: -224px -96px; }
179
+ .ui-icon-tag { background-position: -240px -96px; }
180
+ .ui-icon-home { background-position: 0 -112px; }
181
+ .ui-icon-flag { background-position: -16px -112px; }
182
+ .ui-icon-calendar { background-position: -32px -112px; }
183
+ .ui-icon-cart { background-position: -48px -112px; }
184
+ .ui-icon-pencil { background-position: -64px -112px; }
185
+ .ui-icon-clock { background-position: -80px -112px; }
186
+ .ui-icon-disk { background-position: -96px -112px; }
187
+ .ui-icon-calculator { background-position: -112px -112px; }
188
+ .ui-icon-zoomin { background-position: -128px -112px; }
189
+ .ui-icon-zoomout { background-position: -144px -112px; }
190
+ .ui-icon-search { background-position: -160px -112px; }
191
+ .ui-icon-wrench { background-position: -176px -112px; }
192
+ .ui-icon-gear { background-position: -192px -112px; }
193
+ .ui-icon-heart { background-position: -208px -112px; }
194
+ .ui-icon-star { background-position: -224px -112px; }
195
+ .ui-icon-link { background-position: -240px -112px; }
196
+ .ui-icon-cancel { background-position: 0 -128px; }
197
+ .ui-icon-plus { background-position: -16px -128px; }
198
+ .ui-icon-plusthick { background-position: -32px -128px; }
199
+ .ui-icon-minus { background-position: -48px -128px; }
200
+ .ui-icon-minusthick { background-position: -64px -128px; }
201
+ .ui-icon-close { background-position: -80px -128px; }
202
+ .ui-icon-closethick { background-position: -96px -128px; }
203
+ .ui-icon-key { background-position: -112px -128px; }
204
+ .ui-icon-lightbulb { background-position: -128px -128px; }
205
+ .ui-icon-scissors { background-position: -144px -128px; }
206
+ .ui-icon-clipboard { background-position: -160px -128px; }
207
+ .ui-icon-copy { background-position: -176px -128px; }
208
+ .ui-icon-contact { background-position: -192px -128px; }
209
+ .ui-icon-image { background-position: -208px -128px; }
210
+ .ui-icon-video { background-position: -224px -128px; }
211
+ .ui-icon-script { background-position: -240px -128px; }
212
+ .ui-icon-alert { background-position: 0 -144px; }
213
+ .ui-icon-info { background-position: -16px -144px; }
214
+ .ui-icon-notice { background-position: -32px -144px; }
215
+ .ui-icon-help { background-position: -48px -144px; }
216
+ .ui-icon-check { background-position: -64px -144px; }
217
+ .ui-icon-bullet { background-position: -80px -144px; }
218
+ .ui-icon-radio-off { background-position: -96px -144px; }
219
+ .ui-icon-radio-on { background-position: -112px -144px; }
220
+ .ui-icon-pin-w { background-position: -128px -144px; }
221
+ .ui-icon-pin-s { background-position: -144px -144px; }
222
+ .ui-icon-play { background-position: 0 -160px; }
223
+ .ui-icon-pause { background-position: -16px -160px; }
224
+ .ui-icon-seek-next { background-position: -32px -160px; }
225
+ .ui-icon-seek-prev { background-position: -48px -160px; }
226
+ .ui-icon-seek-end { background-position: -64px -160px; }
227
+ .ui-icon-seek-first { background-position: -80px -160px; }
228
+ .ui-icon-stop { background-position: -96px -160px; }
229
+ .ui-icon-eject { background-position: -112px -160px; }
230
+ .ui-icon-volume-off { background-position: -128px -160px; }
231
+ .ui-icon-volume-on { background-position: -144px -160px; }
232
+ .ui-icon-power { background-position: 0 -176px; }
233
+ .ui-icon-signal-diag { background-position: -16px -176px; }
234
+ .ui-icon-signal { background-position: -32px -176px; }
235
+ .ui-icon-battery-0 { background-position: -48px -176px; }
236
+ .ui-icon-battery-1 { background-position: -64px -176px; }
237
+ .ui-icon-battery-2 { background-position: -80px -176px; }
238
+ .ui-icon-battery-3 { background-position: -96px -176px; }
239
+ .ui-icon-circle-plus { background-position: 0 -192px; }
240
+ .ui-icon-circle-minus { background-position: -16px -192px; }
241
+ .ui-icon-circle-close { background-position: -32px -192px; }
242
+ .ui-icon-circle-triangle-e { background-position: -48px -192px; }
243
+ .ui-icon-circle-triangle-s { background-position: -64px -192px; }
244
+ .ui-icon-circle-triangle-w { background-position: -80px -192px; }
245
+ .ui-icon-circle-triangle-n { background-position: -96px -192px; }
246
+ .ui-icon-circle-arrow-e { background-position: -112px -192px; }
247
+ .ui-icon-circle-arrow-s { background-position: -128px -192px; }
248
+ .ui-icon-circle-arrow-w { background-position: -144px -192px; }
249
+ .ui-icon-circle-arrow-n { background-position: -160px -192px; }
250
+ .ui-icon-circle-zoomin { background-position: -176px -192px; }
251
+ .ui-icon-circle-zoomout { background-position: -192px -192px; }
252
+ .ui-icon-circle-check { background-position: -208px -192px; }
253
+ .ui-icon-circlesmall-plus { background-position: 0 -208px; }
254
+ .ui-icon-circlesmall-minus { background-position: -16px -208px; }
255
+ .ui-icon-circlesmall-close { background-position: -32px -208px; }
256
+ .ui-icon-squaresmall-plus { background-position: -48px -208px; }
257
+ .ui-icon-squaresmall-minus { background-position: -64px -208px; }
258
+ .ui-icon-squaresmall-close { background-position: -80px -208px; }
259
+ .ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
260
+ .ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
261
+ .ui-icon-grip-solid-vertical { background-position: -32px -224px; }
262
+ .ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
263
+ .ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
264
+ .ui-icon-grip-diagonal-se { background-position: -80px -224px; }
265
+
266
+
267
+ /* Misc visuals
268
+ ----------------------------------*/
269
+
270
+ /* Corner radius */
271
+ .ui-corner-tl { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; }
272
+ .ui-corner-tr { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; }
273
+ .ui-corner-bl { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; }
274
+ .ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; }
275
+ .ui-corner-top { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; }
276
+ .ui-corner-bottom { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; }
277
+ .ui-corner-right { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; }
278
+ .ui-corner-left { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; }
279
+ .ui-corner-all, .ac_results, .ac_results * { -moz-border-radius: 4px; -webkit-border-radius: 4px; }
280
+
281
+ /* Overlays */
282
+ .ui-widget-overlay { background: #666666 url(images/ui-bg_diagonals-thick_20_666666_40x40.png) 50% 50% repeat; opacity: .50;filter:Alpha(Opacity=50); }
283
+ .ui-widget-shadow { margin: -5px 0 0 -5px; padding: 5px; background: #000000 url(images/ui-bg_flat_10_000000_40x100.png) 50% 50% repeat-x; opacity: .20;filter:Alpha(Opacity=20); -moz-border-radius: 5px; -webkit-border-radius: 5px; }/* Datepicker
284
+ ----------------------------------*/
285
+ .ui-datepicker { width: 17em; padding: .2em .2em 0; }
286
+ .ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; }
287
+ .ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; }
288
+ .ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; }
289
+ .ui-datepicker .ui-datepicker-prev { left:2px; }
290
+ .ui-datepicker .ui-datepicker-next { right:2px; }
291
+ .ui-datepicker .ui-datepicker-prev-hover { left:1px; }
292
+ .ui-datepicker .ui-datepicker-next-hover { right:1px; }
293
+ .ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; }
294
+ .ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }
295
+ .ui-datepicker .ui-datepicker-title select { float:left; font-size:1em; margin:1px 0; }
296
+ .ui-datepicker select.ui-datepicker-month-year {width: 100%;}
297
+ .ui-datepicker select.ui-datepicker-month,
298
+ .ui-datepicker select.ui-datepicker-year { width: 49%;}
299
+ .ui-datepicker .ui-datepicker-title select.ui-datepicker-year { float: right; }
300
+ .ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; }
301
+ .ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; }
302
+ .ui-datepicker td { border: 0; padding: 1px; }
303
+ .ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; }
304
+ .ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; }
305
+ .ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; }
306
+ .ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; }
307
+
308
+ /* with multiple calendars */
309
+ .ui-datepicker.ui-datepicker-multi { width:auto; }
310
+ .ui-datepicker-multi .ui-datepicker-group { float:left; }
311
+ .ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; }
312
+ .ui-datepicker-multi-2 .ui-datepicker-group { width:50%; }
313
+ .ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; }
314
+ .ui-datepicker-multi-4 .ui-datepicker-group { width:25%; }
315
+ .ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; }
316
+ .ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; }
317
+ .ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; }
318
+ .ui-datepicker-row-break { clear:both; width:100%; }
319
+
320
+ /* RTL support */
321
+ .ui-datepicker-rtl { direction: rtl; }
322
+ .ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; }
323
+ .ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; }
324
+ .ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; }
325
+ .ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; }
326
+ .ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; }
327
+ .ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; }
328
+ .ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; }
329
+ .ui-datepicker-rtl .ui-datepicker-group { float:right; }
330
+ .ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
331
+ .ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
332
+
333
+ /* IE6 IFRAME FIX (taken from datepicker 1.5.3 */
334
+ .ui-datepicker-cover {
335
+ display: none; /*sorry for IE5*/
336
+ display/**/: block; /*sorry for IE5*/
337
+ position: absolute; /*must have*/
338
+ z-index: -1; /*must have*/
339
+ filter: mask(); /*must have*/
340
+ top: -4px; /*must have*/
341
+ left: -4px; /*must have*/
342
+ width: 200px; /*must have*/
343
+ height: 200px; /*must have*/
344
+ }
includes/css/jquery-ui-1.8.5.custom.css ADDED
@@ -0,0 +1,419 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * jQuery UI CSS Framework @VERSION
3
+ *
4
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
5
+ * Dual licensed under the MIT or GPL Version 2 licenses.
6
+ * http://jquery.org/license
7
+ *
8
+ * http://docs.jquery.com/UI/Theming/API
9
+ */
10
+
11
+ /* Custom for EM */
12
+ #ui-datepicker-div a, #ui-datepicker-div td, #ui-datepicker-div th { font-size:11px !important; }
13
+ #ui-datepicker-div { width:200px !important; }
14
+
15
+ /* Layout helpers
16
+ ----------------------------------*/
17
+ .ui-helper-hidden { display: none; }
18
+ .ui-helper-hidden-accessible { position: absolute; left: -99999999px; }
19
+ .ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
20
+ .ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
21
+ .ui-helper-clearfix { display: inline-block; }
22
+ /* required comment for clearfix to work in Opera \*/
23
+ * html .ui-helper-clearfix { height:1%; }
24
+ .ui-helper-clearfix { display:block; }
25
+ /* end clearfix */
26
+ .ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
27
+
28
+
29
+ /* Interaction Cues
30
+ ----------------------------------*/
31
+ .ui-state-disabled { cursor: default !important; }
32
+
33
+
34
+ /* Icons
35
+ ----------------------------------*/
36
+
37
+ /* states and images */
38
+ .ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
39
+
40
+
41
+ /* Misc visuals
42
+ ----------------------------------*/
43
+
44
+ /* Overlays */
45
+ .ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
46
+
47
+
48
+ /*
49
+ * jQuery UI CSS Framework @VERSION
50
+ *
51
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
52
+ * Dual licensed under the MIT or GPL Version 2 licenses.
53
+ * http://jquery.org/license
54
+ *
55
+ * http://docs.jquery.com/UI/Theming/API
56
+ *
57
+ * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Trebuchet%20MS,%20Tahoma,%20Verdana,%20Arial,%20sans-serif&fwDefault=bold&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=f6a828&bgTextureHeader=12_gloss_wave.png&bgImgOpacityHeader=35&borderColorHeader=e78f08&fcHeader=ffffff&iconColorHeader=ffffff&bgColorContent=eeeeee&bgTextureContent=03_highlight_soft.png&bgImgOpacityContent=100&borderColorContent=dddddd&fcContent=333333&iconColorContent=222222&bgColorDefault=f6f6f6&bgTextureDefault=02_glass.png&bgImgOpacityDefault=100&borderColorDefault=cccccc&fcDefault=1c94c4&iconColorDefault=ef8c08&bgColorHover=fdf5ce&bgTextureHover=02_glass.png&bgImgOpacityHover=100&borderColorHover=fbcb09&fcHover=c77405&iconColorHover=ef8c08&bgColorActive=ffffff&bgTextureActive=02_glass.png&bgImgOpacityActive=65&borderColorActive=fbd850&fcActive=eb8f00&iconColorActive=ef8c08&bgColorHighlight=ffe45c&bgTextureHighlight=03_highlight_soft.png&bgImgOpacityHighlight=75&borderColorHighlight=fed22f&fcHighlight=363636&iconColorHighlight=228ef1&bgColorError=b81900&bgTextureError=08_diagonals_thick.png&bgImgOpacityError=18&borderColorError=cd0a0a&fcError=ffffff&iconColorError=ffd27a&bgColorOverlay=666666&bgTextureOverlay=08_diagonals_thick.png&bgImgOpacityOverlay=20&opacityOverlay=50&bgColorShadow=000000&bgTextureShadow=01_flat.png&bgImgOpacityShadow=10&opacityShadow=20&thicknessShadow=5px&offsetTopShadow=-5px&offsetLeftShadow=-5px&cornerRadiusShadow=5px
58
+ */
59
+
60
+
61
+ /* Component containers
62
+ ----------------------------------*/
63
+ .ui-widget { font-family: Trebuchet MS, Tahoma, Verdana, Arial, sans-serif; font-size: 1.1em; }
64
+ .ui-widget .ui-widget { font-size: 1em; }
65
+ .ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Trebuchet MS, Tahoma, Verdana, Arial, sans-serif; font-size: 1em; }
66
+ .ui-widget-content { border: 1px solid #dddddd; background: #eeeeee url(images/ui-bg_highlight-soft_100_eeeeee_1x100.png) 50% top repeat-x; color: #333333; }
67
+ .ui-widget-content a { color: #333333; }
68
+ .ui-widget-header { border: 1px solid #e78f08; background: #f6a828 url(images/ui-bg_gloss-wave_35_f6a828_500x100.png) 50% 50% repeat-x; color: #ffffff; font-weight: bold; }
69
+ .ui-widget-header a { color: #ffffff; }
70
+
71
+ /* Interaction states
72
+ ----------------------------------*/
73
+ .ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #cccccc; background: #f6f6f6 url(images/ui-bg_glass_100_f6f6f6_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #1c94c4; }
74
+ .ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #1c94c4; text-decoration: none; }
75
+ .ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #fbcb09; background: #fdf5ce url(images/ui-bg_glass_100_fdf5ce_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #c77405; }
76
+ .ui-state-hover a, .ui-state-hover a:hover { color: #c77405; text-decoration: none; }
77
+ .ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #fbd850; background: #ffffff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #eb8f00; }
78
+ .ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #eb8f00; text-decoration: none; }
79
+ .ui-widget :active { outline: none; }
80
+
81
+ /* Interaction Cues
82
+ ----------------------------------*/
83
+ .ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #fed22f; background: #ffe45c url(images/ui-bg_highlight-soft_75_ffe45c_1x100.png) 50% top repeat-x; color: #363636; }
84
+ .ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636; }
85
+ .ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #b81900 url(images/ui-bg_diagonals-thick_18_b81900_40x40.png) 50% 50% repeat; color: #ffffff; }
86
+ .ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #ffffff; }
87
+ .ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #ffffff; }
88
+ .ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }
89
+ .ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
90
+ .ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
91
+
92
+ /* Icons
93
+ ----------------------------------*/
94
+
95
+ /* states and images */
96
+ .ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png); }
97
+ .ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); }
98
+ .ui-widget-header .ui-icon {background-image: url(images/ui-icons_ffffff_256x240.png); }
99
+ .ui-state-default .ui-icon { background-image: url(images/ui-icons_ef8c08_256x240.png); }
100
+ .ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_ef8c08_256x240.png); }
101
+ .ui-state-active .ui-icon {background-image: url(images/ui-icons_ef8c08_256x240.png); }
102
+ .ui-state-highlight .ui-icon {background-image: url(images/ui-icons_228ef1_256x240.png); }
103
+ .ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_ffd27a_256x240.png); }
104
+
105
+ /* positioning */
106
+ .ui-icon-carat-1-n { background-position: 0 0; }
107
+ .ui-icon-carat-1-ne { background-position: -16px 0; }
108
+ .ui-icon-carat-1-e { background-position: -32px 0; }
109
+ .ui-icon-carat-1-se { background-position: -48px 0; }
110
+ .ui-icon-carat-1-s { background-position: -64px 0; }
111
+ .ui-icon-carat-1-sw { background-position: -80px 0; }
112
+ .ui-icon-carat-1-w { background-position: -96px 0; }
113
+ .ui-icon-carat-1-nw { background-position: -112px 0; }
114
+ .ui-icon-carat-2-n-s { background-position: -128px 0; }
115
+ .ui-icon-carat-2-e-w { background-position: -144px 0; }
116
+ .ui-icon-triangle-1-n { background-position: 0 -16px; }
117
+ .ui-icon-triangle-1-ne { background-position: -16px -16px; }
118
+ .ui-icon-triangle-1-e { background-position: -32px -16px; }
119
+ .ui-icon-triangle-1-se { background-position: -48px -16px; }
120
+ .ui-icon-triangle-1-s { background-position: -64px -16px; }
121
+ .ui-icon-triangle-1-sw { background-position: -80px -16px; }
122
+ .ui-icon-triangle-1-w { background-position: -96px -16px; }
123
+ .ui-icon-triangle-1-nw { background-position: -112px -16px; }
124
+ .ui-icon-triangle-2-n-s { background-position: -128px -16px; }
125
+ .ui-icon-triangle-2-e-w { background-position: -144px -16px; }
126
+ .ui-icon-arrow-1-n { background-position: 0 -32px; }
127
+ .ui-icon-arrow-1-ne { background-position: -16px -32px; }
128
+ .ui-icon-arrow-1-e { background-position: -32px -32px; }
129
+ .ui-icon-arrow-1-se { background-position: -48px -32px; }
130
+ .ui-icon-arrow-1-s { background-position: -64px -32px; }
131
+ .ui-icon-arrow-1-sw { background-position: -80px -32px; }
132
+ .ui-icon-arrow-1-w { background-position: -96px -32px; }
133
+ .ui-icon-arrow-1-nw { background-position: -112px -32px; }
134
+ .ui-icon-arrow-2-n-s { background-position: -128px -32px; }
135
+ .ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
136
+ .ui-icon-arrow-2-e-w { background-position: -160px -32px; }
137
+ .ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
138
+ .ui-icon-arrowstop-1-n { background-position: -192px -32px; }
139
+ .ui-icon-arrowstop-1-e { background-position: -208px -32px; }
140
+ .ui-icon-arrowstop-1-s { background-position: -224px -32px; }
141
+ .ui-icon-arrowstop-1-w { background-position: -240px -32px; }
142
+ .ui-icon-arrowthick-1-n { background-position: 0 -48px; }
143
+ .ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
144
+ .ui-icon-arrowthick-1-e { background-position: -32px -48px; }
145
+ .ui-icon-arrowthick-1-se { background-position: -48px -48px; }
146
+ .ui-icon-arrowthick-1-s { background-position: -64px -48px; }
147
+ .ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
148
+ .ui-icon-arrowthick-1-w { background-position: -96px -48px; }
149
+ .ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
150
+ .ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
151
+ .ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
152
+ .ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
153
+ .ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
154
+ .ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
155
+ .ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
156
+ .ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
157
+ .ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
158
+ .ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
159
+ .ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
160
+ .ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
161
+ .ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
162
+ .ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
163
+ .ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
164
+ .ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
165
+ .ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
166
+ .ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
167
+ .ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
168
+ .ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
169
+ .ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
170
+ .ui-icon-arrow-4 { background-position: 0 -80px; }
171
+ .ui-icon-arrow-4-diag { background-position: -16px -80px; }
172
+ .ui-icon-extlink { background-position: -32px -80px; }
173
+ .ui-icon-newwin { background-position: -48px -80px; }
174
+ .ui-icon-refresh { background-position: -64px -80px; }
175
+ .ui-icon-shuffle { background-position: -80px -80px; }
176
+ .ui-icon-transfer-e-w { background-position: -96px -80px; }
177
+ .ui-icon-transferthick-e-w { background-position: -112px -80px; }
178
+ .ui-icon-folder-collapsed { background-position: 0 -96px; }
179
+ .ui-icon-folder-open { background-position: -16px -96px; }
180
+ .ui-icon-document { background-position: -32px -96px; }
181
+ .ui-icon-document-b { background-position: -48px -96px; }
182
+ .ui-icon-note { background-position: -64px -96px; }
183
+ .ui-icon-mail-closed { background-position: -80px -96px; }
184
+ .ui-icon-mail-open { background-position: -96px -96px; }
185
+ .ui-icon-suitcase { background-position: -112px -96px; }
186
+ .ui-icon-comment { background-position: -128px -96px; }
187
+ .ui-icon-person { background-position: -144px -96px; }
188
+ .ui-icon-print { background-position: -160px -96px; }
189
+ .ui-icon-trash { background-position: -176px -96px; }
190
+ .ui-icon-locked { background-position: -192px -96px; }
191
+ .ui-icon-unlocked { background-position: -208px -96px; }
192
+ .ui-icon-bookmark { background-position: -224px -96px; }
193
+ .ui-icon-tag { background-position: -240px -96px; }
194
+ .ui-icon-home { background-position: 0 -112px; }
195
+ .ui-icon-flag { background-position: -16px -112px; }
196
+ .ui-icon-calendar { background-position: -32px -112px; }
197
+ .ui-icon-cart { background-position: -48px -112px; }
198
+ .ui-icon-pencil { background-position: -64px -112px; }
199
+ .ui-icon-clock { background-position: -80px -112px; }
200
+ .ui-icon-disk { background-position: -96px -112px; }
201
+ .ui-icon-calculator { background-position: -112px -112px; }
202
+ .ui-icon-zoomin { background-position: -128px -112px; }
203
+ .ui-icon-zoomout { background-position: -144px -112px; }
204
+ .ui-icon-search { background-position: -160px -112px; }
205
+ .ui-icon-wrench { background-position: -176px -112px; }
206
+ .ui-icon-gear { background-position: -192px -112px; }
207
+ .ui-icon-heart { background-position: -208px -112px; }
208
+ .ui-icon-star { background-position: -224px -112px; }
209
+ .ui-icon-link { background-position: -240px -112px; }
210
+ .ui-icon-cancel { background-position: 0 -128px; }
211
+ .ui-icon-plus { background-position: -16px -128px; }
212
+ .ui-icon-plusthick { background-position: -32px -128px; }
213
+ .ui-icon-minus { background-position: -48px -128px; }
214
+ .ui-icon-minusthick { background-position: -64px -128px; }
215
+ .ui-icon-close { background-position: -80px -128px; }
216
+ .ui-icon-closethick { background-position: -96px -128px; }
217
+ .ui-icon-key { background-position: -112px -128px; }
218
+ .ui-icon-lightbulb { background-position: -128px -128px; }
219
+ .ui-icon-scissors { background-position: -144px -128px; }
220
+ .ui-icon-clipboard { background-position: -160px -128px; }
221
+ .ui-icon-copy { background-position: -176px -128px; }
222
+ .ui-icon-contact { background-position: -192px -128px; }
223
+ .ui-icon-image { background-position: -208px -128px; }
224
+ .ui-icon-video { background-position: -224px -128px; }
225
+ .ui-icon-script { background-position: -240px -128px; }
226
+ .ui-icon-alert { background-position: 0 -144px; }
227
+ .ui-icon-info { background-position: -16px -144px; }
228
+ .ui-icon-notice { background-position: -32px -144px; }
229
+ .ui-icon-help { background-position: -48px -144px; }
230
+ .ui-icon-check { background-position: -64px -144px; }
231
+ .ui-icon-bullet { background-position: -80px -144px; }
232
+ .ui-icon-radio-off { background-position: -96px -144px; }
233
+ .ui-icon-radio-on { background-position: -112px -144px; }
234
+ .ui-icon-pin-w { background-position: -128px -144px; }
235
+ .ui-icon-pin-s { background-position: -144px -144px; }
236
+ .ui-icon-play { background-position: 0 -160px; }
237
+ .ui-icon-pause { background-position: -16px -160px; }
238
+ .ui-icon-seek-next { background-position: -32px -160px; }
239
+ .ui-icon-seek-prev { background-position: -48px -160px; }
240
+ .ui-icon-seek-end { background-position: -64px -160px; }
241
+ .ui-icon-seek-start { background-position: -80px -160px; }
242
+ /* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
243
+ .ui-icon-seek-first { background-position: -80px -160px; }
244
+ .ui-icon-stop { background-position: -96px -160px; }
245
+ .ui-icon-eject { background-position: -112px -160px; }
246
+ .ui-icon-volume-off { background-position: -128px -160px; }
247
+ .ui-icon-volume-on { background-position: -144px -160px; }
248
+ .ui-icon-power { background-position: 0 -176px; }
249
+ .ui-icon-signal-diag { background-position: -16px -176px; }
250
+ .ui-icon-signal { background-position: -32px -176px; }
251
+ .ui-icon-battery-0 { background-position: -48px -176px; }
252
+ .ui-icon-battery-1 { background-position: -64px -176px; }
253
+ .ui-icon-battery-2 { background-position: -80px -176px; }
254
+ .ui-icon-battery-3 { background-position: -96px -176px; }
255
+ .ui-icon-circle-plus { background-position: 0 -192px; }
256
+ .ui-icon-circle-minus { background-position: -16px -192px; }
257
+ .ui-icon-circle-close { background-position: -32px -192px; }
258
+ .ui-icon-circle-triangle-e { background-position: -48px -192px; }
259
+ .ui-icon-circle-triangle-s { background-position: -64px -192px; }
260
+ .ui-icon-circle-triangle-w { background-position: -80px -192px; }
261
+ .ui-icon-circle-triangle-n { background-position: -96px -192px; }
262
+ .ui-icon-circle-arrow-e { background-position: -112px -192px; }
263
+ .ui-icon-circle-arrow-s { background-position: -128px -192px; }
264
+ .ui-icon-circle-arrow-w { background-position: -144px -192px; }
265
+ .ui-icon-circle-arrow-n { background-position: -160px -192px; }
266
+ .ui-icon-circle-zoomin { background-position: -176px -192px; }
267
+ .ui-icon-circle-zoomout { background-position: -192px -192px; }
268
+ .ui-icon-circle-check { background-position: -208px -192px; }
269
+ .ui-icon-circlesmall-plus { background-position: 0 -208px; }
270
+ .ui-icon-circlesmall-minus { background-position: -16px -208px; }
271
+ .ui-icon-circlesmall-close { background-position: -32px -208px; }
272
+ .ui-icon-squaresmall-plus { background-position: -48px -208px; }
273
+ .ui-icon-squaresmall-minus { background-position: -64px -208px; }
274
+ .ui-icon-squaresmall-close { background-position: -80px -208px; }
275
+ .ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
276
+ .ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
277
+ .ui-icon-grip-solid-vertical { background-position: -32px -224px; }
278
+ .ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
279
+ .ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
280
+ .ui-icon-grip-diagonal-se { background-position: -80px -224px; }
281
+
282
+
283
+ /* Misc visuals
284
+ ----------------------------------*/
285
+
286
+ /* Corner radius */
287
+ .ui-corner-tl { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; }
288
+ .ui-corner-tr { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; }
289
+ .ui-corner-bl { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; }
290
+ .ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; }
291
+ .ui-corner-top { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; }
292
+ .ui-corner-bottom { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; }
293
+ .ui-corner-right { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; }
294
+ .ui-corner-left { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; }
295
+ .ui-corner-all { -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; }
296
+
297
+ /* Overlays */
298
+ .ui-widget-overlay { background: #666666 url(images/ui-bg_diagonals-thick_20_666666_40x40.png) 50% 50% repeat; opacity: .50;filter:Alpha(Opacity=50); }
299
+ .ui-widget-shadow { margin: -5px 0 0 -5px; padding: 5px; background: #000000 url(images/ui-bg_flat_10_000000_40x100.png) 50% 50% repeat-x; opacity: .20;filter:Alpha(Opacity=20); -moz-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px; }/*
300
+ * jQuery UI Autocomplete @VERSION
301
+ *
302
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
303
+ * Dual licensed under the MIT or GPL Version 2 licenses.
304
+ * http://jquery.org/license
305
+ *
306
+ * http://docs.jquery.com/UI/Autocomplete#theming
307
+ */
308
+ .ui-autocomplete { position: absolute; cursor: default; }
309
+
310
+ /* workarounds */
311
+ * html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */
312
+
313
+ /*
314
+ * jQuery UI Menu @VERSION
315
+ *
316
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
317
+ * Dual licensed under the MIT or GPL Version 2 licenses.
318
+ * http://jquery.org/license
319
+ *
320
+ * http://docs.jquery.com/UI/Menu#theming
321
+ */
322
+ .ui-menu {
323
+ list-style:none;
324
+ padding: 2px;
325
+ margin: 0;
326
+ display:block;
327
+ float: left;
328
+ }
329
+ .ui-menu .ui-menu {
330
+ margin-top: -3px;
331
+ }
332
+ .ui-menu .ui-menu-item {
333
+ margin:0;
334
+ padding: 0;
335
+ zoom: 1;
336
+ float: left;
337
+ clear: left;
338
+ width: 100%;
339
+ }
340
+ .ui-menu .ui-menu-item a {
341
+ text-decoration:none;
342
+ display:block;
343
+ padding:.2em .4em;
344
+ line-height:1.5;
345
+ zoom:1;
346
+ }
347
+ .ui-menu .ui-menu-item a.ui-state-hover,
348
+ .ui-menu .ui-menu-item a.ui-state-active {
349
+ font-weight: normal;
350
+ margin: -1px;
351
+ }
352
+ /*
353
+ * jQuery UI Datepicker @VERSION
354
+ *
355
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
356
+ * Dual licensed under the MIT or GPL Version 2 licenses.
357
+ * http://jquery.org/license
358
+ *
359
+ * http://docs.jquery.com/UI/Datepicker#theming
360
+ */
361
+ .ui-datepicker { width: 17em; padding: .2em .2em 0; }
362
+ .ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; }
363
+ .ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; }
364
+ .ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; }
365
+ .ui-datepicker .ui-datepicker-prev { left:2px; }
366
+ .ui-datepicker .ui-datepicker-next { right:2px; }
367
+ .ui-datepicker .ui-datepicker-prev-hover { left:1px; }
368
+ .ui-datepicker .ui-datepicker-next-hover { right:1px; }
369
+ .ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; }
370
+ .ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }
371
+ .ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; }
372
+ .ui-datepicker select.ui-datepicker-month-year {width: 100%;}
373
+ .ui-datepicker select.ui-datepicker-month,
374
+ .ui-datepicker select.ui-datepicker-year { width: 49%;}
375
+ .ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; }
376
+ .ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; }
377
+ .ui-datepicker td { border: 0; padding: 1px; }
378
+ .ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; }
379
+ .ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; }
380
+ .ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; }
381
+ .ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; }
382
+
383
+ /* with multiple calendars */
384
+ .ui-datepicker.ui-datepicker-multi { width:auto; }
385
+ .ui-datepicker-multi .ui-datepicker-group { float:left; }
386
+ .ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; }
387
+ .ui-datepicker-multi-2 .ui-datepicker-group { width:50%; }
388
+ .ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; }
389
+ .ui-datepicker-multi-4 .ui-datepicker-group { width:25%; }
390
+ .ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; }
391
+ .ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; }
392
+ .ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; }
393
+ .ui-datepicker-row-break { clear:both; width:100%; }
394
+
395
+ /* RTL support */
396
+ .ui-datepicker-rtl { direction: rtl; }
397
+ .ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; }
398
+ .ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; }
399
+ .ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; }
400
+ .ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; }
401
+ .ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; }
402
+ .ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; }
403
+ .ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; }
404
+ .ui-datepicker-rtl .ui-datepicker-group { float:right; }
405
+ .ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
406
+ .ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
407
+
408
+ /* IE6 IFRAME FIX (taken from datepicker 1.5.3 */
409
+ .ui-datepicker-cover {
410
+ display: none; /*sorry for IE5*/
411
+ display/**/: block; /*sorry for IE5*/
412
+ position: absolute; /*must have*/
413
+ z-index: -1; /*must have*/
414
+ filter: mask(); /*must have*/
415
+ top: -4px; /*must have*/
416
+ left: -4px; /*must have*/
417
+ width: 200px; /*must have*/
418
+ height: 200px; /*must have*/
419
+ }
{images → includes/images}/baloon.png RENAMED
File without changes
{images → includes/images}/calendar-16.png RENAMED
File without changes
{images → includes/images}/calendar-32.png RENAMED
File without changes
includes/js/em_admin.js ADDED
@@ -0,0 +1,217 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready( function($) {
2
+ // Managing bookings delete operations
3
+ $('a.bookingdelbutton').click( function(){
4
+ eventId = (jQuery(this).parents('table:first').attr('id').split("-"))[3];
5
+ idToRemove = (jQuery(this).parents('tr:first').attr('id').split("-"))[1];
6
+ $.ajax({
7
+ type: "POST",
8
+ url: "admin.php?page=people&action=remove_booking",
9
+ data: "booking_id="+ idToRemove,
10
+ success: function(){
11
+ $('tr#booking-' + idToRemove).fadeOut('slow');
12
+ $.getJSON("admin.php?page=people&dbem_ajax_action=booking_data",{id: eventId, ajax: 'true'}, function(data){
13
+ booked = data[0].bookedSeats;
14
+ available = data[0].availableSeats;
15
+ $('td#booked-seats').text(booked);
16
+ $('td#available-seats').text(available);
17
+ });
18
+ }
19
+ });
20
+ });
21
+
22
+ //Attributes
23
+ $('#mtm_add_tag').click( function(event){
24
+ event.preventDefault();
25
+ //Get All meta rows
26
+ var metas = $('#mtm_body').children();
27
+ //Copy first row and change values
28
+ var metaCopy = $(metas[0]).clone(true);
29
+ newId = metas.length + 1;
30
+ metaCopy.attr('id', 'mtm_'+newId);
31
+ metaCopy.find('a').attr('rel', newId);
32
+ metaCopy.find('[name=mtm_1_ref]').attr({
33
+ name:'mtm_'+newId+'_ref' ,
34
+ value:''
35
+ });
36
+ metaCopy.find('[name=mtm_1_content]').attr({
37
+ name:'mtm_'+newId+'_content' ,
38
+ value:''
39
+ });
40
+ metaCopy.find('[name=mtm_1_name]').attr({
41
+ name:'mtm_'+newId+'_name' ,
42
+ value:''
43
+ });
44
+ //Insert into end of file
45
+ $('#mtm_body').append(metaCopy);
46
+ //Duplicate the last entry, remove values and rename id
47
+ });
48
+ $('#mtm_body a').click( function(event){
49
+ event.preventDefault();
50
+ //Only remove if there's more than 1 meta tag
51
+ if($('#mtm_body').children().length > 1){
52
+ //Remove the item
53
+ var parents = $(this).parents('#mtm_body tr').first().remove();
54
+ //Renumber all the items
55
+ $('#mtm_body').children().each( function(i){
56
+ metaCopy = $(this);
57
+ oldId = metaCopy.attr('id').replace('mtm_','');
58
+ newId = i+1;
59
+ metaCopy.attr('id', 'mtm_'+newId);
60
+ metaCopy.find('a').attr('rel', newId);
61
+ metaCopy.find('[name=mtm_'+ oldId +'_ref]').attr('name', 'mtm_'+newId+'_ref');
62
+ metaCopy.find('[name=mtm_'+ oldId +'_content]').attr('name', 'mtm_'+newId+'_content');
63
+ metaCopy.find('[name=mtm_'+ oldId +'_name]').attr( 'name', 'mtm_'+newId+'_name');
64
+ });
65
+ }else{
66
+ metaCopy = $(this).parents('#mtm_body tr').first();
67
+ metaCopy.find('[name=mtm_1_ref]').attr('value', '');
68
+ metaCopy.find('[name=mtm_1_content]').attr('value', '');
69
+ metaCopy.find('[name=mtm_1_name]').attr( 'value', '');
70
+ alert("If you don't want any meta tags, just leave the text boxes blank and submit");
71
+ }
72
+ });
73
+
74
+ //Datepicker
75
+ if( $('#date-to-submit').length > 0 ){
76
+ $("#localised-date").datepicker({
77
+ altField: "#date-to-submit",
78
+ altFormat: "yy-mm-dd"
79
+ });
80
+ $("#localised-end-date").datepicker({
81
+ altField: "#end-date-to-submit",
82
+ altFormat: "yy-mm-dd"
83
+ });
84
+ if( $('#date-to-submit').val() != '' ){
85
+ date_dateFormat = $("#localised-date").datepicker('option', 'dateFormat');
86
+ start_date_formatted = $.datepicker.formatDate( date_dateFormat, $.datepicker.parseDate('yy-mm-dd', $('#date-to-submit').val()) );
87
+ end_date_formatted = $.datepicker.formatDate( date_dateFormat, $.datepicker.parseDate('yy-mm-dd', $('#end-date-to-submit').val()) );
88
+ $("#localised-date").val(start_date_formatted);
89
+ $("#localised-end-date").val(end_date_formatted);
90
+ }
91
+ }
92
+
93
+
94
+ //Location stuff - only needed if inputs for location exist
95
+ if( $('select#location-select-id, input#location-name').length > 0 ){
96
+ //Autocomplete
97
+ /* for jquery-ui-1.8.5
98
+ $( "#eventForm input#location-name" ).autocomplete({
99
+ source: '../wp-content/plugins/events-manager/admin/locations-search.php',
100
+ minLength: 2,
101
+ select: function( event, ui ) {
102
+ $("input#location-address").val(ui.item.address);
103
+ $("input#location-town").val(ui.item.town);
104
+ if($('#em-map').length > 0){
105
+ get_map_by_id(ui.item.id);
106
+ }
107
+ }
108
+ });
109
+ */
110
+ $( "#eventForm input#location-name" ).autocomplete( '../wp-content/plugins/events-manager/admin/locations-search.php', {
111
+ multiple: true,
112
+ width: 350,
113
+ scroll:false,
114
+ selectFirst: false,
115
+ dataType: "json",
116
+ parse: function(data) {
117
+ return $.map(data, function(row) {
118
+ return {
119
+ data: row,
120
+ value: row.value,
121
+ result: row.value
122
+ }
123
+ });
124
+ },
125
+ formatItem: function(item) {
126
+ return item.value + '<br><span style="font-size:11px"><em>'+ item.address + ', ' + item.town;
127
+ },
128
+ formatResult: function(item){
129
+ return item.value;
130
+ }
131
+ }).result(function(e, item) {
132
+ e.preventDefault();
133
+ $( "input#location-name" ).val(item.value);
134
+ $('input#location-address').val(item.address);
135
+ $('input#location-town').val(item.town);
136
+ get_map_by_id(item.id);
137
+ });
138
+
139
+ //Load map
140
+ if($('#em-map').length > 0){
141
+ var em_LatLng = new google.maps.LatLng(0, 0);
142
+ var map = new google.maps.Map( document.getElementById('em-map'), {
143
+ zoom: 14,
144
+ center: em_LatLng,
145
+ mapTypeId: google.maps.MapTypeId.ROADMAP,
146
+ mapTypeControl: false
147
+ });
148
+ var marker = new google.maps.Marker({
149
+ position: em_LatLng,
150
+ map: map
151
+ });
152
+ var infoWindow = new google.maps.InfoWindow({
153
+ content: ''
154
+ });
155
+ var geocoder = new google.maps.Geocoder();
156
+ google.maps.event.addListener(infoWindow, 'domready', function() {
157
+ document.getElementById('location-balloon-content').parentNode.style.overflow='';
158
+ document.getElementById('location-balloon-content').parentNode.parentNode.style.overflow='';
159
+ });
160
+ }
161
+
162
+ //Add listeners for changes to address
163
+ var get_map_by_id = function(id){
164
+ if($('#em-map').length > 0){
165
+ $.getJSON(document.URL,{ em_ajax_action:'get_location', id:id }, function(data){
166
+ if( data.location_latitude!=0 && data.location_longitude!=0 ){
167
+ loc_latlng = new google.maps.LatLng(data.location_latitude, data.location_longitude);
168
+ marker.setPosition(loc_latlng);
169
+ marker.setTitle( data.location_name );
170
+ $('#em-map').show();
171
+ $('#em-map-404').hide();
172
+ map.setCenter(loc_latlng);
173
+ map.panBy(40,-55);
174
+ infoWindow.setContent( '<div id="location-balloon-content">'+ data.location_balloon +'</div>');
175
+ infoWindow.open(map, marker);
176
+ google.maps.event.trigger(map, 'resize');
177
+ }else{
178
+ $('#em-map').hide();
179
+ $('#em-map-404').show();
180
+ }
181
+ });
182
+ }
183
+ }
184
+ $('#location-select-id').change( function(){get_map_by_id($(this).val())} );
185
+ $('#location-town, #location-address').change( function(){
186
+ var address = $('#location-address').val() + ', ' + $('#location-town').val();
187
+ if( address != '' && $('#em-map').length > 0 ){
188
+ geocoder.geocode( { 'address': address }, function(results, status) {
189
+ if (status == google.maps.GeocoderStatus.OK) {
190
+ marker.setPosition(results[0].geometry.location);
191
+ marker.setTitle( $('#location-name, #location-select-id').first().val() );
192
+ $('#location-latitude').val(results[0].geometry.location.lat());
193
+ $('#location-longitude').val(results[0].geometry.location.lng());
194
+ $('#em-map').show();
195
+ $('#em-map-404').hide();
196
+ google.maps.event.trigger(map, 'resize');
197
+ map.setCenter(results[0].geometry.location);
198
+ map.panBy(40,-55);
199
+ infoWindow.setContent(
200
+ '<div id="location-balloon-content"><strong>' +
201
+ $('#location-name').val() +
202
+ '</strong><br/>' +
203
+ $('#location-address').val() +
204
+ '<br/>' + $('#location-town').val()+
205
+ '</div>'
206
+ );
207
+ infoWindow.open(map, marker);
208
+ } else {
209
+ $('#em-map').hide();
210
+ $('#em-map-404').show();
211
+ }
212
+ });
213
+ }
214
+ });
215
+ $("input#location-town, select#location-select-id").triggerHandler('change');
216
+ }
217
+ });
includes/js/em_calendar_ajax.js ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ //inserted at wp_head
2
+ jQuery(document).ready( function($) {
3
+ $('.dbem-calendar a.em-calnav').live('click', function(e){
4
+ e.preventDefault();
5
+ $(this).parents('.em-calendar-wrapper').first().load($(this).attr('href'));
6
+ } );
7
+ });
includes/js/em_maps.js ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var map;
2
+
3
+ function em_load_map( callback ) {
4
+ var script = document.createElement("script");
5
+ script.setAttribute("src", "http://maps.google.com/maps/api/js?sensor=false&callback="+callback);
6
+ script.setAttribute("type", "text/javascript");
7
+ document.documentElement.firstChild.appendChild(script);
8
+ }
9
+
10
+ //Load a map on a single page
11
+ function em_map_single() {
12
+ em_LatLng = new google.maps.LatLng(latitude, longitude);
13
+ var map = new google.maps.Map( document.getElementById('em-location-map'), {
14
+ zoom: 14,
15
+ center: em_LatLng,
16
+ mapTypeId: google.maps.MapTypeId.ROADMAP,
17
+ mapTypeControl: false
18
+ });
19
+ var infowindow = new google.maps.InfoWindow({ content: document.getElementById('em-location-map-info').firstChild });
20
+ var marker = new google.maps.Marker({
21
+ position: em_LatLng,
22
+ map: map
23
+ });
24
+ infowindow.open(map,marker);
25
+ }
26
+
27
+ function em_map_global() {
28
+ jQuery.getJSON(document.URL,{ajax: 'true', query:'GlobalMapData', eventful:eventful}, function(data){
29
+ var myLatlng = new google.maps.LatLng(data[0].location_latitude,data[0].location_longitude);
30
+ var myOptions = {
31
+ mapTypeId: google.maps.MapTypeId.ROADMAP
32
+ }
33
+
34
+ map = new google.maps.Map(document.getElementById("em-locations-map"), myOptions);
35
+
36
+ var minLatLngArr = [0,0];
37
+ var maxLatLngArr = [0,0];
38
+
39
+ for (var i = 0; i < data.length; i++) {
40
+ var latitude = parseFloat( data[i].location_latitude );
41
+ var longitude = parseFloat( data[i].location_longitude );
42
+ var location = new google.maps.LatLng( latitude, longitude );
43
+ var marker = new google.maps.Marker({
44
+ position: location,
45
+ map: map
46
+ });
47
+ marker.setTitle(data[i].location_name);
48
+ var myContent = '<div id="em-map-balloon"><div id="content">'+ data[i].location_balloon +'</div></div>';
49
+ em_map_infobox(marker, myContent);
50
+
51
+ //Get min and max long/lats
52
+ minLatLngArr[0] = (latitude < minLatLngArr[0] || i == 0) ? latitude : minLatLngArr[0];
53
+ minLatLngArr[1] = (longitude < minLatLngArr[1] || i == 0) ? longitude : minLatLngArr[1];
54
+ maxLatLngArr[0] = (latitude > maxLatLngArr[0] || i == 0) ? latitude : maxLatLngArr[0];
55
+ maxLatLngArr[1] = (longitude > maxLatLngArr[1] || i == 0) ? longitude : maxLatLngArr[1];
56
+ }
57
+ // Zoom in to the bounds
58
+ var minLatLng = new google.maps.LatLng(minLatLngArr[0],minLatLngArr[1]);
59
+ var maxLatLng = new google.maps.LatLng(maxLatLngArr[0],maxLatLngArr[1]);
60
+ var bounds = new google.maps.LatLngBounds(minLatLng,maxLatLng);
61
+ map.fitBounds(bounds);
62
+ });
63
+ }
64
+
65
+ // The five markers show a secret message when clicked
66
+ // but that message is not within the marker's instance data
67
+
68
+ function em_map_infobox(marker, message) {
69
+ var infowindow = new google.maps.InfoWindow({ content: message });
70
+ google.maps.event.addListener(marker, 'click', function() {
71
+ infowindow.open(map,marker);
72
+ });
73
+ }
includes/js/em_ui.js ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * jQuery UI Datepicker 1.7.3
3
+ *
4
+ * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
5
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
6
+ * and GPL (GPL-LICENSE.txt) licenses.
7
+ *
8
+ * http://docs.jquery.com/UI/Datepicker
9
+ *
10
+ * Depends:
11
+ * ui.core.js
12
+ */
13
+ (function($){$.extend($.ui,{datepicker:{version:"1.7.3"}});var PROP_NAME="datepicker";function Datepicker(){this.debug=false;this._curInst=null;this._keyEvent=false;this._disabledInputs=[];this._datepickerShowing=false;this._inDialog=false;this._mainDivId="ui-datepicker-div";this._inlineClass="ui-datepicker-inline";this._appendClass="ui-datepicker-append";this._triggerClass="ui-datepicker-trigger";this._dialogClass="ui-datepicker-dialog";this._disableClass="ui-datepicker-disabled";this._unselectableClass="ui-datepicker-unselectable";this._currentClass="ui-datepicker-current-day";this._dayOverClass="ui-datepicker-days-cell-over";this.regional=[];this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],dateFormat:"mm/dd/yy",firstDay:0,isRTL:false};this._defaults={showOn:"focus",showAnim:"show",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:false,hideIfNoPrevNext:false,navigationAsDateFormat:false,gotoCurrent:false,changeMonth:false,changeYear:false,showMonthAfterYear:false,yearRange:"-10:+10",showOtherMonths:false,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"normal",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:true,showButtonPanel:false};$.extend(this._defaults,this.regional[""]);this.dpDiv=$('<div id="'+this._mainDivId+'" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all ui-helper-hidden-accessible"></div>')}$.extend(Datepicker.prototype,{markerClassName:"hasDatepicker",log:function(){if(this.debug){console.log.apply("",arguments)}},setDefaults:function(settings){extendRemove(this._defaults,settings||{});return this},_attachDatepicker:function(target,settings){var inlineSettings=null;for(var attrName in this._defaults){var attrValue=target.getAttribute("date:"+attrName);if(attrValue){inlineSettings=inlineSettings||{};try{inlineSettings[attrName]=eval(attrValue)}catch(err){inlineSettings[attrName]=attrValue}}}var nodeName=target.nodeName.toLowerCase();var inline=(nodeName=="div"||nodeName=="span");if(!target.id){target.id="dp"+(++this.uuid)}var inst=this._newInst($(target),inline);inst.settings=$.extend({},settings||{},inlineSettings||{});if(nodeName=="input"){this._connectDatepicker(target,inst)}else{if(inline){this._inlineDatepicker(target,inst)}}},_newInst:function(target,inline){var id=target[0].id.replace(/([:\[\]\.])/g,"\\\\$1");return{id:id,input:target,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:inline,dpDiv:(!inline?this.dpDiv:$('<div class="'+this._inlineClass+' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>'))}},_connectDatepicker:function(target,inst){var input=$(target);inst.append=$([]);inst.trigger=$([]);if(input.hasClass(this.markerClassName)){return}var appendText=this._get(inst,"appendText");var isRTL=this._get(inst,"isRTL");if(appendText){inst.append=$('<span class="'+this._appendClass+'">'+appendText+"</span>");input[isRTL?"before":"after"](inst.append)}var showOn=this._get(inst,"showOn");if(showOn=="focus"||showOn=="both"){input.focus(this._showDatepicker)}if(showOn=="button"||showOn=="both"){var buttonText=this._get(inst,"buttonText");var buttonImage=this._get(inst,"buttonImage");inst.trigger=$(this._get(inst,"buttonImageOnly")?$("<img/>").addClass(this._triggerClass).attr({src:buttonImage,alt:buttonText,title:buttonText}):$('<button type="button"></button>').addClass(this._triggerClass).html(buttonImage==""?buttonText:$("<img/>").attr({src:buttonImage,alt:buttonText,title:buttonText})));input[isRTL?"before":"after"](inst.trigger);inst.trigger.click(function(){if($.datepicker._datepickerShowing&&$.datepicker._lastInput==target){$.datepicker._hideDatepicker()}else{$.datepicker._showDatepicker(target)}return false})}input.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).bind("setData.datepicker",function(event,key,value){inst.settings[key]=value}).bind("getData.datepicker",function(event,key){return this._get(inst,key)});$.data(target,PROP_NAME,inst)},_inlineDatepicker:function(target,inst){var divSpan=$(target);if(divSpan.hasClass(this.markerClassName)){return}divSpan.addClass(this.markerClassName).append(inst.dpDiv).bind("setData.datepicker",function(event,key,value){inst.settings[key]=value}).bind("getData.datepicker",function(event,key){return this._get(inst,key)});$.data(target,PROP_NAME,inst);this._setDate(inst,this._getDefaultDate(inst));this._updateDatepicker(inst);this._updateAlternate(inst)},_dialogDatepicker:function(input,dateText,onSelect,settings,pos){var inst=this._dialogInst;if(!inst){var id="dp"+(++this.uuid);this._dialogInput=$('<input type="text" id="'+id+'" size="1" style="position: absolute; top: -100px;"/>');this._dialogInput.keydown(this._doKeyDown);$("body").append(this._dialogInput);inst=this._dialogInst=this._newInst(this._dialogInput,false);inst.settings={};$.data(this._dialogInput[0],PROP_NAME,inst)}extendRemove(inst.settings,settings||{});this._dialogInput.val(dateText);this._pos=(pos?(pos.length?pos:[pos.pageX,pos.pageY]):null);if(!this._pos){var browserWidth=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth;var browserHeight=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;var scrollX=document.documentElement.scrollLeft||document.body.scrollLeft;var scrollY=document.documentElement.scrollTop||document.body.scrollTop;this._pos=[(browserWidth/2)-100+scrollX,(browserHeight/2)-150+scrollY]}this._dialogInput.css("left",this._pos[0]+"px").css("top",this._pos[1]+"px");inst.settings.onSelect=onSelect;this._inDialog=true;this.dpDiv.addClass(this._dialogClass);this._showDatepicker(this._dialogInput[0]);if($.blockUI){$.blockUI(this.dpDiv)}$.data(this._dialogInput[0],PROP_NAME,inst);return this},_destroyDatepicker:function(target){var $target=$(target);var inst=$.data(target,PROP_NAME);if(!$target.hasClass(this.markerClassName)){return}var nodeName=target.nodeName.toLowerCase();$.removeData(target,PROP_NAME);if(nodeName=="input"){inst.append.remove();inst.trigger.remove();$target.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress)}else{if(nodeName=="div"||nodeName=="span"){$target.removeClass(this.markerClassName).empty()}}},_enableDatepicker:function(target){var $target=$(target);var inst=$.data(target,PROP_NAME);if(!$target.hasClass(this.markerClassName)){return}var nodeName=target.nodeName.toLowerCase();if(nodeName=="input"){target.disabled=false;inst.trigger.filter("button").each(function(){this.disabled=false}).end().filter("img").css({opacity:"1.0",cursor:""})}else{if(nodeName=="div"||nodeName=="span"){var inline=$target.children("."+this._inlineClass);inline.children().removeClass("ui-state-disabled")}}this._disabledInputs=$.map(this._disabledInputs,function(value){return(value==target?null:value)})},_disableDatepicker:function(target){var $target=$(target);var inst=$.data(target,PROP_NAME);if(!$target.hasClass(this.markerClassName)){return}var nodeName=target.nodeName.toLowerCase();if(nodeName=="input"){target.disabled=true;inst.trigger.filter("button").each(function(){this.disabled=true}).end().filter("img").css({opacity:"0.5",cursor:"default"})}else{if(nodeName=="div"||nodeName=="span"){var inline=$target.children("."+this._inlineClass);inline.children().addClass("ui-state-disabled")}}this._disabledInputs=$.map(this._disabledInputs,function(value){return(value==target?null:value)});this._disabledInputs[this._disabledInputs.length]=target},_isDisabledDatepicker:function(target){if(!target){return false}for(var i=0;i<this._disabledInputs.length;i++){if(this._disabledInputs[i]==target){return true}}return false},_getInst:function(target){try{return $.data(target,PROP_NAME)}catch(err){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(target,name,value){var inst=this._getInst(target);if(arguments.length==2&&typeof name=="string"){return(name=="defaults"?$.extend({},$.datepicker._defaults):(inst?(name=="all"?$.extend({},inst.settings):this._get(inst,name)):null))}var settings=name||{};if(typeof name=="string"){settings={};settings[name]=value}if(inst){if(this._curInst==inst){this._hideDatepicker(null)}var date=this._getDateDatepicker(target);extendRemove(inst.settings,settings);this._setDateDatepicker(target,date);this._updateDatepicker(inst)}},_changeDatepicker:function(target,name,value){this._optionDatepicker(target,name,value)},_refreshDatepicker:function(target){var inst=this._getInst(target);if(inst){this._updateDatepicker(inst)}},_setDateDatepicker:function(target,date,endDate){var inst=this._getInst(target);if(inst){this._setDate(inst,date,endDate);this._updateDatepicker(inst);this._updateAlternate(inst)}},_getDateDatepicker:function(target){var inst=this._getInst(target);if(inst&&!inst.inline){this._setDateFromField(inst)}return(inst?this._getDate(inst):null)},_doKeyDown:function(event){var inst=$.datepicker._getInst(event.target);var handled=true;var isRTL=inst.dpDiv.is(".ui-datepicker-rtl");inst._keyEvent=true;if($.datepicker._datepickerShowing){switch(event.keyCode){case 9:$.datepicker._hideDatepicker(null,"");break;case 13:var sel=$("td."+$.datepicker._dayOverClass+", td."+$.datepicker._currentClass,inst.dpDiv);if(sel[0]){$.datepicker._selectDay(event.target,inst.selectedMonth,inst.selectedYear,sel[0])}else{$.datepicker._hideDatepicker(null,$.datepicker._get(inst,"duration"))}return false;break;case 27:$.datepicker._hideDatepicker(null,$.datepicker._get(inst,"duration"));break;case 33:$.datepicker._adjustDate(event.target,(event.ctrlKey?-$.datepicker._get(inst,"stepBigMonths"):-$.datepicker._get(inst,"stepMonths")),"M");break;case 34:$.datepicker._adjustDate(event.target,(event.ctrlKey?+$.datepicker._get(inst,"stepBigMonths"):+$.datepicker._get(inst,"stepMonths")),"M");break;case 35:if(event.ctrlKey||event.metaKey){$.datepicker._clearDate(event.target)}handled=event.ctrlKey||event.metaKey;break;case 36:if(event.ctrlKey||event.metaKey){$.datepicker._gotoToday(event.target)}handled=event.ctrlKey||event.metaKey;break;case 37:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,(isRTL?+1:-1),"D")}handled=event.ctrlKey||event.metaKey;if(event.originalEvent.altKey){$.datepicker._adjustDate(event.target,(event.ctrlKey?-$.datepicker._get(inst,"stepBigMonths"):-$.datepicker._get(inst,"stepMonths")),"M")}break;case 38:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,-7,"D")}handled=event.ctrlKey||event.metaKey;break;case 39:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,(isRTL?-1:+1),"D")}handled=event.ctrlKey||event.metaKey;if(event.originalEvent.altKey){$.datepicker._adjustDate(event.target,(event.ctrlKey?+$.datepicker._get(inst,"stepBigMonths"):+$.datepicker._get(inst,"stepMonths")),"M")}break;case 40:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,+7,"D")}handled=event.ctrlKey||event.metaKey;break;default:handled=false}}else{if(event.keyCode==36&&event.ctrlKey){$.datepicker._showDatepicker(this)}else{handled=false}}if(handled){event.preventDefault();event.stopPropagation()}},_doKeyPress:function(event){var inst=$.datepicker._getInst(event.target);if($.datepicker._get(inst,"constrainInput")){var chars=$.datepicker._possibleChars($.datepicker._get(inst,"dateFormat"));var chr=String.fromCharCode(event.charCode==undefined?event.keyCode:event.charCode);return event.ctrlKey||(chr<" "||!chars||chars.indexOf(chr)>-1)}},_showDatepicker:function(input){input=input.target||input;if(input.nodeName.toLowerCase()!="input"){input=$("input",input.parentNode)[0]}if($.datepicker._isDisabledDatepicker(input)||$.datepicker._lastInput==input){return}var inst=$.datepicker._getInst(input);var beforeShow=$.datepicker._get(inst,"beforeShow");extendRemove(inst.settings,(beforeShow?beforeShow.apply(input,[input,inst]):{}));$.datepicker._hideDatepicker(null,"");$.datepicker._lastInput=input;$.datepicker._setDateFromField(inst);if($.datepicker._inDialog){input.value=""}if(!$.datepicker._pos){$.datepicker._pos=$.datepicker._findPos(input);$.datepicker._pos[1]+=input.offsetHeight}var isFixed=false;$(input).parents().each(function(){isFixed|=$(this).css("position")=="fixed";return !isFixed});if(isFixed&&$.browser.opera){$.datepicker._pos[0]-=document.documentElement.scrollLeft;$.datepicker._pos[1]-=document.documentElement.scrollTop}var offset={left:$.datepicker._pos[0],top:$.datepicker._pos[1]};$.datepicker._pos=null;inst.rangeStart=null;inst.dpDiv.css({position:"absolute",display:"block",top:"-1000px"});$.datepicker._updateDatepicker(inst);offset=$.datepicker._checkOffset(inst,offset,isFixed);inst.dpDiv.css({position:($.datepicker._inDialog&&$.blockUI?"static":(isFixed?"fixed":"absolute")),display:"none",left:offset.left+"px",top:offset.top+"px"});if(!inst.inline){var showAnim=$.datepicker._get(inst,"showAnim")||"show";var duration=$.datepicker._get(inst,"duration");var postProcess=function(){$.datepicker._datepickerShowing=true;if($.browser.msie&&parseInt($.browser.version,10)<7){$("iframe.ui-datepicker-cover").css({width:inst.dpDiv.width()+4,height:inst.dpDiv.height()+4})}};if($.effects&&$.effects[showAnim]){inst.dpDiv.show(showAnim,$.datepicker._get(inst,"showOptions"),duration,postProcess)}else{inst.dpDiv[showAnim](duration,postProcess)}if(duration==""){postProcess()}if(inst.input[0].type!="hidden"){inst.input[0].focus()}$.datepicker._curInst=inst}},_updateDatepicker:function(inst){var dims={width:inst.dpDiv.width()+4,height:inst.dpDiv.height()+4};var self=this;inst.dpDiv.empty().append(this._generateHTML(inst)).find("iframe.ui-datepicker-cover").css({width:dims.width,height:dims.height}).end().find("button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a").bind("mouseout",function(){$(this).removeClass("ui-state-hover");if(this.className.indexOf("ui-datepicker-prev")!=-1){$(this).removeClass("ui-datepicker-prev-hover")}if(this.className.indexOf("ui-datepicker-next")!=-1){$(this).removeClass("ui-datepicker-next-hover")}}).bind("mouseover",function(){if(!self._isDisabledDatepicker(inst.inline?inst.dpDiv.parent()[0]:inst.input[0])){$(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover");$(this).addClass("ui-state-hover");if(this.className.indexOf("ui-datepicker-prev")!=-1){$(this).addClass("ui-datepicker-prev-hover")}if(this.className.indexOf("ui-datepicker-next")!=-1){$(this).addClass("ui-datepicker-next-hover")}}}).end().find("."+this._dayOverClass+" a").trigger("mouseover").end();var numMonths=this._getNumberOfMonths(inst);var cols=numMonths[1];var width=17;if(cols>1){inst.dpDiv.addClass("ui-datepicker-multi-"+cols).css("width",(width*cols)+"em")}else{inst.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width("")}inst.dpDiv[(numMonths[0]!=1||numMonths[1]!=1?"add":"remove")+"Class"]("ui-datepicker-multi");inst.dpDiv[(this._get(inst,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl");if(inst.input&&inst.input[0].type!="hidden"&&inst==$.datepicker._curInst){$(inst.input[0]).focus()}},_checkOffset:function(inst,offset,isFixed){var dpWidth=inst.dpDiv.outerWidth();var dpHeight=inst.dpDiv.outerHeight();var inputWidth=inst.input?inst.input.outerWidth():0;var inputHeight=inst.input?inst.input.outerHeight():0;var viewWidth=(window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth)+$(document).scrollLeft();var viewHeight=(window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight)+$(document).scrollTop();offset.left-=(this._get(inst,"isRTL")?(dpWidth-inputWidth):0);offset.left-=(isFixed&&offset.left==inst.input.offset().left)?$(document).scrollLeft():0;offset.top-=(isFixed&&offset.top==(inst.input.offset().top+inputHeight))?$(document).scrollTop():0;offset.left-=(offset.left+dpWidth>viewWidth&&viewWidth>dpWidth)?Math.abs(offset.left+dpWidth-viewWidth):0;offset.top-=(offset.top+dpHeight>viewHeight&&viewHeight>dpHeight)?Math.abs(offset.top+dpHeight+inputHeight*2-viewHeight):0;return offset},_findPos:function(obj){while(obj&&(obj.type=="hidden"||obj.nodeType!=1)){obj=obj.nextSibling}var position=$(obj).offset();return[position.left,position.top]},_hideDatepicker:function(input,duration){var inst=this._curInst;if(!inst||(input&&inst!=$.data(input,PROP_NAME))){return}if(inst.stayOpen){this._selectDate("#"+inst.id,this._formatDate(inst,inst.currentDay,inst.currentMonth,inst.currentYear))}inst.stayOpen=false;if(this._datepickerShowing){duration=(duration!=null?duration:this._get(inst,"duration"));var showAnim=this._get(inst,"showAnim");var postProcess=function(){$.datepicker._tidyDialog(inst)};if(duration!=""&&$.effects&&$.effects[showAnim]){inst.dpDiv.hide(showAnim,$.datepicker._get(inst,"showOptions"),duration,postProcess)}else{inst.dpDiv[(duration==""?"hide":(showAnim=="slideDown"?"slideUp":(showAnim=="fadeIn"?"fadeOut":"hide")))](duration,postProcess)}if(duration==""){this._tidyDialog(inst)}var onClose=this._get(inst,"onClose");if(onClose){onClose.apply((inst.input?inst.input[0]:null),[(inst.input?inst.input.val():""),inst])}this._datepickerShowing=false;this._lastInput=null;if(this._inDialog){this._dialogInput.css({position:"absolute",left:"0",top:"-100px"});if($.blockUI){$.unblockUI();$("body").append(this.dpDiv)}}this._inDialog=false}this._curInst=null},_tidyDialog:function(inst){inst.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(event){if(!$.datepicker._curInst){return}var $target=$(event.target);if(($target.parents("#"+$.datepicker._mainDivId).length==0)&&!$target.hasClass($.datepicker.markerClassName)&&!$target.hasClass($.datepicker._triggerClass)&&$.datepicker._datepickerShowing&&!($.datepicker._inDialog&&$.blockUI)){$.datepicker._hideDatepicker(null,"")}},_adjustDate:function(id,offset,period){var target=$(id);var inst=this._getInst(target[0]);if(this._isDisabledDatepicker(target[0])){return}this._adjustInstDate(inst,offset+(period=="M"?this._get(inst,"showCurrentAtPos"):0),period);this._updateDatepicker(inst)},_gotoToday:function(id){var target=$(id);var inst=this._getInst(target[0]);if(this._get(inst,"gotoCurrent")&&inst.currentDay){inst.selectedDay=inst.currentDay;inst.drawMonth=inst.selectedMonth=inst.currentMonth;inst.drawYear=inst.selectedYear=inst.currentYear}else{var date=new Date();inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear()}this._notifyChange(inst);this._adjustDate(target)},_selectMonthYear:function(id,select,period){var target=$(id);var inst=this._getInst(target[0]);inst._selectingMonthYear=false;inst["selected"+(period=="M"?"Month":"Year")]=inst["draw"+(period=="M"?"Month":"Year")]=parseInt(select.options[select.selectedIndex].value,10);this._notifyChange(inst);this._adjustDate(target)},_clickMonthYear:function(id){var target=$(id);var inst=this._getInst(target[0]);if(inst.input&&inst._selectingMonthYear&&!$.browser.msie){inst.input[0].focus()}inst._selectingMonthYear=!inst._selectingMonthYear},_selectDay:function(id,month,year,td){var target=$(id);if($(td).hasClass(this._unselectableClass)||this._isDisabledDatepicker(target[0])){return}var inst=this._getInst(target[0]);inst.selectedDay=inst.currentDay=$("a",td).html();inst.selectedMonth=inst.currentMonth=month;inst.selectedYear=inst.currentYear=year;if(inst.stayOpen){inst.endDay=inst.endMonth=inst.endYear=null}this._selectDate(id,this._formatDate(inst,inst.currentDay,inst.currentMonth,inst.currentYear));if(inst.stayOpen){inst.rangeStart=this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay));this._updateDatepicker(inst)}},_clearDate:function(id){var target=$(id);var inst=this._getInst(target[0]);inst.stayOpen=false;inst.endDay=inst.endMonth=inst.endYear=inst.rangeStart=null;this._selectDate(target,"")},_selectDate:function(id,dateStr){var target=$(id);var inst=this._getInst(target[0]);dateStr=(dateStr!=null?dateStr:this._formatDate(inst));if(inst.input){inst.input.val(dateStr)}this._updateAlternate(inst);var onSelect=this._get(inst,"onSelect");if(onSelect){onSelect.apply((inst.input?inst.input[0]:null),[dateStr,inst])}else{if(inst.input){inst.input.trigger("change")}}if(inst.inline){this._updateDatepicker(inst)}else{if(!inst.stayOpen){this._hideDatepicker(null,this._get(inst,"duration"));this._lastInput=inst.input[0];if(typeof(inst.input[0])!="object"){inst.input[0].focus()}this._lastInput=null}}},_updateAlternate:function(inst){var altField=this._get(inst,"altField");if(altField){var altFormat=this._get(inst,"altFormat")||this._get(inst,"dateFormat");var date=this._getDate(inst);dateStr=this.formatDate(altFormat,date,this._getFormatConfig(inst));$(altField).each(function(){$(this).val(dateStr)})}},noWeekends:function(date){var day=date.getDay();return[(day>0&&day<6),""]},iso8601Week:function(date){var checkDate=new Date(date.getFullYear(),date.getMonth(),date.getDate());var firstMon=new Date(checkDate.getFullYear(),1-1,4);var firstDay=firstMon.getDay()||7;firstMon.setDate(firstMon.getDate()+1-firstDay);if(firstDay<4&&checkDate<firstMon){checkDate.setDate(checkDate.getDate()-3);return $.datepicker.iso8601Week(checkDate)}else{if(checkDate>new Date(checkDate.getFullYear(),12-1,28)){firstDay=new Date(checkDate.getFullYear()+1,1-1,4).getDay()||7;if(firstDay>4&&(checkDate.getDay()||7)<firstDay-3){return 1}}}return Math.floor(((checkDate-firstMon)/86400000)/7)+1},parseDate:function(format,value,settings){if(format==null||value==null){throw"Invalid arguments"}value=(typeof value=="object"?value.toString():value+"");if(value==""){return null}var shortYearCutoff=(settings?settings.shortYearCutoff:null)||this._defaults.shortYearCutoff;var dayNamesShort=(settings?settings.dayNamesShort:null)||this._defaults.dayNamesShort;var dayNames=(settings?settings.dayNames:null)||this._defaults.dayNames;var monthNamesShort=(settings?settings.monthNamesShort:null)||this._defaults.monthNamesShort;var monthNames=(settings?settings.monthNames:null)||this._defaults.monthNames;var year=-1;var month=-1;var day=-1;var doy=-1;var literal=false;var lookAhead=function(match){var matches=(iFormat+1<format.length&&format.charAt(iFormat+1)==match);if(matches){iFormat++}return matches};var getNumber=function(match){lookAhead(match);var origSize=(match=="@"?14:(match=="y"?4:(match=="o"?3:2)));var size=origSize;var num=0;while(size>0&&iValue<value.length&&value.charAt(iValue)>="0"&&value.charAt(iValue)<="9"){num=num*10+parseInt(value.charAt(iValue++),10);size--}if(size==origSize){throw"Missing number at position "+iValue}return num};var getName=function(match,shortNames,longNames){var names=(lookAhead(match)?longNames:shortNames);var size=0;for(var j=0;j<names.length;j++){size=Math.max(size,names[j].length)}var name="";var iInit=iValue;while(size>0&&iValue<value.length){name+=value.charAt(iValue++);for(var i=0;i<names.length;i++){if(name==names[i]){return i+1}}size--}throw"Unknown name at position "+iInit};var checkLiteral=function(){if(value.charAt(iValue)!=format.charAt(iFormat)){throw"Unexpected literal at position "+iValue}iValue++};var iValue=0;for(var iFormat=0;iFormat<format.length;iFormat++){if(literal){if(format.charAt(iFormat)=="'"&&!lookAhead("'")){literal=false}else{checkLiteral()}}else{switch(format.charAt(iFormat)){case"d":day=getNumber("d");break;case"D":getName("D",dayNamesShort,dayNames);break;case"o":doy=getNumber("o");break;case"m":month=getNumber("m");break;case"M":month=getName("M",monthNamesShort,monthNames);break;case"y":year=getNumber("y");break;case"@":var date=new Date(getNumber("@"));year=date.getFullYear();month=date.getMonth()+1;day=date.getDate();break;case"'":if(lookAhead("'")){checkLiteral()}else{literal=true}break;default:checkLiteral()}}}if(year==-1){year=new Date().getFullYear()}else{if(year<100){year+=new Date().getFullYear()-new Date().getFullYear()%100+(year<=shortYearCutoff?0:-100)}}if(doy>-1){month=1;day=doy;do{var dim=this._getDaysInMonth(year,month-1);if(day<=dim){break}month++;day-=dim}while(true)}var date=this._daylightSavingAdjust(new Date(year,month-1,day));if(date.getFullYear()!=year||date.getMonth()+1!=month||date.getDate()!=day){throw"Invalid date"}return date},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TIMESTAMP:"@",W3C:"yy-mm-dd",formatDate:function(format,date,settings){if(!date){return""}var dayNamesShort=(settings?settings.dayNamesShort:null)||this._defaults.dayNamesShort;var dayNames=(settings?settings.dayNames:null)||this._defaults.dayNames;var monthNamesShort=(settings?settings.monthNamesShort:null)||this._defaults.monthNamesShort;var monthNames=(settings?settings.monthNames:null)||this._defaults.monthNames;var lookAhead=function(match){var matches=(iFormat+1<format.length&&format.charAt(iFormat+1)==match);if(matches){iFormat++}return matches};var formatNumber=function(match,value,len){var num=""+value;if(lookAhead(match)){while(num.length<len){num="0"+num}}return num};var formatName=function(match,value,shortNames,longNames){return(lookAhead(match)?longNames[value]:shortNames[value])};var output="";var literal=false;if(date){for(var iFormat=0;iFormat<format.length;iFormat++){if(literal){if(format.charAt(iFormat)=="'"&&!lookAhead("'")){literal=false}else{output+=format.charAt(iFormat)}}else{switch(format.charAt(iFormat)){case"d":output+=formatNumber("d",date.getDate(),2);break;case"D":output+=formatName("D",date.getDay(),dayNamesShort,dayNames);break;case"o":var doy=date.getDate();for(var m=date.getMonth()-1;m>=0;m--){doy+=this._getDaysInMonth(date.getFullYear(),m)}output+=formatNumber("o",doy,3);break;case"m":output+=formatNumber("m",date.getMonth()+1,2);break;case"M":output+=formatName("M",date.getMonth(),monthNamesShort,monthNames);break;case"y":output+=(lookAhead("y")?date.getFullYear():(date.getYear()%100<10?"0":"")+date.getYear()%100);break;case"@":output+=date.getTime();break;case"'":if(lookAhead("'")){output+="'"}else{literal=true}break;default:output+=format.charAt(iFormat)}}}}return output},_possibleChars:function(format){var chars="";var literal=false;for(var iFormat=0;iFormat<format.length;iFormat++){if(literal){if(format.charAt(iFormat)=="'"&&!lookAhead("'")){literal=false}else{chars+=format.charAt(iFormat)}}else{switch(format.charAt(iFormat)){case"d":case"m":case"y":case"@":chars+="0123456789";break;case"D":case"M":return null;case"'":if(lookAhead("'")){chars+="'"}else{literal=true}break;default:chars+=format.charAt(iFormat)}}}return chars},_get:function(inst,name){return inst.settings[name]!==undefined?inst.settings[name]:this._defaults[name]},_setDateFromField:function(inst){var dateFormat=this._get(inst,"dateFormat");var dates=inst.input?inst.input.val():null;inst.endDay=inst.endMonth=inst.endYear=null;var date=defaultDate=this._getDefaultDate(inst);var settings=this._getFormatConfig(inst);try{date=this.parseDate(dateFormat,dates,settings)||defaultDate}catch(event){this.log(event);date=defaultDate}inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear();inst.currentDay=(dates?date.getDate():0);inst.currentMonth=(dates?date.getMonth():0);inst.currentYear=(dates?date.getFullYear():0);this._adjustInstDate(inst)},_getDefaultDate:function(inst){var date=this._determineDate(this._get(inst,"defaultDate"),new Date());var minDate=this._getMinMaxDate(inst,"min",true);var maxDate=this._getMinMaxDate(inst,"max");date=(minDate&&date<minDate?minDate:date);date=(maxDate&&date>maxDate?maxDate:date);return date},_determineDate:function(date,defaultDate){var offsetNumeric=function(offset){var date=new Date();date.setDate(date.getDate()+offset);return date};var offsetString=function(offset,getDaysInMonth){var date=new Date();var year=date.getFullYear();var month=date.getMonth();var day=date.getDate();var pattern=/([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g;var matches=pattern.exec(offset);while(matches){switch(matches[2]||"d"){case"d":case"D":day+=parseInt(matches[1],10);break;case"w":case"W":day+=parseInt(matches[1],10)*7;break;case"m":case"M":month+=parseInt(matches[1],10);day=Math.min(day,getDaysInMonth(year,month));break;case"y":case"Y":year+=parseInt(matches[1],10);day=Math.min(day,getDaysInMonth(year,month));break}matches=pattern.exec(offset)}return new Date(year,month,day)};date=(date==null?defaultDate:(typeof date=="string"?offsetString(date,this._getDaysInMonth):(typeof date=="number"?(isNaN(date)?defaultDate:offsetNumeric(date)):date)));date=(date&&date.toString()=="Invalid Date"?defaultDate:date);if(date){date.setHours(0);date.setMinutes(0);date.setSeconds(0);date.setMilliseconds(0)}return this._daylightSavingAdjust(date)},_daylightSavingAdjust:function(date){if(!date){return null}date.setHours(date.getHours()>12?date.getHours()+2:0);return date},_setDate:function(inst,date,endDate){var clear=!(date);var origMonth=inst.selectedMonth;var origYear=inst.selectedYear;date=this._determineDate(date,new Date());inst.selectedDay=inst.currentDay=date.getDate();inst.drawMonth=inst.selectedMonth=inst.currentMonth=date.getMonth();inst.drawYear=inst.selectedYear=inst.currentYear=date.getFullYear();if(origMonth!=inst.selectedMonth||origYear!=inst.selectedYear){this._notifyChange(inst)}this._adjustInstDate(inst);if(inst.input){inst.input.val(clear?"":this._formatDate(inst))}},_getDate:function(inst){var startDate=(!inst.currentYear||(inst.input&&inst.input.val()=="")?null:this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay)));return startDate},_generateHTML:function(inst){var today=new Date();today=this._daylightSavingAdjust(new Date(today.getFullYear(),today.getMonth(),today.getDate()));var isRTL=this._get(inst,"isRTL");var showButtonPanel=this._get(inst,"showButtonPanel");var hideIfNoPrevNext=this._get(inst,"hideIfNoPrevNext");var navigationAsDateFormat=this._get(inst,"navigationAsDateFormat");var numMonths=this._getNumberOfMonths(inst);var showCurrentAtPos=this._get(inst,"showCurrentAtPos");var stepMonths=this._get(inst,"stepMonths");var stepBigMonths=this._get(inst,"stepBigMonths");var isMultiMonth=(numMonths[0]!=1||numMonths[1]!=1);var currentDate=this._daylightSavingAdjust((!inst.currentDay?new Date(9999,9,9):new Date(inst.currentYear,inst.currentMonth,inst.currentDay)));var minDate=this._getMinMaxDate(inst,"min",true);var maxDate=this._getMinMaxDate(inst,"max");var drawMonth=inst.drawMonth-showCurrentAtPos;var drawYear=inst.drawYear;if(drawMonth<0){drawMonth+=12;drawYear--}if(maxDate){var maxDraw=this._daylightSavingAdjust(new Date(maxDate.getFullYear(),maxDate.getMonth()-numMonths[1]+1,maxDate.getDate()));maxDraw=(minDate&&maxDraw<minDate?minDate:maxDraw);while(this._daylightSavingAdjust(new Date(drawYear,drawMonth,1))>maxDraw){drawMonth--;if(drawMonth<0){drawMonth=11;drawYear--}}}inst.drawMonth=drawMonth;inst.drawYear=drawYear;var prevText=this._get(inst,"prevText");prevText=(!navigationAsDateFormat?prevText:this.formatDate(prevText,this._daylightSavingAdjust(new Date(drawYear,drawMonth-stepMonths,1)),this._getFormatConfig(inst)));var prev=(this._canAdjustMonth(inst,-1,drawYear,drawMonth)?'<a class="ui-datepicker-prev ui-corner-all" onclick="DP_jQuery.datepicker._adjustDate(\'#'+inst.id+"', -"+stepMonths+", 'M');\" title=\""+prevText+'"><span class="ui-icon ui-icon-circle-triangle-'+(isRTL?"e":"w")+'">'+prevText+"</span></a>":(hideIfNoPrevNext?"":'<a class="ui-datepicker-prev ui-corner-all ui-state-disabled" title="'+prevText+'"><span class="ui-icon ui-icon-circle-triangle-'+(isRTL?"e":"w")+'">'+prevText+"</span></a>"));var nextText=this._get(inst,"nextText");nextText=(!navigationAsDateFormat?nextText:this.formatDate(nextText,this._daylightSavingAdjust(new Date(drawYear,drawMonth+stepMonths,1)),this._getFormatConfig(inst)));var next=(this._canAdjustMonth(inst,+1,drawYear,drawMonth)?'<a class="ui-datepicker-next ui-corner-all" onclick="DP_jQuery.datepicker._adjustDate(\'#'+inst.id+"', +"+stepMonths+", 'M');\" title=\""+nextText+'"><span class="ui-icon ui-icon-circle-triangle-'+(isRTL?"w":"e")+'">'+nextText+"</span></a>":(hideIfNoPrevNext?"":'<a class="ui-datepicker-next ui-corner-all ui-state-disabled" title="'+nextText+'"><span class="ui-icon ui-icon-circle-triangle-'+(isRTL?"w":"e")+'">'+nextText+"</span></a>"));var currentText=this._get(inst,"currentText");var gotoDate=(this._get(inst,"gotoCurrent")&&inst.currentDay?currentDate:today);currentText=(!navigationAsDateFormat?currentText:this.formatDate(currentText,gotoDate,this._getFormatConfig(inst)));var controls=(!inst.inline?'<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" onclick="DP_jQuery.datepicker._hideDatepicker();">'+this._get(inst,"closeText")+"</button>":"");var buttonPanel=(showButtonPanel)?'<div class="ui-datepicker-buttonpane ui-widget-content">'+(isRTL?controls:"")+(this._isInRange(inst,gotoDate)?'<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" onclick="DP_jQuery.datepicker._gotoToday(\'#'+inst.id+"');\">"+currentText+"</button>":"")+(isRTL?"":controls)+"</div>":"";var firstDay=parseInt(this._get(inst,"firstDay"),10);firstDay=(isNaN(firstDay)?0:firstDay);var dayNames=this._get(inst,"dayNames");var dayNamesShort=this._get(inst,"dayNamesShort");var dayNamesMin=this._get(inst,"dayNamesMin");var monthNames=this._get(inst,"monthNames");var monthNamesShort=this._get(inst,"monthNamesShort");var beforeShowDay=this._get(inst,"beforeShowDay");var showOtherMonths=this._get(inst,"showOtherMonths");var calculateWeek=this._get(inst,"calculateWeek")||this.iso8601Week;var endDate=inst.endDay?this._daylightSavingAdjust(new Date(inst.endYear,inst.endMonth,inst.endDay)):currentDate;var defaultDate=this._getDefaultDate(inst);var html="";for(var row=0;row<numMonths[0];row++){var group="";for(var col=0;col<numMonths[1];col++){var selectedDate=this._daylightSavingAdjust(new Date(drawYear,drawMonth,inst.selectedDay));var cornerClass=" ui-corner-all";var calender="";if(isMultiMonth){calender+='<div class="ui-datepicker-group ui-datepicker-group-';switch(col){case 0:calender+="first";cornerClass=" ui-corner-"+(isRTL?"right":"left");break;case numMonths[1]-1:calender+="last";cornerClass=" ui-corner-"+(isRTL?"left":"right");break;default:calender+="middle";cornerClass="";break}calender+='">'}calender+='<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix'+cornerClass+'">'+(/all|left/.test(cornerClass)&&row==0?(isRTL?next:prev):"")+(/all|right/.test(cornerClass)&&row==0?(isRTL?prev:next):"")+this._generateMonthYearHeader(inst,drawMonth,drawYear,minDate,maxDate,selectedDate,row>0||col>0,monthNames,monthNamesShort)+'</div><table class="ui-datepicker-calendar"><thead><tr>';var thead="";for(var dow=0;dow<7;dow++){var day=(dow+firstDay)%7;thead+="<th"+((dow+firstDay+6)%7>=5?' class="ui-datepicker-week-end"':"")+'><span title="'+dayNames[day]+'">'+dayNamesMin[day]+"</span></th>"}calender+=thead+"</tr></thead><tbody>";var daysInMonth=this._getDaysInMonth(drawYear,drawMonth);if(drawYear==inst.selectedYear&&drawMonth==inst.selectedMonth){inst.selectedDay=Math.min(inst.selectedDay,daysInMonth)}var leadDays=(this._getFirstDayOfMonth(drawYear,drawMonth)-firstDay+7)%7;var numRows=(isMultiMonth?6:Math.ceil((leadDays+daysInMonth)/7));var printDate=this._daylightSavingAdjust(new Date(drawYear,drawMonth,1-leadDays));for(var dRow=0;dRow<numRows;dRow++){calender+="<tr>";var tbody="";for(var dow=0;dow<7;dow++){var daySettings=(beforeShowDay?beforeShowDay.apply((inst.input?inst.input[0]:null),[printDate]):[true,""]);var otherMonth=(printDate.getMonth()!=drawMonth);var unselectable=otherMonth||!daySettings[0]||(minDate&&printDate<minDate)||(maxDate&&printDate>maxDate);tbody+='<td class="'+((dow+firstDay+6)%7>=5?" ui-datepicker-week-end":"")+(otherMonth?" ui-datepicker-other-month":"")+((printDate.getTime()==selectedDate.getTime()&&drawMonth==inst.selectedMonth&&inst._keyEvent)||(defaultDate.getTime()==printDate.getTime()&&defaultDate.getTime()==selectedDate.getTime())?" "+this._dayOverClass:"")+(unselectable?" "+this._unselectableClass+" ui-state-disabled":"")+(otherMonth&&!showOtherMonths?"":" "+daySettings[1]+(printDate.getTime()>=currentDate.getTime()&&printDate.getTime()<=endDate.getTime()?" "+this._currentClass:"")+(printDate.getTime()==today.getTime()?" ui-datepicker-today":""))+'"'+((!otherMonth||showOtherMonths)&&daySettings[2]?' title="'+daySettings[2]+'"':"")+(unselectable?"":" onclick=\"DP_jQuery.datepicker._selectDay('#"+inst.id+"',"+drawMonth+","+drawYear+', this);return false;"')+">"+(otherMonth?(showOtherMonths?printDate.getDate():"&#xa0;"):(unselectable?'<span class="ui-state-default">'+printDate.getDate()+"</span>":'<a class="ui-state-default'+(printDate.getTime()==today.getTime()?" ui-state-highlight":"")+(printDate.getTime()>=currentDate.getTime()&&printDate.getTime()<=endDate.getTime()?" ui-state-active":"")+'" href="#">'+printDate.getDate()+"</a>"))+"</td>";printDate.setDate(printDate.getDate()+1);printDate=this._daylightSavingAdjust(printDate)}calender+=tbody+"</tr>"}drawMonth++;if(drawMonth>11){drawMonth=0;drawYear++}calender+="</tbody></table>"+(isMultiMonth?"</div>"+((numMonths[0]>0&&col==numMonths[1]-1)?'<div class="ui-datepicker-row-break"></div>':""):"");group+=calender}html+=group}html+=buttonPanel+($.browser.msie&&parseInt($.browser.version,10)<7&&!inst.inline?'<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>':"");inst._keyEvent=false;return html},_generateMonthYearHeader:function(inst,drawMonth,drawYear,minDate,maxDate,selectedDate,secondary,monthNames,monthNamesShort){minDate=(inst.rangeStart&&minDate&&selectedDate<minDate?selectedDate:minDate);var changeMonth=this._get(inst,"changeMonth");var changeYear=this._get(inst,"changeYear");var showMonthAfterYear=this._get(inst,"showMonthAfterYear");var html='<div class="ui-datepicker-title">';var monthHtml="";if(secondary||!changeMonth){monthHtml+='<span class="ui-datepicker-month">'+monthNames[drawMonth]+"</span> "}else{var inMinYear=(minDate&&minDate.getFullYear()==drawYear);var inMaxYear=(maxDate&&maxDate.getFullYear()==drawYear);monthHtml+='<select class="ui-datepicker-month" onchange="DP_jQuery.datepicker._selectMonthYear(\'#'+inst.id+"', this, 'M');\" onclick=\"DP_jQuery.datepicker._clickMonthYear('#"+inst.id+"');\">";for(var month=0;month<12;month++){if((!inMinYear||month>=minDate.getMonth())&&(!inMaxYear||month<=maxDate.getMonth())){monthHtml+='<option value="'+month+'"'+(month==drawMonth?' selected="selected"':"")+">"+monthNamesShort[month]+"</option>"}}monthHtml+="</select>"}if(!showMonthAfterYear){html+=monthHtml+((secondary||changeMonth||changeYear)&&(!(changeMonth&&changeYear))?"&#xa0;":"")}if(secondary||!changeYear){html+='<span class="ui-datepicker-year">'+drawYear+"</span>"}else{var years=this._get(inst,"yearRange").split(":");var year=0;var endYear=0;if(years.length!=2){year=drawYear-10;endYear=drawYear+10}else{if(years[0].charAt(0)=="+"||years[0].charAt(0)=="-"){year=drawYear+parseInt(years[0],10);endYear=drawYear+parseInt(years[1],10)}else{year=parseInt(years[0],10);endYear=parseInt(years[1],10)}}year=(minDate?Math.max(year,minDate.getFullYear()):year);endYear=(maxDate?Math.min(endYear,maxDate.getFullYear()):endYear);html+='<select class="ui-datepicker-year" onchange="DP_jQuery.datepicker._selectMonthYear(\'#'+inst.id+"', this, 'Y');\" onclick=\"DP_jQuery.datepicker._clickMonthYear('#"+inst.id+"');\">";for(;year<=endYear;year++){html+='<option value="'+year+'"'+(year==drawYear?' selected="selected"':"")+">"+year+"</option>"}html+="</select>"}if(showMonthAfterYear){html+=(secondary||changeMonth||changeYear?"&#xa0;":"")+monthHtml}html+="</div>";return html},_adjustInstDate:function(inst,offset,period){var year=inst.drawYear+(period=="Y"?offset:0);var month=inst.drawMonth+(period=="M"?offset:0);var day=Math.min(inst.selectedDay,this._getDaysInMonth(year,month))+(period=="D"?offset:0);var date=this._daylightSavingAdjust(new Date(year,month,day));var minDate=this._getMinMaxDate(inst,"min",true);var maxDate=this._getMinMaxDate(inst,"max");date=(minDate&&date<minDate?minDate:date);date=(maxDate&&date>maxDate?maxDate:date);inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear();if(period=="M"||period=="Y"){this._notifyChange(inst)}},_notifyChange:function(inst){var onChange=this._get(inst,"onChangeMonthYear");if(onChange){onChange.apply((inst.input?inst.input[0]:null),[inst.selectedYear,inst.selectedMonth+1,inst])}},_getNumberOfMonths:function(inst){var numMonths=this._get(inst,"numberOfMonths");return(numMonths==null?[1,1]:(typeof numMonths=="number"?[1,numMonths]:numMonths))},_getMinMaxDate:function(inst,minMax,checkRange){var date=this._determineDate(this._get(inst,minMax+"Date"),null);return(!checkRange||!inst.rangeStart?date:(!date||inst.rangeStart>date?inst.rangeStart:date))},_getDaysInMonth:function(year,month){return 32-new Date(year,month,32).getDate()},_getFirstDayOfMonth:function(year,month){return new Date(year,month,1).getDay()},_canAdjustMonth:function(inst,offset,curYear,curMonth){var numMonths=this._getNumberOfMonths(inst);var date=this._daylightSavingAdjust(new Date(curYear,curMonth+(offset<0?offset:numMonths[1]),1));if(offset<0){date.setDate(this._getDaysInMonth(date.getFullYear(),date.getMonth()))}return this._isInRange(inst,date)},_isInRange:function(inst,date){var newMinDate=(!inst.rangeStart?null:this._daylightSavingAdjust(new Date(inst.selectedYear,inst.selectedMonth,inst.selectedDay)));newMinDate=(newMinDate&&inst.rangeStart<newMinDate?inst.rangeStart:newMinDate);var minDate=newMinDate||this._getMinMaxDate(inst,"min");var maxDate=this._getMinMaxDate(inst,"max");return((!minDate||date>=minDate)&&(!maxDate||date<=maxDate))},_getFormatConfig:function(inst){var shortYearCutoff=this._get(inst,"shortYearCutoff");shortYearCutoff=(typeof shortYearCutoff!="string"?shortYearCutoff:new Date().getFullYear()%100+parseInt(shortYearCutoff,10));return{shortYearCutoff:shortYearCutoff,dayNamesShort:this._get(inst,"dayNamesShort"),dayNames:this._get(inst,"dayNames"),monthNamesShort:this._get(inst,"monthNamesShort"),monthNames:this._get(inst,"monthNames")}},_formatDate:function(inst,day,month,year){if(!day){inst.currentDay=inst.selectedDay;inst.currentMonth=inst.selectedMonth;inst.currentYear=inst.selectedYear}var date=(day?(typeof day=="object"?day:this._daylightSavingAdjust(new Date(year,month,day))):this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay)));return this.formatDate(this._get(inst,"dateFormat"),date,this._getFormatConfig(inst))}});function extendRemove(target,props){$.extend(target,props);for(var name in props){if(props[name]==null||props[name]==undefined){target[name]=props[name]}}return target}function isArray(a){return(a&&(($.browser.safari&&typeof a=="object"&&a.length)||(a.constructor&&a.constructor.toString().match(/\Array\(\)/))))}$.fn.datepicker=function(options){if(!$.datepicker.initialized){$(document).mousedown($.datepicker._checkExternalClick).find("body").append($.datepicker.dpDiv);$.datepicker.initialized=true}var otherArgs=Array.prototype.slice.call(arguments,1);if(typeof options=="string"&&(options=="isDisabled"||options=="getDate")){return $.datepicker["_"+options+"Datepicker"].apply($.datepicker,[this[0]].concat(otherArgs))}if(options=="option"&&arguments.length==2&&typeof arguments[1]=="string"){return $.datepicker["_"+options+"Datepicker"].apply($.datepicker,[this[0]].concat(otherArgs))}return this.each(function(){typeof options=="string"?$.datepicker["_"+options+"Datepicker"].apply($.datepicker,[this].concat(otherArgs)):$.datepicker._attachDatepicker(this,options)})};$.datepicker=new Datepicker();$.datepicker.initialized=false;$.datepicker.uuid=new Date().getTime();$.datepicker.version="1.7.3";window.DP_jQuery=$})(jQuery);
14
+
15
+ /*
16
+ * jQuery Autocomplete plugin 1.1
17
+ *
18
+ * Copyright (c) 2009 Joern Zaefferer
19
+ *
20
+ * Dual licensed under the MIT and GPL licenses:
21
+ * http://www.opensource.org/licenses/mit-license.php
22
+ * http://www.gnu.org/licenses/gpl.html
23
+ *
24
+ * Revision: $Id: jquery.autocomplete.js 15 2009-08-22 10:30:27Z joern.zaefferer $
25
+ */;(function($){$.fn.extend({autocomplete:function(urlOrData,options){var isUrl=typeof urlOrData=="string";options=$.extend({},$.Autocompleter.defaults,{url:isUrl?urlOrData:null,data:isUrl?null:urlOrData,delay:isUrl?$.Autocompleter.defaults.delay:10,max:options&&!options.scroll?10:150},options);options.highlight=options.highlight||function(value){return value;};options.formatMatch=options.formatMatch||options.formatItem;return this.each(function(){new $.Autocompleter(this,options);});},result:function(handler){return this.bind("result",handler);},search:function(handler){return this.trigger("search",[handler]);},flushCache:function(){return this.trigger("flushCache");},setOptions:function(options){return this.trigger("setOptions",[options]);},unautocomplete:function(){return this.trigger("unautocomplete");}});$.Autocompleter=function(input,options){var KEY={UP:38,DOWN:40,DEL:46,TAB:9,RETURN:13,ESC:27,COMMA:188,PAGEUP:33,PAGEDOWN:34,BACKSPACE:8};var $input=$(input).attr("autocomplete","off").addClass(options.inputClass);var timeout;var previousValue="";var cache=$.Autocompleter.Cache(options);var hasFocus=0;var lastKeyPressCode;var config={mouseDownOnSelect:false};var select=$.Autocompleter.Select(options,input,selectCurrent,config);var blockSubmit;$.browser.opera&&$(input.form).bind("submit.autocomplete",function(){if(blockSubmit){blockSubmit=false;return false;}});$input.bind(($.browser.opera?"keypress":"keydown")+".autocomplete",function(event){hasFocus=1;lastKeyPressCode=event.keyCode;switch(event.keyCode){case KEY.UP:event.preventDefault();if(select.visible()){select.prev();}else{onChange(0,true);}break;case KEY.DOWN:event.preventDefault();if(select.visible()){select.next();}else{onChange(0,true);}break;case KEY.PAGEUP:event.preventDefault();if(select.visible()){select.pageUp();}else{onChange(0,true);}break;case KEY.PAGEDOWN:event.preventDefault();if(select.visible()){select.pageDown();}else{onChange(0,true);}break;case options.multiple&&$.trim(options.multipleSeparator)==","&&KEY.COMMA:case KEY.TAB:case KEY.RETURN:if(selectCurrent()){event.preventDefault();blockSubmit=true;return false;}break;case KEY.ESC:select.hide();break;default:clearTimeout(timeout);timeout=setTimeout(onChange,options.delay);break;}}).focus(function(){hasFocus++;}).blur(function(){hasFocus=0;if(!config.mouseDownOnSelect){hideResults();}}).click(function(){if(hasFocus++>1&&!select.visible()){onChange(0,true);}}).bind("search",function(){var fn=(arguments.length>1)?arguments[1]:null;function findValueCallback(q,data){var result;if(data&&data.length){for(var i=0;i<data.length;i++){if(data[i].result.toLowerCase()==q.toLowerCase()){result=data[i];break;}}}if(typeof fn=="function")fn(result);else $input.trigger("result",result&&[result.data,result.value]);}$.each(trimWords($input.val()),function(i,value){request(value,findValueCallback,findValueCallback);});}).bind("flushCache",function(){cache.flush();}).bind("setOptions",function(){$.extend(options,arguments[1]);if("data"in arguments[1])cache.populate();}).bind("unautocomplete",function(){select.unbind();$input.unbind();$(input.form).unbind(".autocomplete");});function selectCurrent(){var selected=select.selected();if(!selected)return false;var v=selected.result;previousValue=v;if(options.multiple){var words=trimWords($input.val());if(words.length>1){var seperator=options.multipleSeparator.length;var cursorAt=$(input).selection().start;var wordAt,progress=0;$.each(words,function(i,word){progress+=word.length;if(cursorAt<=progress){wordAt=i;return false;}progress+=seperator;});words[wordAt]=v;v=words.join(options.multipleSeparator);}v+=options.multipleSeparator;}$input.val(v);hideResultsNow();$input.trigger("result",[selected.data,selected.value]);return true;}function onChange(crap,skipPrevCheck){if(lastKeyPressCode==KEY.DEL){select.hide();return;}var currentValue=$input.val();if(!skipPrevCheck&&currentValue==previousValue)return;previousValue=currentValue;currentValue=lastWord(currentValue);if(currentValue.length>=options.minChars){$input.addClass(options.loadingClass);if(!options.matchCase)currentValue=currentValue.toLowerCase();request(currentValue,receiveData,hideResultsNow);}else{stopLoading();select.hide();}};function trimWords(value){if(!value)return[""];if(!options.multiple)return[$.trim(value)];return $.map(value.split(options.multipleSeparator),function(word){return $.trim(value).length?$.trim(word):null;});}function lastWord(value){if(!options.multiple)return value;var words=trimWords(value);if(words.length==1)return words[0];var cursorAt=$(input).selection().start;if(cursorAt==value.length){words=trimWords(value)}else{words=trimWords(value.replace(value.substring(cursorAt),""));}return words[words.length-1];}function autoFill(q,sValue){if(options.autoFill&&(lastWord($input.val()).toLowerCase()==q.toLowerCase())&&lastKeyPressCode!=KEY.BACKSPACE){$input.val($input.val()+sValue.substring(lastWord(previousValue).length));$(input).selection(previousValue.length,previousValue.length+sValue.length);}};function hideResults(){clearTimeout(timeout);timeout=setTimeout(hideResultsNow,200);};function hideResultsNow(){var wasVisible=select.visible();select.hide();clearTimeout(timeout);stopLoading();if(options.mustMatch){$input.search(function(result){if(!result){if(options.multiple){var words=trimWords($input.val()).slice(0,-1);$input.val(words.join(options.multipleSeparator)+(words.length?options.multipleSeparator:""));}else{$input.val("");$input.trigger("result",null);}}});}};function receiveData(q,data){if(data&&data.length&&hasFocus){stopLoading();select.display(data,q);autoFill(q,data[0].value);select.show();}else{hideResultsNow();}};function request(term,success,failure){if(!options.matchCase)term=term.toLowerCase();var data=cache.load(term);if(data&&data.length){success(term,data);}else if((typeof options.url=="string")&&(options.url.length>0)){var extraParams={timestamp:+new Date()};$.each(options.extraParams,function(key,param){extraParams[key]=typeof param=="function"?param():param;});$.ajax({mode:"abort",port:"autocomplete"+input.name,dataType:options.dataType,url:options.url,data:$.extend({q:lastWord(term),limit:options.max},extraParams),success:function(data){var parsed=options.parse&&options.parse(data)||parse(data);cache.add(term,parsed);success(term,parsed);}});}else{select.emptyList();failure(term);}};function parse(data){var parsed=[];var rows=data.split("\n");for(var i=0;i<rows.length;i++){var row=$.trim(rows[i]);if(row){row=row.split("|");parsed[parsed.length]={data:row,value:row[0],result:options.formatResult&&options.formatResult(row,row[0])||row[0]};}}return parsed;};function stopLoading(){$input.removeClass(options.loadingClass);};};$.Autocompleter.defaults={inputClass:"ac_input",resultsClass:"ac_results",loadingClass:"ac_loading",minChars:1,delay:400,matchCase:false,matchSubset:true,matchContains:false,cacheLength:10,max:100,mustMatch:false,extraParams:{},selectFirst:true,formatItem:function(row){return row[0];},formatMatch:null,autoFill:false,width:0,multiple:false,multipleSeparator:", ",highlight:function(value,term){return value.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)("+term.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi,"\\$1")+")(?![^<>]*>)(?![^&;]+;)","gi"),"<strong>$1</strong>");},scroll:true,scrollHeight:180};$.Autocompleter.Cache=function(options){var data={};var length=0;function matchSubset(s,sub){if(!options.matchCase)s=s.toLowerCase();var i=s.indexOf(sub);if(options.matchContains=="word"){i=s.toLowerCase().search("\\b"+sub.toLowerCase());}if(i==-1)return false;return i==0||options.matchContains;};function add(q,value){if(length>options.cacheLength){flush();}if(!data[q]){length++;}data[q]=value;}function populate(){if(!options.data)return false;var stMatchSets={},nullData=0;if(!options.url)options.cacheLength=1;stMatchSets[""]=[];for(var i=0,ol=options.data.length;i<ol;i++){var rawValue=options.data[i];rawValue=(typeof rawValue=="string")?[rawValue]:rawValue;var value=options.formatMatch(rawValue,i+1,options.data.length);if(value===false)continue;var firstChar=value.charAt(0).toLowerCase();if(!stMatchSets[firstChar])stMatchSets[firstChar]=[];var row={value:value,data:rawValue,result:options.formatResult&&options.formatResult(rawValue)||value};stMatchSets[firstChar].push(row);if(nullData++<options.max){stMatchSets[""].push(row);}};$.each(stMatchSets,function(i,value){options.cacheLength++;add(i,value);});}setTimeout(populate,25);function flush(){data={};length=0;}return{flush:flush,add:add,populate:populate,load:function(q){if(!options.cacheLength||!length)return null;if(!options.url&&options.matchContains){var csub=[];for(var k in data){if(k.length>0){var c=data[k];$.each(c,function(i,x){if(matchSubset(x.value,q)){csub.push(x);}});}}return csub;}else
26
+ if(data[q]){return data[q];}else
27
+ if(options.matchSubset){for(var i=q.length-1;i>=options.minChars;i--){var c=data[q.substr(0,i)];if(c){var csub=[];$.each(c,function(i,x){if(matchSubset(x.value,q)){csub[csub.length]=x;}});return csub;}}}return null;}};};$.Autocompleter.Select=function(options,input,select,config){var CLASSES={ACTIVE:"ac_over"};var listItems,active=-1,data,term="",needsInit=true,element,list;function init(){if(!needsInit)return;element=$("<div/>").hide().addClass(options.resultsClass).css("position","absolute").appendTo(document.body);list=$("<ul/>").appendTo(element).mouseover(function(event){if(target(event).nodeName&&target(event).nodeName.toUpperCase()=='LI'){active=$("li",list).removeClass(CLASSES.ACTIVE).index(target(event));$(target(event)).addClass(CLASSES.ACTIVE);}}).click(function(event){$(target(event)).addClass(CLASSES.ACTIVE);select();input.focus();return false;}).mousedown(function(){config.mouseDownOnSelect=true;}).mouseup(function(){config.mouseDownOnSelect=false;});if(options.width>0)element.css("width",options.width);needsInit=false;}function target(event){var element=event.target;while(element&&element.tagName!="LI")element=element.parentNode;if(!element)return[];return element;}function moveSelect(step){listItems.slice(active,active+1).removeClass(CLASSES.ACTIVE);movePosition(step);var activeItem=listItems.slice(active,active+1).addClass(CLASSES.ACTIVE);if(options.scroll){var offset=0;listItems.slice(0,active).each(function(){offset+=this.offsetHeight;});if((offset+activeItem[0].offsetHeight-list.scrollTop())>list[0].clientHeight){list.scrollTop(offset+activeItem[0].offsetHeight-list.innerHeight());}else if(offset<list.scrollTop()){list.scrollTop(offset);}}};function movePosition(step){active+=step;if(active<0){active=listItems.size()-1;}else if(active>=listItems.size()){active=0;}}function limitNumberOfItems(available){return options.max&&options.max<available?options.max:available;}function fillList(){list.empty();var max=limitNumberOfItems(data.length);for(var i=0;i<max;i++){if(!data[i])continue;var formatted=options.formatItem(data[i].data,i+1,max,data[i].value,term);if(formatted===false)continue;var li=$("<li/>").html(options.highlight(formatted,term)).addClass(i%2==0?"ac_even":"ac_odd").appendTo(list)[0];$.data(li,"ac_data",data[i]);}listItems=list.find("li");if(options.selectFirst){listItems.slice(0,1).addClass(CLASSES.ACTIVE);active=0;}if($.fn.bgiframe)list.bgiframe();}return{display:function(d,q){init();data=d;term=q;fillList();},next:function(){moveSelect(1);},prev:function(){moveSelect(-1);},pageUp:function(){if(active!=0&&active-8<0){moveSelect(-active);}else{moveSelect(-8);}},pageDown:function(){if(active!=listItems.size()-1&&active+8>listItems.size()){moveSelect(listItems.size()-1-active);}else{moveSelect(8);}},hide:function(){element&&element.hide();listItems&&listItems.removeClass(CLASSES.ACTIVE);active=-1;},visible:function(){return element&&element.is(":visible");},current:function(){return this.visible()&&(listItems.filter("."+CLASSES.ACTIVE)[0]||options.selectFirst&&listItems[0]);},show:function(){var offset=$(input).offset();element.css({width:typeof options.width=="string"||options.width>0?options.width:$(input).width(),top:offset.top+input.offsetHeight,left:offset.left}).show();if(options.scroll){list.scrollTop(0);list.css({maxHeight:options.scrollHeight,overflow:'auto'});if($.browser.msie&&typeof document.body.style.maxHeight==="undefined"){var listHeight=0;listItems.each(function(){listHeight+=this.offsetHeight;});var scrollbarsVisible=listHeight>options.scrollHeight;list.css('height',scrollbarsVisible?options.scrollHeight:listHeight);if(!scrollbarsVisible){listItems.width(list.width()-parseInt(listItems.css("padding-left"))-parseInt(listItems.css("padding-right")));}}}},selected:function(){var selected=listItems&&listItems.filter("."+CLASSES.ACTIVE).removeClass(CLASSES.ACTIVE);return selected&&selected.length&&$.data(selected[0],"ac_data");},emptyList:function(){list&&list.empty();},unbind:function(){element&&element.remove();}};};$.fn.selection=function(start,end){if(start!==undefined){return this.each(function(){if(this.createTextRange){var selRange=this.createTextRange();if(end===undefined||start==end){selRange.move("character",start);selRange.select();}else{selRange.collapse(true);selRange.moveStart("character",start);selRange.moveEnd("character",end);selRange.select();}}else if(this.setSelectionRange){this.setSelectionRange(start,end);}else if(this.selectionStart){this.selectionStart=start;this.selectionEnd=end;}});}var field=this[0];if(field.createTextRange){var range=document.selection.createRange(),orig=field.value,teststring="<->",textLength=range.text.length;range.text=teststring;var caretAt=field.value.indexOf(teststring);field.value=orig;this.selection(caretAt,caretAt+textLength);return{start:caretAt,end:caretAt+textLength}}else if(field.selectionStart!==undefined){return{start:field.selectionStart,end:field.selectionEnd}}};})(jQuery);
includes/js/i18n/jquery-ui-i18n.js ADDED
@@ -0,0 +1,1199 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Afrikaans initialisation for the jQuery UI date picker plugin. */
2
+ /* Written by Renier Pretorius. */
3
+ jQuery(function($){
4
+ $.datepicker.regional['af'] = {
5
+ closeText: 'Selekteer',
6
+ prevText: 'Vorige',
7
+ nextText: 'Volgende',
8
+ currentText: 'Vandag',
9
+ monthNames: ['Januarie','Februarie','Maart','April','Mei','Junie',
10
+ 'Julie','Augustus','September','Oktober','November','Desember'],
11
+ monthNamesShort: ['Jan', 'Feb', 'Mrt', 'Apr', 'Mei', 'Jun',
12
+ 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Des'],
13
+ dayNames: ['Sondag', 'Maandag', 'Dinsdag', 'Woensdag', 'Donderdag', 'Vrydag', 'Saterdag'],
14
+ dayNamesShort: ['Son', 'Maa', 'Din', 'Woe', 'Don', 'Vry', 'Sat'],
15
+ dayNamesMin: ['So','Ma','Di','Wo','Do','Vr','Sa'],
16
+ weekHeader: 'Wk',
17
+ dateFormat: 'dd/mm/yy',
18
+ firstDay: 1,
19
+ isRTL: false,
20
+ showMonthAfterYear: false,
21
+ yearSuffix: ''};
22
+ $.datepicker.setDefaults($.datepicker.regional['af']);
23
+ });
24
+ /* Arabic Translation for jQuery UI date picker plugin. */
25
+ /* Khaled Al Horani -- koko.dw@gmail.com */
26
+ /* خالد الحوراني -- koko.dw@gmail.com */
27
+ /* NOTE: monthNames are the original months names and they are the Arabic names, not the new months name فبراير - يناير and there isn't any Arabic roots for these months */
28
+ jQuery(function($){
29
+ $.datepicker.regional['ar'] = {
30
+ closeText: 'إغلاق',
31
+ prevText: '&#x3c;السابق',
32
+ nextText: 'التالي&#x3e;',
33
+ currentText: 'اليوم',
34
+ monthNames: ['كانون الثاني', 'شباط', 'آذار', 'نيسان', 'آذار', 'حزيران',
35
+ 'تموز', 'آب', 'أيلول', 'تشرين الأول', 'تشرين الثاني', 'كانون الأول'],
36
+ monthNamesShort: ['1','2','3','4','5','6','7','8','9','10','11','12'],
37
+ dayNames: ['السبت', 'الأحد', 'الاثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة'],
38
+ dayNamesShort: ['سبت', 'أحد', 'اثنين', 'ثلاثاء', 'أربعاء', 'خميس', 'جمعة'],
39
+ dayNamesMin: ['سبت', 'أحد', 'اثنين', 'ثلاثاء', 'أربعاء', 'خميس', 'جمعة'],
40
+ weekHeader: 'أسبوع',
41
+ dateFormat: 'dd/mm/yy',
42
+ firstDay: 0,
43
+ isRTL: true,
44
+ showMonthAfterYear: false,
45
+ yearSuffix: ''};
46
+ $.datepicker.setDefaults($.datepicker.regional['ar']);
47
+ });/* Azerbaijani (UTF-8) initialisation for the jQuery UI date picker plugin. */
48
+ /* Written by Jamil Najafov (necefov33@gmail.com). */
49
+ jQuery(function($) {
50
+ $.datepicker.regional['az'] = {
51
+ closeText: 'Bağla',
52
+ prevText: '&#x3c;Geri',
53
+ nextText: 'İrəli&#x3e;',
54
+ currentText: 'Bugün',
55
+ monthNames: ['Yanvar','Fevral','Mart','Aprel','May','İyun',
56
+ 'İyul','Avqust','Sentyabr','Oktyabr','Noyabr','Dekabr'],
57
+ monthNamesShort: ['Yan','Fev','Mar','Apr','May','İyun',
58
+ 'İyul','Avq','Sen','Okt','Noy','Dek'],
59
+ dayNames: ['Bazar','Bazar ertəsi','Çərşənbə axşamı','Çərşənbə','Cümə axşamı','Cümə','Şənbə'],
60
+ dayNamesShort: ['B','Be','Ça','Ç','Ca','C','Ş'],
61
+ dayNamesMin: ['B','B','Ç','С','Ç','C','Ş'],
62
+ weekHeader: 'Hf',
63
+ dateFormat: 'dd.mm.yy',
64
+ firstDay: 1,
65
+ isRTL: false,
66
+ showMonthAfterYear: false,
67
+ yearSuffix: ''};
68
+ $.datepicker.setDefaults($.datepicker.regional['az']);
69
+ });/* Bulgarian initialisation for the jQuery UI date picker plugin. */
70
+ /* Written by Stoyan Kyosev (http://svest.org). */
71
+ jQuery(function($){
72
+ $.datepicker.regional['bg'] = {
73
+ closeText: 'затвори',
74
+ prevText: '&#x3c;назад',
75
+ nextText: 'напред&#x3e;',
76
+ nextBigText: '&#x3e;&#x3e;',
77
+ currentText: 'днес',
78
+ monthNames: ['Януари','Февруари','Март','Април','Май','Юни',
79
+ 'Юли','Август','Септември','Октомври','Ноември','Декември'],
80
+ monthNamesShort: ['Яну','Фев','Мар','Апр','Май','Юни',
81
+ 'Юли','Авг','Сеп','Окт','Нов','Дек'],
82
+ dayNames: ['Неделя','Понеделник','Вторник','Сряда','Четвъртък','Петък','Събота'],
83
+ dayNamesShort: ['Нед','Пон','Вто','Сря','Чет','Пет','Съб'],
84
+ dayNamesMin: ['Не','По','Вт','Ср','Че','Пе','Съ'],
85
+ weekHeader: 'Wk',
86
+ dateFormat: 'dd.mm.yy',
87
+ firstDay: 1,
88
+ isRTL: false,
89
+ showMonthAfterYear: false,
90
+ yearSuffix: ''};
91
+ $.datepicker.setDefaults($.datepicker.regional['bg']);
92
+ });
93
+ /* Bosnian i18n for the jQuery UI date picker plugin. */
94
+ /* Written by Kenan Konjo. */
95
+ jQuery(function($){
96
+ $.datepicker.regional['bs'] = {
97
+ closeText: 'Zatvori',
98
+ prevText: '&#x3c;',
99
+ nextText: '&#x3e;',
100
+ currentText: 'Danas',
101
+ monthNames: ['Januar','Februar','Mart','April','Maj','Juni',
102
+ 'Juli','August','Septembar','Oktobar','Novembar','Decembar'],
103
+ monthNamesShort: ['Jan','Feb','Mar','Apr','Maj','Jun',
104
+ 'Jul','Aug','Sep','Okt','Nov','Dec'],
105
+ dayNames: ['Nedelja','Ponedeljak','Utorak','Srijeda','Četvrtak','Petak','Subota'],
106
+ dayNamesShort: ['Ned','Pon','Uto','Sri','Čet','Pet','Sub'],
107
+ dayNamesMin: ['Ne','Po','Ut','Sr','Če','Pe','Su'],
108
+ weekHeader: 'Wk',
109
+ dateFormat: 'dd.mm.yy',
110
+ firstDay: 1,
111
+ isRTL: false,
112
+ showMonthAfterYear: false,
113
+ yearSuffix: ''};
114
+ $.datepicker.setDefaults($.datepicker.regional['bs']);
115
+ });/* Inicialització en català per a l'extenció 'calendar' per jQuery. */
116
+ /* Writers: (joan.leon@gmail.com). */
117
+ jQuery(function($){
118
+ $.datepicker.regional['ca'] = {
119
+ closeText: 'Tancar',
120
+ prevText: '&#x3c;Ant',
121
+ nextText: 'Seg&#x3e;',
122
+ currentText: 'Avui',
123
+ monthNames: ['Gener','Febrer','Mar&ccedil;','Abril','Maig','Juny',
124
+ 'Juliol','Agost','Setembre','Octubre','Novembre','Desembre'],
125
+ monthNamesShort: ['Gen','Feb','Mar','Abr','Mai','Jun',
126
+ 'Jul','Ago','Set','Oct','Nov','Des'],
127
+ dayNames: ['Diumenge','Dilluns','Dimarts','Dimecres','Dijous','Divendres','Dissabte'],
128
+ dayNamesShort: ['Dug','Dln','Dmt','Dmc','Djs','Dvn','Dsb'],
129
+ dayNamesMin: ['Dg','Dl','Dt','Dc','Dj','Dv','Ds'],
130
+ weekHeader: 'Sm',
131
+ dateFormat: 'dd/mm/yy',
132
+ firstDay: 1,
133
+ isRTL: false,
134
+ showMonthAfterYear: false,
135
+ yearSuffix: ''};
136
+ $.datepicker.setDefaults($.datepicker.regional['ca']);
137
+ });/* Czech initialisation for the jQuery UI date picker plugin. */
138
+ /* Written by Tomas Muller (tomas@tomas-muller.net). */
139
+ jQuery(function($){
140
+ $.datepicker.regional['cs'] = {
141
+ closeText: 'Zavřít',
142
+ prevText: '&#x3c;Dříve',
143
+ nextText: 'Později&#x3e;',
144
+ currentText: 'Nyní',
145
+ monthNames: ['leden','únor','březen','duben','květen','červen',
146
+ 'červenec','srpen','září','říjen','listopad','prosinec'],
147
+ monthNamesShort: ['led','úno','bře','dub','kvě','čer',
148
+ 'čvc','srp','zář','říj','lis','pro'],
149
+ dayNames: ['neděle', 'pondělí', 'úterý', 'středa', 'čtvrtek', 'pátek', 'sobota'],
150
+ dayNamesShort: ['ne', 'po', 'út', 'st', 'čt', 'pá', 'so'],
151
+ dayNamesMin: ['ne','po','út','st','čt','pá','so'],
152
+ weekHeader: 'Týd',
153
+ dateFormat: 'dd.mm.yy',
154
+ firstDay: 1,
155
+ isRTL: false,
156
+ showMonthAfterYear: false,
157
+ yearSuffix: ''};
158
+ $.datepicker.setDefaults($.datepicker.regional['cs']);
159
+ });
160
+ /* Danish initialisation for the jQuery UI date picker plugin. */
161
+ /* Written by Jan Christensen ( deletestuff@gmail.com). */
162
+ jQuery(function($){
163
+ $.datepicker.regional['da'] = {
164
+ closeText: 'Luk',
165
+ prevText: '&#x3c;Forrige',
166
+ nextText: 'Næste&#x3e;',
167
+ currentText: 'Idag',
168
+ monthNames: ['Januar','Februar','Marts','April','Maj','Juni',
169
+ 'Juli','August','September','Oktober','November','December'],
170
+ monthNamesShort: ['Jan','Feb','Mar','Apr','Maj','Jun',
171
+ 'Jul','Aug','Sep','Okt','Nov','Dec'],
172
+ dayNames: ['Søndag','Mandag','Tirsdag','Onsdag','Torsdag','Fredag','Lørdag'],
173
+ dayNamesShort: ['Søn','Man','Tir','Ons','Tor','Fre','Lør'],
174
+ dayNamesMin: ['Sø','Ma','Ti','On','To','Fr','Lø'],
175
+ weekHeader: 'Uge',
176
+ dateFormat: 'dd-mm-yy',
177
+ firstDay: 1,
178
+ isRTL: false,
179
+ showMonthAfterYear: false,
180
+ yearSuffix: ''};
181
+ $.datepicker.setDefaults($.datepicker.regional['da']);
182
+ });
183
+ /* German initialisation for the jQuery UI date picker plugin. */
184
+ /* Written by Milian Wolff (mail@milianw.de). */
185
+ jQuery(function($){
186
+ $.datepicker.regional['de'] = {
187
+ closeText: 'schließen',
188
+ prevText: '&#x3c;zurück',
189
+ nextText: 'Vor&#x3e;',
190
+ currentText: 'heute',
191
+ monthNames: ['Januar','Februar','März','April','Mai','Juni',
192
+ 'Juli','August','September','Oktober','November','Dezember'],
193
+ monthNamesShort: ['Jan','Feb','Mär','Apr','Mai','Jun',
194
+ 'Jul','Aug','Sep','Okt','Nov','Dez'],
195
+ dayNames: ['Sonntag','Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag'],
196
+ dayNamesShort: ['So','Mo','Di','Mi','Do','Fr','Sa'],
197
+ dayNamesMin: ['So','Mo','Di','Mi','Do','Fr','Sa'],
198
+ weekHeader: 'Wo',
199
+ dateFormat: 'dd.mm.yy',
200
+ firstDay: 1,
201
+ isRTL: false,
202
+ showMonthAfterYear: false,
203
+ yearSuffix: ''};
204
+ $.datepicker.setDefaults($.datepicker.regional['de']);
205
+ });
206
+ /* Greek (el) initialisation for the jQuery UI date picker plugin. */
207
+ /* Written by Alex Cicovic (http://www.alexcicovic.com) */
208
+ jQuery(function($){
209
+ $.datepicker.regional['el'] = {
210
+ closeText: 'Κλείσιμο',
211
+ prevText: 'Προηγούμενος',
212
+ nextText: 'Επόμενος',
213
+ currentText: 'Τρέχων Μήνας',
214
+ monthNames: ['Ιανουάριος','Φεβρουάριος','Μάρτιος','Απρίλιος','Μάιος','Ιούνιος',
215
+ 'Ιούλιος','Αύγουστος','Σεπτέμβριος','Οκτώβριος','Νοέμβριος','Δεκέμβριος'],
216
+ monthNamesShort: ['Ιαν','Φεβ','Μαρ','Απρ','Μαι','Ιουν',
217
+ 'Ιουλ','Αυγ','Σεπ','Οκτ','Νοε','Δεκ'],
218
+ dayNames: ['Κυριακή','Δευτέρα','Τρίτη','Τετάρτη','Πέμπτη','Παρασκευή','Σάββατο'],
219
+ dayNamesShort: ['Κυρ','Δευ','Τρι','Τετ','Πεμ','Παρ','Σαβ'],
220
+ dayNamesMin: ['Κυ','Δε','Τρ','Τε','Πε','Πα','Σα'],
221
+ weekHeader: 'Εβδ',
222
+ dateFormat: 'dd/mm/yy',
223
+ firstDay: 1,
224
+ isRTL: false,
225
+ showMonthAfterYear: false,
226
+ yearSuffix: ''};
227
+ $.datepicker.setDefaults($.datepicker.regional['el']);
228
+ });/* English/UK initialisation for the jQuery UI date picker plugin. */
229
+ /* Written by Stuart. */
230
+ jQuery(function($){
231
+ $.datepicker.regional['en-GB'] = {
232
+ closeText: 'Done',
233
+ prevText: 'Prev',
234
+ nextText: 'Next',
235
+ currentText: 'Today',
236
+ monthNames: ['January','February','March','April','May','June',
237
+ 'July','August','September','October','November','December'],
238
+ monthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
239
+ 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
240
+ dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
241
+ dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
242
+ dayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'],
243
+ weekHeader: 'Wk',
244
+ dateFormat: 'dd/mm/yy',
245
+ firstDay: 1,
246
+ isRTL: false,
247
+ showMonthAfterYear: false,
248
+ yearSuffix: ''};
249
+ $.datepicker.setDefaults($.datepicker.regional['en-GB']);
250
+ });
251
+ /* Esperanto initialisation for the jQuery UI date picker plugin. */
252
+ /* Written by Olivier M. (olivierweb@ifrance.com). */
253
+ jQuery(function($){
254
+ $.datepicker.regional['eo'] = {
255
+ closeText: 'Fermi',
256
+ prevText: '&lt;Anta',
257
+ nextText: 'Sekv&gt;',
258
+ currentText: 'Nuna',
259
+ monthNames: ['Januaro','Februaro','Marto','Aprilo','Majo','Junio',
260
+ 'Julio','Aŭgusto','Septembro','Oktobro','Novembro','Decembro'],
261
+ monthNamesShort: ['Jan','Feb','Mar','Apr','Maj','Jun',
262
+ 'Jul','Aŭg','Sep','Okt','Nov','Dec'],
263
+ dayNames: ['Dimanĉo','Lundo','Mardo','Merkredo','Ĵaŭdo','Vendredo','Sabato'],
264
+ dayNamesShort: ['Dim','Lun','Mar','Mer','Ĵaŭ','Ven','Sab'],
265
+ dayNamesMin: ['Di','Lu','Ma','Me','Ĵa','Ve','Sa'],
266
+ weekHeader: 'Sb',
267
+ dateFormat: 'dd/mm/yy',
268
+ firstDay: 0,
269
+ isRTL: false,
270
+ showMonthAfterYear: false,
271
+ yearSuffix: ''};
272
+ $.datepicker.setDefaults($.datepicker.regional['eo']);
273
+ });
274
+ /* Inicialización en español para la extensión 'UI date picker' para jQuery. */
275
+ /* Traducido por Vester (xvester@gmail.com). */
276
+ jQuery(function($){
277
+ $.datepicker.regional['es'] = {
278
+ closeText: 'Cerrar',
279
+ prevText: '&#x3c;Ant',
280
+ nextText: 'Sig&#x3e;',
281
+ currentText: 'Hoy',
282
+ monthNames: ['Enero','Febrero','Marzo','Abril','Mayo','Junio',
283
+ 'Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre'],
284
+ monthNamesShort: ['Ene','Feb','Mar','Abr','May','Jun',
285
+ 'Jul','Ago','Sep','Oct','Nov','Dic'],
286
+ dayNames: ['Domingo','Lunes','Martes','Mi&eacute;rcoles','Jueves','Viernes','S&aacute;bado'],
287
+ dayNamesShort: ['Dom','Lun','Mar','Mi&eacute;','Juv','Vie','S&aacute;b'],
288
+ dayNamesMin: ['Do','Lu','Ma','Mi','Ju','Vi','S&aacute;'],
289
+ weekHeader: 'Sm',
290
+ dateFormat: 'dd/mm/yy',
291
+ firstDay: 1,
292
+ isRTL: false,
293
+ showMonthAfterYear: false,
294
+ yearSuffix: ''};
295
+ $.datepicker.setDefaults($.datepicker.regional['es']);
296
+ });/* Estonian initialisation for the jQuery UI date picker plugin. */
297
+ /* Written by Mart Sõmermaa (mrts.pydev at gmail com). */
298
+ jQuery(function($){
299
+ $.datepicker.regional['et'] = {
300
+ closeText: 'Sulge',
301
+ prevText: 'Eelnev',
302
+ nextText: 'Järgnev',
303
+ currentText: 'Täna',
304
+ monthNames: ['Jaanuar','Veebruar','Märts','Aprill','Mai','Juuni',
305
+ 'Juuli','August','September','Oktoober','November','Detsember'],
306
+ monthNamesShort: ['Jaan', 'Veebr', 'Märts', 'Apr', 'Mai', 'Juuni',
307
+ 'Juuli', 'Aug', 'Sept', 'Okt', 'Nov', 'Dets'],
308
+ dayNames: ['Pühapäev', 'Esmaspäev', 'Teisipäev', 'Kolmapäev', 'Neljapäev', 'Reede', 'Laupäev'],
309
+ dayNamesShort: ['Pühap', 'Esmasp', 'Teisip', 'Kolmap', 'Neljap', 'Reede', 'Laup'],
310
+ dayNamesMin: ['P','E','T','K','N','R','L'],
311
+ weekHeader: 'Sm',
312
+ dateFormat: 'dd.mm.yy',
313
+ firstDay: 1,
314
+ isRTL: false,
315
+ showMonthAfterYear: false,
316
+ yearSuffix: ''};
317
+ $.datepicker.setDefaults($.datepicker.regional['et']);
318
+ }); /* Euskarako oinarria 'UI date picker' jquery-ko extentsioarentzat */
319
+ /* Karrikas-ek itzulia (karrikas@karrikas.com) */
320
+ jQuery(function($){
321
+ $.datepicker.regional['eu'] = {
322
+ closeText: 'Egina',
323
+ prevText: '&#x3c;Aur',
324
+ nextText: 'Hur&#x3e;',
325
+ currentText: 'Gaur',
326
+ monthNames: ['Urtarrila','Otsaila','Martxoa','Apirila','Maiatza','Ekaina',
327
+ 'Uztaila','Abuztua','Iraila','Urria','Azaroa','Abendua'],
328
+ monthNamesShort: ['Urt','Ots','Mar','Api','Mai','Eka',
329
+ 'Uzt','Abu','Ira','Urr','Aza','Abe'],
330
+ dayNames: ['Igandea','Astelehena','Asteartea','Asteazkena','Osteguna','Ostirala','Larunbata'],
331
+ dayNamesShort: ['Iga','Ast','Ast','Ast','Ost','Ost','Lar'],
332
+ dayNamesMin: ['Ig','As','As','As','Os','Os','La'],
333
+ weekHeader: 'Wk',
334
+ dateFormat: 'yy/mm/dd',
335
+ firstDay: 1,
336
+ isRTL: false,
337
+ showMonthAfterYear: false,
338
+ yearSuffix: ''};
339
+ $.datepicker.setDefaults($.datepicker.regional['eu']);
340
+ });/* Persian (Farsi) Translation for the jQuery UI date picker plugin. */
341
+ /* Javad Mowlanezhad -- jmowla@gmail.com */
342
+ /* Jalali calendar should supported soon! (Its implemented but I have to test it) */
343
+ jQuery(function($) {
344
+ $.datepicker.regional['fa'] = {
345
+ closeText: 'بستن',
346
+ prevText: '&#x3c;قبلي',
347
+ nextText: 'بعدي&#x3e;',
348
+ currentText: 'امروز',
349
+ monthNames: ['فروردين','ارديبهشت','خرداد','تير','مرداد','شهريور',
350
+ 'مهر','آبان','آذر','دي','بهمن','اسفند'],
351
+ monthNamesShort: ['1','2','3','4','5','6','7','8','9','10','11','12'],
352
+ dayNames: ['يکشنبه','دوشنبه','سه‌شنبه','چهارشنبه','پنجشنبه','جمعه','شنبه'],
353
+ dayNamesShort: ['ي','د','س','چ','پ','ج', 'ش'],
354
+ dayNamesMin: ['ي','د','س','چ','پ','ج', 'ش'],
355
+ weekHeader: 'هف',
356
+ dateFormat: 'yy/mm/dd',
357
+ firstDay: 6,
358
+ isRTL: true,
359
+ showMonthAfterYear: false,
360
+ yearSuffix: ''};
361
+ $.datepicker.setDefaults($.datepicker.regional['fa']);
362
+ });/* Finnish initialisation for the jQuery UI date picker plugin. */
363
+ /* Written by Harri Kilpi� (harrikilpio@gmail.com). */
364
+ jQuery(function($){
365
+ $.datepicker.regional['fi'] = {
366
+ closeText: 'Sulje',
367
+ prevText: '&laquo;Edellinen',
368
+ nextText: 'Seuraava&raquo;',
369
+ currentText: 'T&auml;n&auml;&auml;n',
370
+ monthNames: ['Tammikuu','Helmikuu','Maaliskuu','Huhtikuu','Toukokuu','Kes&auml;kuu',
371
+ 'Hein&auml;kuu','Elokuu','Syyskuu','Lokakuu','Marraskuu','Joulukuu'],
372
+ monthNamesShort: ['Tammi','Helmi','Maalis','Huhti','Touko','Kes&auml;',
373
+ 'Hein&auml;','Elo','Syys','Loka','Marras','Joulu'],
374
+ dayNamesShort: ['Su','Ma','Ti','Ke','To','Pe','Su'],
375
+ dayNames: ['Sunnuntai','Maanantai','Tiistai','Keskiviikko','Torstai','Perjantai','Lauantai'],
376
+ dayNamesMin: ['Su','Ma','Ti','Ke','To','Pe','La'],
377
+ weekHeader: 'Vk',
378
+ dateFormat: 'dd.mm.yy',
379
+ firstDay: 1,
380
+ isRTL: false,
381
+ showMonthAfterYear: false,
382
+ yearSuffix: ''};
383
+ $.datepicker.setDefaults($.datepicker.regional['fi']);
384
+ });
385
+ /* Faroese initialisation for the jQuery UI date picker plugin */
386
+ /* Written by Sverri Mohr Olsen, sverrimo@gmail.com */
387
+ jQuery(function($){
388
+ $.datepicker.regional['fo'] = {
389
+ closeText: 'Lat aftur',
390
+ prevText: '&#x3c;Fyrra',
391
+ nextText: 'Næsta&#x3e;',
392
+ currentText: 'Í dag',
393
+ monthNames: ['Januar','Februar','Mars','Apríl','Mei','Juni',
394
+ 'Juli','August','September','Oktober','November','Desember'],
395
+ monthNamesShort: ['Jan','Feb','Mar','Apr','Mei','Jun',
396
+ 'Jul','Aug','Sep','Okt','Nov','Des'],
397
+ dayNames: ['Sunnudagur','Mánadagur','Týsdagur','Mikudagur','Hósdagur','Fríggjadagur','Leyardagur'],
398
+ dayNamesShort: ['Sun','Mán','Týs','Mik','Hós','Frí','Ley'],
399
+ dayNamesMin: ['Su','Má','Tý','Mi','Hó','Fr','Le'],
400
+ weekHeader: 'Vk',
401
+ dateFormat: 'dd-mm-yy',
402
+ firstDay: 0,
403
+ isRTL: false,
404
+ showMonthAfterYear: false,
405
+ yearSuffix: ''};
406
+ $.datepicker.setDefaults($.datepicker.regional['fo']);
407
+ });
408
+ /* Swiss-French initialisation for the jQuery UI date picker plugin. */
409
+ /* Written Martin Voelkle (martin.voelkle@e-tc.ch). */
410
+ jQuery(function($){
411
+ $.datepicker.regional['fr-CH'] = {
412
+ closeText: 'Fermer',
413
+ prevText: '&#x3c;Préc',
414
+ nextText: 'Suiv&#x3e;',
415
+ currentText: 'Courant',
416
+ monthNames: ['Janvier','Février','Mars','Avril','Mai','Juin',
417
+ 'Juillet','Août','Septembre','Octobre','Novembre','Décembre'],
418
+ monthNamesShort: ['Jan','Fév','Mar','Avr','Mai','Jun',
419
+ 'Jul','Aoû','Sep','Oct','Nov','Déc'],
420
+ dayNames: ['Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi'],
421
+ dayNamesShort: ['Dim','Lun','Mar','Mer','Jeu','Ven','Sam'],
422
+ dayNamesMin: ['Di','Lu','Ma','Me','Je','Ve','Sa'],
423
+ weekHeader: 'Sm',
424
+ dateFormat: 'dd.mm.yy',
425
+ firstDay: 1,
426
+ isRTL: false,
427
+ showMonthAfterYear: false,
428
+ yearSuffix: ''};
429
+ $.datepicker.setDefaults($.datepicker.regional['fr-CH']);
430
+ });/* French initialisation for the jQuery UI date picker plugin. */
431
+ /* Written by Keith Wood (kbwood{at}iinet.com.au) and Stéphane Nahmani (sholby@sholby.net). */
432
+ jQuery(function($){
433
+ $.datepicker.regional['fr'] = {
434
+ closeText: 'Fermer',
435
+ prevText: '&#x3c;Préc',
436
+ nextText: 'Suiv&#x3e;',
437
+ currentText: 'Courant',
438
+ monthNames: ['Janvier','Février','Mars','Avril','Mai','Juin',
439
+ 'Juillet','Août','Septembre','Octobre','Novembre','Décembre'],
440
+ monthNamesShort: ['Jan','Fév','Mar','Avr','Mai','Jun',
441
+ 'Jul','Aoû','Sep','Oct','Nov','Déc'],
442
+ dayNames: ['Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi'],
443
+ dayNamesShort: ['Dim','Lun','Mar','Mer','Jeu','Ven','Sam'],
444
+ dayNamesMin: ['Di','Lu','Ma','Me','Je','Ve','Sa'],
445
+ weekHeader: 'Sm',
446
+ dateFormat: 'dd/mm/yy',
447
+ firstDay: 1,
448
+ isRTL: false,
449
+ showMonthAfterYear: false,
450
+ yearSuffix: ''};
451
+ $.datepicker.setDefaults($.datepicker.regional['fr']);
452
+ });/* Hebrew initialisation for the UI Datepicker extension. */
453
+ /* Written by Amir Hardon (ahardon at gmail dot com). */
454
+ jQuery(function($){
455
+ $.datepicker.regional['he'] = {
456
+ closeText: 'סגור',
457
+ prevText: '&#x3c;הקודם',
458
+ nextText: 'הבא&#x3e;',
459
+ currentText: 'היום',
460
+ monthNames: ['ינואר','פברואר','מרץ','אפריל','מאי','יוני',
461
+ 'יולי','אוגוסט','ספטמבר','אוקטובר','נובמבר','דצמבר'],
462
+ monthNamesShort: ['1','2','3','4','5','6',
463
+ '7','8','9','10','11','12'],
464
+ dayNames: ['ראשון','שני','שלישי','רביעי','חמישי','שישי','שבת'],
465
+ dayNamesShort: ['א\'','ב\'','ג\'','ד\'','ה\'','ו\'','שבת'],
466
+ dayNamesMin: ['א\'','ב\'','ג\'','ד\'','ה\'','ו\'','שבת'],
467
+ weekHeader: 'Wk',
468
+ dateFormat: 'dd/mm/yy',
469
+ firstDay: 0,
470
+ isRTL: true,
471
+ showMonthAfterYear: false,
472
+ yearSuffix: ''};
473
+ $.datepicker.setDefaults($.datepicker.regional['he']);
474
+ });
475
+ /* Croatian i18n for the jQuery UI date picker plugin. */
476
+ /* Written by Vjekoslav Nesek. */
477
+ jQuery(function($){
478
+ $.datepicker.regional['hr'] = {
479
+ closeText: 'Zatvori',
480
+ prevText: '&#x3c;',
481
+ nextText: '&#x3e;',
482
+ currentText: 'Danas',
483
+ monthNames: ['Siječanj','Veljača','Ožujak','Travanj','Svibanj','Lipanj',
484
+ 'Srpanj','Kolovoz','Rujan','Listopad','Studeni','Prosinac'],
485
+ monthNamesShort: ['Sij','Velj','Ožu','Tra','Svi','Lip',
486
+ 'Srp','Kol','Ruj','Lis','Stu','Pro'],
487
+ dayNames: ['Nedjelja','Ponedjeljak','Utorak','Srijeda','Četvrtak','Petak','Subota'],
488
+ dayNamesShort: ['Ned','Pon','Uto','Sri','Čet','Pet','Sub'],
489
+ dayNamesMin: ['Ne','Po','Ut','Sr','Če','Pe','Su'],
490
+ weekHeader: 'Tje',
491
+ dateFormat: 'dd.mm.yy.',
492
+ firstDay: 1,
493
+ isRTL: false,
494
+ showMonthAfterYear: false,
495
+ yearSuffix: ''};
496
+ $.datepicker.setDefaults($.datepicker.regional['hr']);
497
+ });/* Hungarian initialisation for the jQuery UI date picker plugin. */
498
+ /* Written by Istvan Karaszi (jquery@spam.raszi.hu). */
499
+ jQuery(function($){
500
+ $.datepicker.regional['hu'] = {
501
+ closeText: 'bezárás',
502
+ prevText: '&laquo;&nbsp;vissza',
503
+ nextText: 'előre&nbsp;&raquo;',
504
+ currentText: 'ma',
505
+ monthNames: ['Január', 'Február', 'Március', 'Április', 'Május', 'Június',
506
+ 'Július', 'Augusztus', 'Szeptember', 'Október', 'November', 'December'],
507
+ monthNamesShort: ['Jan', 'Feb', 'Már', 'Ápr', 'Máj', 'Jún',
508
+ 'Júl', 'Aug', 'Szep', 'Okt', 'Nov', 'Dec'],
509
+ dayNames: ['Vasárnap', 'Hétfö', 'Kedd', 'Szerda', 'Csütörtök', 'Péntek', 'Szombat'],
510
+ dayNamesShort: ['Vas', 'Hét', 'Ked', 'Sze', 'Csü', 'Pén', 'Szo'],
511
+ dayNamesMin: ['V', 'H', 'K', 'Sze', 'Cs', 'P', 'Szo'],
512
+ weekHeader: 'Hé',
513
+ dateFormat: 'yy-mm-dd',
514
+ firstDay: 1,
515
+ isRTL: false,
516
+ showMonthAfterYear: false,
517
+ yearSuffix: ''};
518
+ $.datepicker.setDefaults($.datepicker.regional['hu']);
519
+ });
520
+ /* Armenian(UTF-8) initialisation for the jQuery UI date picker plugin. */
521
+ /* Written by Levon Zakaryan (levon.zakaryan@gmail.com)*/
522
+ jQuery(function($){
523
+ $.datepicker.regional['hy'] = {
524
+ closeText: 'Փակել',
525
+ prevText: '&#x3c;Նախ.',
526
+ nextText: 'Հաջ.&#x3e;',
527
+ currentText: 'Այսօր',
528
+ monthNames: ['Հունվար','Փետրվար','Մարտ','Ապրիլ','Մայիս','Հունիս',
529
+ 'Հուլիս','Օգոստոս','Սեպտեմբեր','Հոկտեմբեր','Նոյեմբեր','Դեկտեմբեր'],
530
+ monthNamesShort: ['Հունվ','Փետր','Մարտ','Ապր','Մայիս','Հունիս',
531
+ 'Հուլ','Օգս','Սեպ','Հոկ','Նոյ','Դեկ'],
532
+ dayNames: ['կիրակի','եկուշաբթի','երեքշաբթի','չորեքշաբթի','հինգշաբթի','ուրբաթ','շաբաթ'],
533
+ dayNamesShort: ['կիր','երկ','երք','չրք','հնգ','ուրբ','շբթ'],
534
+ dayNamesMin: ['կիր','երկ','երք','չրք','հնգ','ուրբ','շբթ'],
535
+ weekHeader: 'ՇԲՏ',
536
+ dateFormat: 'dd.mm.yy',
537
+ firstDay: 1,
538
+ isRTL: false,
539
+ showMonthAfterYear: false,
540
+ yearSuffix: ''};
541
+ $.datepicker.setDefaults($.datepicker.regional['hy']);
542
+ });/* Indonesian initialisation for the jQuery UI date picker plugin. */
543
+ /* Written by Deden Fathurahman (dedenf@gmail.com). */
544
+ jQuery(function($){
545
+ $.datepicker.regional['id'] = {
546
+ closeText: 'Tutup',
547
+ prevText: '&#x3c;mundur',
548
+ nextText: 'maju&#x3e;',
549
+ currentText: 'hari ini',
550
+ monthNames: ['Januari','Februari','Maret','April','Mei','Juni',
551
+ 'Juli','Agustus','September','Oktober','Nopember','Desember'],
552
+ monthNamesShort: ['Jan','Feb','Mar','Apr','Mei','Jun',
553
+ 'Jul','Agus','Sep','Okt','Nop','Des'],
554
+ dayNames: ['Minggu','Senin','Selasa','Rabu','Kamis','Jumat','Sabtu'],
555
+ dayNamesShort: ['Min','Sen','Sel','Rab','kam','Jum','Sab'],
556
+ dayNamesMin: ['Mg','Sn','Sl','Rb','Km','jm','Sb'],
557
+ weekHeader: 'Mg',
558
+ dateFormat: 'dd/mm/yy',
559
+ firstDay: 0,
560
+ isRTL: false,
561
+ showMonthAfterYear: false,
562
+ yearSuffix: ''};
563
+ $.datepicker.setDefaults($.datepicker.regional['id']);
564
+ });/* Icelandic initialisation for the jQuery UI date picker plugin. */
565
+ /* Written by Haukur H. Thorsson (haukur@eskill.is). */
566
+ jQuery(function($){
567
+ $.datepicker.regional['is'] = {
568
+ closeText: 'Loka',
569
+ prevText: '&#x3c; Fyrri',
570
+ nextText: 'N&aelig;sti &#x3e;',
571
+ currentText: '&Iacute; dag',
572
+ monthNames: ['Jan&uacute;ar','Febr&uacute;ar','Mars','Apr&iacute;l','Ma&iacute','J&uacute;n&iacute;',
573
+ 'J&uacute;l&iacute;','&Aacute;g&uacute;st','September','Okt&oacute;ber','N&oacute;vember','Desember'],
574
+ monthNamesShort: ['Jan','Feb','Mar','Apr','Ma&iacute;','J&uacute;n',
575
+ 'J&uacute;l','&Aacute;g&uacute;','Sep','Okt','N&oacute;v','Des'],
576
+ dayNames: ['Sunnudagur','M&aacute;nudagur','&THORN;ri&eth;judagur','Mi&eth;vikudagur','Fimmtudagur','F&ouml;studagur','Laugardagur'],
577
+ dayNamesShort: ['Sun','M&aacute;n','&THORN;ri','Mi&eth;','Fim','F&ouml;s','Lau'],
578
+ dayNamesMin: ['Su','M&aacute;','&THORN;r','Mi','Fi','F&ouml;','La'],
579
+ weekHeader: 'Vika',
580
+ dateFormat: 'dd/mm/yy',
581
+ firstDay: 0,
582
+ isRTL: false,
583
+ showMonthAfterYear: false,
584
+ yearSuffix: ''};
585
+ $.datepicker.setDefaults($.datepicker.regional['is']);
586
+ });/* Italian initialisation for the jQuery UI date picker plugin. */
587
+ /* Written by Antonello Pasella (antonello.pasella@gmail.com). */
588
+ jQuery(function($){
589
+ $.datepicker.regional['it'] = {
590
+ closeText: 'Chiudi',
591
+ prevText: '&#x3c;Prec',
592
+ nextText: 'Succ&#x3e;',
593
+ currentText: 'Oggi',
594
+ monthNames: ['Gennaio','Febbraio','Marzo','Aprile','Maggio','Giugno',
595
+ 'Luglio','Agosto','Settembre','Ottobre','Novembre','Dicembre'],
596
+ monthNamesShort: ['Gen','Feb','Mar','Apr','Mag','Giu',
597
+ 'Lug','Ago','Set','Ott','Nov','Dic'],
598
+ dayNames: ['Domenica','Luned&#236','Marted&#236','Mercoled&#236','Gioved&#236','Venerd&#236','Sabato'],
599
+ dayNamesShort: ['Dom','Lun','Mar','Mer','Gio','Ven','Sab'],
600
+ dayNamesMin: ['Do','Lu','Ma','Me','Gi','Ve','Sa'],
601
+ weekHeader: 'Sm',
602
+ dateFormat: 'dd/mm/yy',
603
+ firstDay: 1,
604
+ isRTL: false,
605
+ showMonthAfterYear: false,
606
+ yearSuffix: ''};
607
+ $.datepicker.setDefaults($.datepicker.regional['it']);
608
+ });
609
+ /* Japanese initialisation for the jQuery UI date picker plugin. */
610
+ /* Written by Kentaro SATO (kentaro@ranvis.com). */
611
+ jQuery(function($){
612
+ $.datepicker.regional['ja'] = {
613
+ closeText: '閉じる',
614
+ prevText: '&#x3c;前',
615
+ nextText: '次&#x3e;',
616
+ currentText: '今日',
617
+ monthNames: ['1月','2月','3月','4月','5月','6月',
618
+ '7月','8月','9月','10月','11月','12月'],
619
+ monthNamesShort: ['1月','2月','3月','4月','5月','6月',
620
+ '7月','8月','9月','10月','11月','12月'],
621
+ dayNames: ['日曜日','月曜日','火曜日','水曜日','木曜日','金曜日','土曜日'],
622
+ dayNamesShort: ['日','月','火','水','木','金','土'],
623
+ dayNamesMin: ['日','月','火','水','木','金','土'],
624
+ weekHeader: '週',
625
+ dateFormat: 'yy/mm/dd',
626
+ firstDay: 0,
627
+ isRTL: false,
628
+ showMonthAfterYear: true,
629
+ yearSuffix: '年'};
630
+ $.datepicker.setDefaults($.datepicker.regional['ja']);
631
+ });/* Korean initialisation for the jQuery calendar extension. */
632
+ /* Written by DaeKwon Kang (ncrash.dk@gmail.com). */
633
+ jQuery(function($){
634
+ $.datepicker.regional['ko'] = {
635
+ closeText: '닫기',
636
+ prevText: '이전달',
637
+ nextText: '다음달',
638
+ currentText: '오늘',
639
+ monthNames: ['1월(JAN)','2월(FEB)','3월(MAR)','4월(APR)','5월(MAY)','6월(JUN)',
640
+ '7월(JUL)','8월(AUG)','9월(SEP)','10월(OCT)','11월(NOV)','12월(DEC)'],
641
+ monthNamesShort: ['1월(JAN)','2월(FEB)','3월(MAR)','4월(APR)','5월(MAY)','6월(JUN)',
642
+ '7월(JUL)','8월(AUG)','9월(SEP)','10월(OCT)','11월(NOV)','12월(DEC)'],
643
+ dayNames: ['일','월','화','수','목','금','토'],
644
+ dayNamesShort: ['일','월','화','수','목','금','토'],
645
+ dayNamesMin: ['일','월','화','수','목','금','토'],
646
+ weekHeader: 'Wk',
647
+ dateFormat: 'yy-mm-dd',
648
+ firstDay: 0,
649
+ isRTL: false,
650
+ showMonthAfterYear: false,
651
+ yearSuffix: '년'};
652
+ $.datepicker.setDefaults($.datepicker.regional['ko']);
653
+ });/* Kazakh (UTF-8) initialisation for the jQuery UI date picker plugin. */
654
+ /* Written by Dmitriy Karasyov (dmitriy.karasyov@gmail.com). */
655
+ jQuery(function($){
656
+ $.datepicker.regional['kz'] = {
657
+ closeText: 'Жабу',
658
+ prevText: '&#x3c;Алдыңғы',
659
+ nextText: 'Келесі&#x3e;',
660
+ currentText: 'Бүгін',
661
+ monthNames: ['Қаңтар','Ақпан','Наурыз','Сәуір','Мамыр','Маусым',
662
+ 'Шілде','Тамыз','Қыркүйек','Қазан','Қараша','Желтоқсан'],
663
+ monthNamesShort: ['Қаң','Ақп','Нау','Сәу','Мам','Мау',
664
+ 'Шіл','Там','Қыр','Қаз','Қар','Жел'],
665
+ dayNames: ['Жексенбі','Дүйсенбі','Сейсенбі','Сәрсенбі','Бейсенбі','Жұма','Сенбі'],
666
+ dayNamesShort: ['жкс','дсн','ссн','срс','бсн','жма','снб'],
667
+ dayNamesMin: ['Жк','Дс','Сс','Ср','Бс','Жм','Сн'],
668
+ weekHeader: 'Не',
669
+ dateFormat: 'dd.mm.yy',
670
+ firstDay: 1,
671
+ isRTL: false,
672
+ showMonthAfterYear: false,
673
+ yearSuffix: ''};
674
+ $.datepicker.setDefaults($.datepicker.regional['kz']);
675
+ });
676
+ /* Lithuanian (UTF-8) initialisation for the jQuery UI date picker plugin. */
677
+ /* @author Arturas Paleicikas <arturas@avalon.lt> */
678
+ jQuery(function($){
679
+ $.datepicker.regional['lt'] = {
680
+ closeText: 'Uždaryti',
681
+ prevText: '&#x3c;Atgal',
682
+ nextText: 'Pirmyn&#x3e;',
683
+ currentText: 'Šiandien',
684
+ monthNames: ['Sausis','Vasaris','Kovas','Balandis','Gegužė','Birželis',
685
+ 'Liepa','Rugpjūtis','Rugsėjis','Spalis','Lapkritis','Gruodis'],
686
+ monthNamesShort: ['Sau','Vas','Kov','Bal','Geg','Bir',
687
+ 'Lie','Rugp','Rugs','Spa','Lap','Gru'],
688
+ dayNames: ['sekmadienis','pirmadienis','antradienis','trečiadienis','ketvirtadienis','penktadienis','šeštadienis'],
689
+ dayNamesShort: ['sek','pir','ant','tre','ket','pen','šeš'],
690
+ dayNamesMin: ['Se','Pr','An','Tr','Ke','Pe','Še'],
691
+ weekHeader: 'Wk',
692
+ dateFormat: 'yy-mm-dd',
693
+ firstDay: 1,
694
+ isRTL: false,
695
+ showMonthAfterYear: false,
696
+ yearSuffix: ''};
697
+ $.datepicker.setDefaults($.datepicker.regional['lt']);
698
+ });/* Latvian (UTF-8) initialisation for the jQuery UI date picker plugin. */
699
+ /* @author Arturas Paleicikas <arturas.paleicikas@metasite.net> */
700
+ jQuery(function($){
701
+ $.datepicker.regional['lv'] = {
702
+ closeText: 'Aizvērt',
703
+ prevText: 'Iepr',
704
+ nextText: 'Nāka',
705
+ currentText: 'Šodien',
706
+ monthNames: ['Janvāris','Februāris','Marts','Aprīlis','Maijs','Jūnijs',
707
+ 'Jūlijs','Augusts','Septembris','Oktobris','Novembris','Decembris'],
708
+ monthNamesShort: ['Jan','Feb','Mar','Apr','Mai','Jūn',
709
+ 'Jūl','Aug','Sep','Okt','Nov','Dec'],
710
+ dayNames: ['svētdiena','pirmdiena','otrdiena','trešdiena','ceturtdiena','piektdiena','sestdiena'],
711
+ dayNamesShort: ['svt','prm','otr','tre','ctr','pkt','sst'],
712
+ dayNamesMin: ['Sv','Pr','Ot','Tr','Ct','Pk','Ss'],
713
+ weekHeader: 'Nav',
714
+ dateFormat: 'dd-mm-yy',
715
+ firstDay: 1,
716
+ isRTL: false,
717
+ showMonthAfterYear: false,
718
+ yearSuffix: ''};
719
+ $.datepicker.setDefaults($.datepicker.regional['lv']);
720
+ });/* Malaysian initialisation for the jQuery UI date picker plugin. */
721
+ /* Written by Mohd Nawawi Mohamad Jamili (nawawi@ronggeng.net). */
722
+ jQuery(function($){
723
+ $.datepicker.regional['ms'] = {
724
+ closeText: 'Tutup',
725
+ prevText: '&#x3c;Sebelum',
726
+ nextText: 'Selepas&#x3e;',
727
+ currentText: 'hari ini',
728
+ monthNames: ['Januari','Februari','Mac','April','Mei','Jun',
729
+ 'Julai','Ogos','September','Oktober','November','Disember'],
730
+ monthNamesShort: ['Jan','Feb','Mac','Apr','Mei','Jun',
731
+ 'Jul','Ogo','Sep','Okt','Nov','Dis'],
732
+ dayNames: ['Ahad','Isnin','Selasa','Rabu','Khamis','Jumaat','Sabtu'],
733
+ dayNamesShort: ['Aha','Isn','Sel','Rab','kha','Jum','Sab'],
734
+ dayNamesMin: ['Ah','Is','Se','Ra','Kh','Ju','Sa'],
735
+ weekHeader: 'Mg',
736
+ dateFormat: 'dd/mm/yy',
737
+ firstDay: 0,
738
+ isRTL: false,
739
+ showMonthAfterYear: false,
740
+ yearSuffix: ''};
741
+ $.datepicker.setDefaults($.datepicker.regional['ms']);
742
+ });/* Dutch (UTF-8) initialisation for the jQuery UI date picker plugin. */
743
+ /* Written by Mathias Bynens <http://mathiasbynens.be/> */
744
+ jQuery(function($){
745
+ $.datepicker.regional.nl = {
746
+ closeText: 'Sluiten',
747
+ prevText: '←',
748
+ nextText: '→',
749
+ currentText: 'Vandaag',
750
+ monthNames: ['januari', 'februari', 'maart', 'april', 'mei', 'juni',
751
+ 'juli', 'augustus', 'september', 'oktober', 'november', 'december'],
752
+ monthNamesShort: ['jan', 'feb', 'maa', 'apr', 'mei', 'jun',
753
+ 'jul', 'aug', 'sep', 'okt', 'nov', 'dec'],
754
+ dayNames: ['zondag', 'maandag', 'dinsdag', 'woensdag', 'donderdag', 'vrijdag', 'zaterdag'],
755
+ dayNamesShort: ['zon', 'maa', 'din', 'woe', 'don', 'vri', 'zat'],
756
+ dayNamesMin: ['zo', 'ma', 'di', 'wo', 'do', 'vr', 'za'],
757
+ weekHeader: 'Wk',
758
+ dateFormat: 'dd/mm/yy',
759
+ firstDay: 1,
760
+ isRTL: false,
761
+ showMonthAfterYear: false,
762
+ yearSuffix: ''};
763
+ $.datepicker.setDefaults($.datepicker.regional.nl);
764
+ });/* Norwegian initialisation for the jQuery UI date picker plugin. */
765
+ /* Written by Naimdjon Takhirov (naimdjon@gmail.com). */
766
+ jQuery(function($){
767
+ $.datepicker.regional['no'] = {
768
+ closeText: 'Lukk',
769
+ prevText: '&laquo;Forrige',
770
+ nextText: 'Neste&raquo;',
771
+ currentText: 'I dag',
772
+ monthNames: ['Januar','Februar','Mars','April','Mai','Juni',
773
+ 'Juli','August','September','Oktober','November','Desember'],
774
+ monthNamesShort: ['Jan','Feb','Mar','Apr','Mai','Jun',
775
+ 'Jul','Aug','Sep','Okt','Nov','Des'],
776
+ dayNamesShort: ['Søn','Man','Tir','Ons','Tor','Fre','Lør'],
777
+ dayNames: ['Søndag','Mandag','Tirsdag','Onsdag','Torsdag','Fredag','Lørdag'],
778
+ dayNamesMin: ['Sø','Ma','Ti','On','To','Fr','Lø'],
779
+ weekHeader: 'Uke',
780
+ dateFormat: 'yy-mm-dd',
781
+ firstDay: 0,
782
+ isRTL: false,
783
+ showMonthAfterYear: false,
784
+ yearSuffix: ''};
785
+ $.datepicker.setDefaults($.datepicker.regional['no']);
786
+ });
787
+ /* Polish initialisation for the jQuery UI date picker plugin. */
788
+ /* Written by Jacek Wysocki (jacek.wysocki@gmail.com). */
789
+ jQuery(function($){
790
+ $.datepicker.regional['pl'] = {
791
+ closeText: 'Zamknij',
792
+ prevText: '&#x3c;Poprzedni',
793
+ nextText: 'Następny&#x3e;',
794
+ currentText: 'Dziś',
795
+ monthNames: ['Styczeń','Luty','Marzec','Kwiecień','Maj','Czerwiec',
796
+ 'Lipiec','Sierpień','Wrzesień','Październik','Listopad','Grudzień'],
797
+ monthNamesShort: ['Sty','Lu','Mar','Kw','Maj','Cze',
798
+ 'Lip','Sie','Wrz','Pa','Lis','Gru'],
799
+ dayNames: ['Niedziela','Poniedziałek','Wtorek','Środa','Czwartek','Piątek','Sobota'],
800
+ dayNamesShort: ['Nie','Pn','Wt','Śr','Czw','Pt','So'],
801
+ dayNamesMin: ['N','Pn','Wt','Śr','Cz','Pt','So'],
802
+ weekHeader: 'Tydz',
803
+ dateFormat: 'dd.mm.yy',
804
+ firstDay: 1,
805
+ isRTL: false,
806
+ showMonthAfterYear: false,
807
+ yearSuffix: ''};
808
+ $.datepicker.setDefaults($.datepicker.regional['pl']);
809
+ });
810
+ /* Brazilian initialisation for the jQuery UI date picker plugin. */
811
+ /* Written by Leonildo Costa Silva (leocsilva@gmail.com). */
812
+ jQuery(function($){
813
+ $.datepicker.regional['pt-BR'] = {
814
+ closeText: 'Fechar',
815
+ prevText: '&#x3c;Anterior',
816
+ nextText: 'Pr&oacute;ximo&#x3e;',
817
+ currentText: 'Hoje',
818
+ monthNames: ['Janeiro','Fevereiro','Mar&ccedil;o','Abril','Maio','Junho',
819
+ 'Julho','Agosto','Setembro','Outubro','Novembro','Dezembro'],
820
+ monthNamesShort: ['Jan','Fev','Mar','Abr','Mai','Jun',
821
+ 'Jul','Ago','Set','Out','Nov','Dez'],
822
+ dayNames: ['Domingo','Segunda-feira','Ter&ccedil;a-feira','Quarta-feira','Quinta-feira','Sexta-feira','S&aacute;bado'],
823
+ dayNamesShort: ['Dom','Seg','Ter','Qua','Qui','Sex','S&aacute;b'],
824
+ dayNamesMin: ['Dom','Seg','Ter','Qua','Qui','Sex','S&aacute;b'],
825
+ weekHeader: 'Sm',
826
+ dateFormat: 'dd/mm/yy',
827
+ firstDay: 0,
828
+ isRTL: false,
829
+ showMonthAfterYear: false,
830
+ yearSuffix: ''};
831
+ $.datepicker.setDefaults($.datepicker.regional['pt-BR']);
832
+ });/* Romanian initialisation for the jQuery UI date picker plugin.
833
+ *
834
+ * Written by Edmond L. (ll_edmond@walla.com)
835
+ * and Ionut G. Stan (ionut.g.stan@gmail.com)
836
+ */
837
+ jQuery(function($){
838
+ $.datepicker.regional['ro'] = {
839
+ closeText: 'Închide',
840
+ prevText: '&laquo; Luna precedentă',
841
+ nextText: 'Luna următoare &raquo;',
842
+ currentText: 'Azi',
843
+ monthNames: ['Ianuarie','Februarie','Martie','Aprilie','Mai','Iunie',
844
+ 'Iulie','August','Septembrie','Octombrie','Noiembrie','Decembrie'],
845
+ monthNamesShort: ['Ian', 'Feb', 'Mar', 'Apr', 'Mai', 'Iun',
846
+ 'Iul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
847
+ dayNames: ['Duminică', 'Luni', 'Marţi', 'Miercuri', 'Joi', 'Vineri', 'Sâmbătă'],
848
+ dayNamesShort: ['Dum', 'Lun', 'Mar', 'Mie', 'Joi', 'Vin', 'Sâm'],
849
+ dayNamesMin: ['Du','Lu','Ma','Mi','Jo','Vi','Sâ'],
850
+ weekHeader: 'Săpt',
851
+ dateFormat: 'dd.mm.yy',
852
+ firstDay: 1,
853
+ isRTL: false,
854
+ showMonthAfterYear: false,
855
+ yearSuffix: ''};
856
+ $.datepicker.setDefaults($.datepicker.regional['ro']);
857
+ });
858
+ /* Russian (UTF-8) initialisation for the jQuery UI date picker plugin. */
859
+ /* Written by Andrew Stromnov (stromnov@gmail.com). */
860
+ jQuery(function($){
861
+ $.datepicker.regional['ru'] = {
862
+ closeText: 'Закрыть',
863
+ prevText: '&#x3c;Пред',
864
+ nextText: 'След&#x3e;',
865
+ currentText: 'Сегодня',
866
+ monthNames: ['Январь','Февраль','Март','Апрель','Май','Июнь',
867
+ 'Июль','Август','Сентябрь','Октябрь','Ноябрь','Декабрь'],
868
+ monthNamesShort: ['Янв','Фев','Мар','Апр','Май','Июн',
869
+ 'Июл','Авг','Сен','Окт','Ноя','Дек'],
870
+ dayNames: ['воскресенье','понедельник','вторник','среда','четверг','пятница','суббота'],
871
+ dayNamesShort: ['вск','пнд','втр','срд','чтв','птн','сбт'],
872
+ dayNamesMin: ['Вс','Пн','Вт','Ср','Чт','Пт','Сб'],
873
+ weekHeader: 'Не',
874
+ dateFormat: 'dd.mm.yy',
875
+ firstDay: 1,
876
+ isRTL: false,
877
+ showMonthAfterYear: false,
878
+ yearSuffix: ''};
879
+ $.datepicker.setDefaults($.datepicker.regional['ru']);
880
+ });/* Slovak initialisation for the jQuery UI date picker plugin. */
881
+ /* Written by Vojtech Rinik (vojto@hmm.sk). */
882
+ jQuery(function($){
883
+ $.datepicker.regional['sk'] = {
884
+ closeText: 'Zavrieť',
885
+ prevText: '&#x3c;Predchádzajúci',
886
+ nextText: 'Nasledujúci&#x3e;',
887
+ currentText: 'Dnes',
888
+ monthNames: ['Január','Február','Marec','Apríl','Máj','Jún',
889
+ 'Júl','August','September','Október','November','December'],
890
+ monthNamesShort: ['Jan','Feb','Mar','Apr','Máj','Jún',
891
+ 'Júl','Aug','Sep','Okt','Nov','Dec'],
892
+ dayNames: ['Nedel\'a','Pondelok','Utorok','Streda','Štvrtok','Piatok','Sobota'],
893
+ dayNamesShort: ['Ned','Pon','Uto','Str','Štv','Pia','Sob'],
894
+ dayNamesMin: ['Ne','Po','Ut','St','Št','Pia','So'],
895
+ weekHeader: 'Ty',
896
+ dateFormat: 'dd.mm.yy',
897
+ firstDay: 1,
898
+ isRTL: false,
899
+ showMonthAfterYear: false,
900
+ yearSuffix: ''};
901
+ $.datepicker.setDefaults($.datepicker.regional['sk']);
902
+ });
903
+ /* Slovenian initialisation for the jQuery UI date picker plugin. */
904
+ /* Written by Jaka Jancar (jaka@kubje.org). */
905
+ /* c = &#x10D;, s = &#x161; z = &#x17E; C = &#x10C; S = &#x160; Z = &#x17D; */
906
+ jQuery(function($){
907
+ $.datepicker.regional['sl'] = {
908
+ closeText: 'Zapri',
909
+ prevText: '&lt;Prej&#x161;nji',
910
+ nextText: 'Naslednji&gt;',
911
+ currentText: 'Trenutni',
912
+ monthNames: ['Januar','Februar','Marec','April','Maj','Junij',
913
+ 'Julij','Avgust','September','Oktober','November','December'],
914
+ monthNamesShort: ['Jan','Feb','Mar','Apr','Maj','Jun',
915
+ 'Jul','Avg','Sep','Okt','Nov','Dec'],
916
+ dayNames: ['Nedelja','Ponedeljek','Torek','Sreda','&#x10C;etrtek','Petek','Sobota'],
917
+ dayNamesShort: ['Ned','Pon','Tor','Sre','&#x10C;et','Pet','Sob'],
918
+ dayNamesMin: ['Ne','Po','To','Sr','&#x10C;e','Pe','So'],
919
+ weekHeader: 'Teden',
920
+ dateFormat: 'dd.mm.yy',
921
+ firstDay: 1,
922
+ isRTL: false,
923
+ showMonthAfterYear: false,
924
+ yearSuffix: ''};
925
+ $.datepicker.setDefaults($.datepicker.regional['sl']);
926
+ });
927
+ /* Albanian initialisation for the jQuery UI date picker plugin. */
928
+ /* Written by Flakron Bytyqi (flakron@gmail.com). */
929
+ jQuery(function($){
930
+ $.datepicker.regional['sq'] = {
931
+ closeText: 'mbylle',
932
+ prevText: '&#x3c;mbrapa',
933
+ nextText: 'Përpara&#x3e;',
934
+ currentText: 'sot',
935
+ monthNames: ['Janar','Shkurt','Mars','Prill','Maj','Qershor',
936
+ 'Korrik','Gusht','Shtator','Tetor','Nëntor','Dhjetor'],
937
+ monthNamesShort: ['Jan','Shk','Mar','Pri','Maj','Qer',
938
+ 'Kor','Gus','Sht','Tet','Nën','Dhj'],
939
+ dayNames: ['E Diel','E Hënë','E Martë','E Mërkurë','E Enjte','E Premte','E Shtune'],
940
+ dayNamesShort: ['Di','Hë','Ma','Më','En','Pr','Sh'],
941
+ dayNamesMin: ['Di','Hë','Ma','Më','En','Pr','Sh'],
942
+ weekHeader: 'Ja',
943
+ dateFormat: 'dd.mm.yy',
944
+ firstDay: 1,
945
+ isRTL: false,
946
+ showMonthAfterYear: false,
947
+ yearSuffix: ''};
948
+ $.datepicker.setDefaults($.datepicker.regional['sq']);
949
+ });
950
+ /* Serbian i18n for the jQuery UI date picker plugin. */
951
+ /* Written by Dejan Dimić. */
952
+ jQuery(function($){
953
+ $.datepicker.regional['sr-SR'] = {
954
+ closeText: 'Zatvori',
955
+ prevText: '&#x3c;',
956
+ nextText: '&#x3e;',
957
+ currentText: 'Danas',
958
+ monthNames: ['Januar','Februar','Mart','April','Maj','Jun',
959
+ 'Jul','Avgust','Septembar','Oktobar','Novembar','Decembar'],
960
+ monthNamesShort: ['Jan','Feb','Mar','Apr','Maj','Jun',
961
+ 'Jul','Avg','Sep','Okt','Nov','Dec'],
962
+ dayNames: ['Nedelja','Ponedeljak','Utorak','Sreda','Četvrtak','Petak','Subota'],
963
+ dayNamesShort: ['Ned','Pon','Uto','Sre','Čet','Pet','Sub'],
964
+ dayNamesMin: ['Ne','Po','Ut','Sr','Če','Pe','Su'],
965
+ weekHeader: 'Sed',
966
+ dateFormat: 'dd/mm/yy',
967
+ firstDay: 1,
968
+ isRTL: false,
969
+ showMonthAfterYear: false,
970
+ yearSuffix: ''};
971
+ $.datepicker.setDefaults($.datepicker.regional['sr-SR']);
972
+ });
973
+ /* Serbian i18n for the jQuery UI date picker plugin. */
974
+ /* Written by Dejan Dimić. */
975
+ jQuery(function($){
976
+ $.datepicker.regional['sr'] = {
977
+ closeText: 'Затвори',
978
+ prevText: '&#x3c;',
979
+ nextText: '&#x3e;',
980
+ currentText: 'Данас',
981
+ monthNames: ['Јануар','Фебруар','Март','Април','Мај','Јун',
982
+ 'Јул','Август','Септембар','Октобар','Новембар','Децембар'],
983
+ monthNamesShort: ['Јан','Феб','Мар','Апр','Мај','Јун',
984
+ 'Јул','Авг','Сеп','Окт','Нов','Дец'],
985
+ dayNames: ['Недеља','Понедељак','Уторак','Среда','Четвртак','Петак','Субота'],
986
+ dayNamesShort: ['Нед','Пон','Уто','Сре','Чет','Пет','Суб'],
987
+ dayNamesMin: ['Не','По','Ут','Ср','Че','Пе','Су'],
988
+ weekHeader: 'Сед',
989
+ dateFormat: 'dd/mm/yy',
990
+ firstDay: 1,
991
+ isRTL: false,
992
+ showMonthAfterYear: false,
993
+ yearSuffix: ''};
994
+ $.datepicker.setDefaults($.datepicker.regional['sr']);
995
+ });
996
+ /* Swedish initialisation for the jQuery UI date picker plugin. */
997
+ /* Written by Anders Ekdahl ( anders@nomadiz.se). */
998
+ jQuery(function($){
999
+ $.datepicker.regional['sv'] = {
1000
+ closeText: 'Stäng',
1001
+ prevText: '&laquo;Förra',
1002
+ nextText: 'Nästa&raquo;',
1003
+ currentText: 'Idag',
1004
+ monthNames: ['Januari','Februari','Mars','April','Maj','Juni',
1005
+ 'Juli','Augusti','September','Oktober','November','December'],
1006
+ monthNamesShort: ['Jan','Feb','Mar','Apr','Maj','Jun',
1007
+ 'Jul','Aug','Sep','Okt','Nov','Dec'],
1008
+ dayNamesShort: ['Sön','Mån','Tis','Ons','Tor','Fre','Lör'],
1009
+ dayNames: ['Söndag','Måndag','Tisdag','Onsdag','Torsdag','Fredag','Lördag'],
1010
+ dayNamesMin: ['Sö','Må','Ti','On','To','Fr','Lö'],
1011
+ weekHeader: 'Ve',
1012
+ dateFormat: 'yy-mm-dd',
1013
+ firstDay: 1,
1014
+ isRTL: false,
1015
+ showMonthAfterYear: false,
1016
+ yearSuffix: ''};
1017
+ $.datepicker.setDefaults($.datepicker.regional['sv']);
1018
+ });
1019
+ /* Tamil (UTF-8) initialisation for the jQuery UI date picker plugin. */
1020
+ /* Written by S A Sureshkumar (saskumar@live.com). */
1021
+ jQuery(function($){
1022
+ $.datepicker.regional['ta'] = {
1023
+ closeText: 'மூடு',
1024
+ prevText: 'முன்னையது',
1025
+ nextText: 'அடுத்தது',
1026
+ currentText: 'இன்று',
1027
+ monthNames: ['தை','மாசி','பங்குனி','சித்திரை','வைகாசி','ஆனி',
1028
+ 'ஆடி','ஆவணி','புரட்டாசி','ஐப்பசி','கார்த்திகை','மார்கழி'],
1029
+ monthNamesShort: ['தை','மாசி','பங்','சித்','வைகா','ஆனி',
1030
+ 'ஆடி','ஆவ','புர','ஐப்','கார்','மார்'],
1031
+ dayNames: ['ஞாயிற்றுக்கிழமை','திங்கட்கிழமை','செவ்வாய்க்கிழமை','புதன்கிழமை','வியாழக்கிழமை','வெள்ளிக்கிழமை','சனிக்கிழமை'],
1032
+ dayNamesShort: ['ஞாயிறு','திங்கள்','செவ்வாய்','புதன்','வியாழன்','வெள்ளி','சனி'],
1033
+ dayNamesMin: ['ஞா','தி','செ','பு','வி','வெ','ச'],
1034
+ weekHeader: 'Не',
1035
+ dateFormat: 'dd/mm/yy',
1036
+ firstDay: 1,
1037
+ isRTL: false,
1038
+ showMonthAfterYear: false,
1039
+ yearSuffix: ''};
1040
+ $.datepicker.setDefaults($.datepicker.regional['ta']);
1041
+ });
1042
+ /* Thai initialisation for the jQuery UI date picker plugin. */
1043
+ /* Written by pipo (pipo@sixhead.com). */
1044
+ jQuery(function($){
1045
+ $.datepicker.regional['th'] = {
1046
+ closeText: 'ปิด',
1047
+ prevText: '&laquo;&nbsp;ย้อน',
1048
+ nextText: 'ถัดไป&nbsp;&raquo;',
1049
+ currentText: 'วันนี้',
1050
+ monthNames: ['มกราคม','กุมภาพันธ์','มีนาคม','เมษายน','พฤษภาคม','มิถุนายน',
1051
+ 'กรกฏาคม','สิงหาคม','กันยายน','ตุลาคม','พฤศจิกายน','ธันวาคม'],
1052
+ monthNamesShort: ['ม.ค.','ก.พ.','มี.ค.','เม.ย.','พ.ค.','มิ.ย.',
1053
+ 'ก.ค.','ส.ค.','ก.ย.','ต.ค.','พ.ย.','ธ.ค.'],
1054
+ dayNames: ['อาทิตย์','จันทร์','อังคาร','พุธ','พฤหัสบดี','ศุกร์','เสาร์'],
1055
+ dayNamesShort: ['อา.','จ.','อ.','พ.','พฤ.','ศ.','ส.'],
1056
+ dayNamesMin: ['อา.','จ.','อ.','พ.','พฤ.','ศ.','ส.'],
1057
+ weekHeader: 'Wk',
1058
+ dateFormat: 'dd/mm/yy',
1059
+ firstDay: 0,
1060
+ isRTL: false,
1061
+ showMonthAfterYear: false,
1062
+ yearSuffix: ''};
1063
+ $.datepicker.setDefaults($.datepicker.regional['th']);
1064
+ });/* Turkish initialisation for the jQuery UI date picker plugin. */
1065
+ /* Written by Izzet Emre Erkan (kara@karalamalar.net). */
1066
+ jQuery(function($){
1067
+ $.datepicker.regional['tr'] = {
1068
+ closeText: 'kapat',
1069
+ prevText: '&#x3c;geri',
1070
+ nextText: 'ileri&#x3e',
1071
+ currentText: 'bugün',
1072
+ monthNames: ['Ocak','Şubat','Mart','Nisan','Mayıs','Haziran',
1073
+ 'Temmuz','Ağustos','Eylül','Ekim','Kasım','Aralık'],
1074
+ monthNamesShort: ['Oca','Şub','Mar','Nis','May','Haz',
1075
+ 'Tem','Ağu','Eyl','Eki','Kas','Ara'],
1076
+ dayNames: ['Pazar','Pazartesi','Salı','Çarşamba','Perşembe','Cuma','Cumartesi'],
1077
+ dayNamesShort: ['Pz','Pt','Sa','Ça','Pe','Cu','Ct'],
1078
+ dayNamesMin: ['Pz','Pt','Sa','Ça','Pe','Cu','Ct'],
1079
+ weekHeader: 'Hf',
1080
+ dateFormat: 'dd.mm.yy',
1081
+ firstDay: 1,
1082
+ isRTL: false,
1083
+ showMonthAfterYear: false,
1084
+ yearSuffix: ''};
1085
+ $.datepicker.setDefaults($.datepicker.regional['tr']);
1086
+ });/* Ukrainian (UTF-8) initialisation for the jQuery UI date picker plugin. */
1087
+ /* Written by Maxim Drogobitskiy (maxdao@gmail.com). */
1088
+ jQuery(function($){
1089
+ $.datepicker.regional['uk'] = {
1090
+ closeText: 'Закрити',
1091
+ prevText: '&#x3c;',
1092
+ nextText: '&#x3e;',
1093
+ currentText: 'Сьогодні',
1094
+ monthNames: ['Січень','Лютий','Березень','Квітень','Травень','Червень',
1095
+ 'Липень','Серпень','Вересень','Жовтень','Листопад','Грудень'],
1096
+ monthNamesShort: ['Січ','Лют','Бер','Кві','Тра','Чер',
1097
+ 'Лип','Сер','Вер','Жов','Лис','Гру'],
1098
+ dayNames: ['неділя','понеділок','вівторок','середа','четвер','п’ятниця','субота'],
1099
+ dayNamesShort: ['нед','пнд','вів','срд','чтв','птн','сбт'],
1100
+ dayNamesMin: ['Нд','Пн','Вт','Ср','Чт','Пт','Сб'],
1101
+ weekHeader: 'Не',
1102
+ dateFormat: 'dd/mm/yy',
1103
+ firstDay: 1,
1104
+ isRTL: false,
1105
+ showMonthAfterYear: false,
1106
+ yearSuffix: ''};
1107
+ $.datepicker.setDefaults($.datepicker.regional['uk']);
1108
+ });/* Vietnamese initialisation for the jQuery UI date picker plugin. */
1109
+ /* Translated by Le Thanh Huy (lthanhhuy@cit.ctu.edu.vn). */
1110
+ jQuery(function($){
1111
+ $.datepicker.regional['vi'] = {
1112
+ closeText: 'Đóng',
1113
+ prevText: '&#x3c;Trước',
1114
+ nextText: 'Tiếp&#x3e;',
1115
+ currentText: 'Hôm nay',
1116
+ monthNames: ['Tháng Một', 'Tháng Hai', 'Tháng Ba', 'Tháng Tư', 'Tháng Năm', 'Tháng Sáu',
1117
+ 'Tháng Bảy', 'Tháng Tám', 'Tháng Chín', 'Tháng Mười', 'Tháng Mười Một', 'Tháng Mười Hai'],
1118
+ monthNamesShort: ['Tháng 1', 'Tháng 2', 'Tháng 3', 'Tháng 4', 'Tháng 5', 'Tháng 6',
1119
+ 'Tháng 7', 'Tháng 8', 'Tháng 9', 'Tháng 10', 'Tháng 11', 'Tháng 12'],
1120
+ dayNames: ['Chủ Nhật', 'Thứ Hai', 'Thứ Ba', 'Thứ Tư', 'Thứ Năm', 'Thứ Sáu', 'Thứ Bảy'],
1121
+ dayNamesShort: ['CN', 'T2', 'T3', 'T4', 'T5', 'T6', 'T7'],
1122
+ dayNamesMin: ['CN', 'T2', 'T3', 'T4', 'T5', 'T6', 'T7'],
1123
+ weekHeader: 'Tu',
1124
+ dateFormat: 'dd/mm/yy',
1125
+ firstDay: 0,
1126
+ isRTL: false,
1127
+ showMonthAfterYear: false,
1128
+ yearSuffix: ''};
1129
+ $.datepicker.setDefaults($.datepicker.regional['vi']);
1130
+ });
1131
+ /* Chinese initialisation for the jQuery UI date picker plugin. */
1132
+ /* Written by Cloudream (cloudream@gmail.com). */
1133
+ jQuery(function($){
1134
+ $.datepicker.regional['zh-CN'] = {
1135
+ closeText: '关闭',
1136
+ prevText: '&#x3c;上月',
1137
+ nextText: '下月&#x3e;',
1138
+ currentText: '今天',
1139
+ monthNames: ['一月','二月','三月','四月','五月','六月',
1140
+ '七月','八月','九月','十月','十一月','十二月'],
1141
+ monthNamesShort: ['一','二','三','四','五','六',
1142
+ '七','八','九','十','十一','十二'],
1143
+ dayNames: ['星期日','星期一','星期二','星期三','星期四','星期五','星期六'],
1144
+ dayNamesShort: ['周日','周一','周二','周三','周四','周五','周六'],
1145
+ dayNamesMin: ['日','一','二','三','四','五','六'],
1146
+ weekHeader: '周',
1147
+ dateFormat: 'yy-mm-dd',
1148
+ firstDay: 1,
1149
+ isRTL: false,
1150
+ showMonthAfterYear: true,
1151
+ yearSuffix: '年'};
1152
+ $.datepicker.setDefaults($.datepicker.regional['zh-CN']);
1153
+ });
1154
+ /* Chinese initialisation for the jQuery UI date picker plugin. */
1155
+ /* Written by SCCY (samuelcychan@gmail.com). */
1156
+ jQuery(function($){
1157
+ $.datepicker.regional['zh-HK'] = {
1158
+ closeText: '關閉',
1159
+ prevText: '&#x3c;上月',
1160
+ nextText: '下月&#x3e;',
1161
+ currentText: '今天',
1162
+ monthNames: ['一月','二月','三月','四月','五月','六月',
1163
+ '七月','八月','九月','十月','十一月','十二月'],
1164
+ monthNamesShort: ['一','二','三','四','五','六',
1165
+ '七','八','九','十','十一','十二'],
1166
+ dayNames: ['星期日','星期一','星期二','星期三','星期四','星期五','星期六'],
1167
+ dayNamesShort: ['周日','周一','周二','周三','周四','周五','周六'],
1168
+ dayNamesMin: ['日','一','二','三','四','五','六'],
1169
+ weekHeader: '周',
1170
+ dateFormat: 'dd-mm-yy',
1171
+ firstDay: 0,
1172
+ isRTL: false,
1173
+ showMonthAfterYear: true,
1174
+ yearSuffix: '年'};
1175
+ $.datepicker.setDefaults($.datepicker.regional['zh-HK']);
1176
+ });
1177
+ /* Chinese initialisation for the jQuery UI date picker plugin. */
1178
+ /* Written by Ressol (ressol@gmail.com). */
1179
+ jQuery(function($){
1180
+ $.datepicker.regional['zh-TW'] = {
1181
+ closeText: '關閉',
1182
+ prevText: '&#x3c;上月',
1183
+ nextText: '下月&#x3e;',
1184
+ currentText: '今天',
1185
+ monthNames: ['一月','二月','三月','四月','五月','六月',
1186
+ '七月','八月','九月','十月','十一月','十二月'],
1187
+ monthNamesShort: ['一','二','三','四','五','六',
1188
+ '七','八','九','十','十一','十二'],
1189
+ dayNames: ['星期日','星期一','星期二','星期三','星期四','星期五','星期六'],
1190
+ dayNamesShort: ['周日','周一','周二','周三','周四','周五','周六'],
1191
+ dayNamesMin: ['日','一','二','三','四','五','六'],
1192
+ weekHeader: '周',
1193
+ dateFormat: 'yy/mm/dd',
1194
+ firstDay: 1,
1195
+ isRTL: false,
1196
+ showMonthAfterYear: true,
1197
+ yearSuffix: '年'};
1198
+ $.datepicker.setDefaults($.datepicker.regional['zh-TW']);
1199
+ });
includes/js/i18n/jquery.ui.datepicker-af.js ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Afrikaans initialisation for the jQuery UI date picker plugin. */
2
+ /* Written by Renier Pretorius. */
3
+ jQuery(function($){
4
+ $.datepicker.regional['af'] = {
5
+ closeText: 'Selekteer',
6
+ prevText: 'Vorige',
7
+ nextText: 'Volgende',
8
+ currentText: 'Vandag',
9
+ monthNames: ['Januarie','Februarie','Maart','April','Mei','Junie',
10
+ 'Julie','Augustus','September','Oktober','November','Desember'],
11
+ monthNamesShort: ['Jan', 'Feb', 'Mrt', 'Apr', 'Mei', 'Jun',
12
+ 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Des'],
13
+ dayNames: ['Sondag', 'Maandag', 'Dinsdag', 'Woensdag', 'Donderdag', 'Vrydag', 'Saterdag'],
14
+ dayNamesShort: ['Son', 'Maa', 'Din', 'Woe', 'Don', 'Vry', 'Sat'],
15
+ dayNamesMin: ['So','Ma','Di','Wo','Do','Vr','Sa'],
16
+ weekHeader: 'Wk',
17
+ dateFormat: 'dd/mm/yy',
18
+ firstDay: 1,
19
+ isRTL: false,
20
+ showMonthAfterYear: false,
21
+ yearSuffix: ''};
22
+ $.datepicker.setDefaults($.datepicker.regional['af']);
23
+ });
includes/js/i18n/jquery.ui.datepicker-ar.js ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Arabic Translation for jQuery UI date picker plugin. */
2
+ /* Khaled Al Horani -- koko.dw@gmail.com */
3
+ /* خالد الحوراني -- koko.dw@gmail.com */
4
+ /* NOTE: monthNames are the original months names and they are the Arabic names, not the new months name فبراير - يناير and there isn't any Arabic roots for these months */
5
+ jQuery(function($){
6
+ $.datepicker.regional['ar'] = {
7
+ closeText: 'إغلاق',
8
+ prevText: '&#x3c;السابق',
9
+ nextText: 'التالي&#x3e;',
10
+ currentText: 'اليوم',
11
+ monthNames: ['كانون الثاني', 'شباط', 'آذار', 'نيسان', 'آذار', 'حزيران',
12
+ 'تموز', 'آب', 'أيلول', 'تشرين الأول', 'تشرين الثاني', 'كانون الأول'],
13
+ monthNamesShort: ['1','2','3','4','5','6','7','8','9','10','11','12'],
14
+ dayNames: ['السبت', 'الأحد', 'الاثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة'],
15
+ dayNamesShort: ['سبت', 'أحد', 'اثنين', 'ثلاثاء', 'أربعاء', 'خميس', 'جمعة'],
16
+ dayNamesMin: ['سبت', 'أحد', 'اثنين', 'ثلاثاء', 'أربعاء', 'خميس', 'جمعة'],
17
+ weekHeader: 'أسبوع',
18
+ dateFormat: 'dd/mm/yy',
19
+ firstDay: 0,
20
+ isRTL: true,
21
+ showMonthAfterYear: false,
22
+ yearSuffix: ''};
23
+ $.datepicker.setDefaults($.datepicker.regional['ar']);
24
+ });
includes/js/i18n/jquery.ui.datepicker-az.js ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Azerbaijani (UTF-8) initialisation for the jQuery UI date picker plugin. */
2
+ /* Written by Jamil Najafov (necefov33@gmail.com). */
3
+ jQuery(function($) {
4
+ $.datepicker.regional['az'] = {
5
+ closeText: 'Bağla',
6
+ prevText: '&#x3c;Geri',
7
+ nextText: 'İrəli&#x3e;',
8
+ currentText: 'Bugün',
9
+ monthNames: ['Yanvar','Fevral','Mart','Aprel','May','İyun',
10
+ 'İyul','Avqust','Sentyabr','Oktyabr','Noyabr','Dekabr'],
11
+ monthNamesShort: ['Yan','Fev','Mar','Apr','May','İyun',
12
+ 'İyul','Avq','Sen','Okt','Noy','Dek'],
13
+ dayNames: ['Bazar','Bazar ertəsi','Çərşənbə axşamı','Çərşənbə','Cümə axşamı','Cümə','Şənbə'],
14
+ dayNamesShort: ['B','Be','Ça','Ç','Ca','C','Ş'],
15
+ dayNamesMin: ['B','B','Ç','С','Ç','C','Ş'],
16
+ weekHeader: 'Hf',
17
+ dateFormat: 'dd.mm.yy',
18
+ firstDay: 1,
19
+ isRTL: false,
20
+ showMonthAfterYear: false,
21
+ yearSuffix: ''};
22
+ $.datepicker.setDefaults($.datepicker.regional['az']);
23
+ });
includes/js/i18n/jquery.ui.datepicker-bg.js ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Bulgarian initialisation for the jQuery UI date picker plugin. */
2
+ /* Written by Stoyan Kyosev (http://svest.org). */
3
+ jQuery(function($){
4
+ $.datepicker.regional['bg'] = {
5
+ closeText: 'затвори',
6
+ prevText: '&#x3c;назад',
7
+ nextText: 'напред&#x3e;',
8
+ nextBigText: '&#x3e;&#x3e;',
9
+ currentText: 'днес',
10
+ monthNames: ['Януари','Февруари','Март','Април','Май','Юни',
11
+ 'Юли','Август','Септември','Октомври','Ноември','Декември'],
12
+ monthNamesShort: ['Яну','Фев','Мар','Апр','Май','Юни',
13
+ 'Юли','Авг','Сеп','Окт','Нов','Дек'],
14
+ dayNames: ['Неделя','Понеделник','Вторник','Сряда','Четвъртък','Петък','Събота'],
15
+ dayNamesShort: ['Нед','Пон','Вто','Сря','Чет','Пет','Съб'],
16
+ dayNamesMin: ['Не','По','Вт','Ср','Че','Пе','Съ'],
17
+ weekHeader: 'Wk',
18
+ dateFormat: 'dd.mm.yy',
19
+ firstDay: 1,
20
+ isRTL: false,
21
+ showMonthAfterYear: false,
22
+ yearSuffix: ''};
23
+ $.datepicker.setDefaults($.datepicker.regional['bg']);
24
+ });
includes/js/i18n/jquery.ui.datepicker-bs.js ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Bosnian i18n for the jQuery UI date picker plugin. */
2
+ /* Written by Kenan Konjo. */
3
+ jQuery(function($){
4
+ $.datepicker.regional['bs'] = {
5
+ closeText: 'Zatvori',
6
+ prevText: '&#x3c;',
7
+ nextText: '&#x3e;',
8
+ currentText: 'Danas',
9
+ monthNames: ['Januar','Februar','Mart','April','Maj','Juni',
10
+ 'Juli','August','Septembar','Oktobar','Novembar','Decembar'],
11
+ monthNamesShort: ['Jan','Feb','Mar','Apr','Maj','Jun',
12
+ 'Jul','Aug','Sep','Okt','Nov','Dec'],
13
+ dayNames: ['Nedelja','Ponedeljak','Utorak','Srijeda','Četvrtak','Petak','Subota'],
14
+ dayNamesShort: ['Ned','Pon','Uto','Sri','Čet','Pet','Sub'],
15
+ dayNamesMin: ['Ne','Po','Ut','Sr','Če','Pe','Su'],
16
+ weekHeader: 'Wk',
17
+ dateFormat: 'dd.mm.yy',
18
+ firstDay: 1,
19
+ isRTL: false,
20
+ showMonthAfterYear: false,
21
+ yearSuffix: ''};
22
+ $.datepicker.setDefaults($.datepicker.regional['bs']);
23
+ });
js/jquery-ui-datepicker/i18n/ui.datepicker-ca.js → includes/js/i18n/jquery.ui.datepicker-ca.js RENAMED
@@ -1,22 +1,23 @@
1
- /* Inicialitzaci� en catal� per a l'extenci� 'calendar' per jQuery. */
2
  /* Writers: (joan.leon@gmail.com). */
3
  jQuery(function($){
4
- $.datepicker.regional['ca'] = {clearText: 'Netejar', clearStatus: '',
5
- closeText: 'Tancar', closeStatus: '',
6
- prevText: '&lt;Ant', prevStatus: '',
7
- nextText: 'Seg&gt;', nextStatus: '',
8
- currentText: 'Avui', currentStatus: '',
9
  monthNames: ['Gener','Febrer','Mar&ccedil;','Abril','Maig','Juny',
10
  'Juliol','Agost','Setembre','Octubre','Novembre','Desembre'],
11
  monthNamesShort: ['Gen','Feb','Mar','Abr','Mai','Jun',
12
  'Jul','Ago','Set','Oct','Nov','Des'],
13
- monthStatus: '', yearStatus: '',
14
- weekHeader: 'Sm', weekStatus: '',
15
  dayNames: ['Diumenge','Dilluns','Dimarts','Dimecres','Dijous','Divendres','Dissabte'],
16
  dayNamesShort: ['Dug','Dln','Dmt','Dmc','Djs','Dvn','Dsb'],
17
  dayNamesMin: ['Dg','Dl','Dt','Dc','Dj','Dv','Ds'],
18
- dayStatus: 'DD', dateStatus: 'D, M d',
19
- dateFormat: 'mm/dd/yy', firstDay: 0,
20
- initStatus: '', isRTL: false};
 
 
 
21
  $.datepicker.setDefaults($.datepicker.regional['ca']);
22
  });
1
+ /* Inicialització en català per a l'extenció 'calendar' per jQuery. */
2
  /* Writers: (joan.leon@gmail.com). */
3
  jQuery(function($){
4
+ $.datepicker.regional['ca'] = {
5
+ closeText: 'Tancar',
6
+ prevText: '&#x3c;Ant',
7
+ nextText: 'Seg&#x3e;',
8
+ currentText: 'Avui',
9
  monthNames: ['Gener','Febrer','Mar&ccedil;','Abril','Maig','Juny',
10
  'Juliol','Agost','Setembre','Octubre','Novembre','Desembre'],
11
  monthNamesShort: ['Gen','Feb','Mar','Abr','Mai','Jun',
12
  'Jul','Ago','Set','Oct','Nov','Des'],
 
 
13
  dayNames: ['Diumenge','Dilluns','Dimarts','Dimecres','Dijous','Divendres','Dissabte'],
14
  dayNamesShort: ['Dug','Dln','Dmt','Dmc','Djs','Dvn','Dsb'],
15
  dayNamesMin: ['Dg','Dl','Dt','Dc','Dj','Dv','Ds'],
16
+ weekHeader: 'Sm',
17
+ dateFormat: 'dd/mm/yy',
18
+ firstDay: 1,
19
+ isRTL: false,
20
+ showMonthAfterYear: false,
21
+ yearSuffix: ''};
22
  $.datepicker.setDefaults($.datepicker.regional['ca']);
23
  });
includes/js/i18n/jquery.ui.datepicker-cs.js ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Czech initialisation for the jQuery UI date picker plugin. */
2
+ /* Written by Tomas Muller (tomas@tomas-muller.net). */
3
+ jQuery(function($){
4
+ $.datepicker.regional['cs'] = {
5
+ closeText: 'Zavřít',
6
+ prevText: '&#x3c;Dříve',
7
+ nextText: 'Později&#x3e;',
8
+ currentText: 'Nyní',
9
+ monthNames: ['leden','únor','březen','duben','květen','červen',
10
+ 'červenec','srpen','září','říjen','listopad','prosinec'],
11
+ monthNamesShort: ['led','úno','bře','dub','kvě','čer',
12
+ 'čvc','srp','zář','říj','lis','pro'],
13
+ dayNames: ['neděle', 'pondělí', 'úterý', 'středa', 'čtvrtek', 'pátek', 'sobota'],
14
+ dayNamesShort: ['ne', 'po', 'út', 'st', 'čt', 'pá', 'so'],
15
+ dayNamesMin: ['ne','po','út','st','čt','pá','so'],
16
+ weekHeader: 'Týd',
17
+ dateFormat: 'dd.mm.yy',
18
+ firstDay: 1,
19
+ isRTL: false,
20
+ showMonthAfterYear: false,
21
+ yearSuffix: ''};
22
+ $.datepicker.setDefaults($.datepicker.regional['cs']);
23
+ });
includes/js/i18n/jquery.ui.datepicker-da.js ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Danish initialisation for the jQuery UI date picker plugin. */
2
+ /* Written by Jan Christensen ( deletestuff@gmail.com). */
3
+ jQuery(function($){
4
+ $.datepicker.regional['da'] = {
5
+ closeText: 'Luk',
6
+ prevText: '&#x3c;Forrige',
7
+ nextText: 'Næste&#x3e;',
8
+ currentText: 'Idag',
9
+ monthNames: ['Januar','Februar','Marts','April','Maj','Juni',
10
+ 'Juli','August','September','Oktober','November','December'],
11
+ monthNamesShort: ['Jan','Feb','Mar','Apr','Maj','Jun',
12
+ 'Jul','Aug','Sep','Okt','Nov','Dec'],
13
+ dayNames: ['Søndag','Mandag','Tirsdag','Onsdag','Torsdag','Fredag','Lørdag'],
14
+ dayNamesShort: ['Søn','Man','Tir','Ons','Tor','Fre','Lør'],
15
+ dayNamesMin: ['Sø','Ma','Ti','On','To','Fr','Lø'],
16
+ weekHeader: 'Uge',
17
+ dateFormat: 'dd-mm-yy',
18
+ firstDay: 1,
19
+ isRTL: false,
20
+ showMonthAfterYear: false,
21
+ yearSuffix: ''};
22
+ $.datepicker.setDefaults($.datepicker.regional['da']);
23
+ });
includes/js/i18n/jquery.ui.datepicker-de.js ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* German initialisation for the jQuery UI date picker plugin. */
2
+ /* Written by Milian Wolff (mail@milianw.de). */
3
+ jQuery(function($){
4
+ $.datepicker.regional['de'] = {
5
+ closeText: 'schließen',
6
+ prevText: '&#x3c;zurück',
7
+ nextText: 'Vor&#x3e;',
8
+ currentText: 'heute',
9
+ monthNames: ['Januar','Februar','März','April','Mai','Juni',
10
+ 'Juli','August','September','Oktober','November','Dezember'],
11
+ monthNamesShort: ['Jan','Feb','Mär','Apr','Mai','Jun',
12
+ 'Jul','Aug','Sep','Okt','Nov','Dez'],
13
+ dayNames: ['Sonntag','Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag'],
14
+ dayNamesShort: ['So','Mo','Di','Mi','Do','Fr','Sa'],
15
+ dayNamesMin: ['So','Mo','Di','Mi','Do','Fr','Sa'],
16
+ weekHeader: 'Wo',
17
+ dateFormat: 'dd.mm.yy',
18
+ firstDay: 1,
19
+ isRTL: false,
20
+ showMonthAfterYear: false,
21
+ yearSuffix: ''};
22
+ $.datepicker.setDefaults($.datepicker.regional['de']);
23
+ });
includes/js/i18n/jquery.ui.datepicker-el.js ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Greek (el) initialisation for the jQuery UI date picker plugin. */
2
+ /* Written by Alex Cicovic (http://www.alexcicovic.com) */
3
+ jQuery(function($){
4
+ $.datepicker.regional['el'] = {
5
+ closeText: 'Κλείσιμο',
6
+ prevText: 'Προηγούμενος',
7
+ nextText: 'Επόμενος',
8
+ currentText: 'Τρέχων Μήνας',
9
+ monthNames: ['Ιανουάριος','Φεβρουάριος','Μάρτιος','Απρίλιος','Μάιος','Ιούνιος',
10
+ 'Ιούλιος','Αύγουστος','Σεπτέμβριος','Οκτώβριος','Νοέμβριος','Δεκέμβριος'],
11
+ monthNamesShort: ['Ιαν','Φεβ','Μαρ','Απρ','Μαι','Ιουν',
12
+ 'Ιουλ','Αυγ','Σεπ','Οκτ','Νοε','Δεκ'],
13
+ dayNames: ['Κυριακή','Δευτέρα','Τρίτη','Τετάρτη','Πέμπτη','Παρασκευή','Σάββατο'],
14
+ dayNamesShort: ['Κυρ','Δευ','Τρι','Τετ','Πεμ','Παρ','Σαβ'],
15
+ dayNamesMin: ['Κυ','Δε','Τρ','Τε','Πε','Πα','Σα'],
16
+ weekHeader: 'Εβδ',
17
+ dateFormat: 'dd/mm/yy',
18
+ firstDay: 1,
19
+ isRTL: false,
20
+ showMonthAfterYear: false,
21
+ yearSuffix: ''};
22
+ $.datepicker.setDefaults($.datepicker.regional['el']);
23
+ });
includes/js/i18n/jquery.ui.datepicker-en-GB.js ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* English/UK initialisation for the jQuery UI date picker plugin. */
2
+ /* Written by Stuart. */
3
+ jQuery(function($){
4
+ $.datepicker.regional['en-GB'] = {
5
+ closeText: 'Done',
6
+ prevText: 'Prev',
7
+ nextText: 'Next',
8
+ currentText: 'Today',
9
+ monthNames: ['January','February','March','April','May','June',
10
+ 'July','August','September','October','November','December'],
11
+ monthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
12
+ 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
13
+ dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
14
+ dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
15
+ dayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'],
16
+ weekHeader: 'Wk',
17
+ dateFormat: 'dd/mm/yy',
18
+ firstDay: 1,
19
+ isRTL: false,
20
+ showMonthAfterYear: false,
21
+ yearSuffix: ''};
22
+ $.datepicker.setDefaults($.datepicker.regional['en-GB']);
23
+ });
includes/js/i18n/jquery.ui.datepicker-eo.js ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Esperanto initialisation for the jQuery UI date picker plugin. */
2
+ /* Written by Olivier M. (olivierweb@ifrance.com). */
3
+ jQuery(function($){
4
+ $.datepicker.regional['eo'] = {
5
+ closeText: 'Fermi',
6
+ prevText: '&lt;Anta',
7
+ nextText: 'Sekv&gt;',
8
+ currentText: 'Nuna',
9
+ monthNames: ['Januaro','Februaro','Marto','Aprilo','Majo','Junio',
10
+ 'Julio','Aŭgusto','Septembro','Oktobro','Novembro','Decembro'],
11
+ monthNamesShort: ['Jan','Feb','Mar','Apr','Maj','Jun',
12
+ 'Jul','Aŭg','Sep','Okt','Nov','Dec'],
13
+ dayNames: ['Dimanĉo','Lundo','Mardo','Merkredo','Ĵaŭdo','Vendredo','Sabato'],
14
+ dayNamesShort: ['Dim','Lun','Mar','Mer','Ĵaŭ','Ven','Sab'],
15
+ dayNamesMin: ['Di','Lu','Ma','Me','Ĵa','Ve','Sa'],
16
+ weekHeader: 'Sb',
17
+ dateFormat: 'dd/mm/yy',
18
+ firstDay: 0,
19
+ isRTL: false,
20
+ showMonthAfterYear: false,
21
+ yearSuffix: ''};
22
+ $.datepicker.setDefaults($.datepicker.regional['eo']);
23
+ });
js/jquery-ui-datepicker/i18n/ui.datepicker-es.js → includes/js/i18n/jquery.ui.datepicker-es.js RENAMED
@@ -1,22 +1,23 @@
1
- /* Inicializaci�n en espa�ol para la extensi�n 'UI date picker' para jQuery. */
2
  /* Traducido por Vester (xvester@gmail.com). */
3
  jQuery(function($){
4
- $.datepicker.regional['es'] = {clearText: 'Limpiar', clearStatus: '',
5
- closeText: 'Cerrar', closeStatus: '',
6
- prevText: '&lt;Ant', prevStatus: '',
7
- nextText: 'Sig&gt;', nextStatus: '',
8
- currentText: 'Hoy', currentStatus: '',
9
  monthNames: ['Enero','Febrero','Marzo','Abril','Mayo','Junio',
10
  'Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre'],
11
  monthNamesShort: ['Ene','Feb','Mar','Abr','May','Jun',
12
  'Jul','Ago','Sep','Oct','Nov','Dic'],
13
- monthStatus: '', yearStatus: '',
14
- weekHeader: 'Sm', weekStatus: '',
15
- dayNames: ['Domingo','Lunes','Martes','Mi&eacute;rcoles','Jueves','Viernes','S&aacute;dabo'],
16
  dayNamesShort: ['Dom','Lun','Mar','Mi&eacute;','Juv','Vie','S&aacute;b'],
17
  dayNamesMin: ['Do','Lu','Ma','Mi','Ju','Vi','S&aacute;'],
18
- dayStatus: 'DD', dateStatus: 'D, M d',
19
- dateFormat: 'dd/mm/yy', firstDay: 0,
20
- initStatus: '', isRTL: false};
 
 
 
21
  $.datepicker.setDefaults($.datepicker.regional['es']);
22
  });
1
+ /* Inicialización en español para la extensión 'UI date picker' para jQuery. */
2
  /* Traducido por Vester (xvester@gmail.com). */
3
  jQuery(function($){
4
+ $.datepicker.regional['es'] = {
5
+ closeText: 'Cerrar',
6
+ prevText: '&#x3c;Ant',
7
+ nextText: 'Sig&#x3e;',
8
+ currentText: 'Hoy',
9
  monthNames: ['Enero','Febrero','Marzo','Abril','Mayo','Junio',
10
  'Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre'],
11
  monthNamesShort: ['Ene','Feb','Mar','Abr','May','Jun',
12
  'Jul','Ago','Sep','Oct','Nov','Dic'],
13
+ dayNames: ['Domingo','Lunes','Martes','Mi&eacute;rcoles','Jueves','Viernes','S&aacute;bado'],
 
 
14
  dayNamesShort: ['Dom','Lun','Mar','Mi&eacute;','Juv','Vie','S&aacute;b'],
15
  dayNamesMin: ['Do','Lu','Ma','Mi','Ju','Vi','S&aacute;'],
16
+ weekHeader: 'Sm',
17
+ dateFormat: 'dd/mm/yy',
18
+ firstDay: 1,
19
+ isRTL: false,
20
+ showMonthAfterYear: false,
21
+ yearSuffix: ''};
22
  $.datepicker.setDefaults($.datepicker.regional['es']);
23
  });
includes/js/i18n/jquery.ui.datepicker-et.js ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Estonian initialisation for the jQuery UI date picker plugin. */
2
+ /* Written by Mart Sõmermaa (mrts.pydev at gmail com). */
3
+ jQuery(function($){
4
+ $.datepicker.regional['et'] = {
5
+ closeText: 'Sulge',
6
+ prevText: 'Eelnev',
7
+ nextText: 'Järgnev',
8
+ currentText: 'Täna',
9
+ monthNames: ['Jaanuar','Veebruar','Märts','Aprill','Mai','Juuni',
10
+ 'Juuli','August','September','Oktoober','November','Detsember'],
11
+ monthNamesShort: ['Jaan', 'Veebr', 'Märts', 'Apr', 'Mai', 'Juuni',
12
+ 'Juuli', 'Aug', 'Sept', 'Okt', 'Nov', 'Dets'],
13
+ dayNames: ['Pühapäev', 'Esmaspäev', 'Teisipäev', 'Kolmapäev', 'Neljapäev', 'Reede', 'Laupäev'],
14
+ dayNamesShort: ['Pühap', 'Esmasp', 'Teisip', 'Kolmap', 'Neljap', 'Reede', 'Laup'],
15
+ dayNamesMin: ['P','E','T','K','N','R','L'],
16
+ weekHeader: 'Sm',
17
+ dateFormat: 'dd.mm.yy',
18
+ firstDay: 1,
19
+ isRTL: false,
20
+ showMonthAfterYear: false,
21
+ yearSuffix: ''};
22
+ $.datepicker.setDefaults($.datepicker.regional['et']);
23
+ });
includes/js/i18n/jquery.ui.datepicker-eu.js ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Euskarako oinarria 'UI date picker' jquery-ko extentsioarentzat */
2
+ /* Karrikas-ek itzulia (karrikas@karrikas.com) */
3
+ jQuery(function($){
4
+ $.datepicker.regional['eu'] = {
5
+ closeText: 'Egina',
6
+ prevText: '&#x3c;Aur',
7
+ nextText: 'Hur&#x3e;',
8
+ currentText: 'Gaur',
9
+ monthNames: ['Urtarrila','Otsaila','Martxoa','Apirila','Maiatza','Ekaina',
10
+ 'Uztaila','Abuztua','Iraila','Urria','Azaroa','Abendua'],
11
+ monthNamesShort: ['Urt','Ots','Mar','Api','Mai','Eka',
12
+ 'Uzt','Abu','Ira','Urr','Aza','Abe'],
13
+ dayNames: ['Igandea','Astelehena','Asteartea','Asteazkena','Osteguna','Ostirala','Larunbata'],
14
+ dayNamesShort: ['Iga','Ast','Ast','Ast','Ost','Ost','Lar'],
15
+ dayNamesMin: ['Ig','As','As','As','Os','Os','La'],
16
+ weekHeader: 'Wk',
17
+ dateFormat: 'yy/mm/dd',
18
+ firstDay: 1,
19
+ isRTL: false,
20
+ showMonthAfterYear: false,
21
+ yearSuffix: ''};
22
+ $.datepicker.setDefaults($.datepicker.regional['eu']);
23
+ });
includes/js/i18n/jquery.ui.datepicker-fa.js ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Persian (Farsi) Translation for the jQuery UI date picker plugin. */
2
+ /* Javad Mowlanezhad -- jmowla@gmail.com */
3
+ /* Jalali calendar should supported soon! (Its implemented but I have to test it) */
4
+ jQuery(function($) {
5
+ $.datepicker.regional['fa'] = {
6
+ closeText: 'بستن',
7
+ prevText: '&#x3c;قبلي',
8
+ nextText: 'بعدي&#x3e;',
9
+ currentText: 'امروز',
10
+ monthNames: ['فروردين','ارديبهشت','خرداد','تير','مرداد','شهريور',
11
+ 'مهر','آبان','آذر','دي','بهمن','اسفند'],
12
+ monthNamesShort: ['1','2','3','4','5','6','7','8','9','10','11','12'],
13
+ dayNames: ['يکشنبه','دوشنبه','سه‌شنبه','چهارشنبه','پنجشنبه','جمعه','شنبه'],
14
+ dayNamesShort: ['ي','د','س','چ','پ','ج', 'ش'],
15
+ dayNamesMin: ['ي','د','س','چ','پ','ج', 'ش'],
16
+ weekHeader: 'هف',
17
+ dateFormat: 'yy/mm/dd',
18
+ firstDay: 6,
19
+ isRTL: true,
20
+ showMonthAfterYear: false,
21
+ yearSuffix: ''};
22
+ $.datepicker.setDefaults($.datepicker.regional['fa']);
23
+ });
js/jquery-ui-datepicker/i18n/ui.datepicker-fi.js → includes/js/i18n/jquery.ui.datepicker-fi.js RENAMED
@@ -1,24 +1,23 @@
1
  /* Finnish initialisation for the jQuery UI date picker plugin. */
2
- /* Written by Harri Kilpi� (harrikilpio@gmail.com). */
3
-
4
- $(document).ready(function(){
5
  $.datepicker.regional['fi'] = {
6
- clearText: 'Tyhjenn&auml;', clearStatus: '',
7
- closeText: 'Sulje', closeStatus: '',
8
- prevText: '&laquo;Edellinen', prevStatus: '',
9
- nextText: 'Seuraava&raquo;', nextStatus: '',
10
- currentText: 'T&auml;n&auml;&auml;n', currentStatus: '',
11
  monthNames: ['Tammikuu','Helmikuu','Maaliskuu','Huhtikuu','Toukokuu','Kes&auml;kuu',
12
  'Hein&auml;kuu','Elokuu','Syyskuu','Lokakuu','Marraskuu','Joulukuu'],
13
  monthNamesShort: ['Tammi','Helmi','Maalis','Huhti','Touko','Kes&auml;',
14
  'Hein&auml;','Elo','Syys','Loka','Marras','Joulu'],
15
- monthStatus: '', yearStatus: '',
16
- weekHeader: 'Vk', weekStatus: '',
17
  dayNamesShort: ['Su','Ma','Ti','Ke','To','Pe','Su'],
18
  dayNames: ['Sunnuntai','Maanantai','Tiistai','Keskiviikko','Torstai','Perjantai','Lauantai'],
19
  dayNamesMin: ['Su','Ma','Ti','Ke','To','Pe','La'],
20
- dayStatus: 'DD', dateStatus: 'D, M d',
21
- dateFormat: 'dd.mm.yy', firstDay: 1,
22
- initStatus: '', isRTL: false};
 
 
 
23
  $.datepicker.setDefaults($.datepicker.regional['fi']);
24
  });
1
  /* Finnish initialisation for the jQuery UI date picker plugin. */
2
+ /* Written by Harri Kilpi� (harrikilpio@gmail.com). */
3
+ jQuery(function($){
 
4
  $.datepicker.regional['fi'] = {
5
+ closeText: 'Sulje',
6
+ prevText: '&laquo;Edellinen',
7
+ nextText: 'Seuraava&raquo;',
8
+ currentText: 'T&auml;n&auml;&auml;n',
 
9
  monthNames: ['Tammikuu','Helmikuu','Maaliskuu','Huhtikuu','Toukokuu','Kes&auml;kuu',
10
  'Hein&auml;kuu','Elokuu','Syyskuu','Lokakuu','Marraskuu','Joulukuu'],
11
  monthNamesShort: ['Tammi','Helmi','Maalis','Huhti','Touko','Kes&auml;',
12
  'Hein&auml;','Elo','Syys','Loka','Marras','Joulu'],
 
 
13
  dayNamesShort: ['Su','Ma','Ti','Ke','To','Pe','Su'],
14
  dayNames: ['Sunnuntai','Maanantai','Tiistai','Keskiviikko','Torstai','Perjantai','Lauantai'],
15
  dayNamesMin: ['Su','Ma','Ti','Ke','To','Pe','La'],
16
+ weekHeader: 'Vk',
17
+ dateFormat: 'dd.mm.yy',
18
+ firstDay: 1,
19
+ isRTL: false,
20
+ showMonthAfterYear: false,
21
+ yearSuffix: ''};
22
  $.datepicker.setDefaults($.datepicker.regional['fi']);
23
  });
includes/js/i18n/jquery.ui.datepicker-fo.js ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Faroese initialisation for the jQuery UI date picker plugin */
2
+ /* Written by Sverri Mohr Olsen, sverrimo@gmail.com */
3
+ jQuery(function($){
4
+ $.datepicker.regional['fo'] = {
5
+ closeText: 'Lat aftur',
6
+ prevText: '&#x3c;Fyrra',
7
+ nextText: 'Næsta&#x3e;',
8
+ currentText: 'Í dag',
9
+ monthNames: ['Januar','Februar','Mars','Apríl','Mei','Juni',
10
+ 'Juli','August','September','Oktober','November','Desember'],
11
+ monthNamesShort: ['Jan','Feb','Mar','Apr','Mei','Jun',
12
+ 'Jul','Aug','Sep','Okt','Nov','Des'],
13
+ dayNames: ['Sunnudagur','Mánadagur','Týsdagur','Mikudagur','Hósdagur','Fríggjadagur','Leyardagur'],
14
+ dayNamesShort: ['Sun','Mán','Týs','Mik','Hós','Frí','Ley'],
15
+ dayNamesMin: ['Su','Má','Tý','Mi','Hó','Fr','Le'],
16
+ weekHeader: 'Vk',
17
+ dateFormat: 'dd-mm-yy',
18
+ firstDay: 0,
19
+ isRTL: false,
20
+ showMonthAfterYear: false,
21
+ yearSuffix: ''};
22
+ $.datepicker.setDefaults($.datepicker.regional['fo']);
23
+ });
includes/js/i18n/jquery.ui.datepicker-fr-CH.js ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Swiss-French initialisation for the jQuery UI date picker plugin. */
2
+ /* Written Martin Voelkle (martin.voelkle@e-tc.ch). */
3
+ jQuery(function($){
4
+ $.datepicker.regional['fr-CH'] = {
5
+ closeText: 'Fermer',
6
+ prevText: '&#x3c;Préc',
7
+ nextText: 'Suiv&#x3e;',
8
+ currentText: 'Courant',
9
+ monthNames: ['Janvier','Février','Mars','Avril','Mai','Juin',
10
+ 'Juillet','Août','Septembre','Octobre','Novembre','Décembre'],
11
+ monthNamesShort: ['Jan','Fév','Mar','Avr','Mai','Jun',
12
+ 'Jul','Aoû','Sep','Oct','Nov','Déc'],
13
+ dayNames: ['Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi'],
14
+ dayNamesShort: ['Dim','Lun','Mar','Mer','Jeu','Ven','Sam'],
15
+ dayNamesMin: ['Di','Lu','Ma','Me','Je','Ve','Sa'],
16
+ weekHeader: 'Sm',
17
+ dateFormat: 'dd.mm.yy',
18
+ firstDay: 1,
19
+ isRTL: false,
20
+ showMonthAfterYear: false,
21
+ yearSuffix: ''};
22
+ $.datepicker.setDefaults($.datepicker.regional['fr-CH']);
23
+ });
includes/js/i18n/jquery.ui.datepicker-fr.js ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* French initialisation for the jQuery UI date picker plugin. */
2
+ /* Written by Keith Wood (kbwood{at}iinet.com.au) and Stéphane Nahmani (sholby@sholby.net). */
3
+ jQuery(function($){
4
+ $.datepicker.regional['fr'] = {
5
+ closeText: 'Fermer',
6
+ prevText: '&#x3c;Préc',
7
+ nextText: 'Suiv&#x3e;',
8
+ currentText: 'Courant',
9
+ monthNames: ['Janvier','Février','Mars','Avril','Mai','Juin',
10
+ 'Juillet','Août','Septembre','Octobre','Novembre','Décembre'],
11
+ monthNamesShort: ['Jan','Fév','Mar','Avr','Mai','Jun',
12
+ 'Jul','Aoû','Sep','Oct','Nov','Déc'],
13
+ dayNames: ['Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi'],
14
+ dayNamesShort: ['Dim','Lun','Mar','Mer','Jeu','Ven','Sam'],
15
+ dayNamesMin: ['Di','Lu','Ma','Me','Je','Ve','Sa'],
16
+ weekHeader: 'Sm',
17
+ dateFormat: 'dd/mm/yy',
18
+ firstDay: 1,
19
+ isRTL: false,
20
+ showMonthAfterYear: false,
21
+ yearSuffix: ''};
22
+ $.datepicker.setDefaults($.datepicker.regional['fr']);
23
+ });
js/jquery-ui-datepicker/i18n/ui.datepicker-he.js → includes/js/i18n/jquery.ui.datepicker-he.js RENAMED
@@ -1,22 +1,23 @@
1
  /* Hebrew initialisation for the UI Datepicker extension. */
2
  /* Written by Amir Hardon (ahardon at gmail dot com). */
3
- jQuery(document).ready(function(){
4
- jQuery.datepicker.regional['he'] = {clearText: 'נקה', clearStatus: '',
5
- closeText: 'סגור', closeStatus: '',
6
- prevText: '&#x3c;הקודם', prevStatus: '',
7
- nextText: 'הבא&#x3e;', nextStatus: '',
8
- currentText: 'היום', currentStatus: '',
9
  monthNames: ['ינואר','פברואר','מרץ','אפריל','מאי','יוני',
10
  'יולי','אוגוסט','ספטמבר','אוקטובר','נובמבר','דצמבר'],
11
  monthNamesShort: ['1','2','3','4','5','6',
12
  '7','8','9','10','11','12'],
13
- monthStatus: '', yearStatus: '',
14
- weekHeader: 'Sm', weekStatus: '',
15
  dayNames: ['ראשון','שני','שלישי','רביעי','חמישי','שישי','שבת'],
16
  dayNamesShort: ['א\'','ב\'','ג\'','ד\'','ה\'','ו\'','שבת'],
17
  dayNamesMin: ['א\'','ב\'','ג\'','ד\'','ה\'','ו\'','שבת'],
18
- dayStatus: 'DD', dateStatus: 'DD, M d',
19
- dateFormat: 'dd/mm/yy', firstDay: 0,
20
- initStatus: '', isRTL: true};
21
- jQuery.datepicker.setDefaults($.datepicker.regional['he']);
 
 
 
22
  });
1
  /* Hebrew initialisation for the UI Datepicker extension. */
2
  /* Written by Amir Hardon (ahardon at gmail dot com). */
3
+ jQuery(function($){
4
+ $.datepicker.regional['he'] = {
5
+ closeText: 'סגור',
6
+ prevText: '&#x3c;הקודם',
7
+ nextText: 'הבא&#x3e;',
8
+ currentText: 'היום',
9
  monthNames: ['ינואר','פברואר','מרץ','אפריל','מאי','יוני',
10
  'יולי','אוגוסט','ספטמבר','אוקטובר','נובמבר','דצמבר'],
11
  monthNamesShort: ['1','2','3','4','5','6',
12
  '7','8','9','10','11','12'],
 
 
13
  dayNames: ['ראשון','שני','שלישי','רביעי','חמישי','שישי','שבת'],
14
  dayNamesShort: ['א\'','ב\'','ג\'','ד\'','ה\'','ו\'','שבת'],
15
  dayNamesMin: ['א\'','ב\'','ג\'','ד\'','ה\'','ו\'','שבת'],
16
+ weekHeader: 'Wk',
17
+ dateFormat: 'dd/mm/yy',
18
+ firstDay: 0,
19
+ isRTL: true,
20
+ showMonthAfterYear: false,
21
+ yearSuffix: ''};
22
+ $.datepicker.setDefaults($.datepicker.regional['he']);
23
  });
includes/js/i18n/jquery.ui.datepicker-hr.js ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Croatian i18n for the jQuery UI date picker plugin. */
2
+ /* Written by Vjekoslav Nesek. */
3
+ jQuery(function($){
4
+ $.datepicker.regional['hr'] = {
5
+ closeText: 'Zatvori',
6
+ prevText: '&#x3c;',
7
+ nextText: '&#x3e;',
8
+ currentText: 'Danas',
9
+ monthNames: ['Siječanj','Veljača','Ožujak','Travanj','Svibanj','Lipanj',
10
+ 'Srpanj','Kolovoz','Rujan','Listopad','Studeni','Prosinac'],
11
+ monthNamesShort: ['Sij','Velj','Ožu','Tra','Svi','Lip',
12
+ 'Srp','Kol','Ruj','Lis','Stu','Pro'],
13
+ dayNames: ['Nedjelja','Ponedjeljak','Utorak','Srijeda','Četvrtak','Petak','Subota'],
14
+ dayNamesShort: ['Ned','Pon','Uto','Sri','Čet','Pet','Sub'],
15
+ dayNamesMin: ['Ne','Po','Ut','Sr','Če','Pe','Su'],
16
+ weekHeader: 'Tje',
17
+ dateFormat: 'dd.mm.yy.',
18
+ firstDay: 1,
19
+ isRTL: false,
20
+ showMonthAfterYear: false,
21
+ yearSuffix: ''};
22
+ $.datepicker.setDefaults($.datepicker.regional['hr']);
23
+ });
includes/js/i18n/jquery.ui.datepicker-hu.js ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Hungarian initialisation for the jQuery UI date picker plugin. */
2
+ /* Written by Istvan Karaszi (jquery@spam.raszi.hu). */
3
+ jQuery(function($){
4
+ $.datepicker.regional['hu'] = {
5
+ closeText: 'bezárás',
6
+ prevText: '&laquo;&nbsp;vissza',
7
+ nextText: 'előre&nbsp;&raquo;',
8
+ currentText: 'ma',
9
+ monthNames: ['Január', 'Február', 'Március', 'Április', 'Május', 'Június',
10
+ 'Július', 'Augusztus', 'Szeptember', 'Október', 'November', 'December'],
11
+ monthNamesShort: ['Jan', 'Feb', 'Már', 'Ápr', 'Máj', 'Jún',
12
+ 'Júl', 'Aug', 'Szep', 'Okt', 'Nov', 'Dec'],
13
+ dayNames: ['Vasárnap', 'Hétfö', 'Kedd', 'Szerda', 'Csütörtök', 'Péntek', 'Szombat'],
14
+ dayNamesShort: ['Vas', 'Hét', 'Ked', 'Sze', 'Csü', 'Pén', 'Szo'],
15
+ dayNamesMin: ['V', 'H', 'K', 'Sze', 'Cs', 'P', 'Szo'],
16
+ weekHeader: 'Hé',
17
+ dateFormat: 'yy-mm-dd',
18
+ firstDay: 1,
19
+ isRTL: false,
20
+ showMonthAfterYear: false,
21
+ yearSuffix: ''};
22
+ $.datepicker.setDefaults($.datepicker.regional['hu']);
23
+ });
js/jquery-ui-datepicker/i18n/ui.datepicker-hy.js → includes/js/i18n/jquery.ui.datepicker-hy.js RENAMED
@@ -1,22 +1,23 @@
1
  /* Armenian(UTF-8) initialisation for the jQuery UI date picker plugin. */
2
  /* Written by Levon Zakaryan (levon.zakaryan@gmail.com)*/
3
  jQuery(function($){
4
- $.datepicker.regional['hy'] = {clearText: 'Մաքրել', clearStatus: '',
5
- closeText: 'Փակել', closeStatus: '',
6
- prevText: '&lt;Նախ.', prevStatus: '',
7
- nextText: 'Հաջ.&gt;', nextStatus: '',
8
- currentText: 'Այսօր', currentStatus: '',
9
  monthNames: ['Հունվար','Փետրվար','Մարտ','Ապրիլ','Մայիս','Հունիս',
10
  'Հուլիս','Օգոստոս','Սեպտեմբեր','Հոկտեմբեր','Նոյեմբեր','Դեկտեմբեր'],
11
  monthNamesShort: ['Հունվ','Փետր','Մարտ','Ապր','Մայիս','Հունիս',
12
  'Հուլ','Օգս','Սեպ','Հոկ','Նոյ','Դեկ'],
13
- monthStatus: '', yearStatus: '',
14
- weekHeader: 'ՇԲՏ', weekStatus: '',
15
  dayNames: ['կիրակի','եկուշաբթի','երեքշաբթի','չորեքշաբթի','հինգշաբթի','ուրբաթ','շաբաթ'],
16
  dayNamesShort: ['կիր','երկ','երք','չրք','հնգ','ուրբ','շբթ'],
17
  dayNamesMin: ['կիր','երկ','երք','չրք','հնգ','ուրբ','շբթ'],
18
- dayStatus: 'DD', dateStatus: 'D, M d',
19
- dateFormat: 'dd.mm.yy', firstDay: 1,
20
- initStatus: '', isRTL: false};
 
 
 
21
  $.datepicker.setDefaults($.datepicker.regional['hy']);
22
  });
1
  /* Armenian(UTF-8) initialisation for the jQuery UI date picker plugin. */
2
  /* Written by Levon Zakaryan (levon.zakaryan@gmail.com)*/
3
  jQuery(function($){
4
+ $.datepicker.regional['hy'] = {
5
+ closeText: 'Փակել',
6
+ prevText: '&#x3c;Նախ.',
7
+ nextText: 'Հաջ.&#x3e;',
8
+ currentText: 'Այսօր',
9
  monthNames: ['Հունվար','Փետրվար','Մարտ','Ապրիլ','Մայիս','Հունիս',
10
  'Հուլիս','Օգոստոս','Սեպտեմբեր','Հոկտեմբեր','Նոյեմբեր','Դեկտեմբեր'],
11
  monthNamesShort: ['Հունվ','Փետր','Մարտ','Ապր','Մայիս','Հունիս',
12
  'Հուլ','Օգս','Սեպ','Հոկ','Նոյ','Դեկ'],
 
 
13
  dayNames: ['կիրակի','եկուշաբթի','երեքշաբթի','չորեքշաբթի','հինգշաբթի','ուրբաթ','շաբաթ'],
14
  dayNamesShort: ['կիր','երկ','երք','չրք','հնգ','ուրբ','շբթ'],
15
  dayNamesMin: ['կիր','երկ','երք','չրք','հնգ','ուրբ','շբթ'],
16
+ weekHeader: 'ՇԲՏ',
17
+ dateFormat: 'dd.mm.yy',
18
+ firstDay: 1,
19
+ isRTL: false,
20
+ showMonthAfterYear: false,
21
+ yearSuffix: ''};
22
  $.datepicker.setDefaults($.datepicker.regional['hy']);
23
  });
includes/js/i18n/jquery.ui.datepicker-id.js ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Indonesian initialisation for the jQuery UI date picker plugin. */
2
+ /* Written by Deden Fathurahman (dedenf@gmail.com). */
3
+ jQuery(function($){
4
+ $.datepicker.regional['id'] = {
5
+ closeText: 'Tutup',
6
+ prevText: '&#x3c;mundur',
7
+ nextText: 'maju&#x3e;',
8
+ currentText: 'hari ini',
9
+ monthNames: ['Januari','Februari','Maret','April','Mei','Juni',
10
+ 'Juli','Agustus','September','Oktober','Nopember','Desember'],
11
+ monthNamesShort: ['Jan','Feb','Mar','Apr','Mei','Jun',
12
+ 'Jul','Agus','Sep','Okt','Nop','Des'],
13
+ dayNames: ['Minggu','Senin','Selasa','Rabu','Kamis','Jumat','Sabtu'],
14
+ dayNamesShort: ['Min','Sen','Sel','Rab','kam','Jum','Sab'],
15
+ dayNamesMin: ['Mg','Sn','Sl','Rb','Km','jm','Sb'],
16
+ weekHeader: 'Mg',
17
+ dateFormat: 'dd/mm/yy',
18
+ firstDay: 0,
19
+ isRTL: false,
20
+ showMonthAfterYear: false,
21
+ yearSuffix: ''};
22
+ $.datepicker.setDefaults($.datepicker.regional['id']);
23
+ });
js/jquery-ui-datepicker/i18n/ui.datepicker-is.js → includes/js/i18n/jquery.ui.datepicker-is.js RENAMED
@@ -1,22 +1,23 @@
1
  /* Icelandic initialisation for the jQuery UI date picker plugin. */
2
  /* Written by Haukur H. Thorsson (haukur@eskill.is). */
3
  jQuery(function($){
4
- $.datepicker.regional['is'] = {clearText: 'Hreinsa', clearStatus: '',
5
- closeText: 'Loka', closeStatus: '',
6
- prevText: '< Fyrri', prevStatus: '',
7
- nextText: 'N&aelig;sti >', nextStatus: '',
8
- currentText: '&Iacute; dag', currentStatus: '',
9
  monthNames: ['Jan&uacute;ar','Febr&uacute;ar','Mars','Apr&iacute;l','Ma&iacute','J&uacute;n&iacute;',
10
  'J&uacute;l&iacute;','&Aacute;g&uacute;st','September','Okt&oacute;ber','N&oacute;vember','Desember'],
11
  monthNamesShort: ['Jan','Feb','Mar','Apr','Ma&iacute;','J&uacute;n',
12
  'J&uacute;l','&Aacute;g&uacute;','Sep','Okt','N&oacute;v','Des'],
13
- monthStatus: '', yearStatus: '',
14
- weekHeader: 'Vika', weekStatus: '',
15
  dayNames: ['Sunnudagur','M&aacute;nudagur','&THORN;ri&eth;judagur','Mi&eth;vikudagur','Fimmtudagur','F&ouml;studagur','Laugardagur'],
16
  dayNamesShort: ['Sun','M&aacute;n','&THORN;ri','Mi&eth;','Fim','F&ouml;s','Lau'],
17
  dayNamesMin: ['Su','M&aacute;','&THORN;r','Mi','Fi','F&ouml;','La'],
18
- dayStatus: 'DD', dateStatus: 'D, M d',
19
- dateFormat: 'dd/mm/yy', firstDay: 0,
20
- initStatus: '', isRTL: false};
 
 
 
21
  $.datepicker.setDefaults($.datepicker.regional['is']);
22
  });
1
  /* Icelandic initialisation for the jQuery UI date picker plugin. */
2
  /* Written by Haukur H. Thorsson (haukur@eskill.is). */
3
  jQuery(function($){
4
+ $.datepicker.regional['is'] = {
5
+ closeText: 'Loka',
6
+ prevText: '&#x3c; Fyrri',
7
+ nextText: 'N&aelig;sti &#x3e;',
8
+ currentText: '&Iacute; dag',
9
  monthNames: ['Jan&uacute;ar','Febr&uacute;ar','Mars','Apr&iacute;l','Ma&iacute','J&uacute;n&iacute;',
10
  'J&uacute;l&iacute;','&Aacute;g&uacute;st','September','Okt&oacute;ber','N&oacute;vember','Desember'],
11
  monthNamesShort: ['Jan','Feb','Mar','Apr','Ma&iacute;','J&uacute;n',
12
  'J&uacute;l','&Aacute;g&uacute;','Sep','Okt','N&oacute;v','Des'],
 
 
13
  dayNames: ['Sunnudagur','M&aacute;nudagur','&THORN;ri&eth;judagur','Mi&eth;vikudagur','Fimmtudagur','F&ouml;studagur','Laugardagur'],
14
  dayNamesShort: ['Sun','M&aacute;n','&THORN;ri','Mi&eth;','Fim','F&ouml;s','Lau'],
15
  dayNamesMin: ['Su','M&aacute;','&THORN;r','Mi','Fi','F&ouml;','La'],
16
+ weekHeader: 'Vika',
17
+ dateFormat: 'dd/mm/yy',
18
+ firstDay: 0,
19
+ isRTL: false,
20
+ showMonthAfterYear: false,
21
+ yearSuffix: ''};
22
  $.datepicker.setDefaults($.datepicker.regional['is']);
23
  });
includes/js/i18n/jquery.ui.datepicker-it.js ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Italian initialisation for the jQuery UI date picker plugin. */
2
+ /* Written by Antonello Pasella (antonello.pasella@gmail.com). */
3
+ jQuery(function($){
4
+ $.datepicker.regional['it'] = {
5
+ closeText: 'Chiudi',
6
+ prevText: '&#x3c;Prec',
7
+ nextText: 'Succ&#x3e;',
8
+ currentText: 'Oggi',
9
+ monthNames: ['Gennaio','Febbraio','Marzo','Aprile','Maggio','Giugno',
10
+ 'Luglio','Agosto','Settembre','Ottobre','Novembre','Dicembre'],
11
+ monthNamesShort: ['Gen','Feb','Mar','Apr','Mag','Giu',
12
+ 'Lug','Ago','Set','Ott','Nov','Dic'],
13
+ dayNames: ['Domenica','Luned&#236','Marted&#236','Mercoled&#236','Gioved&#236','Venerd&#236','Sabato'],
14
+ dayNamesShort: ['Dom','Lun','Mar','Mer','Gio','Ven','Sab'],
15
+ dayNamesMin: ['Do','Lu','Ma','Me','Gi','Ve','Sa'],
16
+ weekHeader: 'Sm',
17
+ dateFormat: 'dd/mm/yy',
18
+ firstDay: 1,
19
+ isRTL: false,
20
+ showMonthAfterYear: false,
21
+ yearSuffix: ''};
22
+ $.datepicker.setDefaults($.datepicker.regional['it']);
23
+ });
includes/js/i18n/jquery.ui.datepicker-ja.js ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Japanese initialisation for the jQuery UI date picker plugin. */
2
+ /* Written by Kentaro SATO (kentaro@ranvis.com). */
3
+ jQuery(function($){
4
+ $.datepicker.regional['ja'] = {
5
+ closeText: '閉じる',
6
+ prevText: '&#x3c;前',
7
+ nextText: '次&#x3e;',
8
+ currentText: '今日',
9
+ monthNames: ['1月','2月','3月','4月','5月','6月',
10
+ '7月','8月','9月','10月','11月','12月'],
11
+ monthNamesShort: ['1月','2月','3月','4月','5月','6月',
12
+ '7月','8月','9月','10月','11月','12月'],
13
+ dayNames: ['日曜日','月曜日','火曜日','水曜日','木曜日','金曜日','土曜日'],
14
+ dayNamesShort: ['日','月','火','水','木','金','土'],
15
+ dayNamesMin: ['日','月','火','水','木','金','土'],
16
+ weekHeader: '週',
17
+ dateFormat: 'yy/mm/dd',
18
+ firstDay: 0,
19
+ isRTL: false,
20
+ showMonthAfterYear: true,
21
+ yearSuffix: '年'};
22
+ $.datepicker.setDefaults($.datepicker.regional['ja']);
23
+ });
includes/js/i18n/jquery.ui.datepicker-ko.js ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Korean initialisation for the jQuery calendar extension. */
2
+ /* Written by DaeKwon Kang (ncrash.dk@gmail.com). */
3
+ jQuery(function($){
4
+ $.datepicker.regional['ko'] = {
5
+ closeText: '닫기',
6
+ prevText: '이전달',
7
+ nextText: '다음달',
8
+ currentText: '오늘',
9
+ monthNames: ['1월(JAN)','2월(FEB)','3월(MAR)','4월(APR)','5월(MAY)','6월(JUN)',
10
+ '7월(JUL)','8월(AUG)','9월(SEP)','10월(OCT)','11월(NOV)','12월(DEC)'],
11
+ monthNamesShort: ['1월(JAN)','2월(FEB)','3월(MAR)','4월(APR)','5월(MAY)','6월(JUN)',
12
+ '7월(JUL)','8월(AUG)','9월(SEP)','10월(OCT)','11월(NOV)','12월(DEC)'],
13
+ dayNames: ['일','월','화','수','목','금','토'],
14
+ dayNamesShort: ['일','월','화','수','목','금','토'],
15
+ dayNamesMin: ['일','월','화','수','목','금','토'],
16
+ weekHeader: 'Wk',
17
+ dateFormat: 'yy-mm-dd',
18
+ firstDay: 0,
19
+ isRTL: false,
20
+ showMonthAfterYear: false,
21
+ yearSuffix: '년'};
22
+ $.datepicker.setDefaults($.datepicker.regional['ko']);
23
+ });
includes/js/i18n/jquery.ui.datepicker-kz.js ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Kazakh (UTF-8) initialisation for the jQuery UI date picker plugin. */
2
+ /* Written by Dmitriy Karasyov (dmitriy.karasyov@gmail.com). */
3
+ jQuery(function($){
4
+ $.datepicker.regional['kz'] = {
5
+ closeText: 'Жабу',
6
+ prevText: '&#x3c;Алдыңғы',
7
+ nextText: 'Келесі&#x3e;',
8
+ currentText: 'Бүгін',
9
+ monthNames: ['Қаңтар','Ақпан','Наурыз','Сәуір','Мамыр','Маусым',
10
+ 'Шілде','Тамыз','Қыркүйек','Қазан','Қараша','Желтоқсан'],
11
+ monthNamesShort: ['Қаң','Ақп','Нау','Сәу','Мам','Мау',
12
+ 'Шіл','Там','Қыр','Қаз','Қар','Жел'],
13
+ dayNames: ['Жексенбі','Дүйсенбі','Сейсенбі','Сәрсенбі','Бейсенбі','Жұма','Сенбі'],
14
+ dayNamesShort: ['жкс','дсн','ссн','срс','бсн','жма','снб'],
15
+ dayNamesMin: ['Жк','Дс','Сс','Ср','Бс','Жм','Сн'],
16
+ weekHeader: 'Не',
17
+ dateFormat: 'dd.mm.yy',
18
+ firstDay: 1,
19
+ isRTL: false,
20
+ showMonthAfterYear: false,
21
+ yearSuffix: ''};
22
+ $.datepicker.setDefaults($.datepicker.regional['kz']);
23
+ });
includes/js/i18n/jquery.ui.datepicker-lt.js ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Lithuanian (UTF-8) initialisation for the jQuery UI date picker plugin. */
2
+ /* @author Arturas Paleicikas <arturas@avalon.lt> */
3
+ jQuery(function($){
4
+ $.datepicker.regional['lt'] = {
5
+ closeText: 'Uždaryti',
6
+ prevText: '&#x3c;Atgal',
7
+ nextText: 'Pirmyn&#x3e;',
8
+ currentText: 'Šiandien',
9
+ monthNames: ['Sausis','Vasaris','Kovas','Balandis','Gegužė','Birželis',
10
+ 'Liepa','Rugpjūtis','Rugsėjis','Spalis','Lapkritis','Gruodis'],
11
+ monthNamesShort: ['Sau','Vas','Kov','Bal','Geg','Bir',
12
+ 'Lie','Rugp','Rugs','Spa','Lap','Gru'],
13
+ dayNames: ['sekmadienis','pirmadienis','antradienis','trečiadienis','ketvirtadienis','penktadienis','šeštadienis'],
14
+ dayNamesShort: ['sek','pir','ant','tre','ket','pen','šeš'],
15
+ dayNamesMin: ['Se','Pr','An','Tr','Ke','Pe','Še'],
16
+ weekHeader: 'Wk',
17
+ dateFormat: 'yy-mm-dd',
18
+ firstDay: 1,
19
+ isRTL: false,
20
+ showMonthAfterYear: false,
21
+ yearSuffix: ''};
22
+ $.datepicker.setDefaults($.datepicker.regional['lt']);
23
+ });
js/jquery-ui-datepicker/i18n/ui.datepicker-lv.js → includes/js/i18n/jquery.ui.datepicker-lv.js RENAMED
@@ -1,25 +1,23 @@
1
- /**
2
- * Latvian (UTF-8) initialisation for the jQuery UI date picker plugin.
3
- * @author Arturas Paleicikas <arturas.paleicikas@metasite.net>
4
- */
5
  jQuery(function($){
6
  $.datepicker.regional['lv'] = {
7
- clearText: 'Notīrīt', clearStatus: '',
8
- closeText: 'Aizvērt', closeStatus: '',
9
- prevText: 'Iepr', prevStatus: '',
10
- nextText: 'Nāka', nextStatus: '',
11
- currentText: 'Šodien', currentStatus: '',
12
  monthNames: ['Janvāris','Februāris','Marts','Aprīlis','Maijs','Jūnijs',
13
  'Jūlijs','Augusts','Septembris','Oktobris','Novembris','Decembris'],
14
  monthNamesShort: ['Jan','Feb','Mar','Apr','Mai','Jūn',
15
  'Jūl','Aug','Sep','Okt','Nov','Dec'],
16
- monthStatus: '', yearStatus: '',
17
- weekHeader: 'Nav', weekStatus: '',
18
  dayNames: ['svētdiena','pirmdiena','otrdiena','trešdiena','ceturtdiena','piektdiena','sestdiena'],
19
  dayNamesShort: ['svt','prm','otr','tre','ctr','pkt','sst'],
20
  dayNamesMin: ['Sv','Pr','Ot','Tr','Ct','Pk','Ss'],
21
- dayStatus: 'DD', dateStatus: 'D, M d',
22
- dateFormat: 'dd-mm-yy', firstDay: 1,
23
- initStatus: '', isRTL: false};
 
 
 
24
  $.datepicker.setDefaults($.datepicker.regional['lv']);
25
  });
1
+ /* Latvian (UTF-8) initialisation for the jQuery UI date picker plugin. */
2
+ /* @author Arturas Paleicikas <arturas.paleicikas@metasite.net> */
 
 
3
  jQuery(function($){
4
  $.datepicker.regional['lv'] = {
5
+ closeText: 'Aizvērt',
6
+ prevText: 'Iepr',
7
+ nextText: 'Nāka',
8
+ currentText: 'Šodien',
 
9
  monthNames: ['Janvāris','Februāris','Marts','Aprīlis','Maijs','Jūnijs',
10
  'Jūlijs','Augusts','Septembris','Oktobris','Novembris','Decembris'],
11
  monthNamesShort: ['Jan','Feb','Mar','Apr','Mai','Jūn',
12
  'Jūl','Aug','Sep','Okt','Nov','Dec'],
 
 
13
  dayNames: ['svētdiena','pirmdiena','otrdiena','trešdiena','ceturtdiena','piektdiena','sestdiena'],
14
  dayNamesShort: ['svt','prm','otr','tre','ctr','pkt','sst'],
15
  dayNamesMin: ['Sv','Pr','Ot','Tr','Ct','Pk','Ss'],
16
+ weekHeader: 'Nav',
17
+ dateFormat: 'dd-mm-yy',
18
+ firstDay: 1,
19
+ isRTL: false,
20
+ showMonthAfterYear: false,
21
+ yearSuffix: ''};
22
  $.datepicker.setDefaults($.datepicker.regional['lv']);
23
  });
includes/js/i18n/jquery.ui.datepicker-ms.js ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Malaysian initialisation for the jQuery UI date picker plugin. */
2
+ /* Written by Mohd Nawawi Mohamad Jamili (nawawi@ronggeng.net). */
3
+ jQuery(function($){
4
+ $.datepicker.regional['ms'] = {
5
+ closeText: 'Tutup',
6
+ prevText: '&#x3c;Sebelum',
7
+ nextText: 'Selepas&#x3e;',
8
+ currentText: 'hari ini',
9
+ monthNames: ['Januari','Februari','Mac','April','Mei','Jun',
10
+ 'Julai','Ogos','September','Oktober','November','Disember'],
11
+ monthNamesShort: ['Jan','Feb','Mac','Apr','Mei','Jun',
12
+ 'Jul','Ogo','Sep','Okt','Nov','Dis'],
13
+ dayNames: ['Ahad','Isnin','Selasa','Rabu','Khamis','Jumaat','Sabtu'],
14
+ dayNamesShort: ['Aha','Isn','Sel','Rab','kha','Jum','Sab'],
15
+ dayNamesMin: ['Ah','Is','Se','Ra','Kh','Ju','Sa'],
16
+ weekHeader: 'Mg',
17
+ dateFormat: 'dd/mm/yy',
18
+ firstDay: 0,
19
+ isRTL: false,
20
+ showMonthAfterYear: false,
21
+ yearSuffix: ''};
22
+ $.datepicker.setDefaults($.datepicker.regional['ms']);
23
+ });
includes/js/i18n/jquery.ui.datepicker-nl.js ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Dutch (UTF-8) initialisation for the jQuery UI date picker plugin. */
2
+ /* Written by Mathias Bynens <http://mathiasbynens.be/> */
3
+ jQuery(function($){
4
+ $.datepicker.regional.nl = {
5
+ closeText: 'Sluiten',
6
+ prevText: '←',
7
+ nextText: '→',
8
+ currentText: 'Vandaag',
9
+ monthNames: ['januari', 'februari', 'maart', 'april', 'mei', 'juni',
10
+ 'juli', 'augustus', 'september', 'oktober', 'november', 'december'],
11
+ monthNamesShort: ['jan', 'feb', 'maa', 'apr', 'mei', 'jun',
12
+ 'jul', 'aug', 'sep', 'okt', 'nov', 'dec'],
13
+ dayNames: ['zondag', 'maandag', 'dinsdag', 'woensdag', 'donderdag', 'vrijdag', 'zaterdag'],
14
+ dayNamesShort: ['zon', 'maa', 'din', 'woe', 'don', 'vri', 'zat'],
15
+ dayNamesMin: ['zo', 'ma', 'di', 'wo', 'do', 'vr', 'za'],
16
+ weekHeader: 'Wk',
17
+ dateFormat: 'dd/mm/yy',
18
+ firstDay: 1,
19
+ isRTL: false,
20
+ showMonthAfterYear: false,
21
+ yearSuffix: ''};
22
+ $.datepicker.setDefaults($.datepicker.regional.nl);
23
+ });
includes/js/i18n/jquery.ui.datepicker-no.js ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Norwegian initialisation for the jQuery UI date picker plugin. */
2
+ /* Written by Naimdjon Takhirov (naimdjon@gmail.com). */
3
+ jQuery(function($){
4
+ $.datepicker.regional['no'] = {
5
+ closeText: 'Lukk',
6
+ prevText: '&laquo;Forrige',
7
+ nextText: 'Neste&raquo;',
8
+ currentText: 'I dag',
9
+ monthNames: ['Januar','Februar','Mars','April','Mai','Juni',
10
+ 'Juli','August','September','Oktober','November','Desember'],
11
+ monthNamesShort: ['Jan','Feb','Mar','Apr','Mai','Jun',
12
+ 'Jul','Aug','Sep','Okt','Nov','Des'],
13
+ dayNamesShort: ['Søn','Man','Tir','Ons','Tor','Fre','Lør'],
14
+ dayNames: ['Søndag','Mandag','Tirsdag','Onsdag','Torsdag','Fredag','Lørdag'],
15
+ dayNamesMin: ['Sø','Ma','Ti','On','To','Fr','Lø'],
16
+ weekHeader: 'Uke',
17
+ dateFormat: 'yy-mm-dd',
18
+ firstDay: 0,
19
+ isRTL: false,
20
+ showMonthAfterYear: false,
21
+ yearSuffix: ''};
22
+ $.datepicker.setDefaults($.datepicker.regional['no']);
23
+ });
includes/js/i18n/jquery.ui.datepicker-pl.js ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Polish initialisation for the jQuery UI date picker plugin. */
2
+ /* Written by Jacek Wysocki (jacek.wysocki@gmail.com). */
3
+ jQuery(function($){
4
+ $.datepicker.regional['pl'] = {
5
+ closeText: 'Zamknij',
6
+ prevText: '&#x3c;Poprzedni',
7
+ nextText: 'Następny&#x3e;',
8
+ currentText: 'Dziś',
9
+ monthNames: ['Styczeń','Luty','Marzec','Kwiecień','Maj','Czerwiec',
10
+ 'Lipiec','Sierpień','Wrzesień','Październik','Listopad','Grudzień'],
11
+ monthNamesShort: ['Sty','Lu','Mar','Kw','Maj','Cze',
12
+ 'Lip','Sie','Wrz','Pa','Lis','Gru'],
13
+ dayNames: ['Niedziela','Poniedziałek','Wtorek','Środa','Czwartek','Piątek','Sobota'],
14
+ dayNamesShort: ['Nie','Pn','Wt','Śr','Czw','Pt','So'],
15
+ dayNamesMin: ['N','Pn','Wt','Śr','Cz','Pt','So'],
16
+ weekHeader: 'Tydz',
17
+ dateFormat: 'dd.mm.yy',
18
+ firstDay: 1,
19
+ isRTL: false,
20
+ showMonthAfterYear: false,
21
+ yearSuffix: ''};
22
+ $.datepicker.setDefaults($.datepicker.regional['pl']);
23
+ });
includes/js/i18n/jquery.ui.datepicker-pt-BR.js ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Brazilian initialisation for the jQuery UI date picker plugin. */
2
+ /* Written by Leonildo Costa Silva (leocsilva@gmail.com). */
3
+ jQuery(function($){
4
+ $.datepicker.regional['pt-BR'] = {
5
+ closeText: 'Fechar',
6
+ prevText: '&#x3c;Anterior',
7
+ nextText: 'Pr&oacute;ximo&#x3e;',
8
+ currentText: 'Hoje',
9
+ monthNames: ['Janeiro','Fevereiro','Mar&ccedil;o','Abril','Maio','Junho',
10
+ 'Julho','Agosto','Setembro','Outubro','Novembro','Dezembro'],
11
+ monthNamesShort: ['Jan','Fev','Mar','Abr','Mai','Jun',
12
+ 'Jul','Ago','Set','Out','Nov','Dez'],
13
+ dayNames: ['Domingo','Segunda-feira','Ter&ccedil;a-feira','Quarta-feira','Quinta-feira','Sexta-feira','S&aacute;bado'],
14
+ dayNamesShort: ['Dom','Seg','Ter','Qua','Qui','Sex','S&aacute;b'],
15
+ dayNamesMin: ['Dom','Seg','Ter','Qua','Qui','Sex','S&aacute;b'],
16
+ weekHeader: 'Sm',
17
+ dateFormat: 'dd/mm/yy',
18
+ firstDay: 0,
19
+ isRTL: false,
20
+ showMonthAfterYear: false,
21
+ yearSuffix: ''};
22
+ $.datepicker.setDefaults($.datepicker.regional['pt-BR']);
23
+ });
includes/js/i18n/jquery.ui.datepicker-ro.js ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Romanian initialisation for the jQuery UI date picker plugin.
2
+ *
3
+ * Written by Edmond L. (ll_edmond@walla.com)
4
+ * and Ionut G. Stan (ionut.g.stan@gmail.com)
5
+ */
6
+ jQuery(function($){
7
+ $.datepicker.regional['ro'] = {
8
+ closeText: 'Închide',
9
+ prevText: '&laquo; Luna precedentă',
10
+ nextText: 'Luna următoare &raquo;',
11
+ currentText: 'Azi',
12
+ monthNames: ['Ianuarie','Februarie','Martie','Aprilie','Mai','Iunie',
13
+ 'Iulie','August','Septembrie','Octombrie','Noiembrie','Decembrie'],
14
+ monthNamesShort: ['Ian', 'Feb', 'Mar', 'Apr', 'Mai', 'Iun',
15
+ 'Iul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
16
+ dayNames: ['Duminică', 'Luni', 'Marţi', 'Miercuri', 'Joi', 'Vineri', 'Sâmbătă'],
17
+ dayNamesShort: ['Dum', 'Lun', 'Mar', 'Mie', 'Joi', 'Vin', 'Sâm'],
18
+ dayNamesMin: ['Du','Lu','Ma','Mi','Jo','Vi','Sâ'],
19
+ weekHeader: 'Săpt',
20
+ dateFormat: 'dd.mm.yy',
21
+ firstDay: 1,
22
+ isRTL: false,
23
+ showMonthAfterYear: false,
24
+ yearSuffix: ''};
25
+ $.datepicker.setDefaults($.datepicker.regional['ro']);
26
+ });
js/jquery-ui-datepicker/i18n/ui.datepicker-ru.js → includes/js/i18n/jquery.ui.datepicker-ru.js RENAMED
@@ -1,22 +1,23 @@
1
  /* Russian (UTF-8) initialisation for the jQuery UI date picker plugin. */
2
  /* Written by Andrew Stromnov (stromnov@gmail.com). */
3
  jQuery(function($){
4
- $.datepicker.regional['ru'] = {clearText: 'Очистить', clearStatus: '',
5
- closeText: 'Закрыть', closeStatus: '',
6
- prevText: '&lt;Пред', prevStatus: '',
7
- nextText: 'След&gt;', nextStatus: '',
8
- currentText: 'Сегодня', currentStatus: '',
9
  monthNames: ['Январь','Февраль','Март','Апрель','Май','Июнь',
10
  'Июль','Август','Сентябрь','Октябрь','Ноябрь','Декабрь'],
11
  monthNamesShort: ['Янв','Фев','Мар','Апр','Май','Июн',
12
  'Июл','Авг','Сен','Окт','Ноя','Дек'],
13
- monthStatus: '', yearStatus: '',
14
- weekHeader: 'Не', weekStatus: '',
15
  dayNames: ['воскресенье','понедельник','вторник','среда','четверг','пятница','суббота'],
16
  dayNamesShort: ['вск','пнд','втр','срд','чтв','птн','сбт'],
17
  dayNamesMin: ['Вс','Пн','Вт','Ср','Чт','Пт','Сб'],
18
- dayStatus: 'DD', dateStatus: 'D, M d',
19
- dateFormat: 'dd.mm.yy', firstDay: 1,
20
- initStatus: '', isRTL: false};
 
 
 
21
  $.datepicker.setDefaults($.datepicker.regional['ru']);
22
  });
1
  /* Russian (UTF-8) initialisation for the jQuery UI date picker plugin. */
2
  /* Written by Andrew Stromnov (stromnov@gmail.com). */
3
  jQuery(function($){
4
+ $.datepicker.regional['ru'] = {
5
+ closeText: 'Закрыть',
6
+ prevText: '&#x3c;Пред',
7
+ nextText: 'След&#x3e;',
8
+ currentText: 'Сегодня',
9
  monthNames: ['Январь','Февраль','Март','Апрель','Май','Июнь',
10
  'Июль','Август','Сентябрь','Октябрь','Ноябрь','Декабрь'],
11
  monthNamesShort: ['Янв','Фев','Мар','Апр','Май','Июн',
12
  'Июл','Авг','Сен','Окт','Ноя','Дек'],
 
 
13
  dayNames: ['воскресенье','понедельник','вторник','среда','четверг','пятница','суббота'],
14
  dayNamesShort: ['вск','пнд','втр','срд','чтв','птн','сбт'],
15
  dayNamesMin: ['Вс','Пн','Вт','Ср','Чт','Пт','Сб'],
16
+ weekHeader: 'Не',
17
+ dateFormat: 'dd.mm.yy',
18
+ firstDay: 1,
19
+ isRTL: false,
20
+ showMonthAfterYear: false,
21
+ yearSuffix: ''};
22
  $.datepicker.setDefaults($.datepicker.regional['ru']);
23
  });
js/jquery-ui-datepicker/i18n/ui.datepicker-sk.js → includes/js/i18n/jquery.ui.datepicker-sk.js RENAMED
@@ -1,22 +1,23 @@
1
  /* Slovak initialisation for the jQuery UI date picker plugin. */
2
  /* Written by Vojtech Rinik (vojto@hmm.sk). */
3
  jQuery(function($){
4
- $.datepicker.regional['sk'] = {clearText: 'Zmazať', clearStatus: '',
5
- closeText: 'Zavrieť', closeStatus: '',
6
- prevText: '&lt;Predchádzajúci', prevStatus: '',
7
- nextText: 'Nasledujúci&gt;', nextStatus: '',
8
- currentText: 'Dnes', currentStatus: '',
9
  monthNames: ['Január','Február','Marec','Apríl','Máj','Jún',
10
  'Júl','August','September','Október','November','December'],
11
  monthNamesShort: ['Jan','Feb','Mar','Apr','Máj','Jún',
12
  'Júl','Aug','Sep','Okt','Nov','Dec'],
13
- monthStatus: '', yearStatus: '',
14
- weekHeader: 'Ty', weekStatus: '',
15
  dayNames: ['Nedel\'a','Pondelok','Utorok','Streda','Štvrtok','Piatok','Sobota'],
16
  dayNamesShort: ['Ned','Pon','Uto','Str','Štv','Pia','Sob'],
17
  dayNamesMin: ['Ne','Po','Ut','St','Št','Pia','So'],
18
- dayStatus: 'DD', dateStatus: 'D, M d',
19
- dateFormat: 'dd.mm.yy', firstDay: 0,
20
- initStatus: '', isRTL: false};
 
 
 
21
  $.datepicker.setDefaults($.datepicker.regional['sk']);
22
  });
1
  /* Slovak initialisation for the jQuery UI date picker plugin. */
2
  /* Written by Vojtech Rinik (vojto@hmm.sk). */
3
  jQuery(function($){
4
+ $.datepicker.regional['sk'] = {
5
+ closeText: 'Zavrieť',
6
+ prevText: '&#x3c;Predchádzajúci',
7
+ nextText: 'Nasledujúci&#x3e;',
8
+ currentText: 'Dnes',
9
  monthNames: ['Január','Február','Marec','Apríl','Máj','Jún',
10
  'Júl','August','September','Október','November','December'],
11
  monthNamesShort: ['Jan','Feb','Mar','Apr','Máj','Jún',
12
  'Júl','Aug','Sep','Okt','Nov','Dec'],
 
 
13
  dayNames: ['Nedel\'a','Pondelok','Utorok','Streda','Štvrtok','Piatok','Sobota'],
14
  dayNamesShort: ['Ned','Pon','Uto','Str','Štv','Pia','Sob'],
15
  dayNamesMin: ['Ne','Po','Ut','St','Št','Pia','So'],
16
+ weekHeader: 'Ty',
17
+ dateFormat: 'dd.mm.yy',
18
+ firstDay: 1,
19
+ isRTL: false,
20
+ showMonthAfterYear: false,
21
+ yearSuffix: ''};
22
  $.datepicker.setDefaults($.datepicker.regional['sk']);
23
  });
includes/js/i18n/jquery.ui.datepicker-sl.js ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Slovenian initialisation for the jQuery UI date picker plugin. */
2
+ /* Written by Jaka Jancar (jaka@kubje.org). */
3
+ /* c = &#x10D;, s = &#x161; z = &#x17E; C = &#x10C; S = &#x160; Z = &#x17D; */
4
+ jQuery(function($){
5
+ $.datepicker.regional['sl'] = {
6
+ closeText: 'Zapri',
7
+ prevText: '&lt;Prej&#x161;nji',
8
+ nextText: 'Naslednji&gt;',
9
+ currentText: 'Trenutni',
10
+ monthNames: ['Januar','Februar','Marec','April','Maj','Junij',
11
+ 'Julij','Avgust','September','Oktober','November','December'],
12
+ monthNamesShort: ['Jan','Feb','Mar','Apr','Maj','Jun',
13
+ 'Jul','Avg','Sep','Okt','Nov','Dec'],
14
+ dayNames: ['Nedelja','Ponedeljek','Torek','Sreda','&#x10C;etrtek','Petek','Sobota'],
15
+ dayNamesShort: ['Ned','Pon','Tor','Sre','&#x10C;et','Pet','Sob'],
16
+ dayNamesMin: ['Ne','Po','To','Sr','&#x10C;e','Pe','So'],
17
+ weekHeader: 'Teden',
18
+ dateFormat: 'dd.mm.yy',
19
+ firstDay: 1,
20
+ isRTL: false,
21
+ showMonthAfterYear: false,
22
+ yearSuffix: ''};
23
+ $.datepicker.setDefaults($.datepicker.regional['sl']);
24
+ });
includes/js/i18n/jquery.ui.datepicker-sq.js ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Albanian initialisation for the jQuery UI date picker plugin. */
2
+ /* Written by Flakron Bytyqi (flakron@gmail.com). */
3
+ jQuery(function($){
4
+ $.datepicker.regional['sq'] = {
5
+ closeText: 'mbylle',
6
+ prevText: '&#x3c;mbrapa',
7
+ nextText: 'Përpara&#x3e;',
8
+ currentText: 'sot',
9
+ monthNames: ['Janar','Shkurt','Mars','Prill','Maj','Qershor',
10
+ 'Korrik','Gusht','Shtator','Tetor','Nëntor','Dhjetor'],
11
+ monthNamesShort: ['Jan','Shk','Mar','Pri','Maj','Qer',
12
+ 'Kor','Gus','Sht','Tet','Nën','Dhj'],
13
+ dayNames: ['E Diel','E Hënë','E Martë','E Mërkurë','E Enjte','E Premte','E Shtune'],
14
+ dayNamesShort: ['Di','Hë','Ma','Më','En','Pr','Sh'],
15
+ dayNamesMin: ['Di','Hë','Ma','Më','En','Pr','Sh'],
16
+ weekHeader: 'Ja',
17
+ dateFormat: 'dd.mm.yy',
18
+ firstDay: 1,
19
+ isRTL: false,
20
+ showMonthAfterYear: false,
21
+ yearSuffix: ''};
22
+ $.datepicker.setDefaults($.datepicker.regional['sq']);
23
+ });
includes/js/i18n/jquery.ui.datepicker-sr-SR.js ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Serbian i18n for the jQuery UI date picker plugin. */
2
+ /* Written by Dejan Dimić. */
3
+ jQuery(function($){
4
+ $.datepicker.regional['sr-SR'] = {
5
+ closeText: 'Zatvori',
6
+ prevText: '&#x3c;',
7
+ nextText: '&#x3e;',
8
+ currentText: 'Danas',
9
+ monthNames: ['Januar','Februar','Mart','April','Maj','Jun',
10
+ 'Jul','Avgust','Septembar','Oktobar','Novembar','Decembar'],
11
+ monthNamesShort: ['Jan','Feb','Mar','Apr','Maj','Jun',
12
+ 'Jul','Avg','Sep','Okt','Nov','Dec'],
13
+ dayNames: ['Nedelja','Ponedeljak','Utorak','Sreda','Četvrtak','Petak','Subota'],
14
+ dayNamesShort: ['Ned','Pon','Uto','Sre','Čet','Pet','Sub'],
15
+ dayNamesMin: ['Ne','Po','Ut','Sr','Če','Pe','Su'],
16
+ weekHeader: 'Sed',
17
+ dateFormat: 'dd/mm/yy',
18
+ firstDay: 1,
19
+ isRTL: false,
20
+ showMonthAfterYear: false,
21
+ yearSuffix: ''};
22
+ $.datepicker.setDefaults($.datepicker.regional['sr-SR']);
23
+ });
includes/js/i18n/jquery.ui.datepicker-sr.js ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Serbian i18n for the jQuery UI date picker plugin. */
2
+ /* Written by Dejan Dimić. */
3
+ jQuery(function($){
4
+ $.datepicker.regional['sr'] = {
5
+ closeText: 'Затвори',
6
+ prevText: '&#x3c;',
7
+ nextText: '&#x3e;',
8
+ currentText: 'Данас',
9
+ monthNames: ['Јануар','Фебруар','Март','Април','Мај','Јун',
10
+ 'Јул','Август','Септембар','Октобар','Новембар','Децембар'],
11
+ monthNamesShort: ['Јан','Феб','Мар','Апр','Мај','Јун',
12
+ 'Јул','Авг','Сеп','Окт','Нов','Дец'],
13
+ dayNames: ['Недеља','Понедељак','Уторак','Среда','Четвртак','Петак','Субота'],
14
+ dayNamesShort: ['Нед','Пон','Уто','Сре','Чет','Пет','Суб'],
15
+ dayNamesMin: ['Не','По','Ут','Ср','Че','Пе','Су'],
16
+ weekHeader: 'Сед',
17
+ dateFormat: 'dd/mm/yy',
18
+ firstDay: 1,
19
+ isRTL: false,
20
+ showMonthAfterYear: false,
21
+ yearSuffix: ''};
22
+ $.datepicker.setDefaults($.datepicker.regional['sr']);
23
+ });
includes/js/i18n/jquery.ui.datepicker-sv.js ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Swedish initialisation for the jQuery UI date picker plugin. */
2
+ /* Written by Anders Ekdahl ( anders@nomadiz.se). */
3
+ jQuery(function($){
4
+ $.datepicker.regional['sv'] = {
5
+ closeText: 'Stäng',
6
+ prevText: '&laquo;Förra',
7
+ nextText: 'Nästa&raquo;',
8
+ currentText: 'Idag',
9
+ monthNames: ['Januari','Februari','Mars','April','Maj','Juni',
10
+ 'Juli','Augusti','September','Oktober','November','December'],
11
+ monthNamesShort: ['Jan','Feb','Mar','Apr','Maj','Jun',
12
+ 'Jul','Aug','Sep','Okt','Nov','Dec'],
13
+ dayNamesShort: ['Sön','Mån','Tis','Ons','Tor','Fre','Lör'],
14
+ dayNames: ['Söndag','Måndag','Tisdag','Onsdag','Torsdag','Fredag','Lördag'],
15
+ dayNamesMin: ['Sö','Må','Ti','On','To','Fr','Lö'],
16
+ weekHeader: 'Ve',
17
+ dateFormat: 'yy-mm-dd',
18
+ firstDay: 1,
19
+ isRTL: false,
20
+ showMonthAfterYear: false,
21
+ yearSuffix: ''};
22
+ $.datepicker.setDefaults($.datepicker.regional['sv']);
23
+ });
includes/js/i18n/jquery.ui.datepicker-ta.js ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Tamil (UTF-8) initialisation for the jQuery UI date picker plugin. */
2
+ /* Written by S A Sureshkumar (saskumar@live.com). */
3
+ jQuery(function($){
4
+ $.datepicker.regional['ta'] = {
5
+ closeText: 'மூடு',
6
+ prevText: 'முன்னையது',
7
+ nextText: 'அடுத்தது',
8
+ currentText: 'இன்று',
9
+ monthNames: ['தை','மாசி','பங்குனி','சித்திரை','வைகாசி','ஆனி',
10
+ 'ஆடி','ஆவணி','புரட்டாசி','ஐப்பசி','கார்த்திகை','மார்கழி'],
11
+ monthNamesShort: ['தை','மாசி','பங்','சித்','வைகா','ஆனி',
12
+ 'ஆடி','ஆவ','புர','ஐப்','கார்','மார்'],
13
+ dayNames: ['ஞாயிற்றுக்கிழமை','திங்கட்கிழமை','செவ்வாய்க்கிழமை','புதன்கிழமை','வியாழக்கிழமை','வெள்ளிக்கிழமை','சனிக்கிழமை'],
14
+ dayNamesShort: ['ஞாயிறு','திங்கள்','செவ்வாய்','புதன்','வியாழன்','வெள்ளி','சனி'],
15
+ dayNamesMin: ['ஞா','தி','செ','பு','வி','வெ','ச'],
16
+ weekHeader: 'Не',
17
+ dateFormat: 'dd/mm/yy',
18
+ firstDay: 1,
19
+ isRTL: false,
20
+ showMonthAfterYear: false,
21
+ yearSuffix: ''};
22
+ $.datepicker.setDefaults($.datepicker.regional['ta']);
23
+ });
js/jquery-ui-datepicker/i18n/ui.datepicker-th.js → includes/js/i18n/jquery.ui.datepicker-th.js RENAMED
@@ -1,22 +1,23 @@
1
  /* Thai initialisation for the jQuery UI date picker plugin. */
2
  /* Written by pipo (pipo@sixhead.com). */
3
  jQuery(function($){
4
- $.datepicker.regional['th'] = {clearText: 'ลบ', clearStatus: '',
5
- closeText: 'ปิด', closeStatus: '',
6
- prevText: '&laquo;&nbsp;ย้อน', prevStatus: '',
7
- nextText: 'ถัดไป&nbsp;&raquo;', nextStatus: '',
8
- currentText: 'วันนี้', currentStatus: '',
9
  monthNames: ['มกราคม','กุมภาพันธ์','มีนาคม','เมษายน','พฤษภาคม','มิถุนายน',
10
  'กรกฏาคม','สิงหาคม','กันยายน','ตุลาคม','พฤศจิกายน','ธันวาคม'],
11
  monthNamesShort: ['ม.ค.','ก.พ.','มี.ค.','เม.ย.','พ.ค.','มิ.ย.',
12
  'ก.ค.','ส.ค.','ก.ย.','ต.ค.','พ.ย.','ธ.ค.'],
13
- monthStatus: '', yearStatus: '',
14
- weekHeader: 'Sm', weekStatus: '',
15
  dayNames: ['อาทิตย์','จันทร์','อังคาร','พุธ','พฤหัสบดี','ศุกร์','เสาร์'],
16
  dayNamesShort: ['อา.','จ.','อ.','พ.','พฤ.','ศ.','ส.'],
17
  dayNamesMin: ['อา.','จ.','อ.','พ.','พฤ.','ศ.','ส.'],
18
- dayStatus: 'DD', dateStatus: 'D, M d',
19
- dateFormat: 'dd/mm/yy', firstDay: 0,
20
- initStatus: '', isRTL: false};
 
 
 
21
  $.datepicker.setDefaults($.datepicker.regional['th']);
22
  });
1
  /* Thai initialisation for the jQuery UI date picker plugin. */
2
  /* Written by pipo (pipo@sixhead.com). */
3
  jQuery(function($){
4
+ $.datepicker.regional['th'] = {
5
+ closeText: 'ปิด',
6
+ prevText: '&laquo;&nbsp;ย้อน',
7
+ nextText: 'ถัดไป&nbsp;&raquo;',
8
+ currentText: 'วันนี้',
9
  monthNames: ['มกราคม','กุมภาพันธ์','มีนาคม','เมษายน','พฤษภาคม','มิถุนายน',
10
  'กรกฏาคม','สิงหาคม','กันยายน','ตุลาคม','พฤศจิกายน','ธันวาคม'],
11
  monthNamesShort: ['ม.ค.','ก.พ.','มี.ค.','เม.ย.','พ.ค.','มิ.ย.',
12
  'ก.ค.','ส.ค.','ก.ย.','ต.ค.','พ.ย.','ธ.ค.'],
 
 
13
  dayNames: ['อาทิตย์','จันทร์','อังคาร','พุธ','พฤหัสบดี','ศุกร์','เสาร์'],
14
  dayNamesShort: ['อา.','จ.','อ.','พ.','พฤ.','ศ.','ส.'],
15
  dayNamesMin: ['อา.','จ.','อ.','พ.','พฤ.','ศ.','ส.'],
16
+ weekHeader: 'Wk',
17
+ dateFormat: 'dd/mm/yy',
18
+ firstDay: 0,
19
+ isRTL: false,
20
+ showMonthAfterYear: false,
21
+ yearSuffix: ''};
22
  $.datepicker.setDefaults($.datepicker.regional['th']);
23
  });
js/jquery-ui-datepicker/i18n/ui.datepicker-tr.js → includes/js/i18n/jquery.ui.datepicker-tr.js RENAMED
@@ -1,22 +1,23 @@
1
  /* Turkish initialisation for the jQuery UI date picker plugin. */
2
  /* Written by Izzet Emre Erkan (kara@karalamalar.net). */
3
  jQuery(function($){
4
- $.datepicker.regional['tr'] = {clearText: 'temizle', clearStatus: 'geçerli tarihi temizler',
5
- closeText: 'kapat', closeStatus: 'sadece göstergeyi kapat',
6
- prevText: '&#x3c;geri', prevStatus: 'önceki ayı göster',
7
- nextText: 'ileri&#x3e', nextStatus: 'sonraki ayı göster',
8
- currentText: 'bugün', currentStatus: '',
9
  monthNames: ['Ocak','Şubat','Mart','Nisan','Mayıs','Haziran',
10
  'Temmuz','Ağustos','Eylül','Ekim','Kasım','Aralık'],
11
  monthNamesShort: ['Oca','Şub','Mar','Nis','May','Haz',
12
  'Tem','Ağu','Eyl','Eki','Kas','Ara'],
13
- monthStatus: 'başka ay', yearStatus: 'başka yıl',
14
- weekHeader: 'Hf', weekStatus: 'Ayın haftaları',
15
  dayNames: ['Pazar','Pazartesi','Salı','Çarşamba','Perşembe','Cuma','Cumartesi'],
16
  dayNamesShort: ['Pz','Pt','Sa','Ça','Pe','Cu','Ct'],
17
  dayNamesMin: ['Pz','Pt','Sa','Ça','Pe','Cu','Ct'],
18
- dayStatus: 'Haftanın ilk gününü belirleyin', dateStatus: 'D, M d seçiniz',
19
- dateFormat: 'dd.mm.yy', firstDay: 1,
20
- initStatus: 'Bir tarih seçiniz', isRTL: false};
 
 
 
21
  $.datepicker.setDefaults($.datepicker.regional['tr']);
22
  });
1
  /* Turkish initialisation for the jQuery UI date picker plugin. */
2
  /* Written by Izzet Emre Erkan (kara@karalamalar.net). */
3
  jQuery(function($){
4
+ $.datepicker.regional['tr'] = {
5
+ closeText: 'kapat',
6
+ prevText: '&#x3c;geri',
7
+ nextText: 'ileri&#x3e',
8
+ currentText: 'bugün',
9
  monthNames: ['Ocak','Şubat','Mart','Nisan','Mayıs','Haziran',
10
  'Temmuz','Ağustos','Eylül','Ekim','Kasım','Aralık'],
11
  monthNamesShort: ['Oca','Şub','Mar','Nis','May','Haz',
12
  'Tem','Ağu','Eyl','Eki','Kas','Ara'],
 
 
13
  dayNames: ['Pazar','Pazartesi','Salı','Çarşamba','Perşembe','Cuma','Cumartesi'],
14
  dayNamesShort: ['Pz','Pt','Sa','Ça','Pe','Cu','Ct'],
15
  dayNamesMin: ['Pz','Pt','Sa','Ça','Pe','Cu','Ct'],
16
+ weekHeader: 'Hf',
17
+ dateFormat: 'dd.mm.yy',
18
+ firstDay: 1,
19
+ isRTL: false,
20
+ showMonthAfterYear: false,
21
+ yearSuffix: ''};
22
  $.datepicker.setDefaults($.datepicker.regional['tr']);
23
  });
js/jquery-ui-datepicker/i18n/ui.datepicker-uk.js → includes/js/i18n/jquery.ui.datepicker-uk.js RENAMED
@@ -1,22 +1,23 @@
1
  /* Ukrainian (UTF-8) initialisation for the jQuery UI date picker plugin. */
2
  /* Written by Maxim Drogobitskiy (maxdao@gmail.com). */
3
  jQuery(function($){
4
- $.datepicker.regional['uk'] = {clearText: 'Очистити', clearStatus: '',
5
- closeText: 'Закрити', closeStatus: '',
6
- prevText: '&lt;&lt;', prevStatus: '',
7
- nextText: '&gt;&gt;', nextStatus: '',
8
- currentText: 'Сьогодні', currentStatus: '',
9
  monthNames: ['Січень','Лютий','Березень','Квітень','Травень','Червень',
10
  'Липень','Серпень','Вересень','Жовтень','Листопад','Грудень'],
11
  monthNamesShort: ['Січ','Лют','Бер','Кві','Тра','Чер',
12
  'Лип','Сер','Вер','Жов','Лис','Гру'],
13
- monthStatus: '', yearStatus: '',
14
- weekHeader: 'Не', weekStatus: '',
15
- dayNames: ['неділя','понеділок','вівторок','середа','четвер','пятниця','суббота'],
16
  dayNamesShort: ['нед','пнд','вів','срд','чтв','птн','сбт'],
17
  dayNamesMin: ['Нд','Пн','Вт','Ср','Чт','Пт','Сб'],
18
- dayStatus: 'DD', dateStatus: 'D, M d',
19
- dateFormat: 'dd.mm.yy', firstDay: 1,
20
- initStatus: '', isRTL: false};
 
 
 
21
  $.datepicker.setDefaults($.datepicker.regional['uk']);
22
  });
1
  /* Ukrainian (UTF-8) initialisation for the jQuery UI date picker plugin. */
2
  /* Written by Maxim Drogobitskiy (maxdao@gmail.com). */
3
  jQuery(function($){
4
+ $.datepicker.regional['uk'] = {
5
+ closeText: 'Закрити',
6
+ prevText: '&#x3c;',
7
+ nextText: '&#x3e;',
8
+ currentText: 'Сьогодні',
9
  monthNames: ['Січень','Лютий','Березень','Квітень','Травень','Червень',
10
  'Липень','Серпень','Вересень','Жовтень','Листопад','Грудень'],
11
  monthNamesShort: ['Січ','Лют','Бер','Кві','Тра','Чер',
12
  'Лип','Сер','Вер','Жов','Лис','Гру'],
13
+ dayNames: ['неділя','понеділок','вівторок','середа','четвер','п’ятниця','субота'],
 
 
14
  dayNamesShort: ['нед','пнд','вів','срд','чтв','птн','сбт'],
15
  dayNamesMin: ['Нд','Пн','Вт','Ср','Чт','Пт','Сб'],
16
+ weekHeader: 'Не',
17
+ dateFormat: 'dd/mm/yy',
18
+ firstDay: 1,
19
+ isRTL: false,
20
+ showMonthAfterYear: false,
21
+ yearSuffix: ''};
22
  $.datepicker.setDefaults($.datepicker.regional['uk']);
23
  });
includes/js/i18n/jquery.ui.datepicker-vi.js ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Vietnamese initialisation for the jQuery UI date picker plugin. */
2
+ /* Translated by Le Thanh Huy (lthanhhuy@cit.ctu.edu.vn). */
3
+ jQuery(function($){
4
+ $.datepicker.regional['vi'] = {
5
+ closeText: 'Đóng',
6
+ prevText: '&#x3c;Trước',
7
+ nextText: 'Tiếp&#x3e;',
8
+ currentText: 'Hôm nay',
9
+ monthNames: ['Tháng Một', 'Tháng Hai', 'Tháng Ba', 'Tháng Tư', 'Tháng Năm', 'Tháng Sáu',
10
+ 'Tháng Bảy', 'Tháng Tám', 'Tháng Chín', 'Tháng Mười', 'Tháng Mười Một', 'Tháng Mười Hai'],
11
+ monthNamesShort: ['Tháng 1', 'Tháng 2', 'Tháng 3', 'Tháng 4', 'Tháng 5', 'Tháng 6',
12
+ 'Tháng 7', 'Tháng 8', 'Tháng 9', 'Tháng 10', 'Tháng 11', 'Tháng 12'],
13
+ dayNames: ['Chủ Nhật', 'Thứ Hai', 'Thứ Ba', 'Thứ Tư', 'Thứ Năm', 'Thứ Sáu', 'Thứ Bảy'],
14
+ dayNamesShort: ['CN', 'T2', 'T3', 'T4', 'T5', 'T6', 'T7'],
15
+ dayNamesMin: ['CN', 'T2', 'T3', 'T4', 'T5', 'T6', 'T7'],
16
+ weekHeader: 'Tu',
17
+ dateFormat: 'dd/mm/yy',
18
+ firstDay: 0,
19
+ isRTL: false,
20
+ showMonthAfterYear: false,
21
+ yearSuffix: ''};
22
+ $.datepicker.setDefaults($.datepicker.regional['vi']);
23
+ });
js/jquery-ui-datepicker/i18n/ui.datepicker-zh-CN.js → includes/js/i18n/jquery.ui.datepicker-zh-CN.js RENAMED
@@ -1,22 +1,23 @@
1
  /* Chinese initialisation for the jQuery UI date picker plugin. */
2
  /* Written by Cloudream (cloudream@gmail.com). */
3
  jQuery(function($){
4
- $.datepicker.regional['zh-CN'] = {clearText: '清除', clearStatus: '清除已选日期',
5
- closeText: '关闭', closeStatus: '不改变当前选择',
6
- prevText: '&lt;上月', prevStatus: '显示上月',
7
- nextText: '下月&gt;', nextStatus: '显示下月',
8
- currentText: '今天', currentStatus: '显示本月',
9
  monthNames: ['一月','二月','三月','四月','五月','六月',
10
  '七月','八月','九月','十月','十一月','十二月'],
11
  monthNamesShort: ['一','二','三','四','五','六',
12
  '七','八','九','十','十一','十二'],
13
- monthStatus: '选择月份', yearStatus: '选择年份',
14
- weekHeader: '周', weekStatus: '年内周次',
15
  dayNames: ['星期日','星期一','星期二','星期三','星期四','星期五','星期六'],
16
  dayNamesShort: ['周日','周一','周二','周三','周四','周五','周六'],
17
  dayNamesMin: ['日','一','二','三','四','五','六'],
18
- dayStatus: '设置 DD 为一周起始', dateStatus: '选择 m月 d日, DD',
19
- dateFormat: 'yy-mm-dd', firstDay: 1,
20
- initStatus: '请选择日期', isRTL: false};
 
 
 
21
  $.datepicker.setDefaults($.datepicker.regional['zh-CN']);
22
  });
1
  /* Chinese initialisation for the jQuery UI date picker plugin. */
2
  /* Written by Cloudream (cloudream@gmail.com). */
3
  jQuery(function($){
4
+ $.datepicker.regional['zh-CN'] = {
5
+ closeText: '关闭',
6
+ prevText: '&#x3c;上月',
7
+ nextText: '下月&#x3e;',
8
+ currentText: '今天',
9
  monthNames: ['一月','二月','三月','四月','五月','六月',
10
  '七月','八月','九月','十月','十一月','十二月'],
11
  monthNamesShort: ['一','二','三','四','五','六',
12
  '七','八','九','十','十一','十二'],
 
 
13
  dayNames: ['星期日','星期一','星期二','星期三','星期四','星期五','星期六'],
14
  dayNamesShort: ['周日','周一','周二','周三','周四','周五','周六'],
15
  dayNamesMin: ['日','一','二','三','四','五','六'],
16
+ weekHeader: '',
17
+ dateFormat: 'yy-mm-dd',
18
+ firstDay: 1,
19
+ isRTL: false,
20
+ showMonthAfterYear: true,
21
+ yearSuffix: '年'};
22
  $.datepicker.setDefaults($.datepicker.regional['zh-CN']);
23
  });
includes/js/i18n/jquery.ui.datepicker-zh-HK.js ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Chinese initialisation for the jQuery UI date picker plugin. */
2
+ /* Written by SCCY (samuelcychan@gmail.com). */
3
+ jQuery(function($){
4
+ $.datepicker.regional['zh-HK'] = {
5
+ closeText: '關閉',
6
+ prevText: '&#x3c;上月',
7
+ nextText: '下月&#x3e;',
8
+ currentText: '今天',
9
+ monthNames: ['一月','二月','三月','四月','五月','六月',
10
+ '七月','八月','九月','十月','十一月','十二月'],
11
+ monthNamesShort: ['一','二','三','四','五','六',
12
+ '七','八','九','十','十一','十二'],
13
+ dayNames: ['星期日','星期一','星期二','星期三','星期四','星期五','星期六'],
14
+ dayNamesShort: ['周日','周一','周二','周三','周四','周五','周六'],
15
+ dayNamesMin: ['日','一','二','三','四','五','六'],
16
+ weekHeader: '周',
17
+ dateFormat: 'dd-mm-yy',
18
+ firstDay: 0,
19
+ isRTL: false,
20
+ showMonthAfterYear: true,
21
+ yearSuffix: '年'};
22
+ $.datepicker.setDefaults($.datepicker.regional['zh-HK']);
23
+ });
js/jquery-ui-datepicker/i18n/ui.datepicker-zh-TW.js → includes/js/i18n/jquery.ui.datepicker-zh-TW.js RENAMED
@@ -2,22 +2,22 @@
2
  /* Written by Ressol (ressol@gmail.com). */
3
  jQuery(function($){
4
  $.datepicker.regional['zh-TW'] = {
5
- clearText: '清除', clearStatus: '清除已選日期',
6
- closeText: '關閉', closeStatus: '不改變目前的選擇',
7
- prevText: '&lt;上月', prevStatus: '顯示上月',
8
- nextText: '下月&gt;', nextStatus: '顯示下月',
9
- currentText: '今天', currentStatus: '顯示本月',
10
  monthNames: ['一月','二月','三月','四月','五月','六月',
11
  '七月','八月','九月','十月','十一月','十二月'],
12
  monthNamesShort: ['一','二','三','四','五','六',
13
  '七','八','九','十','十一','十二'],
14
- monthStatus: '選擇月份', yearStatus: '選擇年份',
15
- weekHeader: '周', weekStatus: '年內周次',
16
  dayNames: ['星期日','星期一','星期二','星期三','星期四','星期五','星期六'],
17
  dayNamesShort: ['周日','周一','周二','周三','周四','周五','周六'],
18
  dayNamesMin: ['日','一','二','三','四','五','六'],
19
- dayStatus: '設定 DD 為一周起始', dateStatus: '選擇 m月 d日, DD',
20
- dateFormat: 'yy/mm/dd', firstDay: 1,
21
- initStatus: '請選擇日期', isRTL: false};
 
 
 
22
  $.datepicker.setDefaults($.datepicker.regional['zh-TW']);
23
  });
2
  /* Written by Ressol (ressol@gmail.com). */
3
  jQuery(function($){
4
  $.datepicker.regional['zh-TW'] = {
5
+ closeText: '關閉',
6
+ prevText: '&#x3c;上月',
7
+ nextText: '下月&#x3e;',
8
+ currentText: '今天',
 
9
  monthNames: ['一月','二月','三月','四月','五月','六月',
10
  '七月','八月','九月','十月','十一月','十二月'],
11
  monthNamesShort: ['一','二','三','四','五','六',
12
  '七','八','九','十','十一','十二'],
 
 
13
  dayNames: ['星期日','星期一','星期二','星期三','星期四','星期五','星期六'],
14
  dayNamesShort: ['周日','周一','周二','周三','周四','周五','周六'],
15
  dayNamesMin: ['日','一','二','三','四','五','六'],
16
+ weekHeader: '',
17
+ dateFormat: 'yy/mm/dd',
18
+ firstDay: 1,
19
+ isRTL: false,
20
+ showMonthAfterYear: true,
21
+ yearSuffix: '年'};
22
  $.datepicker.setDefaults($.datepicker.regional['zh-TW']);
23
  });
includes/js/jquery-ui-1.8.5/jquery-ui-1.8.5.custom.min.js ADDED
@@ -0,0 +1,160 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ * jQuery UI 1.8.5
3
+ *
4
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
5
+ * Dual licensed under the MIT or GPL Version 2 licenses.
6
+ * http://jquery.org/license
7
+ *
8
+ * http://docs.jquery.com/UI
9
+ */
10
+ (function(c,j){function k(a){return!c(a).parents().andSelf().filter(function(){return c.curCSS(this,"visibility")==="hidden"||c.expr.filters.hidden(this)}).length}c.ui=c.ui||{};if(!c.ui.version){c.extend(c.ui,{version:"1.8.5",keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,
11
+ NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}});c.fn.extend({_focus:c.fn.focus,focus:function(a,b){return typeof a==="number"?this.each(function(){var d=this;setTimeout(function(){c(d).focus();b&&b.call(d)},a)}):this._focus.apply(this,arguments)},scrollParent:function(){var a;a=c.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(c.curCSS(this,
12
+ "position",1))&&/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0);return/fixed/.test(this.css("position"))||!a.length?c(document):a},zIndex:function(a){if(a!==j)return this.css("zIndex",a);if(this.length){a=c(this[0]);for(var b;a.length&&a[0]!==document;){b=a.css("position");
13
+ if(b==="absolute"||b==="relative"||b==="fixed"){b=parseInt(a.css("zIndex"));if(!isNaN(b)&&b!=0)return b}a=a.parent()}}return 0},disableSelection:function(){return this.bind("mousedown.ui-disableSelection selectstart.ui-disableSelection",function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}});c.each(["Width","Height"],function(a,b){function d(f,g,l,m){c.each(e,function(){g-=parseFloat(c.curCSS(f,"padding"+this,true))||0;if(l)g-=parseFloat(c.curCSS(f,
14
+ "border"+this+"Width",true))||0;if(m)g-=parseFloat(c.curCSS(f,"margin"+this,true))||0});return g}var e=b==="Width"?["Left","Right"]:["Top","Bottom"],h=b.toLowerCase(),i={innerWidth:c.fn.innerWidth,innerHeight:c.fn.innerHeight,outerWidth:c.fn.outerWidth,outerHeight:c.fn.outerHeight};c.fn["inner"+b]=function(f){if(f===j)return i["inner"+b].call(this);return this.each(function(){c.style(this,h,d(this,f)+"px")})};c.fn["outer"+b]=function(f,g){if(typeof f!=="number")return i["outer"+b].call(this,f);return this.each(function(){c.style(this,
15
+ h,d(this,f,true,g)+"px")})}});c.extend(c.expr[":"],{data:function(a,b,d){return!!c.data(a,d[3])},focusable:function(a){var b=a.nodeName.toLowerCase(),d=c.attr(a,"tabindex");if("area"===b){b=a.parentNode;d=b.name;if(!a.href||!d||b.nodeName.toLowerCase()!=="map")return false;a=c("img[usemap=#"+d+"]")[0];return!!a&&k(a)}return(/input|select|textarea|button|object/.test(b)?!a.disabled:"a"==b?a.href||!isNaN(d):!isNaN(d))&&k(a)},tabbable:function(a){var b=c.attr(a,"tabindex");return(isNaN(b)||b>=0)&&c(a).is(":focusable")}});
16
+ c(function(){var a=document.createElement("div"),b=document.body;c.extend(a.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0});c.support.minHeight=b.appendChild(a).offsetHeight===100;b.removeChild(a).style.display="none"});c.extend(c.ui,{plugin:{add:function(a,b,d){a=c.ui[a].prototype;for(var e in d){a.plugins[e]=a.plugins[e]||[];a.plugins[e].push([b,d[e]])}},call:function(a,b,d){if((b=a.plugins[b])&&a.element[0].parentNode)for(var e=0;e<b.length;e++)a.options[b[e][0]]&&b[e][1].apply(a.element,
17
+ d)}},contains:function(a,b){return document.compareDocumentPosition?a.compareDocumentPosition(b)&16:a!==b&&a.contains(b)},hasScroll:function(a,b){if(c(a).css("overflow")==="hidden")return false;b=b&&b==="left"?"scrollLeft":"scrollTop";var d=false;if(a[b]>0)return true;a[b]=1;d=a[b]>0;a[b]=0;return d},isOverAxis:function(a,b,d){return a>b&&a<b+d},isOver:function(a,b,d,e,h,i){return c.ui.isOverAxis(a,d,h)&&c.ui.isOverAxis(b,e,i)}})}})(jQuery);
18
+ ;/*!
19
+ * jQuery UI Widget 1.8.5
20
+ *
21
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
22
+ * Dual licensed under the MIT or GPL Version 2 licenses.
23
+ * http://jquery.org/license
24
+ *
25
+ * http://docs.jquery.com/UI/Widget
26
+ */
27
+ (function(b,j){if(b.cleanData){var k=b.cleanData;b.cleanData=function(a){for(var c=0,d;(d=a[c])!=null;c++)b(d).triggerHandler("remove");k(a)}}else{var l=b.fn.remove;b.fn.remove=function(a,c){return this.each(function(){if(!c)if(!a||b.filter(a,[this]).length)b("*",this).add([this]).each(function(){b(this).triggerHandler("remove")});return l.call(b(this),a,c)})}}b.widget=function(a,c,d){var e=a.split(".")[0],f;a=a.split(".")[1];f=e+"-"+a;if(!d){d=c;c=b.Widget}b.expr[":"][f]=function(h){return!!b.data(h,
28
+ a)};b[e]=b[e]||{};b[e][a]=function(h,g){arguments.length&&this._createWidget(h,g)};c=new c;c.options=b.extend(true,{},c.options);b[e][a].prototype=b.extend(true,c,{namespace:e,widgetName:a,widgetEventPrefix:b[e][a].prototype.widgetEventPrefix||a,widgetBaseClass:f},d);b.widget.bridge(a,b[e][a])};b.widget.bridge=function(a,c){b.fn[a]=function(d){var e=typeof d==="string",f=Array.prototype.slice.call(arguments,1),h=this;d=!e&&f.length?b.extend.apply(null,[true,d].concat(f)):d;if(e&&d.substring(0,1)===
29
+ "_")return h;e?this.each(function(){var g=b.data(this,a);if(!g)throw"cannot call methods on "+a+" prior to initialization; attempted to call method '"+d+"'";if(!b.isFunction(g[d]))throw"no such method '"+d+"' for "+a+" widget instance";var i=g[d].apply(g,f);if(i!==g&&i!==j){h=i;return false}}):this.each(function(){var g=b.data(this,a);g?g.option(d||{})._init():b.data(this,a,new c(d,this))});return h}};b.Widget=function(a,c){arguments.length&&this._createWidget(a,c)};b.Widget.prototype={widgetName:"widget",
30
+ widgetEventPrefix:"",options:{disabled:false},_createWidget:function(a,c){b.data(c,this.widgetName,this);this.element=b(c);this.options=b.extend(true,{},this.options,b.metadata&&b.metadata.get(c)[this.widgetName],a);var d=this;this.element.bind("remove."+this.widgetName,function(){d.destroy()});this._create();this._init()},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+
31
+ "-disabled ui-state-disabled")},widget:function(){return this.element},option:function(a,c){var d=a,e=this;if(arguments.length===0)return b.extend({},e.options);if(typeof a==="string"){if(c===j)return this.options[a];d={};d[a]=c}b.each(d,function(f,h){e._setOption(f,h)});return e},_setOption:function(a,c){this.options[a]=c;if(a==="disabled")this.widget()[c?"addClass":"removeClass"](this.widgetBaseClass+"-disabled ui-state-disabled").attr("aria-disabled",c);return this},enable:function(){return this._setOption("disabled",
32
+ false)},disable:function(){return this._setOption("disabled",true)},_trigger:function(a,c,d){var e=this.options[a];c=b.Event(c);c.type=(a===this.widgetEventPrefix?a:this.widgetEventPrefix+a).toLowerCase();d=d||{};if(c.originalEvent){a=b.event.props.length;for(var f;a;){f=b.event.props[--a];c[f]=c.originalEvent[f]}}this.element.trigger(c,d);return!(b.isFunction(e)&&e.call(this.element[0],c,d)===false||c.isDefaultPrevented())}}})(jQuery);
33
+ ;/*
34
+ * jQuery UI Position 1.8.5
35
+ *
36
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
37
+ * Dual licensed under the MIT or GPL Version 2 licenses.
38
+ * http://jquery.org/license
39
+ *
40
+ * http://docs.jquery.com/UI/Position
41
+ */
42
+ (function(c){c.ui=c.ui||{};var n=/left|center|right/,o=/top|center|bottom/,t=c.fn.position,u=c.fn.offset;c.fn.position=function(b){if(!b||!b.of)return t.apply(this,arguments);b=c.extend({},b);var a=c(b.of),d=a[0],g=(b.collision||"flip").split(" "),e=b.offset?b.offset.split(" "):[0,0],h,k,j;if(d.nodeType===9){h=a.width();k=a.height();j={top:0,left:0}}else if(d.scrollTo&&d.document){h=a.width();k=a.height();j={top:a.scrollTop(),left:a.scrollLeft()}}else if(d.preventDefault){b.at="left top";h=k=0;j=
43
+ {top:b.of.pageY,left:b.of.pageX}}else{h=a.outerWidth();k=a.outerHeight();j=a.offset()}c.each(["my","at"],function(){var f=(b[this]||"").split(" ");if(f.length===1)f=n.test(f[0])?f.concat(["center"]):o.test(f[0])?["center"].concat(f):["center","center"];f[0]=n.test(f[0])?f[0]:"center";f[1]=o.test(f[1])?f[1]:"center";b[this]=f});if(g.length===1)g[1]=g[0];e[0]=parseInt(e[0],10)||0;if(e.length===1)e[1]=e[0];e[1]=parseInt(e[1],10)||0;if(b.at[0]==="right")j.left+=h;else if(b.at[0]==="center")j.left+=h/
44
+ 2;if(b.at[1]==="bottom")j.top+=k;else if(b.at[1]==="center")j.top+=k/2;j.left+=e[0];j.top+=e[1];return this.each(function(){var f=c(this),l=f.outerWidth(),m=f.outerHeight(),p=parseInt(c.curCSS(this,"marginLeft",true))||0,q=parseInt(c.curCSS(this,"marginTop",true))||0,v=l+p+parseInt(c.curCSS(this,"marginRight",true))||0,w=m+q+parseInt(c.curCSS(this,"marginBottom",true))||0,i=c.extend({},j),r;if(b.my[0]==="right")i.left-=l;else if(b.my[0]==="center")i.left-=l/2;if(b.my[1]==="bottom")i.top-=m;else if(b.my[1]===
45
+ "center")i.top-=m/2;i.left=parseInt(i.left);i.top=parseInt(i.top);r={left:i.left-p,top:i.top-q};c.each(["left","top"],function(s,x){c.ui.position[g[s]]&&c.ui.position[g[s]][x](i,{targetWidth:h,targetHeight:k,elemWidth:l,elemHeight:m,collisionPosition:r,collisionWidth:v,collisionHeight:w,offset:e,my:b.my,at:b.at})});c.fn.bgiframe&&f.bgiframe();f.offset(c.extend(i,{using:b.using}))})};c.ui.position={fit:{left:function(b,a){var d=c(window);d=a.collisionPosition.left+a.collisionWidth-d.width()-d.scrollLeft();
46
+ b.left=d>0?b.left-d:Math.max(b.left-a.collisionPosition.left,b.left)},top:function(b,a){var d=c(window);d=a.collisionPosition.top+a.collisionHeight-d.height()-d.scrollTop();b.top=d>0?b.top-d:Math.max(b.top-a.collisionPosition.top,b.top)}},flip:{left:function(b,a){if(a.at[0]!=="center"){var d=c(window);d=a.collisionPosition.left+a.collisionWidth-d.width()-d.scrollLeft();var g=a.my[0]==="left"?-a.elemWidth:a.my[0]==="right"?a.elemWidth:0,e=a.at[0]==="left"?a.targetWidth:-a.targetWidth,h=-2*a.offset[0];
47
+ b.left+=a.collisionPosition.left<0?g+e+h:d>0?g+e+h:0}},top:function(b,a){if(a.at[1]!=="center"){var d=c(window);d=a.collisionPosition.top+a.collisionHeight-d.height()-d.scrollTop();var g=a.my[1]==="top"?-a.elemHeight:a.my[1]==="bottom"?a.elemHeight:0,e=a.at[1]==="top"?a.targetHeight:-a.targetHeight,h=-2*a.offset[1];b.top+=a.collisionPosition.top<0?g+e+h:d>0?g+e+h:0}}}};if(!c.offset.setOffset){c.offset.setOffset=function(b,a){if(/static/.test(c.curCSS(b,"position")))b.style.position="relative";var d=
48
+ c(b),g=d.offset(),e=parseInt(c.curCSS(b,"top",true),10)||0,h=parseInt(c.curCSS(b,"left",true),10)||0;g={top:a.top-g.top+e,left:a.left-g.left+h};"using"in a?a.using.call(b,g):d.css(g)};c.fn.offset=function(b){var a=this[0];if(!a||!a.ownerDocument)return null;if(b)return this.each(function(){c.offset.setOffset(this,b)});return u.call(this)}}})(jQuery);
49
+ ;/*
50
+ * jQuery UI Autocomplete 1.8.5
51
+ *
52
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
53
+ * Dual licensed under the MIT or GPL Version 2 licenses.
54
+ * http://jquery.org/license
55
+ *
56
+ * http://docs.jquery.com/UI/Autocomplete
57
+ *
58
+ * Depends:
59
+ * jquery.ui.core.js
60
+ * jquery.ui.widget.js
61
+ * jquery.ui.position.js
62
+ */
63
+ (function(e){e.widget("ui.autocomplete",{options:{appendTo:"body",delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null},_create:function(){var a=this,b=this.element[0].ownerDocument;this.element.addClass("ui-autocomplete-input").attr("autocomplete","off").attr({role:"textbox","aria-autocomplete":"list","aria-haspopup":"true"}).bind("keydown.autocomplete",function(c){if(!a.options.disabled){var d=e.ui.keyCode;switch(c.keyCode){case d.PAGE_UP:a._move("previousPage",
64
+ c);break;case d.PAGE_DOWN:a._move("nextPage",c);break;case d.UP:a._move("previous",c);c.preventDefault();break;case d.DOWN:a._move("next",c);c.preventDefault();break;case d.ENTER:case d.NUMPAD_ENTER:a.menu.element.is(":visible")&&c.preventDefault();case d.TAB:if(!a.menu.active)return;a.menu.select(c);break;case d.ESCAPE:a.element.val(a.term);a.close(c);break;default:clearTimeout(a.searching);a.searching=setTimeout(function(){if(a.term!=a.element.val()){a.selectedItem=null;a.search(null,c)}},a.options.delay);
65
+ break}}}).bind("focus.autocomplete",function(){if(!a.options.disabled){a.selectedItem=null;a.previous=a.element.val()}}).bind("blur.autocomplete",function(c){if(!a.options.disabled){clearTimeout(a.searching);a.closing=setTimeout(function(){a.close(c);a._change(c)},150)}});this._initSource();this.response=function(){return a._response.apply(a,arguments)};this.menu=e("<ul></ul>").addClass("ui-autocomplete").appendTo(e(this.options.appendTo||"body",b)[0]).mousedown(function(c){var d=a.menu.element[0];
66
+ c.target===d&&setTimeout(function(){e(document).one("mousedown",function(f){f.target!==a.element[0]&&f.target!==d&&!e.ui.contains(d,f.target)&&a.close()})},1);setTimeout(function(){clearTimeout(a.closing)},13)}).menu({focus:function(c,d){d=d.item.data("item.autocomplete");false!==a._trigger("focus",null,{item:d})&&/^key/.test(c.originalEvent.type)&&a.element.val(d.value)},selected:function(c,d){d=d.item.data("item.autocomplete");var f=a.previous;if(a.element[0]!==b.activeElement){a.element.focus();
67
+ a.previous=f}if(false!==a._trigger("select",c,{item:d})){a.term=d.value;a.element.val(d.value)}a.close(c);a.selectedItem=d},blur:function(){a.menu.element.is(":visible")&&a.element.val()!==a.term&&a.element.val(a.term)}}).zIndex(this.element.zIndex()+1).css({top:0,left:0}).hide().data("menu");e.fn.bgiframe&&this.menu.element.bgiframe()},destroy:function(){this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete").removeAttr("role").removeAttr("aria-autocomplete").removeAttr("aria-haspopup");
68
+ this.menu.element.remove();e.Widget.prototype.destroy.call(this)},_setOption:function(a,b){e.Widget.prototype._setOption.apply(this,arguments);a==="source"&&this._initSource();if(a==="appendTo")this.menu.element.appendTo(e(b||"body",this.element[0].ownerDocument)[0])},_initSource:function(){var a=this,b,c;if(e.isArray(this.options.source)){b=this.options.source;this.source=function(d,f){f(e.ui.autocomplete.filter(b,d.term))}}else if(typeof this.options.source==="string"){c=this.options.source;this.source=
69
+ function(d,f){a.xhr&&a.xhr.abort();a.xhr=e.getJSON(c,d,function(g,i,h){h===a.xhr&&f(g);a.xhr=null})}}else this.source=this.options.source},search:function(a,b){a=a!=null?a:this.element.val();this.term=this.element.val();if(a.length<this.options.minLength)return this.close(b);clearTimeout(this.closing);if(this._trigger("search")!==false)return this._search(a)},_search:function(a){this.element.addClass("ui-autocomplete-loading");this.source({term:a},this.response)},_response:function(a){if(a.length){a=
70
+ this._normalize(a);this._suggest(a);this._trigger("open")}else this.close();this.element.removeClass("ui-autocomplete-loading")},close:function(a){clearTimeout(this.closing);if(this.menu.element.is(":visible")){this._trigger("close",a);this.menu.element.hide();this.menu.deactivate()}},_change:function(a){this.previous!==this.element.val()&&this._trigger("change",a,{item:this.selectedItem})},_normalize:function(a){if(a.length&&a[0].label&&a[0].value)return a;return e.map(a,function(b){if(typeof b===
71
+ "string")return{label:b,value:b};return e.extend({label:b.label||b.value,value:b.value||b.label},b)})},_suggest:function(a){var b=this.menu.element.empty().zIndex(this.element.zIndex()+1),c;this._renderMenu(b,a);this.menu.deactivate();this.menu.refresh();this.menu.element.show().position(e.extend({of:this.element},this.options.position));a=b.width("").outerWidth();c=this.element.outerWidth();b.outerWidth(Math.max(a,c))},_renderMenu:function(a,b){var c=this;e.each(b,function(d,f){c._renderItem(a,f)})},
72
+ _renderItem:function(a,b){return e("<li></li>").data("item.autocomplete",b).append(e("<a></a>").text(b.label)).appendTo(a)},_move:function(a,b){if(this.menu.element.is(":visible"))if(this.menu.first()&&/^previous/.test(a)||this.menu.last()&&/^next/.test(a)){this.element.val(this.term);this.menu.deactivate()}else this.menu[a](b);else this.search(null,b)},widget:function(){return this.menu.element}});e.extend(e.ui.autocomplete,{escapeRegex:function(a){return a.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")},
73
+ filter:function(a,b){var c=new RegExp(e.ui.autocomplete.escapeRegex(b),"i");return e.grep(a,function(d){return c.test(d.label||d.value||d)})}})})(jQuery);
74
+ (function(e){e.widget("ui.menu",{_create:function(){var a=this;this.element.addClass("ui-menu ui-widget ui-widget-content ui-corner-all").attr({role:"listbox","aria-activedescendant":"ui-active-menuitem"}).click(function(b){if(e(b.target).closest(".ui-menu-item a").length){b.preventDefault();a.select(b)}});this.refresh()},refresh:function(){var a=this;this.element.children("li:not(.ui-menu-item):has(a)").addClass("ui-menu-item").attr("role","menuitem").children("a").addClass("ui-corner-all").attr("tabindex",
75
+ -1).mouseenter(function(b){a.activate(b,e(this).parent())}).mouseleave(function(){a.deactivate()})},activate:function(a,b){this.deactivate();if(this.hasScroll()){var c=b.offset().top-this.element.offset().top,d=this.element.attr("scrollTop"),f=this.element.height();if(c<0)this.element.attr("scrollTop",d+c);else c>=f&&this.element.attr("scrollTop",d+c-f+b.height())}this.active=b.eq(0).children("a").addClass("ui-state-hover").attr("id","ui-active-menuitem").end();this._trigger("focus",a,{item:b})},
76
+ deactivate:function(){if(this.active){this.active.children("a").removeClass("ui-state-hover").removeAttr("id");this._trigger("blur");this.active=null}},next:function(a){this.move("next",".ui-menu-item:first",a)},previous:function(a){this.move("prev",".ui-menu-item:last",a)},first:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},last:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},move:function(a,b,c){if(this.active){a=this.active[a+"All"](".ui-menu-item").eq(0);
77
+ a.length?this.activate(c,a):this.activate(c,this.element.children(b))}else this.activate(c,this.element.children(b))},nextPage:function(a){if(this.hasScroll())if(!this.active||this.last())this.activate(a,this.element.children(":first"));else{var b=this.active.offset().top,c=this.element.height(),d=this.element.children("li").filter(function(){var f=e(this).offset().top-b-c+e(this).height();return f<10&&f>-10});d.length||(d=this.element.children(":last"));this.activate(a,d)}else this.activate(a,this.element.children(!this.active||
78
+ this.last()?":first":":last"))},previousPage:function(a){if(this.hasScroll())if(!this.active||this.first())this.activate(a,this.element.children(":last"));else{var b=this.active.offset().top,c=this.element.height();result=this.element.children("li").filter(function(){var d=e(this).offset().top-b+c-e(this).height();return d<10&&d>-10});result.length||(result=this.element.children(":first"));this.activate(a,result)}else this.activate(a,this.element.children(!this.active||this.first()?":last":":first"))},
79
+ hasScroll:function(){return this.element.height()<this.element.attr("scrollHeight")},select:function(a){this._trigger("selected",a,{item:this.active})}})})(jQuery);
80
+ ;/*
81
+ * jQuery UI Datepicker 1.8.5
82
+ *
83
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
84
+ * Dual licensed under the MIT or GPL Version 2 licenses.
85
+ * http://jquery.org/license
86
+ *
87
+ * http://docs.jquery.com/UI/Datepicker
88
+ *
89
+ * Depends:
90
+ * jquery.ui.core.js
91
+ */
92
+ (function(d,G){function L(){this.debug=false;this._curInst=null;this._keyEvent=false;this._disabledInputs=[];this._inDialog=this._datepickerShowing=false;this._mainDivId="ui-datepicker-div";this._inlineClass="ui-datepicker-inline";this._appendClass="ui-datepicker-append";this._triggerClass="ui-datepicker-trigger";this._dialogClass="ui-datepicker-dialog";this._disableClass="ui-datepicker-disabled";this._unselectableClass="ui-datepicker-unselectable";this._currentClass="ui-datepicker-current-day";this._dayOverClass=
93
+ "ui-datepicker-days-cell-over";this.regional=[];this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su",
94
+ "Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:false,showMonthAfterYear:false,yearSuffix:""};this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:false,hideIfNoPrevNext:false,navigationAsDateFormat:false,gotoCurrent:false,changeMonth:false,changeYear:false,yearRange:"c-10:c+10",showOtherMonths:false,selectOtherMonths:false,showWeek:false,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",
95
+ minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:true,showButtonPanel:false,autoSize:false};d.extend(this._defaults,this.regional[""]);this.dpDiv=d('<div id="'+this._mainDivId+'" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all ui-helper-hidden-accessible"></div>')}function E(a,b){d.extend(a,
96
+ b);for(var c in b)if(b[c]==null||b[c]==G)a[c]=b[c];return a}d.extend(d.ui,{datepicker:{version:"1.8.5"}});var y=(new Date).getTime();d.extend(L.prototype,{markerClassName:"hasDatepicker",log:function(){this.debug&&console.log.apply("",arguments)},_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(a){E(this._defaults,a||{});return this},_attachDatepicker:function(a,b){var c=null;for(var e in this._defaults){var f=a.getAttribute("date:"+e);if(f){c=c||{};try{c[e]=eval(f)}catch(h){c[e]=
97
+ f}}}e=a.nodeName.toLowerCase();f=e=="div"||e=="span";if(!a.id){this.uuid+=1;a.id="dp"+this.uuid}var i=this._newInst(d(a),f);i.settings=d.extend({},b||{},c||{});if(e=="input")this._connectDatepicker(a,i);else f&&this._inlineDatepicker(a,i)},_newInst:function(a,b){return{id:a[0].id.replace(/([^A-Za-z0-9_])/g,"\\\\$1"),input:a,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:b,dpDiv:!b?this.dpDiv:d('<div class="'+this._inlineClass+' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>')}},
98
+ _connectDatepicker:function(a,b){var c=d(a);b.append=d([]);b.trigger=d([]);if(!c.hasClass(this.markerClassName)){this._attachments(c,b);c.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp).bind("setData.datepicker",function(e,f,h){b.settings[f]=h}).bind("getData.datepicker",function(e,f){return this._get(b,f)});this._autoSize(b);d.data(a,"datepicker",b)}},_attachments:function(a,b){var c=this._get(b,"appendText"),e=this._get(b,"isRTL");b.append&&
99
+ b.append.remove();if(c){b.append=d('<span class="'+this._appendClass+'">'+c+"</span>");a[e?"before":"after"](b.append)}a.unbind("focus",this._showDatepicker);b.trigger&&b.trigger.remove();c=this._get(b,"showOn");if(c=="focus"||c=="both")a.focus(this._showDatepicker);if(c=="button"||c=="both"){c=this._get(b,"buttonText");var f=this._get(b,"buttonImage");b.trigger=d(this._get(b,"buttonImageOnly")?d("<img/>").addClass(this._triggerClass).attr({src:f,alt:c,title:c}):d('<button type="button"></button>').addClass(this._triggerClass).html(f==
100
+ ""?c:d("<img/>").attr({src:f,alt:c,title:c})));a[e?"before":"after"](b.trigger);b.trigger.click(function(){d.datepicker._datepickerShowing&&d.datepicker._lastInput==a[0]?d.datepicker._hideDatepicker():d.datepicker._showDatepicker(a[0]);return false})}},_autoSize:function(a){if(this._get(a,"autoSize")&&!a.inline){var b=new Date(2009,11,20),c=this._get(a,"dateFormat");if(c.match(/[DM]/)){var e=function(f){for(var h=0,i=0,g=0;g<f.length;g++)if(f[g].length>h){h=f[g].length;i=g}return i};b.setMonth(e(this._get(a,
101
+ c.match(/MM/)?"monthNames":"monthNamesShort")));b.setDate(e(this._get(a,c.match(/DD/)?"dayNames":"dayNamesShort"))+20-b.getDay())}a.input.attr("size",this._formatDate(a,b).length)}},_inlineDatepicker:function(a,b){var c=d(a);if(!c.hasClass(this.markerClassName)){c.addClass(this.markerClassName).append(b.dpDiv).bind("setData.datepicker",function(e,f,h){b.settings[f]=h}).bind("getData.datepicker",function(e,f){return this._get(b,f)});d.data(a,"datepicker",b);this._setDate(b,this._getDefaultDate(b),
102
+ true);this._updateDatepicker(b);this._updateAlternate(b)}},_dialogDatepicker:function(a,b,c,e,f){a=this._dialogInst;if(!a){this.uuid+=1;this._dialogInput=d('<input type="text" id="'+("dp"+this.uuid)+'" style="position: absolute; top: -100px; width: 0px; z-index: -10;"/>');this._dialogInput.keydown(this._doKeyDown);d("body").append(this._dialogInput);a=this._dialogInst=this._newInst(this._dialogInput,false);a.settings={};d.data(this._dialogInput[0],"datepicker",a)}E(a.settings,e||{});b=b&&b.constructor==
103
+ Date?this._formatDate(a,b):b;this._dialogInput.val(b);this._pos=f?f.length?f:[f.pageX,f.pageY]:null;if(!this._pos)this._pos=[document.documentElement.clientWidth/2-100+(document.documentElement.scrollLeft||document.body.scrollLeft),document.documentElement.clientHeight/2-150+(document.documentElement.scrollTop||document.body.scrollTop)];this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px");a.settings.onSelect=c;this._inDialog=true;this.dpDiv.addClass(this._dialogClass);this._showDatepicker(this._dialogInput[0]);
104
+ d.blockUI&&d.blockUI(this.dpDiv);d.data(this._dialogInput[0],"datepicker",a);return this},_destroyDatepicker:function(a){var b=d(a),c=d.data(a,"datepicker");if(b.hasClass(this.markerClassName)){var e=a.nodeName.toLowerCase();d.removeData(a,"datepicker");if(e=="input"){c.append.remove();c.trigger.remove();b.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)}else if(e=="div"||e=="span")b.removeClass(this.markerClassName).empty()}},
105
+ _enableDatepicker:function(a){var b=d(a),c=d.data(a,"datepicker");if(b.hasClass(this.markerClassName)){var e=a.nodeName.toLowerCase();if(e=="input"){a.disabled=false;c.trigger.filter("button").each(function(){this.disabled=false}).end().filter("img").css({opacity:"1.0",cursor:""})}else if(e=="div"||e=="span")b.children("."+this._inlineClass).children().removeClass("ui-state-disabled");this._disabledInputs=d.map(this._disabledInputs,function(f){return f==a?null:f})}},_disableDatepicker:function(a){var b=
106
+ d(a),c=d.data(a,"datepicker");if(b.hasClass(this.markerClassName)){var e=a.nodeName.toLowerCase();if(e=="input"){a.disabled=true;c.trigger.filter("button").each(function(){this.disabled=true}).end().filter("img").css({opacity:"0.5",cursor:"default"})}else if(e=="div"||e=="span")b.children("."+this._inlineClass).children().addClass("ui-state-disabled");this._disabledInputs=d.map(this._disabledInputs,function(f){return f==a?null:f});this._disabledInputs[this._disabledInputs.length]=a}},_isDisabledDatepicker:function(a){if(!a)return false;
107
+ for(var b=0;b<this._disabledInputs.length;b++)if(this._disabledInputs[b]==a)return true;return false},_getInst:function(a){try{return d.data(a,"datepicker")}catch(b){throw"Missing instance data for this datepicker";}},_optionDatepicker:function(a,b,c){var e=this._getInst(a);if(arguments.length==2&&typeof b=="string")return b=="defaults"?d.extend({},d.datepicker._defaults):e?b=="all"?d.extend({},e.settings):this._get(e,b):null;var f=b||{};if(typeof b=="string"){f={};f[b]=c}if(e){this._curInst==e&&
108
+ this._hideDatepicker();var h=this._getDateDatepicker(a,true);E(e.settings,f);this._attachments(d(a),e);this._autoSize(e);this._setDateDatepicker(a,h);this._updateDatepicker(e)}},_changeDatepicker:function(a,b,c){this._optionDatepicker(a,b,c)},_refreshDatepicker:function(a){(a=this._getInst(a))&&this._updateDatepicker(a)},_setDateDatepicker:function(a,b){if(a=this._getInst(a)){this._setDate(a,b);this._updateDatepicker(a);this._updateAlternate(a)}},_getDateDatepicker:function(a,b){(a=this._getInst(a))&&
109
+ !a.inline&&this._setDateFromField(a,b);return a?this._getDate(a):null},_doKeyDown:function(a){var b=d.datepicker._getInst(a.target),c=true,e=b.dpDiv.is(".ui-datepicker-rtl");b._keyEvent=true;if(d.datepicker._datepickerShowing)switch(a.keyCode){case 9:d.datepicker._hideDatepicker();c=false;break;case 13:c=d("td."+d.datepicker._dayOverClass,b.dpDiv).add(d("td."+d.datepicker._currentClass,b.dpDiv));c[0]?d.datepicker._selectDay(a.target,b.selectedMonth,b.selectedYear,c[0]):d.datepicker._hideDatepicker();
110
+ return false;case 27:d.datepicker._hideDatepicker();break;case 33:d.datepicker._adjustDate(a.target,a.ctrlKey?-d.datepicker._get(b,"stepBigMonths"):-d.datepicker._get(b,"stepMonths"),"M");break;case 34:d.datepicker._adjustDate(a.target,a.ctrlKey?+d.datepicker._get(b,"stepBigMonths"):+d.datepicker._get(b,"stepMonths"),"M");break;case 35:if(a.ctrlKey||a.metaKey)d.datepicker._clearDate(a.target);c=a.ctrlKey||a.metaKey;break;case 36:if(a.ctrlKey||a.metaKey)d.datepicker._gotoToday(a.target);c=a.ctrlKey||
111
+ a.metaKey;break;case 37:if(a.ctrlKey||a.metaKey)d.datepicker._adjustDate(a.target,e?+1:-1,"D");c=a.ctrlKey||a.metaKey;if(a.originalEvent.altKey)d.datepicker._adjustDate(a.target,a.ctrlKey?-d.datepicker._get(b,"stepBigMonths"):-d.datepicker._get(b,"stepMonths"),"M");break;case 38:if(a.ctrlKey||a.metaKey)d.datepicker._adjustDate(a.target,-7,"D");c=a.ctrlKey||a.metaKey;break;case 39:if(a.ctrlKey||a.metaKey)d.datepicker._adjustDate(a.target,e?-1:+1,"D");c=a.ctrlKey||a.metaKey;if(a.originalEvent.altKey)d.datepicker._adjustDate(a.target,
112
+ a.ctrlKey?+d.datepicker._get(b,"stepBigMonths"):+d.datepicker._get(b,"stepMonths"),"M");break;case 40:if(a.ctrlKey||a.metaKey)d.datepicker._adjustDate(a.target,+7,"D");c=a.ctrlKey||a.metaKey;break;default:c=false}else if(a.keyCode==36&&a.ctrlKey)d.datepicker._showDatepicker(this);else c=false;if(c){a.preventDefault();a.stopPropagation()}},_doKeyPress:function(a){var b=d.datepicker._getInst(a.target);if(d.datepicker._get(b,"constrainInput")){b=d.datepicker._possibleChars(d.datepicker._get(b,"dateFormat"));
113
+ var c=String.fromCharCode(a.charCode==G?a.keyCode:a.charCode);return a.ctrlKey||c<" "||!b||b.indexOf(c)>-1}},_doKeyUp:function(a){a=d.datepicker._getInst(a.target);if(a.input.val()!=a.lastVal)try{if(d.datepicker.parseDate(d.datepicker._get(a,"dateFormat"),a.input?a.input.val():null,d.datepicker._getFormatConfig(a))){d.datepicker._setDateFromField(a);d.datepicker._updateAlternate(a);d.datepicker._updateDatepicker(a)}}catch(b){d.datepicker.log(b)}return true},_showDatepicker:function(a){a=a.target||
114
+ a;if(a.nodeName.toLowerCase()!="input")a=d("input",a.parentNode)[0];if(!(d.datepicker._isDisabledDatepicker(a)||d.datepicker._lastInput==a)){var b=d.datepicker._getInst(a);d.datepicker._curInst&&d.datepicker._curInst!=b&&d.datepicker._curInst.dpDiv.stop(true,true);var c=d.datepicker._get(b,"beforeShow");E(b.settings,c?c.apply(a,[a,b]):{});b.lastVal=null;d.datepicker._lastInput=a;d.datepicker._setDateFromField(b);if(d.datepicker._inDialog)a.value="";if(!d.datepicker._pos){d.datepicker._pos=d.datepicker._findPos(a);
115
+ d.datepicker._pos[1]+=a.offsetHeight}var e=false;d(a).parents().each(function(){e|=d(this).css("position")=="fixed";return!e});if(e&&d.browser.opera){d.datepicker._pos[0]-=document.documentElement.scrollLeft;d.datepicker._pos[1]-=document.documentElement.scrollTop}c={left:d.datepicker._pos[0],top:d.datepicker._pos[1]};d.datepicker._pos=null;b.dpDiv.css({position:"absolute",display:"block",top:"-1000px"});d.datepicker._updateDatepicker(b);c=d.datepicker._checkOffset(b,c,e);b.dpDiv.css({position:d.datepicker._inDialog&&
116
+ d.blockUI?"static":e?"fixed":"absolute",display:"none",left:c.left+"px",top:c.top+"px"});if(!b.inline){c=d.datepicker._get(b,"showAnim");var f=d.datepicker._get(b,"duration"),h=function(){d.datepicker._datepickerShowing=true;var i=d.datepicker._getBorders(b.dpDiv);b.dpDiv.find("iframe.ui-datepicker-cover").css({left:-i[0],top:-i[1],width:b.dpDiv.outerWidth(),height:b.dpDiv.outerHeight()})};b.dpDiv.zIndex(d(a).zIndex()+1);d.effects&&d.effects[c]?b.dpDiv.show(c,d.datepicker._get(b,"showOptions"),f,
117
+ h):b.dpDiv[c||"show"](c?f:null,h);if(!c||!f)h();b.input.is(":visible")&&!b.input.is(":disabled")&&b.input.focus();d.datepicker._curInst=b}}},_updateDatepicker:function(a){var b=this,c=d.datepicker._getBorders(a.dpDiv);a.dpDiv.empty().append(this._generateHTML(a)).find("iframe.ui-datepicker-cover").css({left:-c[0],top:-c[1],width:a.dpDiv.outerWidth(),height:a.dpDiv.outerHeight()}).end().find("button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a").bind("mouseout",function(){d(this).removeClass("ui-state-hover");
118
+ this.className.indexOf("ui-datepicker-prev")!=-1&&d(this).removeClass("ui-datepicker-prev-hover");this.className.indexOf("ui-datepicker-next")!=-1&&d(this).removeClass("ui-datepicker-next-hover")}).bind("mouseover",function(){if(!b._isDisabledDatepicker(a.inline?a.dpDiv.parent()[0]:a.input[0])){d(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover");d(this).addClass("ui-state-hover");this.className.indexOf("ui-datepicker-prev")!=-1&&d(this).addClass("ui-datepicker-prev-hover");
119
+ this.className.indexOf("ui-datepicker-next")!=-1&&d(this).addClass("ui-datepicker-next-hover")}}).end().find("."+this._dayOverClass+" a").trigger("mouseover").end();c=this._getNumberOfMonths(a);var e=c[1];e>1?a.dpDiv.addClass("ui-datepicker-multi-"+e).css("width",17*e+"em"):a.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width("");a.dpDiv[(c[0]!=1||c[1]!=1?"add":"remove")+"Class"]("ui-datepicker-multi");a.dpDiv[(this._get(a,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl");
120
+ a==d.datepicker._curInst&&d.datepicker._datepickerShowing&&a.input&&a.input.is(":visible")&&!a.input.is(":disabled")&&a.input.focus()},_getBorders:function(a){var b=function(c){return{thin:1,medium:2,thick:3}[c]||c};return[parseFloat(b(a.css("border-left-width"))),parseFloat(b(a.css("border-top-width")))]},_checkOffset:function(a,b,c){var e=a.dpDiv.outerWidth(),f=a.dpDiv.outerHeight(),h=a.input?a.input.outerWidth():0,i=a.input?a.input.outerHeight():0,g=document.documentElement.clientWidth+d(document).scrollLeft(),
121
+ k=document.documentElement.clientHeight+d(document).scrollTop();b.left-=this._get(a,"isRTL")?e-h:0;b.left-=c&&b.left==a.input.offset().left?d(document).scrollLeft():0;b.top-=c&&b.top==a.input.offset().top+i?d(document).scrollTop():0;b.left-=Math.min(b.left,b.left+e>g&&g>e?Math.abs(b.left+e-g):0);b.top-=Math.min(b.top,b.top+f>k&&k>f?Math.abs(f+i):0);return b},_findPos:function(a){for(var b=this._get(this._getInst(a),"isRTL");a&&(a.type=="hidden"||a.nodeType!=1);)a=a[b?"previousSibling":"nextSibling"];
122
+ a=d(a).offset();return[a.left,a.top]},_hideDatepicker:function(a){var b=this._curInst;if(!(!b||a&&b!=d.data(a,"datepicker")))if(this._datepickerShowing){a=this._get(b,"showAnim");var c=this._get(b,"duration"),e=function(){d.datepicker._tidyDialog(b);this._curInst=null};d.effects&&d.effects[a]?b.dpDiv.hide(a,d.datepicker._get(b,"showOptions"),c,e):b.dpDiv[a=="slideDown"?"slideUp":a=="fadeIn"?"fadeOut":"hide"](a?c:null,e);a||e();if(a=this._get(b,"onClose"))a.apply(b.input?b.input[0]:null,[b.input?b.input.val():
123
+ "",b]);this._datepickerShowing=false;this._lastInput=null;if(this._inDialog){this._dialogInput.css({position:"absolute",left:"0",top:"-100px"});if(d.blockUI){d.unblockUI();d("body").append(this.dpDiv)}}this._inDialog=false}},_tidyDialog:function(a){a.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(a){if(d.datepicker._curInst){a=d(a.target);a[0].id!=d.datepicker._mainDivId&&a.parents("#"+d.datepicker._mainDivId).length==0&&!a.hasClass(d.datepicker.markerClassName)&&
124
+ !a.hasClass(d.datepicker._triggerClass)&&d.datepicker._datepickerShowing&&!(d.datepicker._inDialog&&d.blockUI)&&d.datepicker._hideDatepicker()}},_adjustDate:function(a,b,c){a=d(a);var e=this._getInst(a[0]);if(!this._isDisabledDatepicker(a[0])){this._adjustInstDate(e,b+(c=="M"?this._get(e,"showCurrentAtPos"):0),c);this._updateDatepicker(e)}},_gotoToday:function(a){a=d(a);var b=this._getInst(a[0]);if(this._get(b,"gotoCurrent")&&b.currentDay){b.selectedDay=b.currentDay;b.drawMonth=b.selectedMonth=b.currentMonth;
125
+ b.drawYear=b.selectedYear=b.currentYear}else{var c=new Date;b.selectedDay=c.getDate();b.drawMonth=b.selectedMonth=c.getMonth();b.drawYear=b.selectedYear=c.getFullYear()}this._notifyChange(b);this._adjustDate(a)},_selectMonthYear:function(a,b,c){a=d(a);var e=this._getInst(a[0]);e._selectingMonthYear=false;e["selected"+(c=="M"?"Month":"Year")]=e["draw"+(c=="M"?"Month":"Year")]=parseInt(b.options[b.selectedIndex].value,10);this._notifyChange(e);this._adjustDate(a)},_clickMonthYear:function(a){var b=
126
+ this._getInst(d(a)[0]);b.input&&b._selectingMonthYear&&setTimeout(function(){b.input.focus()},0);b._selectingMonthYear=!b._selectingMonthYear},_selectDay:function(a,b,c,e){var f=d(a);if(!(d(e).hasClass(this._unselectableClass)||this._isDisabledDatepicker(f[0]))){f=this._getInst(f[0]);f.selectedDay=f.currentDay=d("a",e).html();f.selectedMonth=f.currentMonth=b;f.selectedYear=f.currentYear=c;this._selectDate(a,this._formatDate(f,f.currentDay,f.currentMonth,f.currentYear))}},_clearDate:function(a){a=
127
+ d(a);this._getInst(a[0]);this._selectDate(a,"")},_selectDate:function(a,b){a=this._getInst(d(a)[0]);b=b!=null?b:this._formatDate(a);a.input&&a.input.val(b);this._updateAlternate(a);var c=this._get(a,"onSelect");if(c)c.apply(a.input?a.input[0]:null,[b,a]);else a.input&&a.input.trigger("change");if(a.inline)this._updateDatepicker(a);else{this._hideDatepicker();this._lastInput=a.input[0];typeof a.input[0]!="object"&&a.input.focus();this._lastInput=null}},_updateAlternate:function(a){var b=this._get(a,
128
+ "altField");if(b){var c=this._get(a,"altFormat")||this._get(a,"dateFormat"),e=this._getDate(a),f=this.formatDate(c,e,this._getFormatConfig(a));d(b).each(function(){d(this).val(f)})}},noWeekends:function(a){a=a.getDay();return[a>0&&a<6,""]},iso8601Week:function(a){a=new Date(a.getTime());a.setDate(a.getDate()+4-(a.getDay()||7));var b=a.getTime();a.setMonth(0);a.setDate(1);return Math.floor(Math.round((b-a)/864E5)/7)+1},parseDate:function(a,b,c){if(a==null||b==null)throw"Invalid arguments";b=typeof b==
129
+ "object"?b.toString():b+"";if(b=="")return null;for(var e=(c?c.shortYearCutoff:null)||this._defaults.shortYearCutoff,f=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,h=(c?c.dayNames:null)||this._defaults.dayNames,i=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort,g=(c?c.monthNames:null)||this._defaults.monthNames,k=c=-1,l=-1,u=-1,j=false,o=function(p){(p=z+1<a.length&&a.charAt(z+1)==p)&&z++;return p},m=function(p){o(p);p=new RegExp("^\\d{1,"+(p=="@"?14:p=="!"?20:p=="y"?4:p=="o"?
130
+ 3:2)+"}");p=b.substring(s).match(p);if(!p)throw"Missing number at position "+s;s+=p[0].length;return parseInt(p[0],10)},n=function(p,w,H){p=o(p)?H:w;for(w=0;w<p.length;w++)if(b.substr(s,p[w].length).toLowerCase()==p[w].toLowerCase()){s+=p[w].length;return w+1}throw"Unknown name at position "+s;},r=function(){if(b.charAt(s)!=a.charAt(z))throw"Unexpected literal at position "+s;s++},s=0,z=0;z<a.length;z++)if(j)if(a.charAt(z)=="'"&&!o("'"))j=false;else r();else switch(a.charAt(z)){case "d":l=m("d");
131
+ break;case "D":n("D",f,h);break;case "o":u=m("o");break;case "m":k=m("m");break;case "M":k=n("M",i,g);break;case "y":c=m("y");break;case "@":var v=new Date(m("@"));c=v.getFullYear();k=v.getMonth()+1;l=v.getDate();break;case "!":v=new Date((m("!")-this._ticksTo1970)/1E4);c=v.getFullYear();k=v.getMonth()+1;l=v.getDate();break;case "'":if(o("'"))r();else j=true;break;default:r()}if(c==-1)c=(new Date).getFullYear();else if(c<100)c+=(new Date).getFullYear()-(new Date).getFullYear()%100+(c<=e?0:-100);if(u>
132
+ -1){k=1;l=u;do{e=this._getDaysInMonth(c,k-1);if(l<=e)break;k++;l-=e}while(1)}v=this._daylightSavingAdjust(new Date(c,k-1,l));if(v.getFullYear()!=c||v.getMonth()+1!=k||v.getDate()!=l)throw"Invalid date";return v},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925))*24*
133
+ 60*60*1E7,formatDate:function(a,b,c){if(!b)return"";var e=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,f=(c?c.dayNames:null)||this._defaults.dayNames,h=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort;c=(c?c.monthNames:null)||this._defaults.monthNames;var i=function(o){(o=j+1<a.length&&a.charAt(j+1)==o)&&j++;return o},g=function(o,m,n){m=""+m;if(i(o))for(;m.length<n;)m="0"+m;return m},k=function(o,m,n,r){return i(o)?r[m]:n[m]},l="",u=false;if(b)for(var j=0;j<a.length;j++)if(u)if(a.charAt(j)==
134
+ "'"&&!i("'"))u=false;else l+=a.charAt(j);else switch(a.charAt(j)){case "d":l+=g("d",b.getDate(),2);break;case "D":l+=k("D",b.getDay(),e,f);break;case "o":l+=g("o",(b.getTime()-(new Date(b.getFullYear(),0,0)).getTime())/864E5,3);break;case "m":l+=g("m",b.getMonth()+1,2);break;case "M":l+=k("M",b.getMonth(),h,c);break;case "y":l+=i("y")?b.getFullYear():(b.getYear()%100<10?"0":"")+b.getYear()%100;break;case "@":l+=b.getTime();break;case "!":l+=b.getTime()*1E4+this._ticksTo1970;break;case "'":if(i("'"))l+=
135
+ "'";else u=true;break;default:l+=a.charAt(j)}return l},_possibleChars:function(a){for(var b="",c=false,e=function(h){(h=f+1<a.length&&a.charAt(f+1)==h)&&f++;return h},f=0;f<a.length;f++)if(c)if(a.charAt(f)=="'"&&!e("'"))c=false;else b+=a.charAt(f);else switch(a.charAt(f)){case "d":case "m":case "y":case "@":b+="0123456789";break;case "D":case "M":return null;case "'":if(e("'"))b+="'";else c=true;break;default:b+=a.charAt(f)}return b},_get:function(a,b){return a.settings[b]!==G?a.settings[b]:this._defaults[b]},
136
+ _setDateFromField:function(a,b){if(a.input.val()!=a.lastVal){var c=this._get(a,"dateFormat"),e=a.lastVal=a.input?a.input.val():null,f,h;f=h=this._getDefaultDate(a);var i=this._getFormatConfig(a);try{f=this.parseDate(c,e,i)||h}catch(g){this.log(g);e=b?"":e}a.selectedDay=f.getDate();a.drawMonth=a.selectedMonth=f.getMonth();a.drawYear=a.selectedYear=f.getFullYear();a.currentDay=e?f.getDate():0;a.currentMonth=e?f.getMonth():0;a.currentYear=e?f.getFullYear():0;this._adjustInstDate(a)}},_getDefaultDate:function(a){return this._restrictMinMax(a,
137
+ this._determineDate(a,this._get(a,"defaultDate"),new Date))},_determineDate:function(a,b,c){var e=function(h){var i=new Date;i.setDate(i.getDate()+h);return i},f=function(h){try{return d.datepicker.parseDate(d.datepicker._get(a,"dateFormat"),h,d.datepicker._getFormatConfig(a))}catch(i){}var g=(h.toLowerCase().match(/^c/)?d.datepicker._getDate(a):null)||new Date,k=g.getFullYear(),l=g.getMonth();g=g.getDate();for(var u=/([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,j=u.exec(h);j;){switch(j[2]||"d"){case "d":case "D":g+=
138
+ parseInt(j[1],10);break;case "w":case "W":g+=parseInt(j[1],10)*7;break;case "m":case "M":l+=parseInt(j[1],10);g=Math.min(g,d.datepicker._getDaysInMonth(k,l));break;case "y":case "Y":k+=parseInt(j[1],10);g=Math.min(g,d.datepicker._getDaysInMonth(k,l));break}j=u.exec(h)}return new Date(k,l,g)};if(b=(b=b==null?c:typeof b=="string"?f(b):typeof b=="number"?isNaN(b)?c:e(b):b)&&b.toString()=="Invalid Date"?c:b){b.setHours(0);b.setMinutes(0);b.setSeconds(0);b.setMilliseconds(0)}return this._daylightSavingAdjust(b)},
139
+ _daylightSavingAdjust:function(a){if(!a)return null;a.setHours(a.getHours()>12?a.getHours()+2:0);return a},_setDate:function(a,b,c){var e=!b,f=a.selectedMonth,h=a.selectedYear;b=this._restrictMinMax(a,this._determineDate(a,b,new Date));a.selectedDay=a.currentDay=b.getDate();a.drawMonth=a.selectedMonth=a.currentMonth=b.getMonth();a.drawYear=a.selectedYear=a.currentYear=b.getFullYear();if((f!=a.selectedMonth||h!=a.selectedYear)&&!c)this._notifyChange(a);this._adjustInstDate(a);if(a.input)a.input.val(e?
140
+ "":this._formatDate(a))},_getDate:function(a){return!a.currentYear||a.input&&a.input.val()==""?null:this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay))},_generateHTML:function(a){var b=new Date;b=this._daylightSavingAdjust(new Date(b.getFullYear(),b.getMonth(),b.getDate()));var c=this._get(a,"isRTL"),e=this._get(a,"showButtonPanel"),f=this._get(a,"hideIfNoPrevNext"),h=this._get(a,"navigationAsDateFormat"),i=this._getNumberOfMonths(a),g=this._get(a,"showCurrentAtPos"),k=
141
+ this._get(a,"stepMonths"),l=i[0]!=1||i[1]!=1,u=this._daylightSavingAdjust(!a.currentDay?new Date(9999,9,9):new Date(a.currentYear,a.currentMonth,a.currentDay)),j=this._getMinMaxDate(a,"min"),o=this._getMinMaxDate(a,"max");g=a.drawMonth-g;var m=a.drawYear;if(g<0){g+=12;m--}if(o){var n=this._daylightSavingAdjust(new Date(o.getFullYear(),o.getMonth()-i[0]*i[1]+1,o.getDate()));for(n=j&&n<j?j:n;this._daylightSavingAdjust(new Date(m,g,1))>n;){g--;if(g<0){g=11;m--}}}a.drawMonth=g;a.drawYear=m;n=this._get(a,
142
+ "prevText");n=!h?n:this.formatDate(n,this._daylightSavingAdjust(new Date(m,g-k,1)),this._getFormatConfig(a));n=this._canAdjustMonth(a,-1,m,g)?'<a class="ui-datepicker-prev ui-corner-all" onclick="DP_jQuery_'+y+".datepicker._adjustDate('#"+a.id+"', -"+k+", 'M');\" title=\""+n+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"e":"w")+'">'+n+"</span></a>":f?"":'<a class="ui-datepicker-prev ui-corner-all ui-state-disabled" title="'+n+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"e":"w")+'">'+
143
+ n+"</span></a>";var r=this._get(a,"nextText");r=!h?r:this.formatDate(r,this._daylightSavingAdjust(new Date(m,g+k,1)),this._getFormatConfig(a));f=this._canAdjustMonth(a,+1,m,g)?'<a class="ui-datepicker-next ui-corner-all" onclick="DP_jQuery_'+y+".datepicker._adjustDate('#"+a.id+"', +"+k+", 'M');\" title=\""+r+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"w":"e")+'">'+r+"</span></a>":f?"":'<a class="ui-datepicker-next ui-corner-all ui-state-disabled" title="'+r+'"><span class="ui-icon ui-icon-circle-triangle-'+
144
+ (c?"w":"e")+'">'+r+"</span></a>";k=this._get(a,"currentText");r=this._get(a,"gotoCurrent")&&a.currentDay?u:b;k=!h?k:this.formatDate(k,r,this._getFormatConfig(a));h=!a.inline?'<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" onclick="DP_jQuery_'+y+'.datepicker._hideDatepicker();">'+this._get(a,"closeText")+"</button>":"";e=e?'<div class="ui-datepicker-buttonpane ui-widget-content">'+(c?h:"")+(this._isInRange(a,r)?'<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" onclick="DP_jQuery_'+
145
+ y+".datepicker._gotoToday('#"+a.id+"');\">"+k+"</button>":"")+(c?"":h)+"</div>":"";h=parseInt(this._get(a,"firstDay"),10);h=isNaN(h)?0:h;k=this._get(a,"showWeek");r=this._get(a,"dayNames");this._get(a,"dayNamesShort");var s=this._get(a,"dayNamesMin"),z=this._get(a,"monthNames"),v=this._get(a,"monthNamesShort"),p=this._get(a,"beforeShowDay"),w=this._get(a,"showOtherMonths"),H=this._get(a,"selectOtherMonths");this._get(a,"calculateWeek");for(var M=this._getDefaultDate(a),I="",C=0;C<i[0];C++){for(var N=
146
+ "",D=0;D<i[1];D++){var J=this._daylightSavingAdjust(new Date(m,g,a.selectedDay)),t=" ui-corner-all",x="";if(l){x+='<div class="ui-datepicker-group';if(i[1]>1)switch(D){case 0:x+=" ui-datepicker-group-first";t=" ui-corner-"+(c?"right":"left");break;case i[1]-1:x+=" ui-datepicker-group-last";t=" ui-corner-"+(c?"left":"right");break;default:x+=" ui-datepicker-group-middle";t="";break}x+='">'}x+='<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix'+t+'">'+(/all|left/.test(t)&&C==0?c?
147
+ f:n:"")+(/all|right/.test(t)&&C==0?c?n:f:"")+this._generateMonthYearHeader(a,g,m,j,o,C>0||D>0,z,v)+'</div><table class="ui-datepicker-calendar"><thead><tr>';var A=k?'<th class="ui-datepicker-week-col">'+this._get(a,"weekHeader")+"</th>":"";for(t=0;t<7;t++){var q=(t+h)%7;A+="<th"+((t+h+6)%7>=5?' class="ui-datepicker-week-end"':"")+'><span title="'+r[q]+'">'+s[q]+"</span></th>"}x+=A+"</tr></thead><tbody>";A=this._getDaysInMonth(m,g);if(m==a.selectedYear&&g==a.selectedMonth)a.selectedDay=Math.min(a.selectedDay,
148
+ A);t=(this._getFirstDayOfMonth(m,g)-h+7)%7;A=l?6:Math.ceil((t+A)/7);q=this._daylightSavingAdjust(new Date(m,g,1-t));for(var O=0;O<A;O++){x+="<tr>";var P=!k?"":'<td class="ui-datepicker-week-col">'+this._get(a,"calculateWeek")(q)+"</td>";for(t=0;t<7;t++){var F=p?p.apply(a.input?a.input[0]:null,[q]):[true,""],B=q.getMonth()!=g,K=B&&!H||!F[0]||j&&q<j||o&&q>o;P+='<td class="'+((t+h+6)%7>=5?" ui-datepicker-week-end":"")+(B?" ui-datepicker-other-month":"")+(q.getTime()==J.getTime()&&g==a.selectedMonth&&
149
+ a._keyEvent||M.getTime()==q.getTime()&&M.getTime()==J.getTime()?" "+this._dayOverClass:"")+(K?" "+this._unselectableClass+" ui-state-disabled":"")+(B&&!w?"":" "+F[1]+(q.getTime()==u.getTime()?" "+this._currentClass:"")+(q.getTime()==b.getTime()?" ui-datepicker-today":""))+'"'+((!B||w)&&F[2]?' title="'+F[2]+'"':"")+(K?"":' onclick="DP_jQuery_'+y+".datepicker._selectDay('#"+a.id+"',"+q.getMonth()+","+q.getFullYear()+', this);return false;"')+">"+(B&&!w?"&#xa0;":K?'<span class="ui-state-default">'+q.getDate()+
150
+ "</span>":'<a class="ui-state-default'+(q.getTime()==b.getTime()?" ui-state-highlight":"")+(q.getTime()==J.getTime()?" ui-state-active":"")+(B?" ui-priority-secondary":"")+'" href="#">'+q.getDate()+"</a>")+"</td>";q.setDate(q.getDate()+1);q=this._daylightSavingAdjust(q)}x+=P+"</tr>"}g++;if(g>11){g=0;m++}x+="</tbody></table>"+(l?"</div>"+(i[0]>0&&D==i[1]-1?'<div class="ui-datepicker-row-break"></div>':""):"");N+=x}I+=N}I+=e+(d.browser.msie&&parseInt(d.browser.version,10)<7&&!a.inline?'<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>':
151
+ "");a._keyEvent=false;return I},_generateMonthYearHeader:function(a,b,c,e,f,h,i,g){var k=this._get(a,"changeMonth"),l=this._get(a,"changeYear"),u=this._get(a,"showMonthAfterYear"),j='<div class="ui-datepicker-title">',o="";if(h||!k)o+='<span class="ui-datepicker-month">'+i[b]+"</span>";else{i=e&&e.getFullYear()==c;var m=f&&f.getFullYear()==c;o+='<select class="ui-datepicker-month" onchange="DP_jQuery_'+y+".datepicker._selectMonthYear('#"+a.id+"', this, 'M');\" onclick=\"DP_jQuery_"+y+".datepicker._clickMonthYear('#"+
152
+ a.id+"');\">";for(var n=0;n<12;n++)if((!i||n>=e.getMonth())&&(!m||n<=f.getMonth()))o+='<option value="'+n+'"'+(n==b?' selected="selected"':"")+">"+g[n]+"</option>";o+="</select>"}u||(j+=o+(h||!(k&&l)?"&#xa0;":""));if(h||!l)j+='<span class="ui-datepicker-year">'+c+"</span>";else{g=this._get(a,"yearRange").split(":");var r=(new Date).getFullYear();i=function(s){s=s.match(/c[+-].*/)?c+parseInt(s.substring(1),10):s.match(/[+-].*/)?r+parseInt(s,10):parseInt(s,10);return isNaN(s)?r:s};b=i(g[0]);g=Math.max(b,
153
+ i(g[1]||""));b=e?Math.max(b,e.getFullYear()):b;g=f?Math.min(g,f.getFullYear()):g;for(j+='<select class="ui-datepicker-year" onchange="DP_jQuery_'+y+".datepicker._selectMonthYear('#"+a.id+"', this, 'Y');\" onclick=\"DP_jQuery_"+y+".datepicker._clickMonthYear('#"+a.id+"');\">";b<=g;b++)j+='<option value="'+b+'"'+(b==c?' selected="selected"':"")+">"+b+"</option>";j+="</select>"}j+=this._get(a,"yearSuffix");if(u)j+=(h||!(k&&l)?"&#xa0;":"")+o;j+="</div>";return j},_adjustInstDate:function(a,b,c){var e=
154
+ a.drawYear+(c=="Y"?b:0),f=a.drawMonth+(c=="M"?b:0);b=Math.min(a.selectedDay,this._getDaysInMonth(e,f))+(c=="D"?b:0);e=this._restrictMinMax(a,this._daylightSavingAdjust(new Date(e,f,b)));a.selectedDay=e.getDate();a.drawMonth=a.selectedMonth=e.getMonth();a.drawYear=a.selectedYear=e.getFullYear();if(c=="M"||c=="Y")this._notifyChange(a)},_restrictMinMax:function(a,b){var c=this._getMinMaxDate(a,"min");a=this._getMinMaxDate(a,"max");b=c&&b<c?c:b;return b=a&&b>a?a:b},_notifyChange:function(a){var b=this._get(a,
155
+ "onChangeMonthYear");if(b)b.apply(a.input?a.input[0]:null,[a.selectedYear,a.selectedMonth+1,a])},_getNumberOfMonths:function(a){a=this._get(a,"numberOfMonths");return a==null?[1,1]:typeof a=="number"?[1,a]:a},_getMinMaxDate:function(a,b){return this._determineDate(a,this._get(a,b+"Date"),null)},_getDaysInMonth:function(a,b){return 32-(new Date(a,b,32)).getDate()},_getFirstDayOfMonth:function(a,b){return(new Date(a,b,1)).getDay()},_canAdjustMonth:function(a,b,c,e){var f=this._getNumberOfMonths(a);
156
+ c=this._daylightSavingAdjust(new Date(c,e+(b<0?b:f[0]*f[1]),1));b<0&&c.setDate(this._getDaysInMonth(c.getFullYear(),c.getMonth()));return this._isInRange(a,c)},_isInRange:function(a,b){var c=this._getMinMaxDate(a,"min");a=this._getMinMaxDate(a,"max");return(!c||b.getTime()>=c.getTime())&&(!a||b.getTime()<=a.getTime())},_getFormatConfig:function(a){var b=this._get(a,"shortYearCutoff");b=typeof b!="string"?b:(new Date).getFullYear()%100+parseInt(b,10);return{shortYearCutoff:b,dayNamesShort:this._get(a,
157
+ "dayNamesShort"),dayNames:this._get(a,"dayNames"),monthNamesShort:this._get(a,"monthNamesShort"),monthNames:this._get(a,"monthNames")}},_formatDate:function(a,b,c,e){if(!b){a.currentDay=a.selectedDay;a.currentMonth=a.selectedMonth;a.currentYear=a.selectedYear}b=b?typeof b=="object"?b:this._daylightSavingAdjust(new Date(e,c,b)):this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay));return this.formatDate(this._get(a,"dateFormat"),b,this._getFormatConfig(a))}});d.fn.datepicker=
158
+ function(a){if(!d.datepicker.initialized){d(document).mousedown(d.datepicker._checkExternalClick).find("body").append(d.datepicker.dpDiv);d.datepicker.initialized=true}var b=Array.prototype.slice.call(arguments,1);if(typeof a=="string"&&(a=="isDisabled"||a=="getDate"||a=="widget"))return d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this[0]].concat(b));if(a=="option"&&arguments.length==2&&typeof arguments[1]=="string")return d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this[0]].concat(b));
159
+ return this.each(function(){typeof a=="string"?d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this].concat(b)):d.datepicker._attachDatepicker(this,a)})};d.datepicker=new L;d.datepicker.initialized=false;d.datepicker.uuid=(new Date).getTime();d.datepicker.version="1.8.5";window["DP_jQuery_"+y]=d})(jQuery);
160
+ ;
{js → includes/js}/timeentry/jquery.timeentry-de.js RENAMED
File without changes
{js → includes/js}/timeentry/jquery.timeentry-es.js RENAMED
File without changes
{js → includes/js}/timeentry/jquery.timeentry-fr.js RENAMED
File without changes
{js → includes/js}/timeentry/jquery.timeentry-hu.js RENAMED
File without changes
{js → includes/js}/timeentry/jquery.timeentry-it.js RENAMED
File without changes
{js → includes/js}/timeentry/jquery.timeentry-nl.js RENAMED
File without changes
{js → includes/js}/timeentry/jquery.timeentry-pl.js RENAMED
File without changes
{js → includes/js}/timeentry/jquery.timeentry-pt.js RENAMED
File without changes
{js → includes/js}/timeentry/jquery.timeentry-ro.js RENAMED
File without changes
{js → includes/js}/timeentry/jquery.timeentry-ru.js RENAMED
File without changes
{js → includes/js}/timeentry/jquery.timeentry-sk.js RENAMED
File without changes
{js → includes/js}/timeentry/jquery.timeentry-sv.js RENAMED
File without changes
{js → includes/js}/timeentry/jquery.timeentry-tr.js RENAMED
File without changes
{js → includes/js}/timeentry/jquery.timeentry-zh-CN.js RENAMED
File without changes
{js → includes/js}/timeentry/jquery.timeentry.compat-1.2.6.js RENAMED
File without changes
{js → includes/js}/timeentry/jquery.timeentry.css RENAMED
File without changes
{js → includes/js}/timeentry/jquery.timeentry.ent RENAMED
File without changes
{js → includes/js}/timeentry/jquery.timeentry.js RENAMED
File without changes
{js → includes/js}/timeentry/jquery.timeentry.min.js RENAMED
File without changes
{js → includes/js}/timeentry/jquery.timeentry.pack.js RENAMED
File without changes
{js → includes/js}/timeentry/timeEntry.png RENAMED
File without changes
{js → includes/js}/timeentry/timeEntry2.png RENAMED
File without changes
{js → includes/js}/timeentry/timeEntry3.png RENAMED
File without changes
{js → includes/js}/timeentry/timeEntry4.png RENAMED
File without changes
{js → includes/js}/timeentry/timeEntry5.png RENAMED
File without changes
{js → includes/js}/timeentry/timeEntry6.png RENAMED
File without changes
{langs → includes/langs}/dbem-cs_CZ.mo RENAMED
File without changes
{langs → includes/langs}/dbem-cs_CZ.po RENAMED
File without changes
{langs → includes/langs}/dbem-de_DE.mo RENAMED
File without changes
{langs → includes/langs}/dbem-es_ES.mo RENAMED
File without changes
{langs → includes/langs}/dbem-es_ES.po RENAMED
File without changes
{langs → includes/langs}/dbem-it_IT.mo RENAMED
File without changes
{langs → includes/langs}/dbem-it_IT.po RENAMED
File without changes
{langs → includes/langs}/dbem-pt_BR.mo RENAMED
File without changes
{langs → includes/langs}/dbem-pt_BR.po RENAMED
File without changes
{langs → includes/langs}/dbem-sv_SE.mo RENAMED
File without changes
{langs → includes/langs}/dbem-sv_SE.po RENAMED
File without changes
includes/sample-placeholers/event-single.html ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <table>
2
+ <tr>
3
+ <th style="width:150px;">When? </th>
4
+ <td>
5
+ Date(s) - #j #M #Y #@_{ \u\n\t\i\l j M Y}<br />
6
+ Time (24h Format) - #_24HSTARTTIME - #_24HENDTIME<br />
7
+ Time (12h Format) - #_12HSTARTTIME - #_12HENDTIME
8
+ </td>
9
+ </tr>
10
+ <tr>
11
+ <th>What? </th>
12
+ <td>
13
+ <h3>#_NAME</h3>
14
+ #_NOTES
15
+ </td>
16
+ </tr>
17
+ <tr>
18
+ <th>
19
+ Price<br />
20
+ Dress Code<br />
21
+ Available Seats
22
+ </th>
23
+ <td>
24
+ #_ATT{Price}{Free}<br />
25
+ #_ATT{Dress Code}{Informal}<br />
26
+ #_AVAILABLESEATS / #_SEATS
27
+ </td>
28
+ </tr>
29
+ <tr>
30
+ <th>Who? </th>
31
+ <td>
32
+ #_CONTACTNAME (aka #_CONTACTPERSON)<br />
33
+ #_CONTACTEMAIL<br />
34
+ #_CONTACTPHONE
35
+ </td>
36
+ </tr>
37
+ <tr>
38
+ <td colspan="2">
39
+ <p>#_ADDBOOKINGFORM</p>
40
+ <p>#_REMOVEBOOKINGFORM</p>
41
+ </td>
42
+ </tr>
43
+ <tr>
44
+ <th>Where? </th>
45
+ <td>
46
+ #_LOCATION, #_ADDRESS, #_TOWN
47
+ <br />
48
+ #_LOCEXCERPT
49
+ <br />
50
+ #_MAP
51
+ <br />
52
+ <h3>Upcoming Events at #_LOCATION</h3>
53
+ #_NEXTEVENTS
54
+ <br />
55
+ <h3>Previous Events at #_LOCATION</h3>
56
+ #_PASTEVENTS
57
+ <br />
58
+ <h3>All Events at #_LOCATION</h3>
59
+ #_ALLEVENTS
60
+ </td>
61
+ </tr>
62
+ </table>
63
+ #_EDITEVENTLINK
install.php ADDED
@@ -0,0 +1,485 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ function em_install() {
3
+ if( EM_VERSION > get_option('dbem_version') ){
4
+ // Creates the events table if necessary
5
+ em_create_events_table();
6
+ em_create_locations_table();
7
+ em_create_bookings_table();
8
+ em_create_people_table();
9
+ em_create_categories_table();
10
+ em_add_options();
11
+
12
+ //Migrate?
13
+ $old_version = get_option('dbem_version');
14
+ if( $old_version < 2.3 && $old_version != '' ){
15
+ em_migrate_to_new_tables();
16
+ em_import_verify();
17
+ }
18
+ //Upate Version
19
+ update_option('dbem_version', EM_VERSION);
20
+
21
+ // wp-content must be chmodded 777. Maybe just wp-content.
22
+ if(!file_exists("../".IMAGE_UPLOAD_DIR))
23
+ mkdir("../".IMAGE_UPLOAD_DIR, 0777); //do we need to 777 it? it'll be owner apache anyway, like normal uploads
24
+
25
+ em_create_events_page();
26
+ }
27
+ }
28
+
29
+ function em_create_events_table() {
30
+ global $wpdb, $user_level, $user_ID;
31
+ get_currentuserinfo();
32
+ require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
33
+
34
+ $table_name = $wpdb->prefix.EVENTS_TBNAME;
35
+ $sql = "CREATE TABLE ".$table_name." (
36
+ event_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
37
+ event_author bigint(20) unsigned DEFAULT NULL,
38
+ event_name tinytext NOT NULL,
39
+ event_start_time time NOT NULL,
40
+ event_end_time time NOT NULL,
41
+ event_start_date date NOT NULL,
42
+ event_end_date date NULL,
43
+ event_notes text NULL DEFAULT NULL,
44
+ event_rsvp bool NOT NULL DEFAULT 0,
45
+ event_seats int(5),
46
+ event_contactperson_id bigint(20) unsigned NULL,
47
+ location_id bigint(20) unsigned NOT NULL,
48
+ recurrence_id bigint(20) unsigned NULL,
49
+ event_category_id bigint(20) unsigned NULL DEFAULT NULL,
50
+ event_attributes text NULL,
51
+ recurrence bool NOT NULL DEFAULT 0,
52
+ recurrence_interval int(4) NULL DEFAULT NULL,
53
+ recurrence_freq tinytext NULL DEFAULT NULL,
54
+ recurrence_byday tinytext NULL DEFAULT NULL,
55
+ recurrence_byweekno int(4) NULL DEFAULT NULL,
56
+ UNIQUE KEY (event_id)
57
+ ) DEFAULT CHARSET=utf8 ;";
58
+
59
+ $old_table_name = $wpdb->prefix.OLD_EVENTS_TBNAME;
60
+
61
+ if($wpdb->get_var("SHOW TABLES LIKE '$table_name'") != $table_name && $wpdb->get_var("SHOW TABLES LIKE '$old_table_name'") != $old_table_name) {
62
+ dbDelta($sql);
63
+ //Add default events
64
+ $in_one_week = date('Y-m-d', time() + 60*60*24*7);
65
+ $in_four_weeks = date('Y-m-d', time() + 60*60*24*7*4);
66
+ $in_one_year = date('Y-m-d', time() + 60*60*24*7*365);
67
+
68
+ $wpdb->query("INSERT INTO ".$table_name." (event_name, event_start_date, event_start_time, event_end_time, location_id) VALUES ('Orality in James Joyce Conference', '$in_one_week', '16:00:00', '18:00:00', 1)");
69
+ $wpdb->query("INSERT INTO ".$table_name." (event_name, event_start_date, event_start_time, event_end_time, location_id) VALUES ('Traditional music session', '$in_four_weeks', '20:00:00', '22:00:00', 2)");
70
+ $wpdb->query("INSERT INTO ".$table_name." (event_name, event_start_date, event_start_time, event_end_time, location_id) VALUES ('6 Nations, Italy VS Ireland', '$in_one_year','22:00:00', '24:00:00', 3)");
71
+ }else{
72
+ dbDelta($sql);
73
+ }
74
+ }
75
+
76
+ function em_create_locations_table() {
77
+
78
+ global $wpdb, $user_level;
79
+ $table_name = $wpdb->prefix.LOCATIONS_TBNAME;
80
+
81
+ // Creating the events table
82
+ $sql = "CREATE TABLE ".$table_name." (
83
+ location_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
84
+ location_name tinytext NOT NULL,
85
+ location_address tinytext NOT NULL,
86
+ location_town tinytext NOT NULL,
87
+ location_province tinytext,
88
+ location_latitude float DEFAULT NULL,
89
+ location_longitude float DEFAULT NULL,
90
+ location_description text DEFAULT NULL,
91
+ UNIQUE KEY (location_id)
92
+ ) DEFAULT CHARSET=utf8 ;";
93
+
94
+ require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
95
+
96
+ $old_table_name = $wpdb->prefix.OLD_LOCATIONS_TBNAME;
97
+
98
+ if($wpdb->get_var("SHOW TABLES LIKE '$table_name'") != $table_name && $wpdb->get_var("SHOW TABLES LIKE '$old_table_name'") != $old_table_name) {
99
+ dbDelta($sql);
100
+ //Add default values
101
+ $wpdb->query("INSERT INTO ".$table_name." (location_name, location_address, location_town, location_latitude, location_longitude) VALUES ('Arts Millenium Building', 'Newcastle Road','Galway', 53.275, -9.06532)");
102
+ $wpdb->query("INSERT INTO ".$table_name." (location_name, location_address, location_town, location_latitude, location_longitude) VALUES ('The Crane Bar', '2, Sea Road','Galway', 53.2692, -9.06151)");
103
+ $wpdb->query("INSERT INTO ".$table_name." (location_name, location_address, location_town, location_latitude, location_longitude) VALUES ('Taaffes Bar', '19 Shop Street','Galway', 53.2725, -9.05321)");
104
+ }else{
105
+ dbDelta($sql);
106
+ }
107
+ }
108
+
109
+ function em_create_bookings_table() {
110
+
111
+ global $wpdb, $user_level;
112
+ $table_name = $wpdb->prefix.BOOKINGS_TBNAME;
113
+
114
+ $sql = "CREATE TABLE ".$table_name." (
115
+ booking_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
116
+ event_id bigint(20) unsigned NOT NULL,
117
+ person_id bigint(20) unsigned NOT NULL,
118
+ booking_seats int(5) NOT NULL,
119
+ booking_comment text DEFAULT NULL,
120
+ booking_date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
121
+ UNIQUE KEY (booking_id)
122
+ ) DEFAULT CHARSET=utf8 ;";
123
+ require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
124
+ dbDelta($sql);
125
+ }
126
+
127
+ function em_create_people_table() {
128
+
129
+ global $wpdb, $user_level;
130
+ $table_name = $wpdb->prefix.PEOPLE_TBNAME;
131
+
132
+ $sql = "CREATE TABLE ".$table_name." (
133
+ person_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
134
+ person_name tinytext NOT NULL,
135
+ person_email tinytext NOT NULL,
136
+ person_phone tinytext NOT NULL,
137
+ UNIQUE KEY (person_id)
138
+ ) DEFAULT CHARSET=utf8 ;";
139
+ require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
140
+ dbDelta($sql);
141
+ }
142
+
143
+ //Add the categories table
144
+ function em_create_categories_table() {
145
+
146
+ global $wpdb, $user_level;
147
+ $table_name = $wpdb->prefix.DBEM_CATEGORIES_TBNAME;
148
+
149
+ // Creating the events table
150
+ $sql = "CREATE TABLE ".$table_name." (
151
+ category_id bigint(20) unsigned NOT NULL auto_increment,
152
+ category_name tinytext NOT NULL,
153
+ PRIMARY KEY (category_id)
154
+ ) DEFAULT CHARSET=utf8 ;";
155
+ require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
156
+
157
+ $old_table_name = $wpdb->prefix.OLD_CATEGORIES_TBNAME;
158
+
159
+ if($wpdb->get_var("SHOW TABLES LIKE '$table_name'") != $table_name && $wpdb->get_var("SHOW TABLES LIKE '$old_table_name'") != $old_table_name) {
160
+ dbDelta($sql);
161
+ $wpdb->insert( $table_name, array('category_name'=>__('Uncategorized', 'dbem')), array('%s') );
162
+ }else{
163
+ dbDelta($sql);
164
+ }
165
+ }
166
+
167
+
168
+ function em_add_options() {
169
+ $contact_person_email_body_localizable = __("#_RESPNAME (#_RESPEMAIL) will attend #_NAME on #m #d, #Y. He wants to reserve #_SPACES spaces.<br/> Now there are #_RESERVEDSPACES spaces reserved, #_AVAILABLESPACES are still available.<br/>Yours faithfully,<br/>Events Manager",'dbem') ;
170
+ $respondent_email_body_localizable = __("Dear #_RESPNAME, <br/>you have successfully reserved #_SPACES space/spaces for #_NAME.<br/>Yours faithfully,<br/> #_CONTACTPERSON",'dbem');
171
+
172
+ $dbem_options = array('dbem_event_list_item_format' => DEFAULT_EVENT_LIST_ITEM_FORMAT,
173
+ 'dbem_display_calendar_in_events_page' => 0,
174
+ 'dbem_single_event_format' => DEFAULT_SINGLE_EVENT_FORMAT,
175
+ 'dbem_event_page_title_format' => DEFAULT_EVENT_PAGE_TITLE_FORMAT,
176
+ 'dbem_list_events_page' => 1,
177
+ 'dbem_events_page_title' => DEFAULT_EVENTS_PAGE_TITLE,
178
+ 'dbem_no_events_message' => __('No events','dbem'),
179
+ 'dbem_location_page_title_format' => DEFAULT_LOCATION_PAGE_TITLE_FORMAT,
180
+ 'dbem_location_baloon_format' => DEFAULT_LOCATION_BALOON_FORMAT,
181
+ 'dbem_location_event_list_item_format' => DEFAULT_LOCATION_EVENT_LIST_ITEM_FORMAT,
182
+ 'dbem_location_no_events_message' => DEFAULT_LOCATION_NO_EVENTS_MESSAGE,
183
+ 'dbem_single_location_format' => DEFAULT_SINGLE_LOCATION_FORMAT,
184
+ 'dbem_map_text_format' => DEFAULT_MAP_TEXT_FORMAT,
185
+ 'dbem_rss_main_title' => get_bloginfo('title')." - ".__('Events'),
186
+ 'dbem_rss_main_description' => get_bloginfo('description')." - ".__('Events'),
187
+ 'dbem_rss_description_format' => DEFAULT_RSS_DESCRIPTION_FORMAT,
188
+ 'dbem_rss_title_format' => DEFAULT_RSS_TITLE_FORMAT,
189
+ 'dbem_gmap_is_active'=> 1,
190
+ 'dbem_default_contact_person' => 1,
191
+ 'dbem_rsvp_mail_notify_is_active' => 0 ,
192
+ 'dbem_contactperson_email_body' => __(str_replace("<br/>", "\n\r", $contact_person_email_body_localizable)),
193
+ 'dbem_respondent_email_body' => __(str_replace("<br/>", "\n\r", $respondent_email_body_localizable)),
194
+ 'dbem_rsvp_mail_port' => 465,
195
+ 'dbem_smtp_host' => 'localhost',
196
+ 'dbem_mail_sender_name' => '',
197
+ 'dbem_rsvp_mail_send_method' => 'smtp',
198
+ 'dbem_rsvp_mail_SMTPAuth' => 1,
199
+ 'dbem_image_max_width' => DEFAULT_IMAGE_MAX_WIDTH,
200
+ 'dbem_image_max_height' => DEFAULT_IMAGE_MAX_HEIGHT,
201
+ 'dbem_image_max_size' => DEFAULT_IMAGE_MAX_SIZE,
202
+ 'dbem_list_date_title' => DEFAULT_LIST_DATE_TITLE,
203
+ 'dbem_full_calendar_event_format' => DEFAULT_FULL_CALENDAR_EVENT_FORMAT,
204
+ 'dbem_small_calendar_event_title_format' => DEFAULT_SMALL_CALENDAR_EVENT_TITLE_FORMAT,
205
+ 'dbem_small_calendar_event_title_separator' => DEFAULT_SMALL_CALENDAR_EVENT_TITLE_SEPARATOR,
206
+ 'dbem_hello_to_user' => 1,
207
+ 'dbem_use_select_for_locations' => DEFAULT_USE_SELECT_FOR_LOCATIONS,
208
+ 'dbem_attributes_enabled', DEFAULT_ATTRIBUTES_ENABLED,
209
+ 'dbem_recurrence_enabled', DEFAULT_RECURRENCE_ENABLED,
210
+ 'dbem_rsvp_enabled', DEFAULT_RSVP_ENABLED,
211
+ 'dbem_categories_enabled', DEFAULT_CATEGORIES_ENABLED);
212
+
213
+ foreach($dbem_options as $key => $value){
214
+ add_option($key, $value);
215
+ }
216
+
217
+ }
218
+
219
+ function em_create_events_page(){
220
+ global $wpdb,$current_user;
221
+ if( get_option('dbem_events_page') == '' && get_option('dbem_dismiss_events_page') != 1 && !is_object( get_page( get_option('dbem_events_page') )) ){
222
+ $post_data = array(
223
+ 'post_status' => 'publish',
224
+ 'post_type' => 'page',
225
+ 'ping_status' => get_option('default_ping_status'),
226
+ 'post_content' => 'CONTENTS',
227
+ 'post_excerpt' => 'CONTENTS',
228
+ 'post_title' => DEFAULT_EVENT_PAGE_NAME
229
+ );
230
+ $post_id = wp_insert_post($post_data, false);
231
+ if( $post_id > 0 ){
232
+ update_option('dbem_events_page', $post_id);
233
+ }
234
+ }
235
+ }
236
+
237
+ // migrate old dbem tables to new em ones
238
+ function em_migrate_to_new_tables(){
239
+ global $wpdb, $current_user;
240
+ get_currentuserinfo();
241
+ $errors = array();
242
+ // migrating events
243
+ $events_required = array('event_id', 'event_name','event_start_time','event_end_time','event_start_date','event_rsvp','location_id','recurrence');
244
+ $events = $wpdb->get_results('SELECT * FROM '.$wpdb->prefix.OLD_EVENTS_TBNAME,ARRAY_A) ;
245
+ $event_fields = array('event_id','event_author','event_name','event_start_time','event_end_time','event_start_date','event_end_date','event_notes','event_rsvp','event_seats','event_contactperson_id','location_id','recurrence_id','event_category_id','event_attributes');
246
+ if( count($events) > 0 ){
247
+ $events_values = array();
248
+ foreach($events as $event) {
249
+ foreach($event as $key => $value){
250
+ if( in_array($key, $event_fields) ){
251
+ if($value == '' && !in_array($key,$events_required)){ $event[$key] = 'NULL'; }
252
+ elseif ( $value == '-1' && !in_array($key,$events_required) ) { $event[$key] = 'NULL'; }
253
+ else { $event[$key] = "'".$wpdb->escape($event[$key])."'"; }
254
+ }else{
255
+ unset($event[$key]);
256
+ }
257
+ }
258
+ $events_values[] = "\n".'('. implode(', ', $event).')';
259
+ }
260
+ $events_keys = array_keys($event);
261
+ if( count($events_values) > 0 ){
262
+ $events_sql = "INSERT INTO " . $wpdb->prefix.EVENTS_TBNAME .
263
+ "(`" . implode('` ,`', $events_keys) . "`) VALUES".
264
+ implode(', ', $events_values);
265
+ $wpdb->query($events_sql);
266
+ if($wpdb->last_error != ''){
267
+ $errors[] = $wpdb->last_error;
268
+ }
269
+ }
270
+ }
271
+
272
+ // inserting recurrences into events
273
+ $table_name = $wpdb->prefix.EVENTS_TBNAME;
274
+ $results = $wpdb->get_results('SELECT * FROM '.$wpdb->prefix.RECURRENCE_TBNAME, ARRAY_A);
275
+ if( count($results) > 0 ){
276
+ foreach($results as $recurrence_raw){
277
+ //Save copy of recurrence_id
278
+ $recurrence_id = $recurrence_raw['recurrence_id'];
279
+ //First insert the event into events table
280
+ $recurrence = array( //Save new array with correct indexes
281
+ 'event_author' => $current_user->ID,
282
+ 'event_name' => $recurrence_raw['recurrence_name'],
283
+ 'event_start_date' => $recurrence_raw['recurrence_start_date'],
284
+ 'event_end_date' => $recurrence_raw['recurrence_end_date'],
285
+ 'event_start_time' => $recurrence_raw['recurrence_start_time'],
286
+ 'event_end_time' => $recurrence_raw['recurrence_end_time'],
287
+ 'event_notes' => $recurrence_raw['recurrence_notes'],
288
+ 'location_id' => $recurrence_raw['location_id'],
289
+ 'recurrence' => 1,
290
+ 'recurrence_interval' => $recurrence_raw['recurrence_interval'],
291
+ 'recurrence_freq' => $recurrence_raw['recurrence_freq'],
292
+ 'recurrence_byday' => $recurrence_raw['recurrence_byday'],
293
+ 'recurrence_byweekno' => $recurrence_raw['recurrence_byweekno']
294
+ );
295
+ $result = $wpdb->insert($table_name, $recurrence, array('%d','%s','%s','%s','%s','%s','%s','%d','%d','%d','%d','%d','%d'));
296
+ //Then change the id of all the events with recurrence_id
297
+ if($result == 1){
298
+ $wpdb->query("UPDATE {$table_name} SET recurrence_id='{$wpdb->insert_id}' WHERE recurrence_id='{$recurrence_id}'");
299
+ }else{
300
+ //FIXME Better fallback in case of bad install
301
+ _e('We could not mirgrate old recurrence data over. DONT WORRY! You can just delete the current plugin, and re-install the previous 2.2.2 version and you wont lose any of your data. Either way, please contact the developers to let them know of this bug.', 'dbem');
302
+ }
303
+ }
304
+ }
305
+
306
+ // migrating locations
307
+ $locations_required = array('location_id', 'location_name', 'location_address', 'location_town');
308
+ $locations = $wpdb->get_results('SELECT * FROM '.$wpdb->prefix.OLD_LOCATIONS_TBNAME,ARRAY_A) ;
309
+ $location_fields = array('location_id','location_name','location_address','location_town','location_province','location_latitude','location_longitude','location_description');
310
+ if( count($locations) > 0 ){
311
+ $locations_values = array();
312
+ foreach($locations as $location) {
313
+ foreach($location as $key => $value){
314
+ if( in_array($key, $location_fields) ){
315
+ if($value == '' && !in_array($key, $locations_required)){ $location[$key] = 'NULL'; }
316
+ elseif ( $value == '-1' && !in_array($key, $locations_required) ) { $location[$key] = 'NULL'; }
317
+ else { $location[$key] = "'".$wpdb->escape($location[$key])."'"; }
318
+ }else{
319
+ unset($location[$key]);
320
+ }
321
+ }
322
+ $locations_values[] = "\n".'('. implode(', ', $location).')';
323
+ }
324
+ $locations_keys = array_keys($location);
325
+ if( count($locations_values) > 0 ){
326
+ $locations_sql = "INSERT INTO " . $wpdb->prefix.LOCATIONS_TBNAME .
327
+ "(`" . implode('` ,`', $locations_keys) . "`) VALUES".
328
+ implode(', ', $locations_values);
329
+ $wpdb->query($locations_sql);
330
+ }
331
+ }
332
+
333
+ // migrating people
334
+ $people = $wpdb->get_results('SELECT * FROM '.$wpdb->prefix.OLD_PEOPLE_TBNAME,ARRAY_A) ;
335
+ if( count($people) > 0 ){
336
+ $people_values = array();
337
+ $people_fields = array('person_id', 'person_name', 'person_email', 'person_phone');
338
+ foreach($people as $person) {
339
+ foreach($person as $key => $value){
340
+ if( in_array($key, $people_fields) ){
341
+ $person[$key] = "'".$wpdb->escape($person[$key])."'";
342
+ }else{
343
+ unset($person[$key]);
344
+ }
345
+ }
346
+ $people_values[] = "\n".'('. implode(', ', $person).')';
347
+ }
348
+ $people_keys = array_keys($person);
349
+ if( count($people_values) > 0 ){
350
+ $people_sql = "INSERT INTO " . $wpdb->prefix.PEOPLE_TBNAME .
351
+ "(`" . implode('` ,`', $people_keys) . "`) VALUES".
352
+ implode(', ', $people_values);
353
+ $wpdb->query($people_sql);
354
+ }
355
+ }
356
+
357
+ // migrating bookings
358
+ $bookings = $wpdb->get_results('SELECT * FROM '.$wpdb->prefix.OLD_BOOKINGS_TBNAME,ARRAY_A) ;
359
+ if( count($bookings) > 0 ){
360
+ $bookings_values = array();
361
+ $booking_fields = array('booking_id', 'event_id', 'person_id', 'booking_seats', 'booking_comment');
362
+ foreach($bookings as $booking) {
363
+ foreach($booking as $key => $value){
364
+ if( in_array($key, $booking_fields) ){
365
+ if($value == '' && $key == 'booking_comment'){ $booking[$key] = 'NULL'; }
366
+ elseif ( $value == '-1' ) { $booking[$key] = '0'; }
367
+ else { $booking[$key] = "'".$wpdb->escape($booking[$key])."'"; }
368
+ }else{
369
+ unset($booking[$key]);
370
+ }
371
+ }
372
+ $bookings_values[] = "\n".'('. implode(', ', $booking).')';
373
+ }
374
+ $bookings_keys = array_keys($booking);
375
+ if( count($bookings_values) > 0 ){
376
+ $bookings_sql = "INSERT INTO " . $wpdb->prefix.BOOKINGS_TBNAME .
377
+ "(`" . implode('` ,`', $bookings_keys) . "`) VALUES".
378
+ implode(', ', $bookings_values);
379
+ $wpdb->query($bookings_sql);
380
+ }
381
+
382
+ // migrating categories
383
+ $categories = $wpdb->get_results('SELECT * FROM '.$wpdb->prefix.OLD_CATEGORIES_TBNAME,ARRAY_A) ;
384
+ $categories_fields = array('category_id', 'category_name');
385
+ foreach($categories as $category) {
386
+ foreach($category as $key => $val){
387
+ if( !in_array($key, $categories_fields) ){
388
+ unset($category[$key]);
389
+ }
390
+ }
391
+ $wpdb->insert($wpdb->prefix.DBEM_CATEGORIES_TBNAME, $category);
392
+ }
393
+ }
394
+
395
+ if( count($errors) > 0 && is_array($errors) ){
396
+ $func = create_function('', '?>
397
+ <div id="em_page_error" class="error">
398
+ <p>SQL Errors:</p>
399
+ <ul>
400
+ <li>'. implode('</li><li>', $errors) .'</li>
401
+ </ul>
402
+ </div>
403
+ <?php
404
+ ');
405
+ add_action ( 'admin_notices', $func);
406
+ }
407
+ }
408
+
409
+ function em_reimport(){
410
+ //Check for reimport request
411
+ global $wpdb;
412
+ if($_GET['em_reimport'] == 1 ){
413
+ check_admin_referer( 'em_reimport' );
414
+ $p = $wpdb->prefix;
415
+ $table_bookings = $p.BOOKINGS_TBNAME;
416
+ $table_categories = $p.DBEM_CATEGORIES_TBNAME;
417
+ $table_events = $p.EVENTS_TBNAME;
418
+ $table_locations = $p.LOCATIONS_TBNAME;
419
+ $table_people = $p.PEOPLE_TBNAME;
420
+ $wpdb->query('DROP TABLE '.$table_bookings.', '.$table_categories.', '.$table_events.', '.$table_locations.', '.$table_people.';');
421
+ update_option('dbem_version','2');
422
+ em_install();
423
+ }
424
+ }
425
+ add_action('admin_init', 'em_reimport');
426
+
427
+ /**
428
+ * If importing from 2.x to 3.x, this function will be called to verify the import went well.
429
+ * @return string|string
430
+ */
431
+ function em_import_verify(){
432
+ global $wpdb;
433
+ $p = $wpdb->prefix;
434
+ //Now go through each table and compare row counts, if all match (events is old recurrences + events, then we're fine
435
+ $results[] = ( $wpdb->get_var("SELECT COUNT(*) FROM ".$p.BOOKINGS_TBNAME.";") == $wpdb->get_var("SELECT COUNT(*) FROM ".$p.OLD_BOOKINGS_TBNAME.";") );
436
+ $results[] = ( $wpdb->get_var("SELECT COUNT(*) FROM ".$p.DBEM_CATEGORIES_TBNAME.";") ."==". $wpdb->get_var("SELECT COUNT(*) FROM ".$p.OLD_CATEGORIES_TBNAME.";") );
437
+ $results[] = ( $wpdb->get_var("SELECT COUNT(*) FROM ".$p.EVENTS_TBNAME.";") == $wpdb->get_var("SELECT COUNT(*) FROM ".$p.OLD_EVENTS_TBNAME.";") + $wpdb->get_var("SELECT COUNT(*) FROM ".$p.OLD_RECURRENCE_TBNAME.";") );
438
+ $results[] = ( $wpdb->get_var("SELECT COUNT(*) FROM ".$p.LOCATIONS_TBNAME.";") == $wpdb->get_var("SELECT COUNT(*) FROM ".$p.OLD_LOCATIONS_TBNAME.";") );
439
+ $results[] = ( $wpdb->get_var("SELECT COUNT(*) FROM ".$p.PEOPLE_TBNAME.";") == $wpdb->get_var("SELECT COUNT(*) FROM ".$p.OLD_PEOPLE_TBNAME.";") );
440
+ /* Debugging
441
+ echo "BOOKINGS : " . $wpdb->get_var("SELECT COUNT(*) FROM ".$p.BOOKINGS_TBNAME.";") ."==". $wpdb->get_var("SELECT COUNT(*) FROM ".$p.OLD_BOOKINGS_TBNAME);
442
+ echo "<br/>CATEGORIES : ". $wpdb->get_var("SELECT COUNT(*) FROM ".$p.DBEM_CATEGORIES_TBNAME.";") == $wpdb->get_var("SELECT COUNT(*) FROM ".$p.OLD_CATEGORIES_TBNAME.";");
443
+ echo "<br/>EVENTS : ". $wpdb->get_var("SELECT COUNT(*) FROM ".$p.EVENTS_TBNAME.";") .'=='. $wpdb->get_var("SELECT COUNT(*) FROM ".$p.OLD_EVENTS_TBNAME.";") .'+'. $wpdb->get_var("SELECT COUNT(*) FROM ".$p.OLD_RECURRENCE_TBNAME.";");
444
+ echo "<br/>LOCATIONS : ". $wpdb->get_var("SELECT COUNT(*) FROM ".$p.LOCATIONS_TBNAME.";") .'=='. $wpdb->get_var("SELECT COUNT(*) FROM ".$p.OLD_LOCATIONS_TBNAME.";");
445
+ echo "<br/>PEOPLE : ". $wpdb->get_var("SELECT COUNT(*) FROM ".$p.PEOPLE_TBNAME.";") .'=='. $wpdb->get_var("SELECT COUNT(*) FROM ".$p.OLD_PEOPLE_TBNAME.";");
446
+ */
447
+ if( in_array(false, $results) ){
448
+ update_option( 'dbem_import_fail', 1 );
449
+ return false;
450
+ }else{
451
+ update_option( 'dbem_import_fail', 0 );
452
+ add_action ( 'admin_notices', 'em_import_message_success' );
453
+ return true;
454
+ }
455
+ }
456
+
457
+ /**
458
+ * Gets called if re-import was successful.
459
+ */
460
+ function em_import_message_success(){
461
+ ?>
462
+ <div id="em_page_error" class="updated">
463
+ <p><?php _e('Events Manager successfully imported your events, please check your records to verify.','dbem')?></p>
464
+ </div>
465
+ <?php
466
+ }
467
+
468
+ /*
469
+ * If import failed, a persistant message will show unless ignored.
470
+ */
471
+ function em_import_message_fail(){
472
+ if( $_GET['em_dismiss_import'] == '1' ){
473
+ update_option('dbem_import_fail', 0);
474
+ }
475
+ if( get_option('dbem_import_fail') == 1 ){
476
+ $dismiss_link_joiner = ( count($_GET) > 0 ) ? '&amp;':'?';
477
+ ?>
478
+ <div id="em_page_error" class="error">
479
+ <p><?php printf( __('Something has gone wrong when importing your old event. See the <a href="%s">support page</a> for more information. <a href="%s">Dismiss this message</a>','dbem'), get_bloginfo('wpurl').'/wp-admin/admin.php?page=events-manager-support', $_SERVER['REQUEST_URI'].$dismiss_link_joiner.'em_dismiss_import=1'); ?></p>
480
+ </div>
481
+ <?php
482
+ }
483
+ }
484
+ add_action ( 'admin_notices', 'em_import_message_fail' );
485
+ ?>
js/jquery-autocomplete/changelog.txt DELETED
@@ -1,20 +0,0 @@
1
- 1.0.2
2
- -----
3
- * Fixed missing semicolon
4
-
5
- 1.0.1
6
- -----
7
- * Fixed element creation (<ul> to <ul/> and <li> to </li>)
8
- * Fixed ac_even class (was ac_event)
9
- * Fixed bgiframe usage: now its really optional
10
- * Removed the blur-on-return workaround, added a less obtrusive one only for Opera
11
- * Fixed hold cursor keys: Opera needs keypress, everyone else keydown to scroll through result list when holding cursor key
12
- * Updated package to jQuery 1.2.5, removing dimensions
13
- * Fixed multiple-mustMatch: Remove only the last term when no match is found
14
- * Fixed multiple without mustMatch: Don't select the last active when no match is found (on tab/return)
15
- * Fixed multiple cursor position: Put cursor at end of input after selecting a value
16
-
17
- 1.0
18
- ---
19
-
20
- * First release.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/jquery-autocomplete/jquery.autocomplete.css DELETED
@@ -1,48 +0,0 @@
1
- .ac_results {
2
- padding: 0px;
3
- border: 1px solid black;
4
- background-color: white;
5
- overflow: hidden;
6
- z-index: 99999;
7
- }
8
-
9
- .ac_results ul {
10
- width: 100%;
11
- list-style-position: outside;
12
- list-style: none;
13
- padding: 0;
14
- margin: 0;
15
- }
16
-
17
- .ac_results li {
18
- margin: 0px;
19
- padding: 2px 5px;
20
- cursor: default;
21
- display: block;
22
- /*
23
- if width will be 100% horizontal scrollbar will apear
24
- when scroll mode will be used
25
- */
26
- /*width: 100%;*/
27
- font: menu;
28
- font-size: 12px;
29
- /*
30
- it is very important, if line-height not setted or setted
31
- in relative units scroll will be broken in firefox
32
- */
33
- line-height: 16px;
34
- overflow: hidden;
35
- }
36
-
37
- .ac_loading {
38
- background: white url('indicator.gif') right center no-repeat;
39
- }
40
-
41
- .ac_odd {
42
- background-color: #eee;
43
- }
44
-
45
- .ac_over {
46
- background-color: #C1E0DB;
47
- color: white;
48
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/jquery-autocomplete/jquery.autocomplete.min.js DELETED
@@ -1,15 +0,0 @@
1
- /*
2
- * Autocomplete - jQuery plugin 1.0.2
3
- *
4
- * Copyright (c) 2007 Dylan Verheul, Dan G. Switzer, Anjesh Tuladhar, Jörn Zaefferer
5
- *
6
- * Dual licensed under the MIT and GPL licenses:
7
- * http://www.opensource.org/licenses/mit-license.php
8
- * http://www.gnu.org/licenses/gpl.html
9
- *
10
- * Revision: $Id: jquery.autocomplete.js 5747 2008-06-25 18:30:55Z joern.zaefferer $
11
- *
12
- */;(function($){$.fn.extend({autocomplete:function(urlOrData,options){var isUrl=typeof urlOrData=="string";options=$.extend({},$.Autocompleter.defaults,{url:isUrl?urlOrData:null,data:isUrl?null:urlOrData,delay:isUrl?$.Autocompleter.defaults.delay:10,max:options&&!options.scroll?10:150},options);options.highlight=options.highlight||function(value){return value;};options.formatMatch=options.formatMatch||options.formatItem;return this.each(function(){new $.Autocompleter(this,options);});},result:function(handler){return this.bind("result",handler);},search:function(handler){return this.trigger("search",[handler]);},flushCache:function(){return this.trigger("flushCache");},setOptions:function(options){return this.trigger("setOptions",[options]);},unautocomplete:function(){return this.trigger("unautocomplete");}});$.Autocompleter=function(input,options){var KEY={UP:38,DOWN:40,DEL:46,TAB:9,RETURN:13,ESC:27,COMMA:188,PAGEUP:33,PAGEDOWN:34,BACKSPACE:8};var $input=$(input).attr("autocomplete","off").addClass(options.inputClass);var timeout;var previousValue="";var cache=$.Autocompleter.Cache(options);var hasFocus=0;var lastKeyPressCode;var config={mouseDownOnSelect:false};var select=$.Autocompleter.Select(options,input,selectCurrent,config);var blockSubmit;$.browser.opera&&$(input.form).bind("submit.autocomplete",function(){if(blockSubmit){blockSubmit=false;return false;}});$input.bind(($.browser.opera?"keypress":"keydown")+".autocomplete",function(event){lastKeyPressCode=event.keyCode;switch(event.keyCode){case KEY.UP:event.preventDefault();if(select.visible()){select.prev();}else{onChange(0,true);}break;case KEY.DOWN:event.preventDefault();if(select.visible()){select.next();}else{onChange(0,true);}break;case KEY.PAGEUP:event.preventDefault();if(select.visible()){select.pageUp();}else{onChange(0,true);}break;case KEY.PAGEDOWN:event.preventDefault();if(select.visible()){select.pageDown();}else{onChange(0,true);}break;case options.multiple&&$.trim(options.multipleSeparator)==","&&KEY.COMMA:case KEY.TAB:case KEY.RETURN:if(selectCurrent()){event.preventDefault();blockSubmit=true;return false;}break;case KEY.ESC:select.hide();break;default:clearTimeout(timeout);timeout=setTimeout(onChange,options.delay);break;}}).focus(function(){hasFocus++;}).blur(function(){hasFocus=0;if(!config.mouseDownOnSelect){hideResults();}}).click(function(){if(hasFocus++>1&&!select.visible()){onChange(0,true);}}).bind("search",function(){var fn=(arguments.length>1)?arguments[1]:null;function findValueCallback(q,data){var result;if(data&&data.length){for(var i=0;i<data.length;i++){if(data[i].result.toLowerCase()==q.toLowerCase()){result=data[i];break;}}}if(typeof fn=="function")fn(result);else $input.trigger("result",result&&[result.data,result.value]);}$.each(trimWords($input.val()),function(i,value){request(value,findValueCallback,findValueCallback);});}).bind("flushCache",function(){cache.flush();}).bind("setOptions",function(){$.extend(options,arguments[1]);if("data"in arguments[1])cache.populate();}).bind("unautocomplete",function(){select.unbind();$input.unbind();$(input.form).unbind(".autocomplete");});function selectCurrent(){var selected=select.selected();if(!selected)return false;var v=selected.result;previousValue=v;if(options.multiple){var words=trimWords($input.val());if(words.length>1){v=words.slice(0,words.length-1).join(options.multipleSeparator)+options.multipleSeparator+v;}v+=options.multipleSeparator;}$input.val(v);hideResultsNow();$input.trigger("result",[selected.data,selected.value]);return true;}function onChange(crap,skipPrevCheck){if(lastKeyPressCode==KEY.DEL){select.hide();return;}var currentValue=$input.val();if(!skipPrevCheck&&currentValue==previousValue)return;previousValue=currentValue;currentValue=lastWord(currentValue);if(currentValue.length>=options.minChars){$input.addClass(options.loadingClass);if(!options.matchCase)currentValue=currentValue.toLowerCase();request(currentValue,receiveData,hideResultsNow);}else{stopLoading();select.hide();}};function trimWords(value){if(!value){return[""];}var words=value.split(options.multipleSeparator);var result=[];$.each(words,function(i,value){if($.trim(value))result[i]=$.trim(value);});return result;}function lastWord(value){if(!options.multiple)return value;var words=trimWords(value);return words[words.length-1];}function autoFill(q,sValue){if(options.autoFill&&(lastWord($input.val()).toLowerCase()==q.toLowerCase())&&lastKeyPressCode!=KEY.BACKSPACE){$input.val($input.val()+sValue.substring(lastWord(previousValue).length));$.Autocompleter.Selection(input,previousValue.length,previousValue.length+sValue.length);}};function hideResults(){clearTimeout(timeout);timeout=setTimeout(hideResultsNow,200);};function hideResultsNow(){var wasVisible=select.visible();select.hide();clearTimeout(timeout);stopLoading();if(options.mustMatch){$input.search(function(result){if(!result){if(options.multiple){var words=trimWords($input.val()).slice(0,-1);$input.val(words.join(options.multipleSeparator)+(words.length?options.multipleSeparator:""));}else
13
- $input.val("");}});}if(wasVisible)$.Autocompleter.Selection(input,input.value.length,input.value.length);};function receiveData(q,data){if(data&&data.length&&hasFocus){stopLoading();select.display(data,q);autoFill(q,data[0].value);select.show();}else{hideResultsNow();}};function request(term,success,failure){if(!options.matchCase)term=term.toLowerCase();var data=cache.load(term);if(data&&data.length){success(term,data);}else if((typeof options.url=="string")&&(options.url.length>0)){var extraParams={timestamp:+new Date()};$.each(options.extraParams,function(key,param){extraParams[key]=typeof param=="function"?param():param;});$.ajax({mode:"abort",port:"autocomplete"+input.name,dataType:options.dataType,url:options.url,data:$.extend({q:lastWord(term),limit:options.max},extraParams),success:function(data){var parsed=options.parse&&options.parse(data)||parse(data);cache.add(term,parsed);success(term,parsed);}});}else{select.emptyList();failure(term);}};function parse(data){var parsed=[];var rows=data.split("\n");for(var i=0;i<rows.length;i++){var row=$.trim(rows[i]);if(row){row=row.split("|");parsed[parsed.length]={data:row,value:row[0],result:options.formatResult&&options.formatResult(row,row[0])||row[0]};}}return parsed;};function stopLoading(){$input.removeClass(options.loadingClass);};};$.Autocompleter.defaults={inputClass:"ac_input",resultsClass:"ac_results",loadingClass:"ac_loading",minChars:1,delay:400,matchCase:false,matchSubset:true,matchContains:false,cacheLength:10,max:100,mustMatch:false,extraParams:{},selectFirst:true,formatItem:function(row){return row[0];},formatMatch:null,autoFill:false,width:0,multiple:false,multipleSeparator:", ",highlight:function(value,term){return value.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)("+term.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi,"\\$1")+")(?![^<>]*>)(?![^&;]+;)","gi"),"<strong>$1</strong>");},scroll:true,scrollHeight:180};$.Autocompleter.Cache=function(options){var data={};var length=0;function matchSubset(s,sub){if(!options.matchCase)s=s.toLowerCase();var i=s.indexOf(sub);if(i==-1)return false;return i==0||options.matchContains;};function add(q,value){if(length>options.cacheLength){flush();}if(!data[q]){length++;}data[q]=value;}function populate(){if(!options.data)return false;var stMatchSets={},nullData=0;if(!options.url)options.cacheLength=1;stMatchSets[""]=[];for(var i=0,ol=options.data.length;i<ol;i++){var rawValue=options.data[i];rawValue=(typeof rawValue=="string")?[rawValue]:rawValue;var value=options.formatMatch(rawValue,i+1,options.data.length);if(value===false)continue;var firstChar=value.charAt(0).toLowerCase();if(!stMatchSets[firstChar])stMatchSets[firstChar]=[];var row={value:value,data:rawValue,result:options.formatResult&&options.formatResult(rawValue)||value};stMatchSets[firstChar].push(row);if(nullData++<options.max){stMatchSets[""].push(row);}};$.each(stMatchSets,function(i,value){options.cacheLength++;add(i,value);});}setTimeout(populate,25);function flush(){data={};length=0;}return{flush:flush,add:add,populate:populate,load:function(q){if(!options.cacheLength||!length)return null;if(!options.url&&options.matchContains){var csub=[];for(var k in data){if(k.length>0){var c=data[k];$.each(c,function(i,x){if(matchSubset(x.value,q)){csub.push(x);}});}}return csub;}else
14
- if(data[q]){return data[q];}else
15
- if(options.matchSubset){for(var i=q.length-1;i>=options.minChars;i--){var c=data[q.substr(0,i)];if(c){var csub=[];$.each(c,function(i,x){if(matchSubset(x.value,q)){csub[csub.length]=x;}});return csub;}}}return null;}};};$.Autocompleter.Select=function(options,input,select,config){var CLASSES={ACTIVE:"ac_over"};var listItems,active=-1,data,term="",needsInit=true,element,list;function init(){if(!needsInit)return;element=$("<div/>").hide().addClass(options.resultsClass).css("position","absolute").appendTo(document.body);list=$("<ul/>").appendTo(element).mouseover(function(event){if(target(event).nodeName&&target(event).nodeName.toUpperCase()=='LI'){active=$("li",list).removeClass(CLASSES.ACTIVE).index(target(event));$(target(event)).addClass(CLASSES.ACTIVE);}}).click(function(event){$(target(event)).addClass(CLASSES.ACTIVE);select();input.focus();return false;}).mousedown(function(){config.mouseDownOnSelect=true;}).mouseup(function(){config.mouseDownOnSelect=false;});if(options.width>0)element.css("width",options.width);needsInit=false;}function target(event){var element=event.target;while(element&&element.tagName!="LI")element=element.parentNode;if(!element)return[];return element;}function moveSelect(step){listItems.slice(active,active+1).removeClass(CLASSES.ACTIVE);movePosition(step);var activeItem=listItems.slice(active,active+1).addClass(CLASSES.ACTIVE);if(options.scroll){var offset=0;listItems.slice(0,active).each(function(){offset+=this.offsetHeight;});if((offset+activeItem[0].offsetHeight-list.scrollTop())>list[0].clientHeight){list.scrollTop(offset+activeItem[0].offsetHeight-list.innerHeight());}else if(offset<list.scrollTop()){list.scrollTop(offset);}}};function movePosition(step){active+=step;if(active<0){active=listItems.size()-1;}else if(active>=listItems.size()){active=0;}}function limitNumberOfItems(available){return options.max&&options.max<available?options.max:available;}function fillList(){list.empty();var max=limitNumberOfItems(data.length);for(var i=0;i<max;i++){if(!data[i])continue;var formatted=options.formatItem(data[i].data,i+1,max,data[i].value,term);if(formatted===false)continue;var li=$("<li/>").html(options.highlight(formatted,term)).addClass(i%2==0?"ac_even":"ac_odd").appendTo(list)[0];$.data(li,"ac_data",data[i]);}listItems=list.find("li");if(options.selectFirst){listItems.slice(0,1).addClass(CLASSES.ACTIVE);active=0;}if($.fn.bgiframe)list.bgiframe();}return{display:function(d,q){init();data=d;term=q;fillList();},next:function(){moveSelect(1);},prev:function(){moveSelect(-1);},pageUp:function(){if(active!=0&&active-8<0){moveSelect(-active);}else{moveSelect(-8);}},pageDown:function(){if(active!=listItems.size()-1&&active+8>listItems.size()){moveSelect(listItems.size()-1-active);}else{moveSelect(8);}},hide:function(){element&&element.hide();listItems&&listItems.removeClass(CLASSES.ACTIVE);active=-1;},visible:function(){return element&&element.is(":visible");},current:function(){return this.visible()&&(listItems.filter("."+CLASSES.ACTIVE)[0]||options.selectFirst&&listItems[0]);},show:function(){var offset=$(input).offset();element.css({width:typeof options.width=="string"||options.width>0?options.width:$(input).width(),top:offset.top+input.offsetHeight,left:offset.left}).show();if(options.scroll){list.scrollTop(0);list.css({maxHeight:options.scrollHeight,overflow:'auto'});if($.browser.msie&&typeof document.body.style.maxHeight==="undefined"){var listHeight=0;listItems.each(function(){listHeight+=this.offsetHeight;});var scrollbarsVisible=listHeight>options.scrollHeight;list.css('height',scrollbarsVisible?options.scrollHeight:listHeight);if(!scrollbarsVisible){listItems.width(list.width()-parseInt(listItems.css("padding-left"))-parseInt(listItems.css("padding-right")));}}}},selected:function(){var selected=listItems&&listItems.filter("."+CLASSES.ACTIVE).removeClass(CLASSES.ACTIVE);return selected&&selected.length&&$.data(selected[0],"ac_data");},emptyList:function(){list&&list.empty();},unbind:function(){element&&element.remove();}};};$.Autocompleter.Selection=function(field,start,end){if(field.createTextRange){var selRange=field.createTextRange();selRange.collapse(true);selRange.moveStart("character",start);selRange.moveEnd("character",end);selRange.select();}else if(field.setSelectionRange){field.setSelectionRange(start,end);}else{if(field.selectionStart){field.selectionStart=start;field.selectionEnd=end;}}field.focus();};})(jQuery);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/jquery-autocomplete/jquery.autocomplete.pack.js DELETED
@@ -1,13 +0,0 @@
1
- /*
2
- * Autocomplete - jQuery plugin 1.0.2
3
- *
4
- * Copyright (c) 2007 Dylan Verheul, Dan G. Switzer, Anjesh Tuladhar, Jörn Zaefferer
5
- *
6
- * Dual licensed under the MIT and GPL licenses:
7
- * http://www.opensource.org/licenses/mit-license.php
8
- * http://www.gnu.org/licenses/gpl.html
9
- *
10
- * Revision: $Id: jquery.autocomplete.js 5747 2008-06-25 18:30:55Z joern.zaefferer $
11
- *
12
- */
13
- eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}(';(3($){$.31.1o({12:3(b,d){5 c=Y b=="1w";d=$.1o({},$.D.1L,{11:c?b:14,w:c?14:b,1D:c?$.D.1L.1D:10,Z:d&&!d.1x?10:3U},d);d.1t=d.1t||3(a){6 a};d.1q=d.1q||d.1K;6 I.K(3(){1E $.D(I,d)})},M:3(a){6 I.X("M",a)},1y:3(a){6 I.15("1y",[a])},20:3(){6 I.15("20")},1Y:3(a){6 I.15("1Y",[a])},1X:3(){6 I.15("1X")}});$.D=3(o,r){5 t={2N:38,2I:40,2D:46,2x:9,2v:13,2q:27,2d:3x,2j:33,2o:34,2e:8};5 u=$(o).3f("12","3c").P(r.24);5 p;5 m="";5 n=$.D.2W(r);5 s=0;5 k;5 h={1z:B};5 l=$.D.2Q(r,o,1U,h);5 j;$.1T.2L&&$(o.2K).X("3S.12",3(){4(j){j=B;6 B}});u.X(($.1T.2L?"3Q":"3N")+".12",3(a){k=a.2F;3L(a.2F){Q t.2N:a.1d();4(l.L()){l.2y()}A{W(0,C)}N;Q t.2I:a.1d();4(l.L()){l.2u()}A{W(0,C)}N;Q t.2j:a.1d();4(l.L()){l.2t()}A{W(0,C)}N;Q t.2o:a.1d();4(l.L()){l.2s()}A{W(0,C)}N;Q r.19&&$.1p(r.R)==","&&t.2d:Q t.2x:Q t.2v:4(1U()){a.1d();j=C;6 B}N;Q t.2q:l.U();N;3A:1I(p);p=1H(W,r.1D);N}}).1G(3(){s++}).3v(3(){s=0;4(!h.1z){2k()}}).2i(3(){4(s++>1&&!l.L()){W(0,C)}}).X("1y",3(){5 c=(1n.7>1)?1n[1]:14;3 23(q,a){5 b;4(a&&a.7){16(5 i=0;i<a.7;i++){4(a[i].M.O()==q.O()){b=a[i];N}}}4(Y c=="3")c(b);A u.15("M",b&&[b.w,b.H])}$.K(1g(u.J()),3(i,a){1R(a,23,23)})}).X("20",3(){n.18()}).X("1Y",3(){$.1o(r,1n[1]);4("w"2G 1n[1])n.1f()}).X("1X",3(){l.1u();u.1u();$(o.2K).1u(".12")});3 1U(){5 b=l.26();4(!b)6 B;5 v=b.M;m=v;4(r.19){5 a=1g(u.J());4(a.7>1){v=a.17(0,a.7-1).2Z(r.R)+r.R+v}v+=r.R}u.J(v);1l();u.15("M",[b.w,b.H]);6 C}3 W(b,c){4(k==t.2D){l.U();6}5 a=u.J();4(!c&&a==m)6;m=a;a=1k(a);4(a.7>=r.22){u.P(r.21);4(!r.1C)a=a.O();1R(a,2V,1l)}A{1B();l.U()}};3 1g(b){4(!b){6[""]}5 d=b.1Z(r.R);5 c=[];$.K(d,3(i,a){4($.1p(a))c[i]=$.1p(a)});6 c}3 1k(a){4(!r.19)6 a;5 b=1g(a);6 b[b.7-1]}3 1A(q,a){4(r.1A&&(1k(u.J()).O()==q.O())&&k!=t.2e){u.J(u.J()+a.48(1k(m).7));$.D.1N(o,m.7,m.7+a.7)}};3 2k(){1I(p);p=1H(1l,47)};3 1l(){5 c=l.L();l.U();1I(p);1B();4(r.2U){u.1y(3(a){4(!a){4(r.19){5 b=1g(u.J()).17(0,-1);u.J(b.2Z(r.R)+(b.7?r.R:""))}A u.J("")}})}4(c)$.D.1N(o,o.H.7,o.H.7)};3 2V(q,a){4(a&&a.7&&s){1B();l.2T(a,q);1A(q,a[0].H);l.1W()}A{1l()}};3 1R(f,d,g){4(!r.1C)f=f.O();5 e=n.2S(f);4(e&&e.7){d(f,e)}A 4((Y r.11=="1w")&&(r.11.7>0)){5 c={45:+1E 44()};$.K(r.2R,3(a,b){c[a]=Y b=="3"?b():b});$.43({42:"41",3Z:"12"+o.3Y,2M:r.2M,11:r.11,w:$.1o({q:1k(f),3X:r.Z},c),3W:3(a){5 b=r.1r&&r.1r(a)||1r(a);n.1h(f,b);d(f,b)}})}A{l.2J();g(f)}};3 1r(c){5 d=[];5 b=c.1Z("\\n");16(5 i=0;i<b.7;i++){5 a=$.1p(b[i]);4(a){a=a.1Z("|");d[d.7]={w:a,H:a[0],M:r.1v&&r.1v(a,a[0])||a[0]}}}6 d};3 1B(){u.1e(r.21)}};$.D.1L={24:"3R",2H:"3P",21:"3O",22:1,1D:3M,1C:B,1a:C,1V:B,1j:10,Z:3K,2U:B,2R:{},1S:C,1K:3(a){6 a[0]},1q:14,1A:B,E:0,19:B,R:", ",1t:3(b,a){6 b.2C(1E 3J("(?![^&;]+;)(?!<[^<>]*)("+a.2C(/([\\^\\$\\(\\)\\[\\]\\{\\}\\*\\.\\+\\?\\|\\\\])/2A,"\\\\$1")+")(?![^<>]*>)(?![^&;]+;)","2A"),"<2z>$1</2z>")},1x:C,1s:3I};$.D.2W=3(g){5 h={};5 j=0;3 1a(s,a){4(!g.1C)s=s.O();5 i=s.3H(a);4(i==-1)6 B;6 i==0||g.1V};3 1h(q,a){4(j>g.1j){18()}4(!h[q]){j++}h[q]=a}3 1f(){4(!g.w)6 B;5 f={},2w=0;4(!g.11)g.1j=1;f[""]=[];16(5 i=0,30=g.w.7;i<30;i++){5 c=g.w[i];c=(Y c=="1w")?[c]:c;5 d=g.1q(c,i+1,g.w.7);4(d===B)1P;5 e=d.3G(0).O();4(!f[e])f[e]=[];5 b={H:d,w:c,M:g.1v&&g.1v(c)||d};f[e].1O(b);4(2w++<g.Z){f[""].1O(b)}};$.K(f,3(i,a){g.1j++;1h(i,a)})}1H(1f,25);3 18(){h={};j=0}6{18:18,1h:1h,1f:1f,2S:3(q){4(!g.1j||!j)6 14;4(!g.11&&g.1V){5 a=[];16(5 k 2G h){4(k.7>0){5 c=h[k];$.K(c,3(i,x){4(1a(x.H,q)){a.1O(x)}})}}6 a}A 4(h[q]){6 h[q]}A 4(g.1a){16(5 i=q.7-1;i>=g.22;i--){5 c=h[q.3F(0,i)];4(c){5 a=[];$.K(c,3(i,x){4(1a(x.H,q)){a[a.7]=x}});6 a}}}6 14}}};$.D.2Q=3(e,g,f,k){5 h={G:"3E"};5 j,y=-1,w,1m="",1M=C,F,z;3 2r(){4(!1M)6;F=$("<3D/>").U().P(e.2H).T("3C","3B").1J(2p.2n);z=$("<3z/>").1J(F).3y(3(a){4(V(a).2m&&V(a).2m.3w()==\'2l\'){y=$("1F",z).1e(h.G).3u(V(a));$(V(a)).P(h.G)}}).2i(3(a){$(V(a)).P(h.G);f();g.1G();6 B}).3t(3(){k.1z=C}).3s(3(){k.1z=B});4(e.E>0)F.T("E",e.E);1M=B}3 V(a){5 b=a.V;3r(b&&b.3q!="2l")b=b.3p;4(!b)6[];6 b}3 S(b){j.17(y,y+1).1e(h.G);2h(b);5 a=j.17(y,y+1).P(h.G);4(e.1x){5 c=0;j.17(0,y).K(3(){c+=I.1i});4((c+a[0].1i-z.1c())>z[0].3o){z.1c(c+a[0].1i-z.3n())}A 4(c<z.1c()){z.1c(c)}}};3 2h(a){y+=a;4(y<0){y=j.1b()-1}A 4(y>=j.1b()){y=0}}3 2g(a){6 e.Z&&e.Z<a?e.Z:a}3 2f(){z.2B();5 b=2g(w.7);16(5 i=0;i<b;i++){4(!w[i])1P;5 a=e.1K(w[i].w,i+1,b,w[i].H,1m);4(a===B)1P;5 c=$("<1F/>").3m(e.1t(a,1m)).P(i%2==0?"3l":"3k").1J(z)[0];$.w(c,"2c",w[i])}j=z.3j("1F");4(e.1S){j.17(0,1).P(h.G);y=0}4($.31.2b)z.2b()}6{2T:3(d,q){2r();w=d;1m=q;2f()},2u:3(){S(1)},2y:3(){S(-1)},2t:3(){4(y!=0&&y-8<0){S(-y)}A{S(-8)}},2s:3(){4(y!=j.1b()-1&&y+8>j.1b()){S(j.1b()-1-y)}A{S(8)}},U:3(){F&&F.U();j&&j.1e(h.G);y=-1},L:3(){6 F&&F.3i(":L")},3h:3(){6 I.L()&&(j.2a("."+h.G)[0]||e.1S&&j[0])},1W:3(){5 a=$(g).3g();F.T({E:Y e.E=="1w"||e.E>0?e.E:$(g).E(),2E:a.2E+g.1i,1Q:a.1Q}).1W();4(e.1x){z.1c(0);z.T({29:e.1s,3e:\'3d\'});4($.1T.3b&&Y 2p.2n.3T.29==="3a"){5 c=0;j.K(3(){c+=I.1i});5 b=c>e.1s;z.T(\'3V\',b?e.1s:c);4(!b){j.E(z.E()-28(j.T("32-1Q"))-28(j.T("32-39")))}}}},26:3(){5 a=j&&j.2a("."+h.G).1e(h.G);6 a&&a.7&&$.w(a[0],"2c")},2J:3(){z&&z.2B()},1u:3(){F&&F.37()}}};$.D.1N=3(b,a,c){4(b.2O){5 d=b.2O();d.36(C);d.35("2P",a);d.4c("2P",c);d.4b()}A 4(b.2Y){b.2Y(a,c)}A{4(b.2X){b.2X=a;b.4a=c}}b.1G()}})(49);',62,261,'|||function|if|var|return|length|||||||||||||||||||||||||data||active|list|else|false|true|Autocompleter|width|element|ACTIVE|value|this|val|each|visible|result|break|toLowerCase|addClass|case|multipleSeparator|moveSelect|css|hide|target|onChange|bind|typeof|max||url|autocomplete||null|trigger|for|slice|flush|multiple|matchSubset|size|scrollTop|preventDefault|removeClass|populate|trimWords|add|offsetHeight|cacheLength|lastWord|hideResultsNow|term|arguments|extend|trim|formatMatch|parse|scrollHeight|highlight|unbind|formatResult|string|scroll|search|mouseDownOnSelect|autoFill|stopLoading|matchCase|delay|new|li|focus|setTimeout|clearTimeout|appendTo|formatItem|defaults|needsInit|Selection|push|continue|left|request|selectFirst|browser|selectCurrent|matchContains|show|unautocomplete|setOptions|split|flushCache|loadingClass|minChars|findValueCallback|inputClass||selected||parseInt|maxHeight|filter|bgiframe|ac_data|COMMA|BACKSPACE|fillList|limitNumberOfItems|movePosition|click|PAGEUP|hideResults|LI|nodeName|body|PAGEDOWN|document|ESC|init|pageDown|pageUp|next|RETURN|nullData|TAB|prev|strong|gi|empty|replace|DEL|top|keyCode|in|resultsClass|DOWN|emptyList|form|opera|dataType|UP|createTextRange|character|Select|extraParams|load|display|mustMatch|receiveData|Cache|selectionStart|setSelectionRange|join|ol|fn|padding|||moveStart|collapse|remove||right|undefined|msie|off|auto|overflow|attr|offset|current|is|find|ac_odd|ac_even|html|innerHeight|clientHeight|parentNode|tagName|while|mouseup|mousedown|index|blur|toUpperCase|188|mouseover|ul|default|absolute|position|div|ac_over|substr|charAt|indexOf|180|RegExp|100|switch|400|keydown|ac_loading|ac_results|keypress|ac_input|submit|style|150|height|success|limit|name|port||abort|mode|ajax|Date|timestamp||200|substring|jQuery|selectionEnd|select|moveEnd'.split('|'),0,{}))
 
 
 
 
 
 
 
 
 
 
 
 
 
js/jquery-autocomplete/lib/jquery.ajaxQueue.js DELETED
@@ -1,116 +0,0 @@
1
- /**
2
- * Ajax Queue Plugin
3
- *
4
- * Homepage: http://jquery.com/plugins/project/ajaxqueue
5
- * Documentation: http://docs.jquery.com/AjaxQueue
6
- */
7
-
8
- /**
9
-
10
- <script>
11
- $(function(){
12
- jQuery.ajaxQueue({
13
- url: "test.php",
14
- success: function(html){ jQuery("ul").append(html); }
15
- });
16
- jQuery.ajaxQueue({
17
- url: "test.php",
18
- success: function(html){ jQuery("ul").append(html); }
19
- });
20
- jQuery.ajaxSync({
21
- url: "test.php",
22
- success: function(html){ jQuery("ul").append("<b>"+html+"</b>"); }
23
- });
24
- jQuery.ajaxSync({
25
- url: "test.php",
26
- success: function(html){ jQuery("ul").append("<b>"+html+"</b>"); }
27
- });
28
- });
29
- </script>
30
- <ul style="position: absolute; top: 5px; right: 5px;"></ul>
31
-
32
- */
33
- /*
34
- * Queued Ajax requests.
35
- * A new Ajax request won't be started until the previous queued
36
- * request has finished.
37
- */
38
-
39
- /*
40
- * Synced Ajax requests.
41
- * The Ajax request will happen as soon as you call this method, but
42
- * the callbacks (success/error/complete) won't fire until all previous
43
- * synced requests have been completed.
44
- */
45
-
46
-
47
- (function($) {
48
-
49
- var ajax = $.ajax;
50
-
51
- var pendingRequests = {};
52
-
53
- var synced = [];
54
- var syncedData = [];
55
-
56
- $.ajax = function(settings) {
57
- // create settings for compatibility with ajaxSetup
58
- settings = jQuery.extend(settings, jQuery.extend({}, jQuery.ajaxSettings, settings));
59
-
60
- var port = settings.port;
61
-
62
- switch(settings.mode) {
63
- case "abort":
64
- if ( pendingRequests[port] ) {
65
- pendingRequests[port].abort();
66
- }
67
- return pendingRequests[port] = ajax.apply(this, arguments);
68
- case "queue":
69
- var _old = settings.complete;
70
- settings.complete = function(){
71
- if ( _old )
72
- _old.apply( this, arguments );
73
- jQuery([ajax]).dequeue("ajax" + port );;
74
- };
75
-
76
- jQuery([ ajax ]).queue("ajax" + port, function(){
77
- ajax( settings );
78
- });
79
- return;
80
- case "sync":
81
- var pos = synced.length;
82
-
83
- synced[ pos ] = {
84
- error: settings.error,
85
- success: settings.success,
86
- complete: settings.complete,
87
- done: false
88
- };
89
-
90
- syncedData[ pos ] = {
91
- error: [],
92
- success: [],
93
- complete: []
94
- };
95
-
96
- settings.error = function(){ syncedData[ pos ].error = arguments; };
97
- settings.success = function(){ syncedData[ pos ].success = arguments; };
98
- settings.complete = function(){
99
- syncedData[ pos ].complete = arguments;
100
- synced[ pos ].done = true;
101
-
102
- if ( pos == 0 || !synced[ pos-1 ] )
103
- for ( var i = pos; i < synced.length && synced[i].done; i++ ) {
104
- if ( synced[i].error ) synced[i].error.apply( jQuery, syncedData[i].error );
105
- if ( synced[i].success ) synced[i].success.apply( jQuery, syncedData[i].success );
106
- if ( synced[i].complete ) synced[i].complete.apply( jQuery, syncedData[i].complete );
107
-
108
- synced[i] = null;
109
- syncedData[i] = null;
110
- }
111
- };
112
- }
113
- return ajax.apply(this, arguments);
114
- };
115
-
116
- })(jQuery);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/jquery-autocomplete/lib/jquery.bgiframe.min.js DELETED
@@ -1,10 +0,0 @@
1
- /* Copyright (c) 2006 Brandon Aaron (http://brandonaaron.net)
2
- * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
3
- * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
4
- *
5
- * $LastChangedDate: 2007-07-22 01:45:56 +0200 (Son, 22 Jul 2007) $
6
- * $Rev: 2447 $
7
- *
8
- * Version 2.1.1
9
- */
10
- (function($){$.fn.bgIframe=$.fn.bgiframe=function(s){if($.browser.msie&&/6.0/.test(navigator.userAgent)){s=$.extend({top:'auto',left:'auto',width:'auto',height:'auto',opacity:true,src:'javascript:false;'},s||{});var prop=function(n){return n&&n.constructor==Number?n+'px':n;},html='<iframe class="bgiframe"frameborder="0"tabindex="-1"src="'+s.src+'"'+'style="display:block;position:absolute;z-index:-1;'+(s.opacity!==false?'filter:Alpha(Opacity=\'0\');':'')+'top:'+(s.top=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+\'px\')':prop(s.top))+';'+'left:'+(s.left=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+\'px\')':prop(s.left))+';'+'width:'+(s.width=='auto'?'expression(this.parentNode.offsetWidth+\'px\')':prop(s.width))+';'+'height:'+(s.height=='auto'?'expression(this.parentNode.offsetHeight+\'px\')':prop(s.height))+';'+'"/>';return this.each(function(){if($('> iframe.bgiframe',this).length==0)this.insertBefore(document.createElement(html),this.firstChild);});}return this;};})(jQuery);
 
 
 
 
 
 
 
 
 
 
js/jquery-autocomplete/todo DELETED
@@ -1,166 +0,0 @@
1
- TODO
2
-
3
- - test formatItem implementation that returns (clickable) anchors
4
- - bug: handle del key; eg. type a letter, remove it using del, type same letter again: nothing happens
5
- - handle up/down keys in textarea (prevent default while select is open?)
6
- - docs: max:0 works, too, "removing" it(??)
7
- - fix ac_loading/options.loadingClass
8
- - support/enable request urls like foo/bar/10 instead of foo/q=10
9
- - urlencode request term before passing to $.ajax/data; evaluate why $.ajax doesn't handle that itself, if at all; try with umlauts, russian/danish/chinese characeters (see validate)
10
- - test what happens when an element gets focused programmatically (maybe even before then autcomplete is applied)
11
- - check if blur on selecting can be removed
12
- - fix keyhandling to ignore metakeys, eg. shift; especially important for chinese characters that need more then one key
13
- - enhance mustMatch: provide event/callback when a value gets deleted
14
- - handle tab key different then enter, eg. don't blur field or prevent default, just let it move on; in any case, no need to blur the field when selecting a value via tab, unlike return
15
- - prevent redundant requests on
16
- - superstring returned no result, no need to query again for substring, eg. pete returned nothing, peter won't either
17
- - previous query mustn't be requested again, eg. pete returns 10 lines, peter nothing, backspace to pete should get the 10 lines from cache (may need TimeToLive setting for cache to invalidate it)
18
- - incorporate improvements and suggestions by Hector: http://beta.winserver.com/public/test/MultiSuggestTest.wct
19
- - json support: An optional JSON format, that assumes a certain JSON format as default and just looks for a dataType "json" to be activated; [records], where each record is { id:String, label:String, moreOptionalValues... }
20
- - accept callback as first argument to let users implement their own dynamic data (no caching) - consider async API
21
- - allow users to keep their incomplete value when pressing tab, just mimic the default-browser-autocomplete: tab doesn't select any proposed value -> tab closes the select and works normal otherwise
22
- - small bug in your autocomplete, When setting autoFill:true I would expect formatResult to be called on autofill, it seems not to be the case.
23
- - add a callback to allow decoding the response
24
- - allow modification of not-last value in multiple-fields
25
- @option Number size Limit the number of items to show at once. Default:
26
- @option Function parse - TEST AND DOCUMENT ME
27
- - add option to display selectbox on focus
28
-
29
- $input.bind("show", function() {
30
- if ( !select.visible() ) {
31
- onChange(0, true);
32
- }
33
- });
34
-
35
- - reference: http://capxous.com/
36
- - add "try ..." hints to demo
37
- - check out demos
38
- - reference: http://createwebapp.com/demo/
39
-
40
- - add option to hide selectbox when no match is found - see comment by Ian on plugin page (14. Juli 2007 04:31)
41
- - add example for reinitializing an autocomplete using unbind()
42
-
43
- - Add option to pass through additional arguments to $.ajax, like type to use POST instead of GET
44
-
45
- - I found out that the problem with UTF-8 not being correctly sent can be solved on the server side by applying (PHP) rawurldecode() function, which decodes the Unicode characters sent by GET method and therefore URL-encoded.
46
- -> add that hint to docs and examples
47
-
48
- But I am trying this with these three values: “foo bar”, “foo foo”, and “foo far”, and if I enter “b” (or “ba”) nothing matches, if I enter “f” all three do match, and if I enter “fa” the last one matches.
49
- The problem seems to be that the cache is implemented with a first-character hashtable, so only after matching the first character, the latter ones are searched for.
50
-
51
- xml example:
52
- <script type="text/javascript">
53
- function parseXML(data) {
54
- var results = [];
55
- var branches = $(data).find('item');
56
- $(branches).each(function() {
57
- var text = $.trim($(this).find('text').text());
58
- var value = $.trim($(this).find('value').text());
59
- //console.log(text);
60
- //console.log(value);
61
- results[results.length] = {'data': this, 'result': value, 'value': text};
62
- });
63
- $(results).each(function() {
64
- //console.log('value', this.value);
65
- //console.log('text', this.text);
66
- });
67
- //console.log(results);
68
- return results;
69
- };
70
- $(YourOojHere).autocomplete(SERVER_AJAX_URL, {parse: parseXML});
71
- </script>
72
- <?xml version="1.0"?>
73
- <ajaxresponse>
74
- <item>
75
- <text>
76
- <![CDATA[<b>FreeNode:</b> irc.freenode.net:6667]]>
77
- </text>
78
- <value><![CDATA[irc.freenode.net:6667]]></value>
79
- </item><item>
80
- <text>
81
- <![CDATA[<b>irc.oftc.net</b>:6667]]>
82
- </text>
83
- <value><![CDATA[irc.oftc.net:6667]]></value>
84
- </item><item>
85
- <text>
86
- <![CDATA[<b>irc.undernet.org</b>:6667]]>
87
- </text>
88
- <value><![CDATA[irc.undernet.org:6667]]></value>
89
- </item>
90
- </ajaxresponse>
91
-
92
-
93
-
94
- Hi all,
95
-
96
- I use Autocomplete 1.0 Alpha mostly for form inputs bound to foreign
97
- key columns. For instance I have a user_position table with two
98
- columns: user_id and position_id. On new appointment form I have two
99
- autocomplete text inputs with the following code:
100
-
101
- <input type="text" id="user_id" class="ac_input" tabindex="1" />
102
- <input type="text" id="position_id" class="ac_input" tabindex="2" />
103
-
104
- As you can see the inputs do not have a name attribute, and when the
105
- form is submitted their values are not sent, which is all right since
106
- they will contain strings like:
107
-
108
- 'John Doe'
109
- 'Sales Manager'
110
-
111
- whereas our backend expects something like:
112
-
113
- 23
114
- 14
115
-
116
- which are the user_id for John Doe and position_id for Sales Manager.
117
- To send these values I have two hidden inputs in the form like this:
118
-
119
- <input type="hidden" name="user_id" value="">
120
- <input type="hidden" name="position_id" value="">
121
-
122
- Also I have the following code in the $().ready function:
123
-
124
- $("#user_id").result(function(event, data, formatted) {
125
- $("input[@name=user_id]").val(data[1]);
126
- });
127
- $("#position_id").result(function(event, data, formatted) {
128
- $("input[@name=position_id]").val(data[1]);
129
- });
130
-
131
- As could be seen these functions stuff user_id and position_id values
132
- (in our example 23 and 14) into the hidden inputs, and when the form
133
- is submitted these values are sent:
134
-
135
- user_id = 23
136
- position_id = 14
137
-
138
- The backend script then takes care of adding a record to our
139
- user_position table containing those values.
140
-
141
- I wonder how could the plugin code be modified to simplify the setup
142
- by taking care of adding hidden inputs and updating the value of
143
- hidden inputs as default behavior. I have successfully attempted a
144
- simpler solution - writing a wrapper to perform these additional tasks
145
- and invoke autocomplete as well. I hope my intention is clear enough,
146
- if not, this is exactly the expected outcome:
147
-
148
- Before:
149
-
150
- <script type="text/javascript"
151
- src="jquery.autocomplete-modified.js"></script>
152
- <input type="text" name="user_id" class="ac_input" tabindex="1" />
153
-
154
- After:
155
-
156
- <input type="text" id="user_id" class="ac_input" tabindex="1" />
157
- <input type="hidden" name="user_id" value="23">
158
-
159
-
160
- Last word, I know this looks like a tall order, and I do not hope
161
- someone will make a complete working mod for me, but rather would very
162
- much appreciate helpful advise and directions.
163
-
164
- Many thanks in advance
165
- Majid
166
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/jquery-ui-datepicker/i18n/ui.datepicker-ar.js DELETED
@@ -1,23 +0,0 @@
1
- /* Arabic Translation for jQuery UI date picker plugin. */
2
- /* Khaled Al Horani -- koko.dw@gmail.com */
3
- /* خالد الحوراني -- koko.dw@gmail.com */
4
- /* NOTE: monthNames are the original months names and thez are the Arabic names, not the new months name فبراير - يناير and there isnät any Arabic roots for these months */
5
- jQuery(function($){
6
- $.datepicker.regional['ar'] = {
7
- clearText: 'مسح', clearStatus: 'امسح التاريخ الحالي',
8
- closeText: 'إغلاق', closeStatus: 'إغلاق بدون حفظ',
9
- prevText: '<السابق', prevStatus: 'عرض الشهر السابق',
10
- nextText: 'التالي>', nextStatus: 'عرض الشهر القادم',
11
- currentText: 'اليوم', currentStatus: 'عرض الشهر الحالي',
12
- monthNames: ['كانون الثاني', 'شباط', 'آذار', 'نيسان', 'آذار', 'حزيران', 'تموز', 'آب', 'أيلول', 'تشرين الأول', 'تشرين الثاني', 'كانون الأول'],
13
- monthNamesShort: ['1','2','3','4','5','6','7','8','9','10','11','12'],
14
- monthStatus: 'عرض شهر آخر', yearStatus: 'عرض سنة آخرى',
15
- weekHeader: 'أسبوع', weekStatus: 'أسبوع السنة',
16
- dayNames: ['السبت', 'الأحد', 'الاثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة'],
17
- dayNamesShort: ['سبت', 'أحد', 'اثنين', 'ثلاثاء', 'أربعاء', 'خميس', 'جمعة'],
18
- dayNamesMin: ['سبت', 'أحد', 'اثنين', 'ثلاثاء', 'أربعاء', 'خميس', 'جمعة'],
19
- dayStatus: 'اختر DD لليوم الأول من الأسبوع', dateStatus: 'اختر D, M d',
20
- dateFormat: 'dd/mm/yy', firstDay: 0,
21
- initStatus: 'اختر يوم', isRTL: true};
22
- $.datepicker.setDefaults($.datepicker.regional['ar']);
23
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/jquery-ui-datepicker/i18n/ui.datepicker-bg.js DELETED
@@ -1,22 +0,0 @@
1
- /* Bulgarian initialisation for the jQuery UI date picker plugin. */
2
- /* Written by Stoyan Kyosev (http://svest.org). */
3
- jQuery(function($){
4
- $.datepicker.regional['bg'] = {clearText: 'изчисти', clearStatus: 'изчисти актуалната дата',
5
- closeText: 'затвори', closeStatus: 'затвори без промени',
6
- prevText: '&#x3c;назад', prevStatus: 'покажи последния месец',
7
- nextText: 'напред&#x3e;', nextStatus: 'покажи следващия месец',
8
- currentText: 'днес', currentStatus: '',
9
- monthNames: ['Януари','Февруари','Март','Април','Май','Юни',
10
- 'Юли','Август','Септември','Октомври','Ноември','Декември'],
11
- monthNamesShort: ['Яну','Фев','Мар','Апр','Май','Юни',
12
- 'Юли','Авг','Сеп','Окт','Нов','Дек'],
13
- monthStatus: 'покажи друг месец', yearStatus: 'покажи друга година',
14
- weekHeader: 'Wk', weekStatus: 'седмица от месеца',
15
- dayNames: ['Неделя','Понеделник','Вторник','Сряда','Четвъртък','Петък','Събота'],
16
- dayNamesShort: ['Нед','Пон','Вто','Сря','Чет','Пет','Съб'],
17
- dayNamesMin: ['Не','По','Вт','Ср','Че','Пе','Съ'],
18
- dayStatus: 'Сложи DD като първи ден от седмицата', dateStatus: 'Избери D, M d',
19
- dateFormat: 'dd.mm.yy', firstDay: 1,
20
- initStatus: 'Избери дата', isRTL: false};
21
- $.datepicker.setDefaults($.datepicker.regional['bg']);
22
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/jquery-ui-datepicker/i18n/ui.datepicker-cs.js DELETED
@@ -1,22 +0,0 @@
1
- /* Czech initialisation for the jQuery UI date picker plugin. */
2
- /* Written by Tomas Muller (tomas@tomas-muller.net). */
3
- jQuery(function($){
4
- $.datepicker.regional['cs'] = {clearText: 'Vymazat', clearStatus: 'Vymaže zadané datum',
5
- closeText: 'Zavřít', closeStatus: 'Zavře kalendář beze změny',
6
- prevText: '&#x3c;Dříve', prevStatus: 'Přejít na předchozí měsí',
7
- nextText: 'Později&#x3e;', nextStatus: 'Přejít na další měsíc',
8
- currentText: 'Nyní', currentStatus: 'Přejde na aktuální měsíc',
9
- monthNames: ['leden','únor','březen','duben','květen','červen',
10
- 'červenec','srpen','září','říjen','listopad','prosinec'],
11
- monthNamesShort: ['led','úno','bře','dub','kvě','čer',
12
- 'čvc','srp','zář','říj','lis','pro'],
13
- monthStatus: 'Přejít na jiný měsíc', yearStatus: 'Přejít na jiný rok',
14
- weekHeader: 'Týd', weekStatus: 'Týden v roce',
15
- dayNames: ['neděle', 'pondělí', 'úterý', 'středa', 'čtvrtek', 'pátek', 'sobota'],
16
- dayNamesShort: ['ne', 'po', 'út', 'st', 'čt', 'pá', 'so'],
17
- dayNamesMin: ['ne','po','út','st','čt','pá','so'],
18
- dayStatus: 'Nastavit DD jako první den v týdnu', dateStatus: '\'Vyber\' DD, M d',
19
- dateFormat: 'dd.mm.yy', firstDay: 1,
20
- initStatus: 'Vyberte datum', isRTL: false};
21
- $.datepicker.setDefaults($.datepicker.regional['cs']);
22
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/jquery-ui-datepicker/i18n/ui.datepicker-da.js DELETED
@@ -1,22 +0,0 @@
1
- /* Danish initialisation for the jQuery UI date picker plugin. */
2
- /* Written by Jan Christensen ( deletestuff@gmail.com). */
3
- jQuery(function($){
4
- $.datepicker.regional['da'] = {clearText: 'Nulstil', clearStatus: 'Nulstil den aktuelle dato',
5
- closeText: 'Luk', closeStatus: 'Luk uden ændringer',
6
- prevText: '&#x3c;Forrige', prevStatus: 'Vis forrige måned',
7
- nextText: 'Næste&#x3e;', nextStatus: 'Vis næste måned',
8
- currentText: 'Idag', currentStatus: 'Vis aktuel måned',
9
- monthNames: ['Januar','Februar','Marts','April','Maj','Juni',
10
- 'Juli','August','September','Oktober','November','December'],
11
- monthNamesShort: ['Jan','Feb','Mar','Apr','Maj','Jun',
12
- 'Jul','Aug','Sep','Okt','Nov','Dec'],
13
- monthStatus: 'Vis en anden måned', yearStatus: 'Vis et andet år',
14
- weekHeader: 'Uge', weekStatus: 'Årets uge',
15
- dayNames: ['Søndag','Mandag','Tirsdag','Onsdag','Torsdag','Fredag','Lørdag'],
16
- dayNamesShort: ['Søn','Man','Tir','Ons','Tor','Fre','Lør'],
17
- dayNamesMin: ['Sø','Ma','Ti','On','To','Fr','Lø'],
18
- dayStatus: 'Sæt DD som første ugedag', dateStatus: 'Vælg D, M d',
19
- dateFormat: 'dd-mm-yy', firstDay: 0,
20
- initStatus: 'Vælg en dato', isRTL: false};
21
- $.datepicker.setDefaults($.datepicker.regional['da']);
22
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/jquery-ui-datepicker/i18n/ui.datepicker-de.js DELETED
@@ -1,22 +0,0 @@
1
- /* German initialisation for the jQuery UI date picker plugin. */
2
- /* Written by Milian Wolff (mail@milianw.de). */
3
- jQuery(function($){
4
- $.datepicker.regional['de'] = {clearText: 'löschen', clearStatus: 'aktuelles Datum löschen',
5
- closeText: 'schließen', closeStatus: 'ohne Änderungen schließen',
6
- prevText: '&#x3c;zurück', prevStatus: 'letzten Monat zeigen',
7
- nextText: 'Vor&#x3e;', nextStatus: 'nächsten Monat zeigen',
8
- currentText: 'heute', currentStatus: '',
9
- monthNames: ['Januar','Februar','März','April','Mai','Juni',
10
- 'Juli','August','September','Oktober','November','Dezember'],
11
- monthNamesShort: ['Jan','Feb','Mär','Apr','Mai','Jun',
12
- 'Jul','Aug','Sep','Okt','Nov','Dez'],
13
- monthStatus: 'anderen Monat anzeigen', yearStatus: 'anderes Jahr anzeigen',
14
- weekHeader: 'Wo', weekStatus: 'Woche des Monats',
15
- dayNames: ['Sonntag','Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag'],
16
- dayNamesShort: ['So','Mo','Di','Mi','Do','Fr','Sa'],
17
- dayNamesMin: ['So','Mo','Di','Mi','Do','Fr','Sa'],
18
- dayStatus: 'Setze DD als ersten Wochentag', dateStatus: 'Wähle D, M d',
19
- dateFormat: 'dd.mm.yy', firstDay: 1,
20
- initStatus: 'Wähle ein Datum', isRTL: false};
21
- $.datepicker.setDefaults($.datepicker.regional['de']);
22
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/jquery-ui-datepicker/i18n/ui.datepicker-fr.js DELETED
@@ -1,22 +0,0 @@
1
- /* French initialisation for the jQuery UI date picker plugin. */
2
- /* Written by Keith Wood (kbwood@virginbroadband.com.au) and Stéphane Nahmani (sholby@sholby.net). */
3
- jQuery(function($){
4
- $.datepicker.regional['fr'] = {clearText: 'Effacer', clearStatus: '',
5
- closeText: 'Fermer', closeStatus: 'Fermer sans modifier',
6
- prevText: '&lt;Préc', prevStatus: 'Voir le mois précédent',
7
- nextText: 'Suiv&gt;', nextStatus: 'Voir le mois suivant',
8
- currentText: 'Courant', currentStatus: 'Voir le mois courant',
9
- monthNames: ['Janvier','Février','Mars','Avril','Mai','Juin',
10
- 'Juillet','Août','Septembre','Octobre','Novembre','Décembre'],
11
- monthNamesShort: ['Jan','Fév','Mar','Avr','Mai','Jun',
12
- 'Jul','Aoû','Sep','Oct','Nov','Déc'],
13
- monthStatus: 'Voir un autre mois', yearStatus: 'Voir un autre année',
14
- weekHeader: 'Sm', weekStatus: '',
15
- dayNames: ['Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi'],
16
- dayNamesShort: ['Dim','Lun','Mar','Mer','Jeu','Ven','Sam'],
17
- dayNamesMin: ['Di','Lu','Ma','Me','Je','Ve','Sa'],
18
- dayStatus: 'Utiliser DD comme premier jour de la semaine', dateStatus: 'Choisir le DD, MM d',
19
- dateFormat: 'dd/mm/yy', firstDay: 0,
20
- initStatus: 'Choisir la date', isRTL: false};
21
- $.datepicker.setDefaults($.datepicker.regional['fr']);
22
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/jquery-ui-datepicker/i18n/ui.datepicker-hu.js DELETED
@@ -1,22 +0,0 @@
1
- /* Hungarian initialisation for the jQuery UI date picker plugin. */
2
- /* Written by Istvan Karaszi (jquerycalendar@spam.raszi.hu). */
3
- jQuery(function($){
4
- $.datepicker.regional['hu'] = {clearText: 'törlés', clearStatus: '',
5
- closeText: 'bezárás', closeStatus: '',
6
- prevText: '&laquo;&nbsp;vissza', prevStatus: '',
7
- nextText: 'előre&nbsp;&raquo;', nextStatus: '',
8
- currentText: 'ma', currentStatus: '',
9
- monthNames: ['Január', 'Február', 'Március', 'Április', 'Május', 'Június',
10
- 'Július', 'Augusztus', 'Szeptember', 'Október', 'November', 'December'],
11
- monthNamesShort: ['Jan', 'Feb', 'Már', 'Ápr', 'Máj', 'Jún',
12
- 'Júl', 'Aug', 'Szep', 'Okt', 'Nov', 'Dec'],
13
- monthStatus: '', yearStatus: '',
14
- weekHeader: 'Hé', weekStatus: '',
15
- dayNames: ['Vasámap', 'Hétfö', 'Kedd', 'Szerda', 'Csütörtök', 'Péntek', 'Szombat'],
16
- dayNamesShort: ['Vas', 'Hét', 'Ked', 'Sze', 'Csü', 'Pén', 'Szo'],
17
- dayNamesMin: ['V', 'H', 'K', 'Sze', 'Cs', 'P', 'Szo'],
18
- dayStatus: 'DD', dateStatus: 'D, M d',
19
- dateFormat: 'yy-mm-dd', firstDay: 1,
20
- initStatus: '', isRTL: false};
21
- $.datepicker.setDefaults($.datepicker.regional['hu']);
22
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/jquery-ui-datepicker/i18n/ui.datepicker-id.js DELETED
@@ -1,22 +0,0 @@
1
- /* Indonesian initialisation for the jQuery UI date picker plugin. */
2
- /* Written by Deden Fathurahman (dedenf@gmail.com). */
3
- jQuery(function($){
4
- $.datepicker.regional['id'] = {clearText: 'kosongkan', clearStatus: 'bersihkan tanggal yang sekarang',
5
- closeText: 'Tutup', closeStatus: 'Tutup tanpa mengubah',
6
- prevText: '&lt;mundur', prevStatus: 'Tampilkan bulan sebelumnya',
7
- nextText: 'maju&gt;', nextStatus: 'Tampilkan bulan berikutnya',
8
- currentText: 'hari ini', currentStatus: 'Tampilkan bulan sekarang',
9
- monthNames: ['Januari','Februari','Maret','April','Mei','Juni',
10
- 'Juli','Agustus','September','Oktober','Nopember','Desember'],
11
- monthNamesShort: ['Jan','Feb','Mar','Apr','Mei','Jun',
12
- 'Jul','Agus','Sep','Okt','Nop','Des'],
13
- monthStatus: 'Tampilkan bulan yang berbeda', yearStatus: 'Tampilkan tahun yang berbeda',
14
- weekHeader: 'Mg', weekStatus: 'Minggu dalam tahun',
15
- dayNames: ['Minggu','Senin','Selasa','Rabu','Kamis','Jumat','Sabtu'],
16
- dayNamesShort: ['Min','Sen','Sel','Rab','kam','Jum','Sab'],
17
- dayNamesMin: ['Mg','Sn','Sl','Rb','Km','jm','Sb'],
18
- dayStatus: 'gunakan DD sebagai awal hari dalam minggu', dateStatus: 'pilih le DD, MM d',
19
- dateFormat: 'dd/mm/yy', firstDay: 0,
20
- initStatus: 'Pilih Tanggal', isRTL: false};
21
- $.datepicker.setDefaults($.datepicker.regional['id']);
22
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/jquery-ui-datepicker/i18n/ui.datepicker-it.js DELETED
@@ -1,22 +0,0 @@
1
- /* Italian initialisation for the jQuery UI date picker plugin. */
2
- /* Written by Apaella (apaella@gmail.com). */
3
- jQuery(function($){
4
- $.datepicker.regional['it'] = {clearText: 'Svuota', clearStatus: '',
5
- closeText: 'Chiudi', closeStatus: '',
6
- prevText: '&lt;Prec', prevStatus: '',
7
- nextText: 'Succ&gt;', nextStatus: '',
8
- currentText: 'Oggi', currentStatus: '',
9
- monthNames: ['Gennaio','Febbraio','Marzo','Aprile','Maggio','Giugno',
10
- 'Luglio','Agosto','Settembre','Ottobre','Novembre','Dicembre'],
11
- monthNamesShort: ['Gen','Feb','Mar','Apr','Mag','Giu',
12
- 'Lug','Ago','Set','Ott','Nov','Dic'],
13
- monthStatus: '', yearStatus: '',
14
- weekHeader: 'Sm', weekStatus: '',
15
- dayNames: ['Domenica','Luned&#236','Marted&#236','Mercoled&#236','Gioved&#236','Venerd&#236','Sabato'],
16
- dayNamesShort: ['Dom','Lun','Mar','Mer','Gio','Ven','Sab'],
17
- dayNamesMin: ['Do','Lu','Ma','Me','Gio','Ve','Sa'],
18
- dayStatus: 'DD', dateStatus: 'D, M d',
19
- dateFormat: 'dd/mm/yy', firstDay: 1,
20
- initStatus: '', isRTL: false};
21
- $.datepicker.setDefaults($.datepicker.regional['it']);
22
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/jquery-ui-datepicker/i18n/ui.datepicker-ja.js DELETED
@@ -1,22 +0,0 @@
1
- /* Japanese (UTF-8) initialisation for the jQuery UI date picker plugin. */
2
- /* Written by Milly. */
3
- jQuery(function($){
4
- $.datepicker.regional['ja'] = {clearText: '&#21066;&#38500;', clearStatus: '',
5
- closeText: '&#38281;&#12376;&#12427;', closeStatus: '',
6
- prevText: '&lt;&#21069;&#26376;', prevStatus: '',
7
- nextText: '&#27425;&#26376;&gt;', nextStatus: '',
8
- currentText: '&#20170;&#26085;', currentStatus: '',
9
- monthNames: ['1&#26376;','2&#26376;','3&#26376;','4&#26376;','5&#26376;','6&#26376;',
10
- '7&#26376;','8&#26376;','9&#26376;','10&#26376;','11&#26376;','12&#26376;'],
11
- monthNamesShort: ['1&#26376;','2&#26376;','3&#26376;','4&#26376;','5&#26376;','6&#26376;',
12
- '7&#26376;','8&#26376;','9&#26376;','10&#26376;','11&#26376;','12&#26376;'],
13
- monthStatus: '', yearStatus: '',
14
- weekHeader: 'Wk', weekStatus: '',
15
- dayNames: ['&#26085;','&#26376;','&#28779;','&#27700;','&#26408;','&#37329;','&#22303;'],
16
- dayNamesShort: ['&#26085;','&#26376;','&#28779;','&#27700;','&#26408;','&#37329;','&#22303;'],
17
- dayNamesMin: ['&#26085;','&#26376;','&#28779;','&#27700;','&#26408;','&#37329;','&#22303;'],
18
- dayStatus: 'DD', dateStatus: 'D, M d',
19
- dateFormat: 'yy/mm/dd', firstDay: 0,
20
- initStatus: '', isRTL: false};
21
- $.datepicker.setDefaults($.datepicker.regional['ja']);
22
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/jquery-ui-datepicker/i18n/ui.datepicker-ko.js DELETED
@@ -1,22 +0,0 @@
1
- /* Korean initialisation for the jQuery calendar extension. */
2
- /* Written by DaeKwon Kang (ncrash.dk@gmail.com). */
3
- jQuery(function($){
4
- $.datepicker.regional['ko'] = {clearText: '지우기', clearStatus: '',
5
- closeText: '닫기', closeStatus: '',
6
- prevText: '이전달', prevStatus: '',
7
- nextText: '다음달', nextStatus: '',
8
- currentText: '오늘', currentStatus: '',
9
- monthNames: ['1월(JAN)','2월(FEB)','3월(MAR)','4월(APR)','5월(MAY)','6월(JUN)',
10
- '7월(JUL)','8월(AUG)','9월(SEP)','10월(OCT)','11월(NOV)','12월(DEC)'],
11
- monthNamesShort: ['1월(JAN)','2월(FEB)','3월(MAR)','4월(APR)','5월(MAY)','6월(JUN)',
12
- '7월(JUL)','8월(AUG)','9월(SEP)','10월(OCT)','11월(NOV)','12월(DEC)'],
13
- monthStatus: '', yearStatus: '',
14
- weekHeader: 'Wk', weekStatus: '',
15
- dayNames: ['일','월','화','수','목','금','토'],
16
- dayNamesShort: ['일','월','화','수','목','금','토'],
17
- dayNamesMin: ['일','월','화','수','목','금','토'],
18
- dayStatus: 'DD', dateStatus: 'D, M d',
19
- dateFormat: 'yy-mm-dd', firstDay: 0,
20
- initStatus: '', isRTL: false};
21
- $.datepicker.setDefaults($.datepicker.regional['ko']);
22
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/jquery-ui-datepicker/i18n/ui.datepicker-lt.js DELETED
@@ -1,25 +0,0 @@
1
- /**
2
- * Lithuanian (UTF-8) initialisation for the jQuery UI date picker plugin.
3
- *
4
- * @author Arturas Paleicikas <arturas@avalon.lt>
5
- */
6
- jQuery(function($){
7
- $.datepicker.regional['lt'] = {clearText: 'Išvalyti', clearStatus: '',
8
- closeText: 'Uždaryti', closeStatus: '',
9
- prevText: '&lt;Atgal', prevStatus: '',
10
- nextText: 'Pirmyn&gt;', nextStatus: '',
11
- currentText: 'Šiandien', currentStatus: '',
12
- monthNames: ['Sausis','Vasaris','Kovas','Balandis','Gegužė','Birželis',
13
- 'Liepa','Rugpjūtis','Rugsėjis','Spalis','Lapkritis','Gruodis'],
14
- monthNamesShort: ['Sau','Vas','Kov','Bal','Geg','Bir',
15
- 'Lie','Rugp','Rugs','Spa','Lap','Gru'],
16
- monthStatus: '', yearStatus: '',
17
- weekHeader: '', weekStatus: '',
18
- dayNames: ['sekmadienis','pirmadienis','antradienis','trečiadienis','ketvirtadienis','penktadienis','šeštadienis'],
19
- dayNamesShort: ['sek','pir','ant','tre','ket','pen','šeš'],
20
- dayNamesMin: ['Se','Pr','An','Tr','Ke','Pe','Še'],
21
- dayStatus: 'DD', dateStatus: 'D, M d',
22
- dateFormat: 'yy-mm-dd', firstDay: 1,
23
- initStatus: '', isRTL: false};
24
- $.datepicker.setDefaults($.datepicker.regional['lt']);
25
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/jquery-ui-datepicker/i18n/ui.datepicker-nl.js DELETED
@@ -1,21 +0,0 @@
1
- /* Dutch (UTF-8) initialisation for the jQuery UI date picker plugin. */
2
- jQuery(function($){
3
- $.datepicker.regional['nl'] = {clearText: 'Wissen', clearStatus: 'Wis de huidige datum',
4
- closeText: 'Sluiten', closeStatus: 'Sluit zonder verandering',
5
- prevText: '&lt;Terug', prevStatus: 'Laat de voorgaande maand zien',
6
- nextText: 'Volgende&gt;', nextStatus: 'Laat de volgende maand zien',
7
- currentText: 'Vandaag', currentStatus: 'Laat de huidige maand zien',
8
- monthNames: ['Januari','Februari','Maart','April','Mei','Juni',
9
- 'Juli','Augustus','September','Oktober','November','December'],
10
- monthNamesShort: ['Jan','Feb','Mrt','Apr','Mei','Jun',
11
- 'Jul','Aug','Sep','Okt','Nov','Dec'],
12
- monthStatus: 'Laat een andere maand zien', yearStatus: 'Laat een ander jaar zien',
13
- weekHeader: 'Wk', weekStatus: 'Week van het jaar',
14
- dayNames: ['Zondag','Maandag','Dinsdag','Woensdag','Donderdag','Vrijdag','Zaterdag'],
15
- dayNamesShort: ['Zon','Maa','Din','Woe','Don','Vri','Zat'],
16
- dayNamesMin: ['Zo','Ma','Di','Wo','Do','Vr','Za'],
17
- dayStatus: 'DD', dateStatus: 'D, M d',
18
- dateFormat: 'dd.mm.yy', firstDay: 1,
19
- initStatus: 'Kies een datum', isRTL: false};
20
- $.datepicker.setDefaults($.datepicker.regional['nl']);
21
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/jquery-ui-datepicker/i18n/ui.datepicker-no.js DELETED
@@ -1,23 +0,0 @@
1
- /* Norwegian initialisation for the jQuery UI date picker plugin. */
2
- /* Written by Naimdjon Takhirov (naimdjon@gmail.com). */
3
-
4
- $(document).ready(function(){
5
- $.datepicker.regional['no'] = {clearText: 'Tøm', clearStatus: '',
6
- closeText: 'Lukk', closeStatus: '',
7
- prevText: '&laquo;Forrige', prevStatus: '',
8
- nextText: 'Neste&raquo;', nextStatus: '',
9
- currentText: 'I dag', currentStatus: '',
10
- monthNames: ['Januar','Februar','Mars','April','Mai','Juni',
11
- 'Juli','August','September','Oktober','November','Desember'],
12
- monthNamesShort: ['Jan','Feb','Mar','Apr','Mai','Jun',
13
- 'Jul','Aug','Sep','Okt','Nov','Des'],
14
- monthStatus: '', yearStatus: '',
15
- weekHeader: 'Uke', weekStatus: '',
16
- dayNamesShort: ['Søn','Man','Tir','Ons','Tor','Fre','Lør'],
17
- dayNames: ['Søndag','Mandag','Tirsdag','Onsdag','Torsdag','Fredag','Lørdag'],
18
- dayNamesMin: ['Sø','Ma','Ti','On','To','Fr','Lø'],
19
- dayStatus: 'DD', dateStatus: 'D, M d',
20
- dateFormat: 'yy-mm-dd', firstDay: 0,
21
- initStatus: '', isRTL: false};
22
- $.datepicker.setDefaults($.datepicker.regional['no']);
23
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/jquery-ui-datepicker/i18n/ui.datepicker-pl.js DELETED
@@ -1,22 +0,0 @@
1
- /* Polish initialisation for the jQuery UI date picker plugin. */
2
- /* Written by Jacek Wysocki (jacek.wysocki@gmail.com). */
3
- jQuery(function($){
4
- $.datepicker.regional['pl'] = {clearText: 'Wyczyść', clearStatus: 'Wyczyść obecną datę',
5
- closeText: 'Zamknij', closeStatus: 'Zamknij bez zapisywania',
6
- prevText: '&#x3c;Poprzedni', prevStatus: 'Pokaż poprzedni miesiąc',
7
- nextText: 'Następny&#x3e;', nextStatus: 'Pokaż następny miesiąc',
8
- currentText: 'Dziś', currentStatus: 'Pokaż aktualny miesiąc',
9
- monthNames: ['Styczeń','Luty','Marzec','Kwiecień','Maj','Czerwiec',
10
- 'Lipiec','Sierpień','Wrzesień','Październik','Listopad','Grudzień'],
11
- monthNamesShort: ['Sty','Lu','Mar','Kw','Maj','Cze',
12
- 'Lip','Sie','Wrz','Pa','Lis','Gru'],
13
- monthStatus: 'Pokaż inny miesiąc', yearStatus: 'Pokaż inny rok',
14
- weekHeader: 'Tydz', weekStatus: 'Tydzień roku',
15
- dayNames: ['Niedziela','Poniedzialek','Wtorek','Środa','Czwartek','Piątek','Sobota'],
16
- dayNamesShort: ['Nie','Pn','Wt','Śr','Czw','Pt','So'],
17
- dayNamesMin: ['N','Pn','Wt','Śr','Cz','Pt','So'],
18
- dayStatus: 'Ustaw DD jako pierwszy dzień tygodnia', dateStatus: 'Wybierz D, M d',
19
- dateFormat: 'yy-mm-dd', firstDay: 1,
20
- initStatus: 'Wybierz datę', isRTL: false};
21
- $.datepicker.setDefaults($.datepicker.regional['pl']);
22
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/jquery-ui-datepicker/i18n/ui.datepicker-pt-BR.js DELETED
@@ -1,22 +0,0 @@
1
- /* Brazilian initialisation for the jQuery UI date picker plugin. */
2
- /* Written by Leonildo Costa Silva (leocsilva@gmail.com). */
3
- jQuery(function($){
4
- $.datepicker.regional['pt-BR'] = {clearText: 'Limpar', clearStatus: '',
5
- closeText: 'Fechar', closeStatus: '',
6
- prevText: '&lt;Anterior', prevStatus: '',
7
- nextText: 'Pr&oacute;ximo&gt;', nextStatus: '',
8
- currentText: 'Hoje', currentStatus: '',
9
- monthNames: ['Janeiro','Fevereiro','Mar&ccedil;o','Abril','Maio','Junho',
10
- 'Julho','Agosto','Setembro','Outubro','Novembro','Dezembro'],
11
- monthNamesShort: ['Jan','Fev','Mar','Abr','Mai','Jun',
12
- 'Jul','Ago','Set','Out','Nov','Dez'],
13
- monthStatus: '', yearStatus: '',
14
- weekHeader: 'Sm', weekStatus: '',
15
- dayNames: ['Domingo','Segunda-feira','Ter&ccedil;a-feira','Quarta-feira','Quinta-feira','Sexta-feira','Sabado'],
16
- dayNamesShort: ['Dom','Seg','Ter','Qua','Qui','Sex','Sab'],
17
- dayNamesMin: ['Dom','Seg','Ter','Qua','Qui','Sex','Sab'],
18
- dayStatus: 'DD', dateStatus: 'D, M d',
19
- dateFormat: 'dd/mm/yy', firstDay: 0,
20
- initStatus: '', isRTL: false};
21
- $.datepicker.setDefaults($.datepicker.regional['pt-BR']);
22
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/jquery-ui-datepicker/i18n/ui.datepicker-ro.js DELETED
@@ -1,22 +0,0 @@
1
- /* Romanian initialisation for the jQuery UI date picker plugin. */
2
- /* Written by Edmond L. (ll_edmond@walla.com). */
3
- jQuery(function($){
4
- $.datepicker.regional['ro'] = {clearText: 'Curat', clearStatus: 'Sterge data curenta',
5
- closeText: 'Inchide', closeStatus: 'Inchide fara schimbare',
6
- prevText: '&#x3c;Anterior', prevStatus: 'Arata luna trecuta',
7
- nextText: 'Urmator&#x3e;', nextStatus: 'Arata luna urmatoare',
8
- currentText: 'Azi', currentStatus: 'Arata luna curenta',
9
- monthNames: ['Ianuarie','Februarie','Martie','Aprilie','Mai','Junie',
10
- 'Julie','August','Septembrie','Octobrie','Noiembrie','Decembrie'],
11
- monthNamesShort: ['Ian', 'Feb', 'Mar', 'Apr', 'Mai', 'Jun',
12
- 'Jul', 'Aug', 'Sep', 'Oct', 'Noi', 'Dec'],
13
- monthStatus: 'Arata o luna diferita', yearStatus: 'Arat un an diferit',
14
- weekHeader: 'Sapt', weekStatus: 'Saptamana anului',
15
- dayNames: ['Duminica', 'Luni', 'Marti', 'Miercuri', 'Joi', 'Vineri', 'Sambata'],
16
- dayNamesShort: ['Dum', 'Lun', 'Mar', 'Mie', 'Joi', 'Vin', 'Sam'],
17
- dayNamesMin: ['Du','Lu','Ma','Mi','Jo','Vi','Sa'],
18
- dayStatus: 'Seteaza DD ca prima saptamana zi', dateStatus: 'Selecteaza D, M d',
19
- dateFormat: 'mm/dd/yy', firstDay: 0,
20
- initStatus: 'Selecteaza o data', isRTL: false};
21
- $.datepicker.setDefaults($.datepicker.regional['ro']);
22
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/jquery-ui-datepicker/i18n/ui.datepicker-sv.js DELETED
@@ -1,22 +0,0 @@
1
- /* Swedish initialisation for the jQuery UI date picker plugin. */
2
- /* Written by Anders Ekdahl ( anders@nomadiz.se). */
3
- jQuery(function($){
4
- $.datepicker.regional['sv'] = {clearText: 'Rensa', clearStatus: '',
5
- closeText: 'Stäng', closeStatus: '',
6
- prevText: '&laquo;Förra', prevStatus: '',
7
- nextText: 'Nästa&raquo;', nextStatus: '',
8
- currentText: 'Idag', currentStatus: '',
9
- monthNames: ['Januari','Februari','Mars','April','Maj','Juni',
10
- 'Juli','Augusti','September','Oktober','November','December'],
11
- monthNamesShort: ['Jan','Feb','Mar','Apr','Maj','Jun',
12
- 'Jul','Aug','Sep','Okt','Nov','Dec'],
13
- monthStatus: '', yearStatus: '',
14
- weekHeader: 'Ve', weekStatus: '',
15
- dayNamesShort: ['Sön','Mån','Tis','Ons','Tor','Fre','Lör'],
16
- dayNames: ['Söndag','Måndag','Tisdag','Onsdag','Torsdag','Fredag','Lördag'],
17
- dayNamesMin: ['Sö','Må','Ti','On','To','Fr','Lö'],
18
- dayStatus: 'DD', dateStatus: 'D, M d',
19
- dateFormat: 'yy-mm-dd', firstDay: 1,
20
- initStatus: '', isRTL: false};
21
- $.datepicker.setDefaults($.datepicker.regional['sv']);
22
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/jquery-ui-datepicker/ui.datepicker.css DELETED
@@ -1,213 +0,0 @@
1
- /* Main Style Sheet for jQuery UI date picker */
2
- #ui-datepicker-div, .ui-datepicker-inline {
3
- font-family: Arial, Helvetica, sans-serif;
4
- font-size: 14px;
5
- padding: 0;
6
- margin: 0;
7
- background: #ddd;
8
- width: 185px;
9
- }
10
- #ui-datepicker-div {
11
- display: none;
12
- border: 1px solid #777;
13
- z-index: 100; /*must have*/
14
- }
15
- .ui-datepicker-inline {
16
- float: left;
17
- display: block;
18
- border: 0;
19
- }
20
- .ui-datepicker-rtl {
21
- direction: rtl;
22
- }
23
- .ui-datepicker-dialog {
24
- padding: 5px !important;
25
- border: 4px ridge #ddd !important;
26
- }
27
- .ui-datepicker-disabled {
28
- position: absolute;
29
- z-index: 100;
30
- background-color: white;
31
- opacity: 0.5;
32
- }
33
- button.ui-datepicker-trigger {
34
- width: 25px;
35
- }
36
- img.ui-datepicker-trigger {
37
- margin: 2px;
38
- vertical-align: middle;
39
- }
40
- .ui-datepicker-prompt {
41
- float: left;
42
- padding: 2px;
43
- background: #ddd;
44
- color: #000;
45
- }
46
- * html .ui-datepicker-prompt {
47
- width: 185px;
48
- }
49
- .ui-datepicker-control, .ui-datepicker-links, .ui-datepicker-header, .ui-datepicker {
50
- clear: both;
51
- float: left;
52
- width: 100%;
53
- color: #fff;
54
- }
55
- .ui-datepicker-control {
56
- background: #400;
57
- padding: 2px 0px;
58
- }
59
- .ui-datepicker-links {
60
- background: #000;
61
- padding: 2px 0px;
62
- }
63
- .ui-datepicker-control, .ui-datepicker-links {
64
- font-weight: bold;
65
- font-size: 80%;
66
- }
67
- .ui-datepicker-links label { /* disabled links */
68
- padding: 2px 5px;
69
- color: #888;
70
- }
71
- .ui-datepicker-clear, .ui-datepicker-prev {
72
- float: left;
73
- width: 34%;
74
- }
75
- .ui-datepicker-rtl .ui-datepicker-clear, .ui-datepicker-rtl .ui-datepicker-prev {
76
- float: right;
77
- text-align: right;
78
- }
79
- .ui-datepicker-current {
80
- float: left;
81
- width: 30%;
82
- text-align: center;
83
- }
84
- .ui-datepicker-close, .ui-datepicker-next {
85
- float: right;
86
- width: 34%;
87
- text-align: right;
88
- }
89
- .ui-datepicker-rtl .ui-datepicker-close, .ui-datepicker-rtl .ui-datepicker-next {
90
- float: left;
91
- text-align: left;
92
- }
93
- .ui-datepicker-header {
94
- padding: 1px 0 3px;
95
- background: #333;
96
- text-align: center;
97
- font-weight: bold;
98
- height: 1.3em;
99
- }
100
- .ui-datepicker-header select {
101
- background: #333;
102
- color: #fff;
103
- border: 0px;
104
- font-weight: bold;
105
- }
106
- .ui-datepicker {
107
- background: #ccc;
108
- text-align: center;
109
- font-size: 100%;
110
- }
111
- .ui-datepicker a {
112
- display: block;
113
- width: 100%;
114
- }
115
- .ui-datepicker-title-row {
116
- background: #777;
117
- }
118
- .ui-datepicker-days-row {
119
- background: #eee;
120
- color: #666;
121
- }
122
- .ui-datepicker-week-col {
123
- background: #777;
124
- color: #fff;
125
- }
126
- .ui-datepicker-days-cell {
127
- color: #000;
128
- border: 1px solid #ddd;
129
- }
130
- .ui-datepicker-days-cell a{
131
- display: block;
132
- }
133
- .ui-datepicker-week-end-cell {
134
- background: #ddd;
135
- }
136
- .ui-datepicker-title-row .ui-datepicker-week-end-cell {
137
- background: #777;
138
- }
139
- .ui-datepicker-days-cell-over {
140
- background: #fff;
141
- border: 1px solid #777;
142
- }
143
- .ui-datepicker-unselectable {
144
- color: #888;
145
- }
146
- .ui-datepicker-today {
147
- background: #fcc !important;
148
- }
149
- .ui-datepicker-current-day {
150
- background: #999 !important;
151
- }
152
- .ui-datepicker-status {
153
- background: #ddd;
154
- width: 100%;
155
- font-size: 80%;
156
- text-align: center;
157
- }
158
-
159
- /* ________ Datepicker Links _______
160
-
161
- ** Reset link properties and then override them with !important */
162
- #ui-datepicker-div a, .ui-datepicker-inline a {
163
- cursor: pointer;
164
- margin: 0;
165
- padding: 0;
166
- background: none;
167
- color: #000;
168
- }
169
- .ui-datepicker-inline .ui-datepicker-links a {
170
- padding: 0 5px !important;
171
- }
172
- .ui-datepicker-control a, .ui-datepicker-links a {
173
- padding: 2px 5px !important;
174
- color: #eee !important;
175
- }
176
- .ui-datepicker-title-row a {
177
- color: #eee !important;
178
- }
179
- .ui-datepicker-control a:hover {
180
- background: #fdd !important;
181
- color: #333 !important;
182
- }
183
- .ui-datepicker-links a:hover, .ui-datepicker-title-row a:hover {
184
- background: #ddd !important;
185
- color: #333 !important;
186
- }
187
-
188
- /* ___________ MULTIPLE MONTHS _________*/
189
-
190
- .ui-datepicker-multi .ui-datepicker {
191
- border: 1px solid #777;
192
- }
193
- .ui-datepicker-one-month {
194
- float: left;
195
- width: 185px;
196
- }
197
- .ui-datepicker-new-row {
198
- clear: left;
199
- }
200
-
201
- /* ___________ IE6 IFRAME FIX ________ */
202
-
203
- .ui-datepicker-cover {
204
- display: none; /*sorry for IE5*/
205
- display/**/: block; /*sorry for IE5*/
206
- position: absolute; /*must have*/
207
- z-index: -1; /*must have*/
208
- filter: mask(); /*must have*/
209
- top: -4px; /*must have*/
210
- left: -4px; /*must have*/
211
- width: 200px; /*must have*/
212
- height: 200px; /*must have*/
213
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/jquery-ui-datepicker/ui.datepicker.js DELETED
@@ -1,1674 +0,0 @@
1
- /*
2
- * jQuery UI Datepicker
3
- *
4
- * Copyright (c) 2006, 2007, 2008 Marc Grabanski
5
- * Dual licensed under the MIT (MIT-LICENSE.txt)
6
- * and GPL (GPL-LICENSE.txt) licenses.
7
- *
8
- * http://docs.jquery.com/UI/Datepicker
9
- *
10
- * Depends:
11
- * ui.core.js
12
- *
13
- * Marc Grabanski (m@marcgrabanski.com) and Keith Wood (kbwood@virginbroadband.com.au).
14
- */
15
-
16
- (function($) { // hide the namespace
17
-
18
- var PROP_NAME = 'datepicker';
19
-
20
- /* Date picker manager.
21
- Use the singleton instance of this class, $.datepicker, to interact with the date picker.
22
- Settings for (groups of) date pickers are maintained in an instance object,
23
- allowing multiple different settings on the same page. */
24
-
25
- function Datepicker() {
26
- this.debug = false; // Change this to true to start debugging
27
- this._curInst = null; // The current instance in use
28
- this._disabledInputs = []; // List of date picker inputs that have been disabled
29
- this._datepickerShowing = false; // True if the popup picker is showing , false if not
30
- this._inDialog = false; // True if showing within a "dialog", false if not
31
- this._mainDivId = 'ui-datepicker-div'; // The ID of the main datepicker division
32
- this._inlineClass = 'ui-datepicker-inline'; // The name of the inline marker class
33
- this._appendClass = 'ui-datepicker-append'; // The name of the append marker class
34
- this._triggerClass = 'ui-datepicker-trigger'; // The name of the trigger marker class
35
- this._dialogClass = 'ui-datepicker-dialog'; // The name of the dialog marker class
36
- this._promptClass = 'ui-datepicker-prompt'; // The name of the dialog prompt marker class
37
- this._disableClass = 'ui-datepicker-disabled'; // The name of the disabled covering marker class
38
- this._unselectableClass = 'ui-datepicker-unselectable'; // The name of the unselectable cell marker class
39
- this._currentClass = 'ui-datepicker-current-day'; // The name of the current day marker class
40
- this.regional = []; // Available regional settings, indexed by language code
41
- this.regional[''] = { // Default regional settings
42
- clearText: 'Clear', // Display text for clear link
43
- clearStatus: 'Erase the current date', // Status text for clear link
44
- closeText: 'Close', // Display text for close link
45
- closeStatus: 'Close without change', // Status text for close link
46
- prevText: '&#x3c;Prev', // Display text for previous month link
47
- prevStatus: 'Show the previous month', // Status text for previous month link
48
- prevBigText: '&#x3c;&#x3c;', // Display text for previous year link
49
- prevBigStatus: 'Show the previous year', // Status text for previous year link
50
- nextText: 'Next&#x3e;', // Display text for next month link
51
- nextStatus: 'Show the next month', // Status text for next month link
52
- nextBigText: '&#x3e;&#x3e;', // Display text for next year link
53
- nextBigStatus: 'Show the next year', // Status text for next year link
54
- currentText: 'Today', // Display text for current month link
55
- currentStatus: 'Show the current month', // Status text for current month link
56
- monthNames: ['January','February','March','April','May','June',
57
- 'July','August','September','October','November','December'], // Names of months for drop-down and formatting
58
- monthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], // For formatting
59
- monthStatus: 'Show a different month', // Status text for selecting a month
60
- yearStatus: 'Show a different year', // Status text for selecting a year
61
- weekHeader: 'Wk', // Header for the week of the year column
62
- weekStatus: 'Week of the year', // Status text for the week of the year column
63
- dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], // For formatting
64
- dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], // For formatting
65
- dayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'], // Column headings for days starting at Sunday
66
- dayStatus: 'Set DD as first week day', // Status text for the day of the week selection
67
- dateStatus: 'Select DD, M d', // Status text for the date selection
68
- dateFormat: 'mm/dd/yy', // See format options on parseDate
69
- firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...
70
- initStatus: 'Select a date', // Initial Status text on opening
71
- isRTL: false // True if right-to-left language, false if left-to-right
72
- };
73
- this._defaults = { // Global defaults for all the date picker instances
74
- showOn: 'focus', // 'focus' for popup on focus,
75
- // 'button' for trigger button, or 'both' for either
76
- showAnim: 'show', // Name of jQuery animation for popup
77
- showOptions: {}, // Options for enhanced animations
78
- defaultDate: null, // Used when field is blank: actual date,
79
- // +/-number for offset from today, null for today
80
- appendText: '', // Display text following the input box, e.g. showing the format
81
- buttonText: '...', // Text for trigger button
82
- buttonImage: '', // URL for trigger button image
83
- buttonImageOnly: false, // True if the image appears alone, false if it appears on a button
84
- closeAtTop: true, // True to have the clear/close at the top,
85
- // false to have them at the bottom
86
- mandatory: false, // True to hide the Clear link, false to include it
87
- hideIfNoPrevNext: false, // True to hide next/previous month links
88
- // if not applicable, false to just disable them
89
- navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links
90
- showBigPrevNext: false, // True to show big prev/next links
91
- gotoCurrent: false, // True if today link goes back to current selection instead
92
- changeMonth: true, // True if month can be selected directly, false if only prev/next
93
- changeYear: true, // True if year can be selected directly, false if only prev/next
94
- showMonthAfterYear: false, // True if the year select precedes month, false for month then year
95
- yearRange: '-10:+10', // Range of years to display in drop-down,
96
- // either relative to current year (-nn:+nn) or absolute (nnnn:nnnn)
97
- changeFirstDay: true, // True to click on day name to change, false to remain as set
98
- highlightWeek: false, // True to highlight the selected week
99
- showOtherMonths: false, // True to show dates in other months, false to leave blank
100
- showWeeks: false, // True to show week of the year, false to omit
101
- calculateWeek: this.iso8601Week, // How to calculate the week of the year,
102
- // takes a Date and returns the number of the week for it
103
- shortYearCutoff: '+10', // Short year values < this are in the current century,
104
- // > this are in the previous century,
105
- // string value starting with '+' for current year + value
106
- showStatus: false, // True to show status bar at bottom, false to not show it
107
- statusForDate: this.dateStatus, // Function to provide status text for a date -
108
- // takes date and instance as parameters, returns display text
109
- minDate: null, // The earliest selectable date, or null for no limit
110
- maxDate: null, // The latest selectable date, or null for no limit
111
- duration: 'normal', // Duration of display/closure
112
- beforeShowDay: null, // Function that takes a date and returns an array with
113
- // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or '',
114
- // [2] = cell title (optional), e.g. $.datepicker.noWeekends
115
- beforeShow: null, // Function that takes an input field and
116
- // returns a set of custom settings for the date picker
117
- onSelect: null, // Define a callback function when a date is selected
118
- onChangeMonthYear: null, // Define a callback function when the month or year is changed
119
- onClose: null, // Define a callback function when the datepicker is closed
120
- numberOfMonths: 1, // Number of months to show at a time
121
- showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)
122
- stepMonths: 1, // Number of months to step back/forward
123
- stepBigMonths: 12, // Number of months to step back/forward for the big links
124
- rangeSelect: false, // Allows for selecting a date range on one date picker
125
- rangeSeparator: ' - ', // Text between two dates in a range
126
- altField: '', // Selector for an alternate field to store selected dates into
127
- altFormat: '' // The date format to use for the alternate field
128
- };
129
- $.extend(this._defaults, this.regional['']);
130
- this.dpDiv = $('<div id="' + this._mainDivId + '" style="display: none;"></div>');
131
- }
132
-
133
- $.extend(Datepicker.prototype, {
134
- /* Class name added to elements to indicate already configured with a date picker. */
135
- markerClassName: 'hasDatepicker',
136
-
137
- /* Debug logging (if enabled). */
138
- log: function () {
139
- if (this.debug)
140
- console.log.apply('', arguments);
141
- },
142
-
143
- /* Override the default settings for all instances of the date picker.
144
- @param settings object - the new settings to use as defaults (anonymous object)
145
- @return the manager object */
146
- setDefaults: function(settings) {
147
- extendRemove(this._defaults, settings || {});
148
- return this;
149
- },
150
-
151
- /* Attach the date picker to a jQuery selection.
152
- @param target element - the target input field or division or span
153
- @param settings object - the new settings to use for this date picker instance (anonymous) */
154
- _attachDatepicker: function(target, settings) {
155
- // check for settings on the control itself - in namespace 'date:'
156
- var inlineSettings = null;
157
- for (attrName in this._defaults) {
158
- var attrValue = target.getAttribute('date:' + attrName);
159
- if (attrValue) {
160
- inlineSettings = inlineSettings || {};
161
- try {
162
- inlineSettings[attrName] = eval(attrValue);
163
- } catch (err) {
164
- inlineSettings[attrName] = attrValue;
165
- }
166
- }
167
- }
168
- var nodeName = target.nodeName.toLowerCase();
169
- var inline = (nodeName == 'div' || nodeName == 'span');
170
- if (!target.id)
171
- target.id = 'dp' + new Date().getTime();
172
- var inst = this._newInst($(target), inline);
173
- inst.settings = $.extend({}, settings || {}, inlineSettings || {});
174
- if (nodeName == 'input') {
175
- this._connectDatepicker(target, inst);
176
- } else if (inline) {
177
- this._inlineDatepicker(target, inst);
178
- }
179
- },
180
-
181
- /* Create a new instance object. */
182
- _newInst: function(target, inline) {
183
- var id = target[0].id.replace(/([:\[\]\.])/g, '\\\\$1'); // escape jQuery meta chars
184
- return {id: id, input: target, // associated target
185
- selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection
186
- drawMonth: 0, drawYear: 0, // month being drawn
187
- inline: inline, // is datepicker inline or not
188
- dpDiv: (!inline ? this.dpDiv : // presentation div
189
- $('<div class="' + this._inlineClass + '"></div>'))};
190
- },
191
-
192
- /* Attach the date picker to an input field. */
193
- _connectDatepicker: function(target, inst) {
194
- var input = $(target);
195
- if (input.hasClass(this.markerClassName))
196
- return;
197
- var appendText = this._get(inst, 'appendText');
198
- var isRTL = this._get(inst, 'isRTL');
199
- if (appendText)
200
- input[isRTL ? 'before' : 'after']('<span class="' + this._appendClass + '">' + appendText + '</span>');
201
- var showOn = this._get(inst, 'showOn');
202
- if (showOn == 'focus' || showOn == 'both') // pop-up date picker when in the marked field
203
- input.focus(this._showDatepicker);
204
- if (showOn == 'button' || showOn == 'both') { // pop-up date picker when button clicked
205
- var buttonText = this._get(inst, 'buttonText');
206
- var buttonImage = this._get(inst, 'buttonImage');
207
- var trigger = $(this._get(inst, 'buttonImageOnly') ?
208
- $('<img/>').addClass(this._triggerClass).
209
- attr({ src: buttonImage, alt: buttonText, title: buttonText }) :
210
- $('<button type="button"></button>').addClass(this._triggerClass).
211
- html(buttonImage == '' ? buttonText : $('<img/>').attr(
212
- { src:buttonImage, alt:buttonText, title:buttonText })));
213
- input[isRTL ? 'before' : 'after'](trigger);
214
- trigger.click(function() {
215
- if ($.datepicker._datepickerShowing && $.datepicker._lastInput == target)
216
- $.datepicker._hideDatepicker();
217
- else
218
- $.datepicker._showDatepicker(target);
219
- return false;
220
- });
221
- }
222
- input.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).
223
- bind("setData.datepicker", function(event, key, value) {
224
- inst.settings[key] = value;
225
- }).bind("getData.datepicker", function(event, key) {
226
- return this._get(inst, key);
227
- });
228
- $.data(target, PROP_NAME, inst);
229
- },
230
-
231
- /* Attach an inline date picker to a div. */
232
- _inlineDatepicker: function(target, inst) {
233
- var input = $(target);
234
- if (input.hasClass(this.markerClassName))
235
- return;
236
- input.addClass(this.markerClassName).append(inst.dpDiv).
237
- bind("setData.datepicker", function(event, key, value){
238
- inst.settings[key] = value;
239
- }).bind("getData.datepicker", function(event, key){
240
- return this._get(inst, key);
241
- });
242
- $.data(target, PROP_NAME, inst);
243
- this._setDate(inst, this._getDefaultDate(inst));
244
- this._updateDatepicker(inst);
245
- },
246
-
247
- /* Tidy up after displaying the date picker. */
248
- _inlineShow: function(inst) {
249
- var numMonths = this._getNumberOfMonths(inst); // fix width for dynamic number of date pickers
250
- inst.dpDiv.width(numMonths[1] * $('.ui-datepicker', inst.dpDiv[0]).width());
251
- },
252
-
253
- /* Pop-up the date picker in a "dialog" box.
254
- @param input element - ignored
255
- @param dateText string - the initial date to display (in the current format)
256
- @param onSelect function - the function(dateText) to call when a date is selected
257
- @param settings object - update the dialog date picker instance's settings (anonymous object)
258
- @param pos int[2] - coordinates for the dialog's position within the screen or
259
- event - with x/y coordinates or
260
- leave empty for default (screen centre)
261
- @return the manager object */
262
- _dialogDatepicker: function(input, dateText, onSelect, settings, pos) {
263
- var inst = this._dialogInst; // internal instance
264
- if (!inst) {
265
- var id = 'dp' + new Date().getTime();
266
- this._dialogInput = $('<input type="text" id="' + id +
267
- '" size="1" style="position: absolute; top: -100px;"/>');
268
- this._dialogInput.keydown(this._doKeyDown);
269
- $('body').append(this._dialogInput);
270
- inst = this._dialogInst = this._newInst(this._dialogInput, false);
271
- inst.settings = {};
272
- $.data(this._dialogInput[0], PROP_NAME, inst);
273
- }
274
- extendRemove(inst.settings, settings || {});
275
- this._dialogInput.val(dateText);
276
-
277
- this._pos = (pos ? (pos.length ? pos : [pos.pageX, pos.pageY]) : null);
278
- if (!this._pos) {
279
- var browserWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
280
- var browserHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
281
- var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
282
- var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
283
- this._pos = // should use actual width/height below
284
- [(browserWidth / 2) - 100 + scrollX, (browserHeight / 2) - 150 + scrollY];
285
- }
286
-
287
- // move input on screen for focus, but hidden behind dialog
288
- this._dialogInput.css('left', this._pos[0] + 'px').css('top', this._pos[1] + 'px');
289
- inst.settings.onSelect = onSelect;
290
- this._inDialog = true;
291
- this.dpDiv.addClass(this._dialogClass);
292
- this._showDatepicker(this._dialogInput[0]);
293
- if ($.blockUI)
294
- $.blockUI(this.dpDiv);
295
- $.data(this._dialogInput[0], PROP_NAME, inst);
296
- return this;
297
- },
298
-
299
- /* Detach a datepicker from its control.
300
- @param target element - the target input field or division or span */
301
- _destroyDatepicker: function(target) {
302
- var $target = $(target);
303
- if (!$target.hasClass(this.markerClassName)) {
304
- return;
305
- }
306
- var nodeName = target.nodeName.toLowerCase();
307
- $.removeData(target, PROP_NAME);
308
- if (nodeName == 'input') {
309
- $target.siblings('.' + this._appendClass).remove().end().
310
- siblings('.' + this._triggerClass).remove().end().
311
- removeClass(this.markerClassName).
312
- unbind('focus', this._showDatepicker).
313
- unbind('keydown', this._doKeyDown).
314
- unbind('keypress', this._doKeyPress);
315
- } else if (nodeName == 'div' || nodeName == 'span')
316
- $target.removeClass(this.markerClassName).empty();
317
- },
318
-
319
- /* Enable the date picker to a jQuery selection.
320
- @param target element - the target input field or division or span */
321
- _enableDatepicker: function(target) {
322
- var $target = $(target);
323
- if (!$target.hasClass(this.markerClassName)) {
324
- return;
325
- }
326
- var nodeName = target.nodeName.toLowerCase();
327
- if (nodeName == 'input') {
328
- target.disabled = false;
329
- $target.siblings('button.' + this._triggerClass).
330
- each(function() { this.disabled = false; }).end().
331
- siblings('img.' + this._triggerClass).
332
- css({opacity: '1.0', cursor: ''});
333
- }
334
- else if (nodeName == 'div' || nodeName == 'span') {
335
- $target.children('.' + this._disableClass).remove();
336
- }
337
- this._disabledInputs = $.map(this._disabledInputs,
338
- function(value) { return (value == target ? null : value); }); // delete entry
339
- },
340
-
341
- /* Disable the date picker to a jQuery selection.
342
- @param target element - the target input field or division or span */
343
- _disableDatepicker: function(target) {
344
- var $target = $(target);
345
- if (!$target.hasClass(this.markerClassName)) {
346
- return;
347
- }
348
- var nodeName = target.nodeName.toLowerCase();
349
- if (nodeName == 'input') {
350
- target.disabled = true;
351
- $target.siblings('button.' + this._triggerClass).
352
- each(function() { this.disabled = true; }).end().
353
- siblings('img.' + this._triggerClass).
354
- css({opacity: '0.5', cursor: 'default'});
355
- }
356
- else if (nodeName == 'div' || nodeName == 'span') {
357
- var inline = $target.children('.' + this._inlineClass);
358
- var offset = inline.offset();
359
- var relOffset = {left: 0, top: 0};
360
- inline.parents().each(function() {
361
- if ($(this).css('position') == 'relative') {
362
- relOffset = $(this).offset();
363
- return false;
364
- }
365
- });
366
- $target.prepend('<div class="' + this._disableClass + '" style="' +
367
- ($.browser.msie ? 'background-color: transparent; ' : '') +
368
- 'width: ' + inline.width() + 'px; height: ' + inline.height() +
369
- 'px; left: ' + (offset.left - relOffset.left) +
370
- 'px; top: ' + (offset.top - relOffset.top) + 'px;"></div>');
371
- }
372
- this._disabledInputs = $.map(this._disabledInputs,
373
- function(value) { return (value == target ? null : value); }); // delete entry
374
- this._disabledInputs[this._disabledInputs.length] = target;
375
- },
376
-
377
- /* Is the first field in a jQuery collection disabled as a datepicker?
378
- @param target element - the target input field or division or span
379
- @return boolean - true if disabled, false if enabled */
380
- _isDisabledDatepicker: function(target) {
381
- if (!target)
382
- return false;
383
- for (var i = 0; i < this._disabledInputs.length; i++) {
384
- if (this._disabledInputs[i] == target)
385
- return true;
386
- }
387
- return false;
388
- },
389
-
390
- /* Update the settings for a date picker attached to an input field or division.
391
- @param target element - the target input field or division or span
392
- @param name object - the new settings to update or
393
- string - the name of the setting to change or
394
- @param value any - the new value for the setting (omit if above is an object) */
395
- _changeDatepicker: function(target, name, value) {
396
- var settings = name || {};
397
- if (typeof name == 'string') {
398
- settings = {};
399
- settings[name] = value;
400
- }
401
- var inst = $.data(target, PROP_NAME);
402
- if (inst) {
403
- if (this._curInst == inst) {
404
- this._hideDatepicker(null);
405
- }
406
- extendRemove(inst.settings, settings);
407
- var date = new Date();
408
- extendRemove(inst, {rangeStart: null, // start of range
409
- endDay: null, endMonth: null, endYear: null, // end of range
410
- selectedDay: date.getDate(), selectedMonth: date.getMonth(),
411
- selectedYear: date.getFullYear(), // starting point
412
- currentDay: date.getDate(), currentMonth: date.getMonth(),
413
- currentYear: date.getFullYear(), // current selection
414
- drawMonth: date.getMonth(), drawYear: date.getFullYear()}); // month being drawn
415
- this._updateDatepicker(inst);
416
- }
417
- },
418
-
419
- /* Set the dates for a jQuery selection.
420
- @param target element - the target input field or division or span
421
- @param date Date - the new date
422
- @param endDate Date - the new end date for a range (optional) */
423
- _setDateDatepicker: function(target, date, endDate) {
424
- var inst = $.data(target, PROP_NAME);
425
- if (inst) {
426
- this._setDate(inst, date, endDate);
427
- this._updateDatepicker(inst);
428
- }
429
- },
430
-
431
- /* Get the date(s) for the first entry in a jQuery selection.
432
- @param target element - the target input field or division or span
433
- @return Date - the current date or
434
- Date[2] - the current dates for a range */
435
- _getDateDatepicker: function(target) {
436
- var inst = $.data(target, PROP_NAME);
437
- if (inst && !inst.inline)
438
- this._setDateFromField(inst);
439
- return (inst ? this._getDate(inst) : null);
440
- },
441
-
442
- /* Handle keystrokes. */
443
- _doKeyDown: function(e) {
444
- var inst = $.data(e.target, PROP_NAME);
445
- var handled = true;
446
- if ($.datepicker._datepickerShowing)
447
- switch (e.keyCode) {
448
- case 9: $.datepicker._hideDatepicker(null, '');
449
- break; // hide on tab out
450
- case 13: $.datepicker._selectDay(e.target, inst.selectedMonth, inst.selectedYear,
451
- $('td.ui-datepicker-days-cell-over', inst.dpDiv)[0]);
452
- return false; // don't submit the form
453
- break; // select the value on enter
454
- case 27: $.datepicker._hideDatepicker(null, $.datepicker._get(inst, 'duration'));
455
- break; // hide on escape
456
- case 33: $.datepicker._adjustDate(e.target, (e.ctrlKey ?
457
- -$.datepicker._get(inst, 'stepBigMonths') :
458
- -$.datepicker._get(inst, 'stepMonths')), 'M');
459
- break; // previous month/year on page up/+ ctrl
460
- case 34: $.datepicker._adjustDate(e.target, (e.ctrlKey ?
461
- +$.datepicker._get(inst, 'stepBigMonths') :
462
- +$.datepicker._get(inst, 'stepMonths')), 'M');
463
- break; // next month/year on page down/+ ctrl
464
- case 35: if (e.ctrlKey) $.datepicker._clearDate(e.target);
465
- handled = e.ctrlKey;
466
- break; // clear on ctrl+end
467
- case 36: if (e.ctrlKey) $.datepicker._gotoToday(e.target);
468
- handled = e.ctrlKey;
469
- break; // current on ctrl+home
470
- case 37: if (e.ctrlKey) $.datepicker._adjustDate(e.target, -1, 'D');
471
- handled = e.ctrlKey;
472
- break; // -1 day on ctrl+left
473
- case 38: if (e.ctrlKey) $.datepicker._adjustDate(e.target, -7, 'D');
474
- handled = e.ctrlKey;
475
- break; // -1 week on ctrl+up
476
- case 39: if (e.ctrlKey) $.datepicker._adjustDate(e.target, +1, 'D');
477
- handled = e.ctrlKey;
478
- break; // +1 day on ctrl+right
479
- case 40: if (e.ctrlKey) $.datepicker._adjustDate(e.target, +7, 'D');
480
- handled = e.ctrlKey;
481
- break; // +1 week on ctrl+down
482
- default: handled = false;
483
- }
484
- else if (e.keyCode == 36 && e.ctrlKey) // display the date picker on ctrl+home
485
- $.datepicker._showDatepicker(this);
486
- else
487
- handled = false;
488
- if (handled) {
489
- e.preventDefault();
490
- e.stopPropagation();
491
- }
492
- },
493
-
494
- /* Filter entered characters - based on date format. */
495
- _doKeyPress: function(e) {
496
- var inst = $.data(e.target, PROP_NAME);
497
- var chars = $.datepicker._possibleChars($.datepicker._get(inst, 'dateFormat'));
498
- var chr = String.fromCharCode(e.charCode == undefined ? e.keyCode : e.charCode);
499
- return e.ctrlKey || (chr < ' ' || !chars || chars.indexOf(chr) > -1);
500
- },
501
-
502
- /* Pop-up the date picker for a given input field.
503
- @param input element - the input field attached to the date picker or
504
- event - if triggered by focus */
505
- _showDatepicker: function(input) {
506
- input = input.target || input;
507
- if (input.nodeName.toLowerCase() != 'input') // find from button/image trigger
508
- input = $('input', input.parentNode)[0];
509
- if ($.datepicker._isDisabledDatepicker(input) || $.datepicker._lastInput == input) // already here
510
- return;
511
- var inst = $.data(input, PROP_NAME);
512
- var beforeShow = $.datepicker._get(inst, 'beforeShow');
513
- extendRemove(inst.settings, (beforeShow ? beforeShow.apply(input, [input, inst]) : {}));
514
- $.datepicker._hideDatepicker(null, '');
515
- $.datepicker._lastInput = input;
516
- $.datepicker._setDateFromField(inst);
517
- if ($.datepicker._inDialog) // hide cursor
518
- input.value = '';
519
- if (!$.datepicker._pos) { // position below input
520
- $.datepicker._pos = $.datepicker._findPos(input);
521
- $.datepicker._pos[1] += input.offsetHeight; // add the height
522
- }
523
- var isFixed = false;
524
- $(input).parents().each(function() {
525
- isFixed |= $(this).css('position') == 'fixed';
526
- return !isFixed;
527
- });
528
- if (isFixed && $.browser.opera) { // correction for Opera when fixed and scrolled
529
- $.datepicker._pos[0] -= document.documentElement.scrollLeft;
530
- $.datepicker._pos[1] -= document.documentElement.scrollTop;
531
- }
532
- var offset = {left: $.datepicker._pos[0], top: $.datepicker._pos[1]};
533
- $.datepicker._pos = null;
534
- inst.rangeStart = null;
535
- // determine sizing offscreen
536
- inst.dpDiv.css({position: 'absolute', display: 'block', top: '-1000px'});
537
- $.datepicker._updateDatepicker(inst);
538
- // fix width for dynamic number of date pickers
539
- inst.dpDiv.width($.datepicker._getNumberOfMonths(inst)[1] *
540
- $('.ui-datepicker', inst.dpDiv[0])[0].offsetWidth);
541
- // and adjust position before showing
542
- offset = $.datepicker._checkOffset(inst, offset, isFixed);
543
- inst.dpDiv.css({position: ($.datepicker._inDialog && $.blockUI ?
544
- 'static' : (isFixed ? 'fixed' : 'absolute')), display: 'none',
545
- left: offset.left + 'px', top: offset.top + 'px'});
546
- if (!inst.inline) {
547
- var showAnim = $.datepicker._get(inst, 'showAnim') || 'show';
548
- var duration = $.datepicker._get(inst, 'duration');
549
- var postProcess = function() {
550
- $.datepicker._datepickerShowing = true;
551
- if ($.browser.msie && parseInt($.browser.version) < 7) // fix IE < 7 select problems
552
- $('iframe.ui-datepicker-cover').css({width: inst.dpDiv.width() + 4,
553
- height: inst.dpDiv.height() + 4});
554
- };
555
- if ($.effects && $.effects[showAnim])
556
- inst.dpDiv.show(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess);
557
- else
558
- inst.dpDiv[showAnim](duration, postProcess);
559
- if (duration == '')
560
- postProcess();
561
- if (inst.input[0].type != 'hidden')
562
- inst.input[0].focus();
563
- $.datepicker._curInst = inst;
564
- }
565
- },
566
-
567
- /* Generate the date picker content. */
568
- _updateDatepicker: function(inst) {
569
- var dims = {width: inst.dpDiv.width() + 4,
570
- height: inst.dpDiv.height() + 4};
571
- inst.dpDiv.empty().append(this._generateHTML(inst)).
572
- find('iframe.ui-datepicker-cover').
573
- css({width: dims.width, height: dims.height});
574
- var numMonths = this._getNumberOfMonths(inst);
575
- inst.dpDiv[(numMonths[0] != 1 || numMonths[1] != 1 ? 'add' : 'remove') +
576
- 'Class']('ui-datepicker-multi');
577
- inst.dpDiv[(this._get(inst, 'isRTL') ? 'add' : 'remove') +
578
- 'Class']('ui-datepicker-rtl');
579
- if (inst.input && inst.input[0].type != 'hidden')
580
- $(inst.input[0]).focus();
581
- },
582
-
583
- /* Check positioning to remain on screen. */
584
- _checkOffset: function(inst, offset, isFixed) {
585
- var pos = inst.input ? this._findPos(inst.input[0]) : null;
586
- var browserWidth = window.innerWidth || document.documentElement.clientWidth;
587
- var browserHeight = window.innerHeight || document.documentElement.clientHeight;
588
- var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
589
- var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
590
- // reposition date picker horizontally if outside the browser window
591
- if (this._get(inst, 'isRTL') || (offset.left + inst.dpDiv.width() - scrollX) > browserWidth)
592
- offset.left = Math.max((isFixed ? 0 : scrollX),
593
- pos[0] + (inst.input ? inst.input.width() : 0) - (isFixed ? scrollX : 0) - inst.dpDiv.width() -
594
- (isFixed && $.browser.opera ? document.documentElement.scrollLeft : 0));
595
- else
596
- offset.left -= (isFixed ? scrollX : 0);
597
- // reposition date picker vertically if outside the browser window
598
- if ((offset.top + inst.dpDiv.height() - scrollY) > browserHeight)
599
- offset.top = Math.max((isFixed ? 0 : scrollY),
600
- pos[1] - (isFixed ? scrollY : 0) - (this._inDialog ? 0 : inst.dpDiv.height()) -
601
- (isFixed && $.browser.opera ? document.documentElement.scrollTop : 0));
602
- else
603
- offset.top -= (isFixed ? scrollY : 0);
604
- return offset;
605
- },
606
-
607
- /* Find an object's position on the screen. */
608
- _findPos: function(obj) {
609
- while (obj && (obj.type == 'hidden' || obj.nodeType != 1)) {
610
- obj = obj.nextSibling;
611
- }
612
- var position = $(obj).offset();
613
- return [position.left, position.top];
614
- },
615
-
616
- /* Hide the date picker from view.
617
- @param input element - the input field attached to the date picker
618
- @param duration string - the duration over which to close the date picker */
619
- _hideDatepicker: function(input, duration) {
620
- var inst = this._curInst;
621
- if (!inst || (input && inst != $.data(input, PROP_NAME)))
622
- return;
623
- var rangeSelect = this._get(inst, 'rangeSelect');
624
- if (rangeSelect && inst.stayOpen)
625
- this._selectDate('#' + inst.id, this._formatDate(inst,
626
- inst.currentDay, inst.currentMonth, inst.currentYear));
627
- inst.stayOpen = false;
628
- if (this._datepickerShowing) {
629
- duration = (duration != null ? duration : this._get(inst, 'duration'));
630
- var showAnim = this._get(inst, 'showAnim');
631
- var postProcess = function() {
632
- $.datepicker._tidyDialog(inst);
633
- };
634
- if (duration != '' && $.effects && $.effects[showAnim])
635
- inst.dpDiv.hide(showAnim, $.datepicker._get(inst, 'showOptions'),
636
- duration, postProcess);
637
- else
638
- inst.dpDiv[(duration == '' ? 'hide' : (showAnim == 'slideDown' ? 'slideUp' :
639
- (showAnim == 'fadeIn' ? 'fadeOut' : 'hide')))](duration, postProcess);
640
- if (duration == '')
641
- this._tidyDialog(inst);
642
- var onClose = this._get(inst, 'onClose');
643
- if (onClose)
644
- onClose.apply((inst.input ? inst.input[0] : null),
645
- [this._getDate(inst), inst]); // trigger custom callback
646
- this._datepickerShowing = false;
647
- this._lastInput = null;
648
- inst.settings.prompt = null;
649
- if (this._inDialog) {
650
- this._dialogInput.css({ position: 'absolute', left: '0', top: '-100px' });
651
- if ($.blockUI) {
652
- $.unblockUI();
653
- $('body').append(this.dpDiv);
654
- }
655
- }
656
- this._inDialog = false;
657
- }
658
- this._curInst = null;
659
- },
660
-
661
- /* Tidy up after a dialog display. */
662
- _tidyDialog: function(inst) {
663
- inst.dpDiv.removeClass(this._dialogClass).unbind('.ui-datepicker');
664
- $('.' + this._promptClass, inst.dpDiv).remove();
665
- },
666
-
667
- /* Close date picker if clicked elsewhere. */
668
- _checkExternalClick: function(event) {
669
- if (!$.datepicker._curInst)
670
- return;
671
- var $target = $(event.target);
672
- if (($target.parents('#' + $.datepicker._mainDivId).length == 0) &&
673
- !$target.hasClass($.datepicker.markerClassName) &&
674
- !$target.hasClass($.datepicker._triggerClass) &&
675
- $.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI))
676
- $.datepicker._hideDatepicker(null, '');
677
- },
678
-
679
- /* Adjust one of the date sub-fields. */
680
- _adjustDate: function(id, offset, period) {
681
- var target = $(id);
682
- var inst = $.data(target[0], PROP_NAME);
683
- this._adjustInstDate(inst, offset, period);
684
- this._updateDatepicker(inst);
685
- },
686
-
687
- /* Action for current link. */
688
- _gotoToday: function(id) {
689
- var target = $(id);
690
- var inst = $.data(target[0], PROP_NAME);
691
- if (this._get(inst, 'gotoCurrent') && inst.currentDay) {
692
- inst.selectedDay = inst.currentDay;
693
- inst.drawMonth = inst.selectedMonth = inst.currentMonth;
694
- inst.drawYear = inst.selectedYear = inst.currentYear;
695
- }
696
- else {
697
- var date = new Date();
698
- inst.selectedDay = date.getDate();
699
- inst.drawMonth = inst.selectedMonth = date.getMonth();
700
- inst.drawYear = inst.selectedYear = date.getFullYear();
701
- }
702
- this._notifyChange(inst);
703
- this._adjustDate(target);
704
- },
705
-
706
- /* Action for selecting a new month/year. */
707
- _selectMonthYear: function(id, select, period) {
708
- var target = $(id);
709
- var inst = $.data(target[0], PROP_NAME);
710
- inst._selectingMonthYear = false;
711
- inst['selected' + (period == 'M' ? 'Month' : 'Year')] =
712
- inst['draw' + (period == 'M' ? 'Month' : 'Year')] =
713
- parseInt(select.options[select.selectedIndex].value);
714
- this._notifyChange(inst);
715
- this._adjustDate(target);
716
- },
717
-
718
- /* Restore input focus after not changing month/year. */
719
- _clickMonthYear: function(id) {
720
- var target = $(id);
721
- var inst = $.data(target[0], PROP_NAME);
722
- if (inst.input && inst._selectingMonthYear && !$.browser.msie)
723
- inst.input[0].focus();
724
- inst._selectingMonthYear = !inst._selectingMonthYear;
725
- },
726
-
727
- /* Action for changing the first week day. */
728
- _changeFirstDay: function(id, day) {
729
- var target = $(id);
730
- var inst = $.data(target[0], PROP_NAME);
731
- inst.settings.firstDay = day;
732
- this._updateDatepicker(inst);
733
- },
734
-
735
- /* Action for selecting a day. */
736
- _selectDay: function(id, month, year, td) {
737
- if ($(td).hasClass(this._unselectableClass))
738
- return;
739
- var target = $(id);
740
- var inst = $.data(target[0], PROP_NAME);
741
- var rangeSelect = this._get(inst, 'rangeSelect');
742
- if (rangeSelect) {
743
- inst.stayOpen = !inst.stayOpen;
744
- if (inst.stayOpen) {
745
- $('.ui-datepicker td', inst.dpDiv).removeClass(this._currentClass);
746
- $(td).addClass(this._currentClass);
747
- }
748
- }
749
- inst.selectedDay = inst.currentDay = $('a', td).html();
750
- inst.selectedMonth = inst.currentMonth = month;
751
- inst.selectedYear = inst.currentYear = year;
752
- if (inst.stayOpen) {
753
- inst.endDay = inst.endMonth = inst.endYear = null;
754
- }
755
- else if (rangeSelect) {
756
- inst.endDay = inst.currentDay;
757
- inst.endMonth = inst.currentMonth;
758
- inst.endYear = inst.currentYear;
759
- }
760
- this._selectDate(id, this._formatDate(inst,
761
- inst.currentDay, inst.currentMonth, inst.currentYear));
762
- if (inst.stayOpen) {
763
- inst.rangeStart = new Date(inst.currentYear, inst.currentMonth, inst.currentDay);
764
- this._updateDatepicker(inst);
765
- }
766
- else if (rangeSelect) {
767
- inst.selectedDay = inst.currentDay = inst.rangeStart.getDate();
768
- inst.selectedMonth = inst.currentMonth = inst.rangeStart.getMonth();
769
- inst.selectedYear = inst.currentYear = inst.rangeStart.getFullYear();
770
- inst.rangeStart = null;
771
- if (inst.inline)
772
- this._updateDatepicker(inst);
773
- }
774
- },
775
-
776
- /* Erase the input field and hide the date picker. */
777
- _clearDate: function(id) {
778
- var target = $(id);
779
- var inst = $.data(target[0], PROP_NAME);
780
- if (this._get(inst, 'mandatory'))
781
- return;
782
- inst.stayOpen = false;
783
- inst.endDay = inst.endMonth = inst.endYear = inst.rangeStart = null;
784
- this._selectDate(target, '');
785
- },
786
-
787
- /* Update the input field with the selected date. */
788
- _selectDate: function(id, dateStr) {
789
- var target = $(id);
790
- var inst = $.data(target[0], PROP_NAME);
791
- dateStr = (dateStr != null ? dateStr : this._formatDate(inst));
792
- if (this._get(inst, 'rangeSelect') && dateStr)
793
- dateStr = (inst.rangeStart ? this._formatDate(inst, inst.rangeStart) :
794
- dateStr) + this._get(inst, 'rangeSeparator') + dateStr;
795
- if (inst.input)
796
- inst.input.val(dateStr);
797
- this._updateAlternate(inst);
798
- var onSelect = this._get(inst, 'onSelect');
799
- if (onSelect)
800
- onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]); // trigger custom callback
801
- else if (inst.input)
802
- inst.input.trigger('change'); // fire the change event
803
- if (inst.inline)
804
- this._updateDatepicker(inst);
805
- else if (!inst.stayOpen) {
806
- this._hideDatepicker(null, this._get(inst, 'duration'));
807
- this._lastInput = inst.input[0];
808
- if (typeof(inst.input[0]) != 'object')
809
- inst.input[0].focus(); // restore focus
810
- this._lastInput = null;
811
- }
812
- },
813
-
814
- /* Update any alternate field to synchronise with the main field. */
815
- _updateAlternate: function(inst) {
816
- var altField = this._get(inst, 'altField');
817
- if (altField) { // update alternate field too
818
- var altFormat = this._get(inst, 'altFormat');
819
- var date = this._getDate(inst);
820
- dateStr = (isArray(date) ? (!date[0] && !date[1] ? '' :
821
- this.formatDate(altFormat, date[0], this._getFormatConfig(inst)) +
822
- this._get(inst, 'rangeSeparator') + this.formatDate(
823
- altFormat, date[1] || date[0], this._getFormatConfig(inst))) :
824
- this.formatDate(altFormat, date, this._getFormatConfig(inst)));
825
- $(altField).each(function() { $(this).val(dateStr); });
826
- }
827
- },
828
-
829
- /* Set as beforeShowDay function to prevent selection of weekends.
830
- @param date Date - the date to customise
831
- @return [boolean, string] - is this date selectable?, what is its CSS class? */
832
- noWeekends: function(date) {
833
- var day = date.getDay();
834
- return [(day > 0 && day < 6), ''];
835
- },
836
-
837
- /* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition.
838
- @param date Date - the date to get the week for
839
- @return number - the number of the week within the year that contains this date */
840
- iso8601Week: function(date) {
841
- var checkDate = new Date(date.getFullYear(), date.getMonth(), date.getDate(), (date.getTimezoneOffset() / -60));
842
- var firstMon = new Date(checkDate.getFullYear(), 1 - 1, 4); // First week always contains 4 Jan
843
- var firstDay = firstMon.getDay() || 7; // Day of week: Mon = 1, ..., Sun = 7
844
- firstMon.setDate(firstMon.getDate() + 1 - firstDay); // Preceding Monday
845
- if (firstDay < 4 && checkDate < firstMon) { // Adjust first three days in year if necessary
846
- checkDate.setDate(checkDate.getDate() - 3); // Generate for previous year
847
- return $.datepicker.iso8601Week(checkDate);
848
- } else if (checkDate > new Date(checkDate.getFullYear(), 12 - 1, 28)) { // Check last three days in year
849
- firstDay = new Date(checkDate.getFullYear() + 1, 1 - 1, 4).getDay() || 7;
850
- if (firstDay > 4 && (checkDate.getDay() || 7) < firstDay - 3) { // Adjust if necessary
851
- checkDate.setDate(checkDate.getDate() + 3); // Generate for next year
852
- return $.datepicker.iso8601Week(checkDate);
853
- }
854
- }
855
- return Math.floor(((checkDate - firstMon) / 86400000) / 7) + 1; // Weeks to given date
856
- },
857
-
858
- /* Provide status text for a particular date.
859
- @param date the date to get the status for
860
- @param inst the current datepicker instance
861
- @return the status display text for this date */
862
- dateStatus: function(date, inst) {
863
- return $.datepicker.formatDate($.datepicker._get(inst, 'dateStatus'),
864
- date, $.datepicker._getFormatConfig(inst));
865
- },
866
-
867
- /* Parse a string value into a date object.
868
- See formatDate below for the possible formats.
869
-
870
- @param format string - the expected format of the date
871
- @param value string - the date in the above format
872
- @param settings Object - attributes include:
873
- shortYearCutoff number - the cutoff year for determining the century (optional)
874
- dayNamesShort string[7] - abbreviated names of the days from Sunday (optional)
875
- dayNames string[7] - names of the days from Sunday (optional)
876
- monthNamesShort string[12] - abbreviated names of the months (optional)
877
- monthNames string[12] - names of the months (optional)
878
- @return Date - the extracted date value or null if value is blank */
879
- parseDate: function (format, value, settings) {
880
- if (format == null || value == null)
881
- throw 'Invalid arguments';
882
- value = (typeof value == 'object' ? value.toString() : value + '');
883
- if (value == '')
884
- return null;
885
- var shortYearCutoff = (settings ? settings.shortYearCutoff : null) || this._defaults.shortYearCutoff;
886
- var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort;
887
- var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames;
888
- var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort;
889
- var monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames;
890
- var year = -1;
891
- var month = -1;
892
- var day = -1;
893
- var doy = -1;
894
- var literal = false;
895
- // Check whether a format character is doubled
896
- var lookAhead = function(match) {
897
- var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);
898
- if (matches)
899
- iFormat++;
900
- return matches;
901
- };
902
- // Extract a number from the string value
903
- var getNumber = function(match) {
904
- lookAhead(match);
905
- var origSize = (match == '@' ? 14 : (match == 'y' ? 4 : (match == 'o' ? 3 : 2)));
906
- var size = origSize;
907
- var num = 0;
908
- while (size > 0 && iValue < value.length &&
909
- value.charAt(iValue) >= '0' && value.charAt(iValue) <= '9') {
910
- num = num * 10 + parseInt(value.charAt(iValue++));
911
- size--;
912
- }
913
- if (size == origSize)
914
- throw 'Missing number at position ' + iValue;
915
- return num;
916
- };
917
- // Extract a name from the string value and convert to an index
918
- var getName = function(match, shortNames, longNames) {
919
- var names = (lookAhead(match) ? longNames : shortNames);
920
- var size = 0;
921
- for (var j = 0; j < names.length; j++)
922
- size = Math.max(size, names[j].length);
923
- var name = '';
924
- var iInit = iValue;
925
- while (size > 0 && iValue < value.length) {
926
- name += value.charAt(iValue++);
927
- for (var i = 0; i < names.length; i++)
928
- if (name == names[i])
929
- return i + 1;
930
- size--;
931
- }
932
- throw 'Unknown name at position ' + iInit;
933
- };
934
- // Confirm that a literal character matches the string value
935
- var checkLiteral = function() {
936
- if (value.charAt(iValue) != format.charAt(iFormat))
937
- throw 'Unexpected literal at position ' + iValue;
938
- iValue++;
939
- };
940
- var iValue = 0;
941
- for (var iFormat = 0; iFormat < format.length; iFormat++) {
942
- if (literal)
943
- if (format.charAt(iFormat) == "'" && !lookAhead("'"))
944
- literal = false;
945
- else
946
- checkLiteral();
947
- else
948
- switch (format.charAt(iFormat)) {
949
- case 'd':
950
- day = getNumber('d');
951
- break;
952
- case 'D':
953
- getName('D', dayNamesShort, dayNames);
954
- break;
955
- case 'o':
956
- doy = getNumber('o');
957
- break;
958
- case 'm':
959
- month = getNumber('m');
960
- break;
961
- case 'M':
962
- month = getName('M', monthNamesShort, monthNames);
963
- break;
964
- case 'y':
965
- year = getNumber('y');
966
- break;
967
- case '@':
968
- var date = new Date(getNumber('@'));
969
- year = date.getFullYear();
970
- month = date.getMonth() + 1;
971
- day = date.getDate();
972
- break;
973
- case "'":
974
- if (lookAhead("'"))
975
- checkLiteral();
976
- else
977
- literal = true;
978
- break;
979
- default:
980
- checkLiteral();
981
- }
982
- }
983
- if (year < 100)
984
- year += new Date().getFullYear() - new Date().getFullYear() % 100 +
985
- (year <= shortYearCutoff ? 0 : -100);
986
- if (doy > -1) {
987
- month = 1;
988
- day = doy;
989
- do {
990
- var dim = this._getDaysInMonth(year, month - 1);
991
- if (day <= dim)
992
- break;
993
- month++;
994
- day -= dim;
995
- } while (true);
996
- }
997
- var date = new Date(year, month - 1, day);
998
- if (date.getFullYear() != year || date.getMonth() + 1 != month || date.getDate() != day)
999
- throw 'Invalid date'; // E.g. 31/02/*
1000
- return date;
1001
- },
1002
-
1003
- /* Standard date formats. */
1004
- ATOM: 'yy-mm-dd', // RFC 3339 (ISO 8601)
1005
- COOKIE: 'D, dd M yy',
1006
- ISO_8601: 'yy-mm-dd',
1007
- RFC_822: 'D, d M y',
1008
- RFC_850: 'DD, dd-M-y',
1009
- RFC_1036: 'D, d M y',
1010
- RFC_1123: 'D, d M yy',
1011
- RFC_2822: 'D, d M yy',
1012
- RSS: 'D, d M y', // RFC 822
1013
- TIMESTAMP: '@',
1014
- W3C: 'yy-mm-dd', // ISO 8601
1015
-
1016
- /* Format a date object into a string value.
1017
- The format can be combinations of the following:
1018
- d - day of month (no leading zero)
1019
- dd - day of month (two digit)
1020
- o - day of year (no leading zeros)
1021
- oo - day of year (three digit)
1022
- D - day name short
1023
- DD - day name long
1024
- m - month of year (no leading zero)
1025
- mm - month of year (two digit)
1026
- M - month name short
1027
- MM - month name long
1028
- y - year (two digit)
1029
- yy - year (four digit)
1030
- @ - Unix timestamp (ms since 01/01/1970)
1031
- '...' - literal text
1032
- '' - single quote
1033
-
1034
- @param format string - the desired format of the date
1035
- @param date Date - the date value to format
1036
- @param settings Object - attributes include:
1037
- dayNamesShort string[7] - abbreviated names of the days from Sunday (optional)
1038
- dayNames string[7] - names of the days from Sunday (optional)
1039
- monthNamesShort string[12] - abbreviated names of the months (optional)
1040
- monthNames string[12] - names of the months (optional)
1041
- @return string - the date in the above format */
1042
- formatDate: function (format, date, settings) {
1043
- if (!date)
1044
- return '';
1045
- var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort;
1046
- var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames;
1047
- var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort;
1048
- var monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames;
1049
- // Check whether a format character is doubled
1050
- var lookAhead = function(match) {
1051
- var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);
1052
- if (matches)
1053
- iFormat++;
1054
- return matches;
1055
- };
1056
- // Format a number, with leading zero if necessary
1057
- var formatNumber = function(match, value, len) {
1058
- var num = '' + value;
1059
- if (lookAhead(match))
1060
- while (num.length < len)
1061
- num = '0' + num;
1062
- return num;
1063
- };
1064
- // Format a name, short or long as requested
1065
- var formatName = function(match, value, shortNames, longNames) {
1066
- return (lookAhead(match) ? longNames[value] : shortNames[value]);
1067
- };
1068
- var output = '';
1069
- var literal = false;
1070
- if (date)
1071
- for (var iFormat = 0; iFormat < format.length; iFormat++) {
1072
- if (literal)
1073
- if (format.charAt(iFormat) == "'" && !lookAhead("'"))
1074
- literal = false;
1075
- else
1076
- output += format.charAt(iFormat);
1077
- else
1078
- switch (format.charAt(iFormat)) {
1079
- case 'd':
1080
- output += formatNumber('d', date.getDate(), 2);
1081
- break;
1082
- case 'D':
1083
- output += formatName('D', date.getDay(), dayNamesShort, dayNames);
1084
- break;
1085
- case 'o':
1086
- var doy = date.getDate();
1087
- for (var m = date.getMonth() - 1; m >= 0; m--)
1088
- doy += this._getDaysInMonth(date.getFullYear(), m);
1089
- output += formatNumber('o', doy, 3);
1090
- break;
1091
- case 'm':
1092
- output += formatNumber('m', date.getMonth() + 1, 2);
1093
- break;
1094
- case 'M':
1095
- output += formatName('M', date.getMonth(), monthNamesShort, monthNames);
1096
- break;
1097
- case 'y':
1098
- output += (lookAhead('y') ? date.getFullYear() :
1099
- (date.getYear() % 100 < 10 ? '0' : '') + date.getYear() % 100);
1100
- break;
1101
- case '@':
1102
- output += date.getTime();
1103
- break;
1104
- case "'":
1105
- if (lookAhead("'"))
1106
- output += "'";
1107
- else
1108
- literal = true;
1109
- break;
1110
- default:
1111
- output += format.charAt(iFormat);
1112
- }
1113
- }
1114
- return output;
1115
- },
1116
-
1117
- /* Extract all possible characters from the date format. */
1118
- _possibleChars: function (format) {
1119
- var chars = '';
1120
- var literal = false;
1121
- for (var iFormat = 0; iFormat < format.length; iFormat++)
1122
- if (literal)
1123
- if (format.charAt(iFormat) == "'" && !lookAhead("'"))
1124
- literal = false;
1125
- else
1126
- chars += format.charAt(iFormat);
1127
- else
1128
- switch (format.charAt(iFormat)) {
1129
- case 'd': case 'm': case 'y': case '@':
1130
- chars += '0123456789';
1131
- break;
1132
- case 'D': case 'M':
1133
- return null; // Accept anything
1134
- case "'":
1135
- if (lookAhead("'"))
1136
- chars += "'";
1137
- else
1138
- literal = true;
1139
- break;
1140
- default:
1141
- chars += format.charAt(iFormat);
1142
- }
1143
- return chars;
1144
- },
1145
-
1146
- /* Get a setting value, defaulting if necessary. */
1147
- _get: function(inst, name) {
1148
- return inst.settings[name] !== undefined ?
1149
- inst.settings[name] : this._defaults[name];
1150
- },
1151
-
1152
- /* Parse existing date and initialise date picker. */
1153
- _setDateFromField: function(inst) {
1154
- var dateFormat = this._get(inst, 'dateFormat');
1155
- var dates = inst.input ? inst.input.val().split(this._get(inst, 'rangeSeparator')) : null;
1156
- inst.endDay = inst.endMonth = inst.endYear = null;
1157
- var date = defaultDate = this._getDefaultDate(inst);
1158
- if (dates.length > 0) {
1159
- var settings = this._getFormatConfig(inst);
1160
- if (dates.length > 1) {
1161
- date = this.parseDate(dateFormat, dates[1], settings) || defaultDate;
1162
- inst.endDay = date.getDate();
1163
- inst.endMonth = date.getMonth();
1164
- inst.endYear = date.getFullYear();
1165
- }
1166
- try {
1167
- date = this.parseDate(dateFormat, dates[0], settings) || defaultDate;
1168
- } catch (e) {
1169
- this.log(e);
1170
- date = defaultDate;
1171
- }
1172
- }
1173
- inst.selectedDay = date.getDate();
1174
- inst.drawMonth = inst.selectedMonth = date.getMonth();
1175
- inst.drawYear = inst.selectedYear = date.getFullYear();
1176
- inst.currentDay = (dates[0] ? date.getDate() : 0);
1177
- inst.currentMonth = (dates[0] ? date.getMonth() : 0);
1178
- inst.currentYear = (dates[0] ? date.getFullYear() : 0);
1179
- this._adjustInstDate(inst);
1180
- },
1181
-
1182
- /* Retrieve the default date shown on opening. */
1183
- _getDefaultDate: function(inst) {
1184
- var date = this._determineDate(this._get(inst, 'defaultDate'), new Date());
1185
- var minDate = this._getMinMaxDate(inst, 'min', true);
1186
- var maxDate = this._getMinMaxDate(inst, 'max');
1187
- date = (minDate && date < minDate ? minDate : date);
1188
- date = (maxDate && date > maxDate ? maxDate : date);
1189
- return date;
1190
- },
1191
-
1192
- /* A date may be specified as an exact value or a relative one. */
1193
- _determineDate: function(date, defaultDate) {
1194
- var offsetNumeric = function(offset) {
1195
- var date = new Date();
1196
- date.setUTCDate(date.getUTCDate() + offset);
1197
- return date;
1198
- };
1199
- var offsetString = function(offset, getDaysInMonth) {
1200
- var date = new Date();
1201
- var year = date.getFullYear();
1202
- var month = date.getMonth();
1203
- var day = date.getDate();
1204
- var pattern = /([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g;
1205
- var matches = pattern.exec(offset);
1206
- while (matches) {
1207
- switch (matches[2] || 'd') {
1208
- case 'd' : case 'D' :
1209
- day += parseInt(matches[1]); break;
1210
- case 'w' : case 'W' :
1211
- day += parseInt(matches[1]) * 7; break;
1212
- case 'm' : case 'M' :
1213
- month += parseInt(matches[1]);
1214
- day = Math.min(day, getDaysInMonth(year, month));
1215
- break;
1216
- case 'y': case 'Y' :
1217
- year += parseInt(matches[1]);
1218
- day = Math.min(day, getDaysInMonth(year, month));
1219
- break;
1220
- }
1221
- matches = pattern.exec(offset);
1222
- }
1223
- return new Date(year, month, day);
1224
- };
1225
- return (date == null ? defaultDate :
1226
- (typeof date == 'string' ? offsetString(date, this._getDaysInMonth) :
1227
- (typeof date == 'number' ? offsetNumeric(date) : date)));
1228
- },
1229
-
1230
- /* Set the date(s) directly. */
1231
- _setDate: function(inst, date, endDate) {
1232
- var clear = !(date);
1233
- var origMonth = inst.selectedMonth;
1234
- var origYear = inst.selectedYear;
1235
- date = this._determineDate(date, new Date());
1236
- inst.selectedDay = inst.currentDay = date.getDate();
1237
- inst.drawMonth = inst.selectedMonth = inst.currentMonth = date.getMonth();
1238
- inst.drawYear = inst.selectedYear = inst.currentYear = date.getFullYear();
1239
- if (this._get(inst, 'rangeSelect')) {
1240
- if (endDate) {
1241
- endDate = this._determineDate(endDate, null);
1242
- inst.endDay = endDate.getDate();
1243
- inst.endMonth = endDate.getMonth();
1244
- inst.endYear = endDate.getFullYear();
1245
- } else {
1246
- inst.endDay = inst.currentDay;
1247
- inst.endMonth = inst.currentMonth;
1248
- inst.endYear = inst.currentYear;
1249
- }
1250
- }
1251
- if (origMonth != inst.selectedMonth || origYear != inst.selectedYear)
1252
- this._notifyChange(inst);
1253
- this._adjustInstDate(inst);
1254
- if (inst.input)
1255
- inst.input.val(clear ? '' : this._formatDate(inst) +
1256
- (!this._get(inst, 'rangeSelect') ? '' : this._get(inst, 'rangeSeparator') +
1257
- this._formatDate(inst, inst.endDay, inst.endMonth, inst.endYear)));
1258
- },
1259
-
1260
- /* Retrieve the date(s) directly. */
1261
- _getDate: function(inst) {
1262
- var startDate = (!inst.currentYear || (inst.input && inst.input.val() == '') ? null :
1263
- new Date(inst.currentYear, inst.currentMonth, inst.currentDay));
1264
- if (this._get(inst, 'rangeSelect')) {
1265
- return [inst.rangeStart || startDate,
1266
- (!inst.endYear ? inst.rangeStart || startDate :
1267
- new Date(inst.endYear, inst.endMonth, inst.endDay))];
1268
- } else
1269
- return startDate;
1270
- },
1271
-
1272
- /* Generate the HTML for the current state of the date picker. */
1273
- _generateHTML: function(inst) {
1274
- var today = new Date();
1275
- today = new Date(today.getFullYear(), today.getMonth(), today.getDate()); // clear time
1276
- var showStatus = this._get(inst, 'showStatus');
1277
- var initStatus = this._get(inst, 'initStatus') || '&#xa0;';
1278
- var isRTL = this._get(inst, 'isRTL');
1279
- // build the date picker HTML
1280
- var clear = (this._get(inst, 'mandatory') ? '' :
1281
- '<div class="ui-datepicker-clear"><a onclick="jQuery.datepicker._clearDate(\'#' + inst.id + '\');"' +
1282
- this._addStatus(showStatus, inst.id, this._get(inst, 'clearStatus'), initStatus) + '>' +
1283
- this._get(inst, 'clearText') + '</a></div>');
1284
- var controls = '<div class="ui-datepicker-control">' + (isRTL ? '' : clear) +
1285
- '<div class="ui-datepicker-close"><a onclick="jQuery.datepicker._hideDatepicker();"' +
1286
- this._addStatus(showStatus, inst.id, this._get(inst, 'closeStatus'), initStatus) + '>' +
1287
- this._get(inst, 'closeText') + '</a></div>' + (isRTL ? clear : '') + '</div>';
1288
- var prompt = this._get(inst, 'prompt');
1289
- var closeAtTop = this._get(inst, 'closeAtTop');
1290
- var hideIfNoPrevNext = this._get(inst, 'hideIfNoPrevNext');
1291
- var navigationAsDateFormat = this._get(inst, 'navigationAsDateFormat');
1292
- var showBigPrevNext = this._get(inst, 'showBigPrevNext');
1293
- var numMonths = this._getNumberOfMonths(inst);
1294
- var showCurrentAtPos = this._get(inst, 'showCurrentAtPos');
1295
- var stepMonths = this._get(inst, 'stepMonths');
1296
- var stepBigMonths = this._get(inst, 'stepBigMonths');
1297
- var isMultiMonth = (numMonths[0] != 1 || numMonths[1] != 1);
1298
- var currentDate = (!inst.currentDay ? new Date(9999, 9, 9) :
1299
- new Date(inst.currentYear, inst.currentMonth, inst.currentDay));
1300
- var minDate = this._getMinMaxDate(inst, 'min', true);
1301
- var maxDate = this._getMinMaxDate(inst, 'max');
1302
- var drawMonth = inst.drawMonth - showCurrentAtPos;
1303
- var drawYear = inst.drawYear;
1304
- if (drawMonth < 0) {
1305
- drawMonth += 12;
1306
- drawYear--;
1307
- }
1308
- if (maxDate) {
1309
- var maxDraw = new Date(maxDate.getFullYear(),
1310
- maxDate.getMonth() - numMonths[1] + 1, maxDate.getDate());
1311
- maxDraw = (minDate && maxDraw < minDate ? minDate : maxDraw);
1312
- while (new Date(drawYear, drawMonth, 1) > maxDraw) {
1313
- drawMonth--;
1314
- if (drawMonth < 0) {
1315
- drawMonth = 11;
1316
- drawYear--;
1317
- }
1318
- }
1319
- }
1320
- // controls and links
1321
- var prevText = this._get(inst, 'prevText');
1322
- prevText = (!navigationAsDateFormat ? prevText : this.formatDate(
1323
- prevText, new Date(drawYear, drawMonth - stepMonths, 1), this._getFormatConfig(inst)));
1324
- var prevBigText = (showBigPrevNext ? this._get(inst, 'prevBigText') : '');
1325
- prevBigText = (!navigationAsDateFormat ? prevBigText : this.formatDate(
1326
- prevBigText, new Date(drawYear, drawMonth - stepBigMonths, 1), this._getFormatConfig(inst)));
1327
- var prev = '<div class="ui-datepicker-prev">' + (this._canAdjustMonth(inst, -1, drawYear, drawMonth) ?
1328
- (showBigPrevNext ? '<a onclick="jQuery.datepicker._adjustDate(\'#' + inst.id + '\', -' + stepBigMonths + ', \'M\');"' +
1329
- this._addStatus(showStatus, inst.id, this._get(inst, 'prevBigStatus'), initStatus) + '>' + prevBigText + '</a>' : '') +
1330
- '<a onclick="jQuery.datepicker._adjustDate(\'#' + inst.id + '\', -' + stepMonths + ', \'M\');"' +
1331
- this._addStatus(showStatus, inst.id, this._get(inst, 'prevStatus'), initStatus) + '>' + prevText + '</a>' :
1332
- (hideIfNoPrevNext ? '' : '<label>' + prevBigText + '</label><label>' + prevText + '</label>')) + '</div>';
1333
- var nextText = this._get(inst, 'nextText');
1334
- nextText = (!navigationAsDateFormat ? nextText : this.formatDate(
1335
- nextText, new Date(drawYear, drawMonth + stepMonths, 1), this._getFormatConfig(inst)));
1336
- var nextBigText = (showBigPrevNext ? this._get(inst, 'nextBigText') : '');
1337
- nextBigText = (!navigationAsDateFormat ? nextBigText : this.formatDate(
1338
- nextBigText, new Date(drawYear, drawMonth + stepBigMonths, 1), this._getFormatConfig(inst)));
1339
- var next = '<div class="ui-datepicker-next">' + (this._canAdjustMonth(inst, +1, drawYear, drawMonth) ?
1340
- '<a onclick="jQuery.datepicker._adjustDate(\'#' + inst.id + '\', +' + stepMonths + ', \'M\');"' +
1341
- this._addStatus(showStatus, inst.id, this._get(inst, 'nextStatus'), initStatus) + '>' + nextText + '</a>' +
1342
- (showBigPrevNext ? '<a onclick="jQuery.datepicker._adjustDate(\'#' + inst.id + '\', +' + stepBigMonths + ', \'M\');"' +
1343
- this._addStatus(showStatus, inst.id, this._get(inst, 'nextBigStatus'), initStatus) + '>' + nextBigText + '</a>' : '') :
1344
- (hideIfNoPrevNext ? '' : '<label>' + nextText + '</label><label>' + nextBigText + '</label>')) + '</div>';
1345
- var currentText = this._get(inst, 'currentText');
1346
- var gotoDate = (this._get(inst, 'gotoCurrent') && inst.currentDay ? currentDate : today);
1347
- currentText = (!navigationAsDateFormat ? currentText :
1348
- this.formatDate(currentText, gotoDate, this._getFormatConfig(inst)));
1349
- var html = (prompt ? '<div class="' + this._promptClass + '">' + prompt + '</div>' : '') +
1350
- (closeAtTop && !inst.inline ? controls : '') +
1351
- '<div class="ui-datepicker-links">' + (isRTL ? next : prev) +
1352
- (this._isInRange(inst, gotoDate) ? '<div class="ui-datepicker-current">' +
1353
- '<a onclick="jQuery.datepicker._gotoToday(\'#' + inst.id + '\');"' +
1354
- this._addStatus(showStatus, inst.id, this._get(inst, 'currentStatus'), initStatus) + '>' +
1355
- currentText + '</a></div>' : '') + (isRTL ? prev : next) + '</div>';
1356
- var firstDay = this._get(inst, 'firstDay');
1357
- var changeFirstDay = this._get(inst, 'changeFirstDay');
1358
- var dayNames = this._get(inst, 'dayNames');
1359
- var dayNamesShort = this._get(inst, 'dayNamesShort');
1360
- var dayNamesMin = this._get(inst, 'dayNamesMin');
1361
- var monthNames = this._get(inst, 'monthNames');
1362
- var beforeShowDay = this._get(inst, 'beforeShowDay');
1363
- var highlightWeek = this._get(inst, 'highlightWeek');
1364
- var showOtherMonths = this._get(inst, 'showOtherMonths');
1365
- var showWeeks = this._get(inst, 'showWeeks');
1366
- var calculateWeek = this._get(inst, 'calculateWeek') || this.iso8601Week;
1367
- var weekStatus = this._get(inst, 'weekStatus');
1368
- var status = (showStatus ? this._get(inst, 'dayStatus') || initStatus : '');
1369
- var dateStatus = this._get(inst, 'statusForDate') || this.dateStatus;
1370
- var endDate = inst.endDay ? new Date(inst.endYear, inst.endMonth, inst.endDay) : currentDate;
1371
- for (var row = 0; row < numMonths[0]; row++)
1372
- for (var col = 0; col < numMonths[1]; col++) {
1373
- var selectedDate = new Date(drawYear, drawMonth, inst.selectedDay);
1374
- html += '<div class="ui-datepicker-one-month' + (col == 0 ? ' ui-datepicker-new-row' : '') + '">' +
1375
- this._generateMonthYearHeader(inst, drawMonth, drawYear, minDate, maxDate,
1376
- selectedDate, row > 0 || col > 0, showStatus, initStatus, monthNames) + // draw month headers
1377
- '<table class="ui-datepicker" cellpadding="0" cellspacing="0"><thead>' +
1378
- '<tr class="ui-datepicker-title-row">' +
1379
- (showWeeks ? '<td' + this._addStatus(showStatus, inst.id, weekStatus, initStatus) + '>' +
1380
- this._get(inst, 'weekHeader') + '</td>' : '');
1381
- for (var dow = 0; dow < 7; dow++) { // days of the week
1382
- var day = (dow + firstDay) % 7;
1383
- var dayStatus = (status.indexOf('DD') > -1 ? status.replace(/DD/, dayNames[day]) :
1384
- status.replace(/D/, dayNamesShort[day]));
1385
- html += '<td' + ((dow + firstDay + 6) % 7 >= 5 ? ' class="ui-datepicker-week-end-cell"' : '') + '>' +
1386
- (!changeFirstDay ? '<span' :
1387
- '<a onclick="jQuery.datepicker._changeFirstDay(\'#' + inst.id + '\', ' + day + ');"') +
1388
- this._addStatus(showStatus, inst.id, dayStatus, initStatus) + ' title="' + dayNames[day] + '">' +
1389
- dayNamesMin[day] + (changeFirstDay ? '</a>' : '</span>') + '</td>';
1390
- }
1391
- html += '</tr></thead><tbody>';
1392
- var daysInMonth = this._getDaysInMonth(drawYear, drawMonth);
1393
- if (drawYear == inst.selectedYear && drawMonth == inst.selectedMonth)
1394
- inst.selectedDay = Math.min(inst.selectedDay, daysInMonth);
1395
- var leadDays = (this._getFirstDayOfMonth(drawYear, drawMonth) - firstDay + 7) % 7;
1396
- var tzDate = new Date(drawYear, drawMonth, 1 - leadDays);
1397
- var utcDate = new Date(drawYear, drawMonth, 1 - leadDays);
1398
- var printDate = utcDate;
1399
- var numRows = (isMultiMonth ? 6 : Math.ceil((leadDays + daysInMonth) / 7)); // calculate the number of rows to generate
1400
- for (var dRow = 0; dRow < numRows; dRow++) { // create date picker rows
1401
- html += '<tr class="ui-datepicker-days-row">' +
1402
- (showWeeks ? '<td class="ui-datepicker-week-col"' +
1403
- this._addStatus(showStatus, inst.id, weekStatus, initStatus) + '>' +
1404
- calculateWeek(printDate) + '</td>' : '');
1405
- for (var dow = 0; dow < 7; dow++) { // create date picker days
1406
- var daySettings = (beforeShowDay ?
1407
- beforeShowDay.apply((inst.input ? inst.input[0] : null), [printDate]) : [true, '']);
1408
- var otherMonth = (printDate.getMonth() != drawMonth);
1409
- var unselectable = otherMonth || !daySettings[0] ||
1410
- (minDate && printDate < minDate) || (maxDate && printDate > maxDate);
1411
- html += '<td class="ui-datepicker-days-cell' +
1412
- ((dow + firstDay + 6) % 7 >= 5 ? ' ui-datepicker-week-end-cell' : '') + // highlight weekends
1413
- (otherMonth ? ' ui-datepicker-other-month' : '') + // highlight days from other months
1414
- (printDate.getTime() == selectedDate.getTime() && drawMonth == inst.selectedMonth ?
1415
- ' ui-datepicker-days-cell-over' : '') + // highlight selected day
1416
- (unselectable ? ' ' + this._unselectableClass : '') + // highlight unselectable days
1417
- (otherMonth && !showOtherMonths ? '' : ' ' + daySettings[1] + // highlight custom dates
1418
- (printDate.getTime() >= currentDate.getTime() && printDate.getTime() <= endDate.getTime() ? // in current range
1419
- ' ' + this._currentClass : '') + // highlight selected day
1420
- (printDate.getTime() == today.getTime() ? ' ui-datepicker-today' : '')) + '"' + // highlight today (if different)
1421
- ((!otherMonth || showOtherMonths) && daySettings[2] ? ' title="' + daySettings[2] + '"' : '') + // cell title
1422
- (unselectable ? (highlightWeek ? ' onmouseover="jQuery(this).parent().addClass(\'ui-datepicker-week-over\');"' + // highlight selection week
1423
- ' onmouseout="jQuery(this).parent().removeClass(\'ui-datepicker-week-over\');"' : '') : // unhighlight selection week
1424
- ' onmouseover="jQuery(this).addClass(\'ui-datepicker-days-cell-over\')' + // highlight selection
1425
- (highlightWeek ? '.parent().addClass(\'ui-datepicker-week-over\')' : '') + ';' + // highlight selection week
1426
- (!showStatus || (otherMonth && !showOtherMonths) ? '' : 'jQuery(\'#ui-datepicker-status-' +
1427
- inst.id + '\').html(\'' + (dateStatus.apply((inst.input ? inst.input[0] : null),
1428
- [printDate, inst]) || initStatus) +'\');') + '"' +
1429
- ' onmouseout="jQuery(this).removeClass(\'ui-datepicker-days-cell-over\')' + // unhighlight selection
1430
- (highlightWeek ? '.parent().removeClass(\'ui-datepicker-week-over\')' : '') + ';' + // unhighlight selection week
1431
- (!showStatus || (otherMonth && !showOtherMonths) ? '' : 'jQuery(\'#ui-datepicker-status-' +
1432
- inst.id + '\').html(\'' + initStatus + '\');') + '" onclick="jQuery.datepicker._selectDay(\'#' +
1433
- inst.id + '\',' + drawMonth + ',' + drawYear + ', this);"') + '>' + // actions
1434
- (otherMonth ? (showOtherMonths ? printDate.getDate() : '&#xa0;') : // display for other months
1435
- (unselectable ? printDate.getDate() : '<a>' + printDate.getDate() + '</a>')) + '</td>'; // display for this month
1436
- tzDate.setDate(tzDate.getDate() + 1);
1437
- utcDate.setUTCDate(utcDate.getUTCDate() + 1);
1438
- printDate = (tzDate > utcDate ? tzDate : utcDate);
1439
- }
1440
- html += '</tr>';
1441
- }
1442
- drawMonth++;
1443
- if (drawMonth > 11) {
1444
- drawMonth = 0;
1445
- drawYear++;
1446
- }
1447
- html += '</tbody></table></div>';
1448
- }
1449
- html += (showStatus ? '<div style="clear: both;"></div><div id="ui-datepicker-status-' + inst.id +
1450
- '" class="ui-datepicker-status">' + initStatus + '</div>' : '') +
1451
- (!closeAtTop && !inst.inline ? controls : '') +
1452
- '<div style="clear: both;"></div>' +
1453
- ($.browser.msie && parseInt($.browser.version) < 7 && !inst.inline ?
1454
- '<iframe src="javascript:false;" class="ui-datepicker-cover"></iframe>' : '');
1455
- return html;
1456
- },
1457
-
1458
- /* Generate the month and year header. */
1459
- _generateMonthYearHeader: function(inst, drawMonth, drawYear, minDate, maxDate,
1460
- selectedDate, secondary, showStatus, initStatus, monthNames) {
1461
- minDate = (inst.rangeStart && minDate && selectedDate < minDate ? selectedDate : minDate);
1462
- var showMonthAfterYear = this._get(inst, 'showMonthAfterYear');
1463
- var html = '<div class="ui-datepicker-header">';
1464
- var monthHtml = '';
1465
- // month selection
1466
- if (secondary || !this._get(inst, 'changeMonth'))
1467
- monthHtml += monthNames[drawMonth] + '&#xa0;';
1468
- else {
1469
- var inMinYear = (minDate && minDate.getFullYear() == drawYear);
1470
- var inMaxYear = (maxDate && maxDate.getFullYear() == drawYear);
1471
- monthHtml += '<select class="ui-datepicker-new-month" ' +
1472
- 'onchange="jQuery.datepicker._selectMonthYear(\'#' + inst.id + '\', this, \'M\');" ' +
1473
- 'onclick="jQuery.datepicker._clickMonthYear(\'#' + inst.id + '\');"' +
1474
- this._addStatus(showStatus, inst.id, this._get(inst, 'monthStatus'), initStatus) + '>';
1475
- for (var month = 0; month < 12; month++) {
1476
- if ((!inMinYear || month >= minDate.getMonth()) &&
1477
- (!inMaxYear || month <= maxDate.getMonth()))
1478
- monthHtml += '<option value="' + month + '"' +
1479
- (month == drawMonth ? ' selected="selected"' : '') +
1480
- '>' + monthNames[month] + '</option>';
1481
- }
1482
- monthHtml += '</select>';
1483
- }
1484
- if (!showMonthAfterYear)
1485
- html += monthHtml;
1486
- // year selection
1487
- if (secondary || !this._get(inst, 'changeYear'))
1488
- html += drawYear;
1489
- else {
1490
- // determine range of years to display
1491
- var years = this._get(inst, 'yearRange').split(':');
1492
- var year = 0;
1493
- var endYear = 0;
1494
- if (years.length != 2) {
1495
- year = drawYear - 10;
1496
- endYear = drawYear + 10;
1497
- } else if (years[0].charAt(0) == '+' || years[0].charAt(0) == '-') {
1498
- year = endYear = new Date().getFullYear();
1499
- year += parseInt(years[0], 10);
1500
- endYear += parseInt(years[1], 10);
1501
- } else {
1502
- year = parseInt(years[0], 10);
1503
- endYear = parseInt(years[1], 10);
1504
- }
1505
- year = (minDate ? Math.max(year, minDate.getFullYear()) : year);
1506
- endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear);
1507
- html += '<select class="ui-datepicker-new-year" ' +
1508
- 'onchange="jQuery.datepicker._selectMonthYear(\'#' + inst.id + '\', this, \'Y\');" ' +
1509
- 'onclick="jQuery.datepicker._clickMonthYear(\'#' + inst.id + '\');"' +
1510
- this._addStatus(showStatus, inst.id, this._get(inst, 'yearStatus'), initStatus) + '>';
1511
- for (; year <= endYear; year++) {
1512
- html += '<option value="' + year + '"' +
1513
- (year == drawYear ? ' selected="selected"' : '') +
1514
- '>' + year + '</option>';
1515
- }
1516
- html += '</select>';
1517
- }
1518
- if (showMonthAfterYear)
1519
- html += monthHtml;
1520
- html += '</div>'; // Close datepicker_header
1521
- return html;
1522
- },
1523
-
1524
- /* Provide code to set and clear the status panel. */
1525
- _addStatus: function(showStatus, id, text, initStatus) {
1526
- return (showStatus ? ' onmouseover="jQuery(\'#ui-datepicker-status-' + id +
1527
- '\').html(\'' + (text || initStatus) + '\');" ' +
1528
- 'onmouseout="jQuery(\'#ui-datepicker-status-' + id +
1529
- '\').html(\'' + initStatus + '\');"' : '');
1530
- },
1531
-
1532
- /* Adjust one of the date sub-fields. */
1533
- _adjustInstDate: function(inst, offset, period) {
1534
- var year = inst.drawYear + (period == 'Y' ? offset : 0);
1535
- var month = inst.drawMonth + (period == 'M' ? offset : 0);
1536
- var day = Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) +
1537
- (period == 'D' ? offset : 0);
1538
- var date = new Date(year, month, day);
1539
- // ensure it is within the bounds set
1540
- var minDate = this._getMinMaxDate(inst, 'min', true);
1541
- var maxDate = this._getMinMaxDate(inst, 'max');
1542
- date = (minDate && date < minDate ? minDate : date);
1543
- date = (maxDate && date > maxDate ? maxDate : date);
1544
- inst.selectedDay = date.getDate();
1545
- inst.drawMonth = inst.selectedMonth = date.getMonth();
1546
- inst.drawYear = inst.selectedYear = date.getFullYear();
1547
- if (period == 'M' || period == 'Y')
1548
- this._notifyChange(inst);
1549
- },
1550
-
1551
- /* Notify change of month/year. */
1552
- _notifyChange: function(inst) {
1553
- var onChange = this._get(inst, 'onChangeMonthYear');
1554
- if (onChange)
1555
- onChange.apply((inst.input ? inst.input[0] : null),
1556
- [new Date(inst.selectedYear, inst.selectedMonth, 1), inst]);
1557
- },
1558
-
1559
- /* Determine the number of months to show. */
1560
- _getNumberOfMonths: function(inst) {
1561
- var numMonths = this._get(inst, 'numberOfMonths');
1562
- return (numMonths == null ? [1, 1] : (typeof numMonths == 'number' ? [1, numMonths] : numMonths));
1563
- },
1564
-
1565
- /* Determine the current maximum date - ensure no time components are set - may be overridden for a range. */
1566
- _getMinMaxDate: function(inst, minMax, checkRange) {
1567
- var date = this._determineDate(this._get(inst, minMax + 'Date'), null);
1568
- if (date) {
1569
- date.setHours(0);
1570
- date.setMinutes(0);
1571
- date.setSeconds(0);
1572
- date.setMilliseconds(0);
1573
- }
1574
- return (!checkRange || !inst.rangeStart ? date :
1575
- (!date || inst.rangeStart > date ? inst.rangeStart : date));
1576
- },
1577
-
1578
- /* Find the number of days in a given month. */
1579
- _getDaysInMonth: function(year, month) {
1580
- return 32 - new Date(year, month, 32).getDate();
1581
- },
1582
-
1583
- /* Find the day of the week of the first of a month. */
1584
- _getFirstDayOfMonth: function(year, month) {
1585
- return new Date(year, month, 1).getDay();
1586
- },
1587
-
1588
- /* Determines if we should allow a "next/prev" month display change. */
1589
- _canAdjustMonth: function(inst, offset, curYear, curMonth) {
1590
- var numMonths = this._getNumberOfMonths(inst);
1591
- var date = new Date(curYear, curMonth + (offset < 0 ? offset : numMonths[1]), 1);
1592
- if (offset < 0)
1593
- date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth()));
1594
- return this._isInRange(inst, date);
1595
- },
1596
-
1597
- /* Is the given date in the accepted range? */
1598
- _isInRange: function(inst, date) {
1599
- // during range selection, use minimum of selected date and range start
1600
- var newMinDate = (!inst.rangeStart ? null :
1601
- new Date(inst.selectedYear, inst.selectedMonth, inst.selectedDay));
1602
- newMinDate = (newMinDate && inst.rangeStart < newMinDate ? inst.rangeStart : newMinDate);
1603
- var minDate = newMinDate || this._getMinMaxDate(inst, 'min');
1604
- var maxDate = this._getMinMaxDate(inst, 'max');
1605
- return ((!minDate || date >= minDate) && (!maxDate || date <= maxDate));
1606
- },
1607
-
1608
- /* Provide the configuration settings for formatting/parsing. */
1609
- _getFormatConfig: function(inst) {
1610
- var shortYearCutoff = this._get(inst, 'shortYearCutoff');
1611
- shortYearCutoff = (typeof shortYearCutoff != 'string' ? shortYearCutoff :
1612
- new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10));
1613
- return {shortYearCutoff: shortYearCutoff,
1614
- dayNamesShort: this._get(inst, 'dayNamesShort'), dayNames: this._get(inst, 'dayNames'),
1615
- monthNamesShort: this._get(inst, 'monthNamesShort'), monthNames: this._get(inst, 'monthNames')};
1616
- },
1617
-
1618
- /* Format the given date for display. */
1619
- _formatDate: function(inst, day, month, year) {
1620
- if (!day) {
1621
- inst.currentDay = inst.selectedDay;
1622
- inst.currentMonth = inst.selectedMonth;
1623
- inst.currentYear = inst.selectedYear;
1624
- }
1625
- var date = (day ? (typeof day == 'object' ? day : new Date(year, month, day)) :
1626
- new Date(inst.currentYear, inst.currentMonth, inst.currentDay));
1627
- return this.formatDate(this._get(inst, 'dateFormat'), date, this._getFormatConfig(inst));
1628
- }
1629
- });
1630
-
1631
- /* jQuery extend now ignores nulls! */
1632
- function extendRemove(target, props) {
1633
- $.extend(target, props);
1634
- for (var name in props)
1635
- if (props[name] == null || props[name] == undefined)
1636
- target[name] = props[name];
1637
- return target;
1638
- };
1639
-
1640
- /* Determine whether an object is an array. */
1641
- function isArray(a) {
1642
- return (a && (($.browser.safari && typeof a == 'object' && a.length) ||
1643
- (a.constructor && a.constructor.toString().match(/\Array\(\)/))));
1644
- };
1645
-
1646
- /* Invoke the datepicker functionality.
1647
- @param options string - a command, optionally followed by additional parameters or
1648
- Object - settings for attaching new datepicker functionality
1649
- @return jQuery object */
1650
- $.fn.datepicker = function(options){
1651
-
1652
- /* Initialise the date picker. */
1653
- if (!$.datepicker.initialized) {
1654
- $(document.body).append($.datepicker.dpDiv).
1655
- mousedown($.datepicker._checkExternalClick);
1656
- $.datepicker.initialized = true;
1657
- }
1658
-
1659
- var otherArgs = Array.prototype.slice.call(arguments, 1);
1660
- if (typeof options == 'string' && (options == 'isDisabled' || options == 'getDate'))
1661
- return $.datepicker['_' + options + 'Datepicker'].
1662
- apply($.datepicker, [this[0]].concat(otherArgs));
1663
- return this.each(function() {
1664
- typeof options == 'string' ?
1665
- $.datepicker['_' + options + 'Datepicker'].
1666
- apply($.datepicker, [this].concat(otherArgs)) :
1667
- $.datepicker._attachDatepicker(this, options);
1668
- });
1669
- };
1670
-
1671
- $.datepicker = new Datepicker(); // singleton instance
1672
- $.datepicker.initialized = false;
1673
-
1674
- })(jQuery);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
locations-search.php DELETED
@@ -1,37 +0,0 @@
1
- <?php
2
- require_once('../../../wp-load.php');
3
- if(isset($_GET['id']) && $_GET['id'] != "") {
4
- $location = dbem_get_location($_GET['id']);
5
- echo '{"id":"'.$location['location_id'].'" , "name" : "'.$location['location_name'].'","town" : "'.$location['location_town'].'","address" : "'.$location['location_address'].'" }';
6
-
7
- } else {
8
-
9
- $locations = dbem_get_locations();
10
- $return = array();
11
-
12
- foreach($locations as $item) {
13
- $record = array();
14
- $record['id'] = $item['location_id'];
15
- $record['name'] = $item['location_name'];
16
- $record['address'] = $item['location_address'];
17
- $record['town'] = $item['location_town'];
18
- $return[] = $record;
19
- }
20
-
21
- $q = strtolower($_GET["q"]);
22
- if (!$q) return;
23
-
24
- foreach($return as $row) {
25
-
26
- if (strpos(strtolower($row['name']), $q) !== false) {
27
- $location = array();
28
- $rows =array();
29
- foreach($row as $key => $value)
30
- $location[] = "'$key' : '".str_replace("'", "\'", $value)."'";
31
- echo ("{".implode(" , ", $location)." }\n");
32
- }
33
-
34
- }
35
-
36
- }
37
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
locations.php ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Currently these are template tags that refer to the main objects.
4
+ * Please replace calls to these with direct object methods when possible.
5
+ * These will be phased out unless they are specifically template tags for public use.
6
+ */
7
+
8
+ function dbem_get_locations($eventful = false) {
9
+ return EM_Locations::get($eventful, false);
10
+ }
11
+
12
+ function dbem_get_location($location_id) {
13
+ $EM_Location = new EM_Location($location_id);
14
+ return $EM_Location->to_array();
15
+ }
16
+
17
+ /**
18
+ * Find a location with same name, address and town as supplied array
19
+ * @param $location
20
+ * @return array
21
+ */
22
+ function dbem_get_identical_location($location) {
23
+ $EM_Location = new EM_Location($location);
24
+ return $EM_Location->load_similar();
25
+ }
26
+
27
+ function dbem_validate_location($location) {
28
+ $EM_Location = new EM_Location($location);
29
+ if ( $EM_Location->validate() ){
30
+ return "OK";
31
+ }else{
32
+ return '<strong>'.__('Ach, some problems here:', 'dbem').'</strong><br /><br />'."\n".implode('<br />', $EM_Location->errors);
33
+ }
34
+ }
35
+
36
+ function dbem_update_location($location) {
37
+ $EM_Location = new EM_Location($location);
38
+ $EM_Location->update();
39
+ }
40
+
41
+ function dbem_insert_location($location) {
42
+ $EM_Location = new EM_Location($location);
43
+ $EM_Location->insert();
44
+ return $EM_Location->to_array();
45
+ }
46
+
47
+ function dbem_delete_location($location) {
48
+ $EM_Location = new EM_Location($location);
49
+ $EM_Location->delete();
50
+ }
51
+
52
+ function dbem_location_has_events($location_id) {
53
+ $EM_Location = new EM_Location($location_id);
54
+ return $EM_Location->has_events();
55
+ }
56
+
57
+ function dbem_upload_location_picture($location) {
58
+ $EM_Location = new EM_Location($location);
59
+ $EM_Location->image_upload();
60
+ }
61
+
62
+ function dbem_delete_image_files_for_location_id($location_id) {
63
+ $EM_Location = new EM_Location($location_id);
64
+ $EM_Location->image_delete();
65
+ }
66
+
67
+ function dbem_replace_locations_placeholders($format, $location, $target="html") {
68
+ $EM_Location = new EM_Location($location);
69
+ return $EM_Location->output($format, $target);
70
+ }
71
+
72
+ /*
73
+ Deleted these functions due to not being used (and unecessary):
74
+ function dbem_cache_location($event){}
75
+ function dbem_get_location_by_name($name) {}
76
+ function dbem_insert_location_from_event($event) {}
77
+ */
marcus-extras.php DELETED
@@ -1,388 +0,0 @@
1
- <?php
2
- define('DBEM_CATEGORIES_TBNAME', 'dbem_categories');
3
-
4
- //Add the categories table
5
- function dbem_create_categories_table() {
6
-
7
- global $wpdb, $user_level;
8
- $table_name = $wpdb->prefix.DBEM_CATEGORIES_TBNAME;
9
-
10
- if($wpdb->get_var("SHOW TABLES LIKE '$table_name'") != $table_name) {
11
- // Creating the events table
12
- $sql = "CREATE TABLE ".$table_name." (
13
- category_id int(11) NOT NULL auto_increment,
14
- category_name tinytext NOT NULL,
15
- PRIMARY KEY (category_id)
16
- );";
17
- require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
18
- dbDelta($sql);
19
- }
20
- }
21
-
22
- // Create the Manage Events and the Options submenus
23
- add_action('admin_menu','dbem_add_to_events_submenu', 100);
24
- function dbem_add_to_events_submenu () {
25
- if(function_exists('add_submenu_page')) {
26
- $file = dirname(__FILE__).DIRECTORY_SEPARATOR."events-manager.php";
27
- $plugin_page = add_submenu_page($file, __('Event Categories','dbem'),__('Categories','dbem'), SETTING_CAPABILITY, "events-manager-categories", 'dbem_categories_subpanel');
28
- add_action( 'admin_head-'. $plugin_page, 'dbem_admin_general_script' );
29
- }
30
- }
31
-
32
-
33
- function dbem_duplicate_event($event_ID) {
34
- global $wpdb, $EZSQL_ERROR;
35
- //First, duplicate.
36
- $event_table_name = $wpdb->prefix . EVENTS_TBNAME;
37
- $eventArray = $wpdb->get_row("SELECT * FROM {$event_table_name} WHERE event_id={$event_ID}", ARRAY_A );
38
- unset($eventArray['event_id']);
39
- $result = $wpdb->insert($event_table_name, $eventArray);
40
- if($result !== false){
41
- //Get the ID of the new item
42
- $event_ID = $wpdb->insert_id;
43
- $event = dbem_get_event ( $event_ID );
44
- $event['event_id'] = $event_ID;
45
- //Now we edit the duplicated item
46
- $title = __ ( "Edit Event", 'dbem' ) . " '" . $event ['event_name'] . "'";
47
- echo "<div id='message' class='updated below-h2'>You are now editing the duplicated event.</div>";
48
- dbem_event_form ( $event, $title, $event_ID );
49
- }else{
50
- echo "<div class='error'><p>There was an error duplicating the event. Try again maybe? Here are the errors:</p>";
51
- foreach($EZSQL_ERROR as $errorArray){
52
- echo "<p>{$errorArray['error_str']}</p>";
53
- }
54
- echo "</div>";
55
- $scope = $_GET ['scope'];
56
- $offset = $_GET ['offset'];
57
- $order = $_GET ['order'];
58
- $limit = 20;
59
- $events = dbem_get_events ( $limit, $scope, $order, $offset );
60
- dbem_events_table ( $events, $limit, $title );
61
- }
62
- }
63
-
64
- function dbem_categories_subpanel() {
65
- global $wpdb;
66
-
67
- if(isset($_GET['action']) && $_GET['action'] == "edit") {
68
- // edit category
69
- dbem_categories_edit_layout();
70
- } else {
71
- // Insert/Update/Delete Record
72
- $categories_table = $wpdb->prefix.DBEM_CATEGORIES_TBNAME;
73
- if( isset($_POST['action']) && $_POST['action'] == "edit" ) {
74
- // category update required
75
- $category = array();
76
- $category['category_name'] = $_POST['category_name'];
77
- $validation_result = $wpdb->update( $categories_table, $category, array('category_id' => $_POST['category_ID']) );
78
- } elseif( isset($_POST['action']) && $_POST['action'] == "add" ) {
79
- // Add a new category
80
- $category = array();
81
- $category['category_name'] = $_POST['category_name'];
82
- $validation_result = $wpdb->insert($categories_table, $category);
83
- } elseif( isset($_POST['action']) && $_POST['action'] == "delete" ) {
84
- // Delete category or multiple
85
- $categories = $_POST['categories'];
86
- if(is_array($categories)){
87
- //Make sure the array is only numbers
88
- foreach ($categories as $cat_id){
89
- if(is_numeric($cat_id)){
90
- $cats[] = "category_id = $cat_id";
91
- }
92
- }
93
- //Run the query if we have an array of category ids
94
- if(count($cats > 0)){
95
- $validation_result = $wpdb->query( "DELETE FROM $categories_table WHERE ". implode(" OR ", $cats) );
96
- }else{
97
- $validation_result = false;
98
- $message = "Couldn't delete the categories. Incorrect category IDs supplied. Please try agian.";
99
- }
100
- }
101
- }
102
- //die(print_r($_POST));
103
- if ( is_numeric($validation_result) ) {
104
- $message = (isset($message)) ? $message : __("Successfully {$_POST['action']}ed category", "dbem");
105
- dbem_categories_table_layout($message);
106
- } elseif ( $validation_result === false ) {
107
- $message = (isset($message)) ? $message : __("There was a problem {$_POST['action']}ing your category, please try again.");
108
- dbem_categories_table_layout($message);
109
- } else {
110
- // no action, just a categories list
111
- dbem_categories_table_layout();
112
- }
113
- }
114
- }
115
-
116
- function dbem_categories_table_layout($message = "") {
117
- $categories = dbem_get_categories();
118
- $destination = get_bloginfo('url')."/wp-admin/admin.php";
119
- $table = "
120
- <div class='wrap nosubsub'>\n
121
- <div id='icon-edit' class='icon32'>
122
- <br/>
123
- </div>
124
- <h2>".__('Categories', 'dbem')."</h2>\n ";
125
-
126
- if($message != "") {
127
- $table .= "
128
- <div id='message' class='updated fade below-h2' style='background-color: rgb(255, 251, 204);'>
129
- <p>$message</p>
130
- </div>";
131
- }
132
-
133
- $table .= "
134
- <div id='col-container'>\n
135
-
136
- <?-- begin col-right -->\n
137
- <div id='col-right'>\n
138
- <div class='col-wrap'>\n
139
- <form id='bookings-filter' method='post' action='".get_bloginfo('wpurl')."/wp-admin/admin.php?page=events-manager-categories'>\n
140
- <input type='hidden' name='action' value='delete'/>\n";
141
-
142
- if (count($categories)>0) {
143
- $table .= "<table class='widefat'>\n
144
- <thead>\n
145
- <tr>\n
146
- <th class='manage-column column-cb check-column' scope='col'><input type='checkbox' class='select-all' value='1'/></th>\n
147
- <th>".__('ID', 'dbem')."</th>\n
148
- <th>".__('Name', 'dbem')."</th>\n
149
- </tr>\n
150
- </thead>\n
151
- <tfoot>\n
152
- <tr>\n
153
- <th class='manage-column column-cb check-column' scope='col'><input type='checkbox' class='select-all' value='1'/></th>\n
154
- <th>".__('ID', 'dbem')."</th>\n
155
- <th>".__('Name', 'dbem')."</th>\n
156
- </tr>\n
157
- </tfoot>\n
158
- <tbody>\n";
159
- foreach ($categories as $this_category) {
160
- $table .= "
161
- <tr>\n
162
- <td><input type='checkbox' class ='row-selector' value='".$this_category['category_id']."' name='categories[]'/></td>\n
163
- <td><a href='".get_bloginfo('wpurl')."/wp-admin/admin.php?page=events-manager-categories&amp;action=edit&amp;category_ID=".$this_category['category_id']."'>".$this_category['category_id']."</a></td>\n
164
- <td><a href='".get_bloginfo('wpurl')."/wp-admin/admin.php?page=events-manager-categories&amp;action=edit&amp;category_ID=".$this_category['category_id']."'>".$this_category['category_name']."</a></td>\n
165
- </tr>\n
166
- ";
167
- }
168
- $table .= "
169
- </tbody>\n
170
-
171
- </table>\n
172
-
173
- <div class='tablenav'>\n
174
- <div class='alignleft actions'>\n
175
- <input class='button-secondary action' type='submit' name='doaction2' value='Delete'/>\n
176
- <br class='clear'/>\n
177
- </div>\n
178
- <br class='clear'/>\n
179
- </div>\n";
180
- } else {
181
- $table .= "<p>".__('No categories have been inserted yet!', 'dbem');
182
- }
183
- $table .= "
184
- </form>\n
185
- </div>\n
186
- </div>
187
- <?-- end col-right -->\n
188
-
189
- <?-- begin col-left -->
190
- <div id='col-left'>\n
191
- <div class='col-wrap'>\n
192
- <div class='form-wrap'>\n
193
- <div id='ajax-response'/>
194
- <h3>".__('Add category', 'dbem')."</h3>\n
195
- <form name='add' id='add' method='post' action='admin.php?page=events-manager-categories' class='add:the-list: validate'>\n
196
- <input type='hidden' name='action' value='add' />\n
197
- <div class='form-field form-required'>\n
198
- <label for='category_name'>".__('Category name', 'dbem')."</label>\n
199
- <input id='category-name' name='category_name' id='category_name' type='text' value='".$new_category['category_name']."' size='40' />\n
200
- <p>".__('The name of the category', 'dbem').".</p>\n
201
- </div>\n
202
- <p class='submit'><input type='submit' class='button' name='submit' value='".__('Add category', 'dbem')."' /></p>\n
203
- </form>\n
204
-
205
- </div>\n
206
- </div>\n
207
- </div>
208
- <?-- end col-left -->\n
209
- </div>\n
210
- </div>\n";
211
-
212
- echo $table;
213
- }
214
-
215
-
216
- function dbem_categories_edit_layout($message = "") {
217
- $category_id = $_GET['category_ID'];
218
- $category = dbem_get_category($category_id);
219
- $layout = "
220
- <div class='wrap'>
221
- <div id='icon-edit' class='icon32'>
222
- <br/>
223
- </div>
224
-
225
- <h2>".__('Edit category', 'dbem')."</h2>";
226
-
227
- if($message != "") {
228
- $layout .= "
229
- <div id='message' class='updated fade below-h2' style='background-color: rgb(255, 251, 204);'>
230
- <p>$message</p>
231
- </div>";
232
- }
233
- $layout .= "
234
- <div id='ajax-response'></div>
235
-
236
- <form name='editcat' id='editcat' method='post' action='admin.php?page=events-manager-categories' class='validate'>
237
- <input type='hidden' name='action' value='edit' />
238
- <input type='hidden' name='category_ID' value='".$category['category_id']."'/>";
239
-
240
- $layout .= "
241
- <table class='form-table'>
242
- <tr class='form-field form-required'>
243
- <th scope='row' valign='top'><label for='category_name'>".__('Category name', 'dbem')."</label></th>
244
- <td><input name='category_name' id='category-name' type='text' value='".$category['category_name']."' size='40' /><br />
245
- ".__('The name of the category', 'dbem')."</td>
246
- </tr>
247
- </table>
248
- <p class='submit'><input type='submit' class='button-primary' name='submit' value='".__('Update category', 'dbem')."' /></p>
249
- </form>
250
-
251
-
252
- </div>
253
-
254
- ";
255
- echo $layout;
256
- }
257
-
258
- function dbem_get_categories(){
259
- global $wpdb;
260
- $categories_table = $wpdb->prefix.DBEM_CATEGORIES_TBNAME;
261
- return $wpdb->get_results("SELECT * FROM $categories_table", ARRAY_A);
262
- }
263
-
264
- function dbem_get_category($category_id) {
265
- global $wpdb;
266
- $categories_table = $wpdb->prefix.DBEM_CATEGORIES_TBNAME;
267
- $sql = "SELECT * FROM $categories_table WHERE category_id ='$category_id'";
268
- $category = $wpdb->get_row($sql, ARRAY_A);
269
- return $category;
270
- }
271
-
272
- function dbem_get_event_category($event_id) {
273
- global $wpdb;
274
- $event_table = $wpdb->prefix.EVENTS_TBNAME;
275
- $sql = "SELECT category_id, category_name FROM $event_table LEFT JOIN ".$wpdb->prefix.DBEM_CATEGORIES_TBNAME." ON category_id=event_category_id WHERE event_id ='$event_id'";
276
- $category = $wpdb->get_row($sql, ARRAY_A);
277
- return $category;
278
- }
279
-
280
- function dbem_attributes_form($event) {
281
- $dbem_data = $event['event_attributes'];
282
- //We also get a list of attribute names and create a ddm list (since placeholders are fixed)
283
- $formats =
284
- get_option ( 'dbem_event_list_item_format' ).
285
- get_option ( 'dbem_event_page_title_format' ).
286
- get_option ( 'dbem_full_calendar_event_format' ).
287
- get_option ( 'dbem_location_baloon_format' ).
288
- get_option ( 'dbem_location_event_list_item_format' ).
289
- get_option ( 'dbem_location_page_title_format' ).
290
- get_option ( 'dbem_map_text_format' ).
291
- get_option ( 'dbem_rss_description_format' ).
292
- get_option ( 'dbem_rss_title_format' ).
293
- get_option ( 'dbem_single_event_format' ).
294
- get_option ( 'dbem_single_location_format' );
295
- //We now have one long string of formats
296
- preg_match_all("/#_ATT\{.+?\}(\{.+?\})?/", $formats, $placeholders);
297
- $attributes = array();
298
- //Now grab all the unique attributes we can use in our event.
299
- foreach($placeholders[0] as $result) {
300
- $attribute = substr( substr($result, 0, strpos($result, '}')), 6 );
301
- if( !in_array($attribute, $attributes) ){
302
- $attributes[] = $attribute ;
303
- }
304
- }
305
- ?>
306
- <div class="wrap">
307
- <h2>Attributes</h2>
308
- <p>Add attributes here</p>
309
- <table class="form-table">
310
- <thead>
311
- <tr valign="top">
312
- <td><strong>Attribute Name</strong></td>
313
- <td><strong>Value</strong></td>
314
- </tr>
315
- </thead>
316
- <tfoot>
317
- <tr valign="top">
318
- <td colspan="3"><a href="#" id="mtm_add_tag">Add new tag</a></td>
319
- </tr>
320
- </tfoot>
321
- <tbody id="mtm_body">
322
- <?php
323
- $count = 1;
324
- if( is_array($dbem_data) and count($dbem_data) > 0){
325
- foreach( $dbem_data as $name => $value){
326
- ?>
327
- <tr valign="top" id="mtm_<?php echo $count ?>">
328
- <td scope="row">
329
- <select name="mtm_<?php echo $count ?>_ref">
330
- <?php
331
- if( !in_array($name, $attributes) ){
332
- echo "<option value='$name'>$name (".__('Not defined in templates', 'dbem').")</option>";
333
- }
334
- foreach( $attributes as $attribute ){
335
- if( $attribute == $name ) {
336
- echo "<option selected='selected'>$attribute</option>";
337
- }else{
338
- echo "<option>$attribute</option>";
339
- }
340
- }
341
- ?>
342
- </select>
343
- <a href="#" rel="<?php echo $count ?>">Remove</a>
344
- </td>
345
- <td>
346
- <input type="text" name="mtm_<?php echo $count ?>_name" value="<?php echo $value ?>" />
347
- </td>
348
- </tr>
349
- <?php
350
- $count++;
351
- }
352
- }else{
353
- if( count( $attributes ) > 0 ){
354
- ?>
355
- <tr valign="top" id="mtm_<?php echo $count ?>">
356
- <td scope="row">
357
- <select name="mtm_<?php echo $count ?>_ref">
358
- <?php
359
- foreach( $attributes as $attribute ){
360
- echo "<option>$attribute</option>";
361
- }
362
- ?>
363
- </select>
364
- <a href="#" rel="<?php echo $count ?>">Remove</a>
365
- </td>
366
- <td>
367
- <input type="text" name="mtm_<?php echo $count ?>_name" value="<?php echo $value ?>" />
368
- </td>
369
- </tr>
370
- <?php
371
- }else{
372
- ?>
373
- <tr valign="top">
374
- <td scope="row" colspan='2'>
375
- <?php _e('In order to use attributes, you must define some in your templates, otherwise they\'ll never show. Go to Events > Settings to add attribute placeholders.', 'dbem'); ?>
376
- </td>
377
- </tr>
378
- <?php
379
-
380
- }
381
- }
382
- ?>
383
- </tbody>
384
- </table>
385
- </div>
386
- <?php
387
- }
388
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
phpmailer/dbem_phpmailer.php DELETED
@@ -1,47 +0,0 @@
1
- <?php
2
- // phpmailer support
3
- function dbem_send_mail($subject="no title",$body="No message specified", $receiver='') {
4
-
5
- global $smtpsettings, $phpmailer, $cformsSettings;
6
-
7
- if ( file_exists(dirname(__FILE__) . '/class.phpmailer.php') && !class_exists('PHPMailer') ) {
8
- require_once(dirname(__FILE__) . '/class.phpmailer.php');
9
- require_once(dirname(__FILE__) . '/class.smtp.php');
10
- }
11
-
12
-
13
-
14
- $mail = new PHPMailer();
15
- $mail->ClearAllRecipients();
16
- $mail->ClearAddresses();
17
- $mail->ClearAttachments();
18
- $mail->CharSet = 'utf-8';
19
- $mail->SetLanguage('en', dirname(__FILE__).'/');
20
-
21
- $mail->PluginDir = dirname(__FILE__).'/';
22
- get_option('dbem_rsvp_mail_send_method') == 'qmail' ?
23
- $mail->IsQmail() :
24
- $mail->Mailer = get_option('dbem_rsvp_mail_send_method');
25
- $mail->Host = get_option('dbem_smtp_host');
26
- $mail->port = get_option('dbem_rsvp_mail_port');
27
- if(get_option('dbem_rsvp_mail_SMTPAuth') == '1')
28
- $mail->SMTPAuth = TRUE;
29
- $mail->Username = get_option('dbem_smtp_username');
30
- $mail->Password = get_option('dbem_smtp_password');
31
- $mail->From = get_option('dbem_mail_sender_address');
32
- //$mail->SMTPDebug = true;
33
-
34
- $mail->FromName = get_option('dbem_mail_sender_name'); // This is the from name in the email, you can put anything you like here
35
- $mail->Body = $body;
36
- $mail->Subject = $subject;
37
- $mail->AddAddress($receiver);
38
-
39
- if(!$mail->Send()){
40
- echo "Message was not sent<br/ >";
41
- echo "Mailer Error: " . $mail->ErrorInfo;
42
- // print_r($mailer);
43
- } else {
44
- // echo "Message has been sent";
45
- }
46
- }
47
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
readme.txt CHANGED
@@ -1,18 +1,18 @@
1
  === Events Manager ===
2
  Contributors: nutsmuggler, netweblogic
3
  Donate link: http://davidebenini.it
4
- Tags: events, manager, calendar, gigs, concert, maps, geotagging
5
  Requires at least: 2.7
6
- Tested up to: 2.9.2
7
- Stable tag: 2.2.2
8
 
9
  Manage events and display them in your blog. Includes recurring events, location management, calendar, Google map integration, RSVP.
10
 
11
  == Description ==
12
 
13
- Events Manager 2.0 is a full-featured event management solution for Wordpress. Events Manager supports recurring events, venues data, RSVP and maps. With Events Manager you can plan and publish your tour, or let people reserve spaces for your weekly meetings. You can then add events list, calendars and description to your blog using a sidebar widget or shortcodes; if you’re web designer you can simply employ the template tags provided by Events Manager.
14
 
15
- Events Manager integrates with Google Maps; thanks the geocoding, Events Manager can find the location of your events, and accordingly display a map. To enable Google Maps integration, you need a Google maps API key, which you can obtain freely at the [Google Maps API Signup Page](http://code.google.com/apis/maps/signup.html).
16
 
17
  Events Manager provides also a RSS feed, to keep your subscribers updated about the events you're organising.
18
 
@@ -24,19 +24,23 @@ For more information visit the [Documentation Page](http://davidebenini.it/wordp
24
 
25
  == Installation ==
26
 
27
- 1. Upload the `events-manager` folder to the `/wp-content/plugins/` directory
28
- 2. Activate the plugin through the 'Plugins' menu in WordPress
29
- 3. Add events list or calendars following the instructions in the Usage section.
 
 
 
 
 
30
 
31
  Events Manager 1.* adopters should:
32
 
33
  1. backup the Wordpress database.
34
  2. deactivate Events Manager 1.*
35
  3. delete Events Managers 1.* and upload Events Manager 2.* to the server
36
- 4. activate Events Manager 2.*
37
-
38
- Events Manager should take care of your events database migration automatically, but since this is a beta release it's much better to perform a database backup, as previously suggested.
39
-
40
  == Usage ==
41
 
42
  After the installation, Events Manager add a top level "Events" menu to your Wordpress Administration.
@@ -47,14 +51,15 @@ After the installation, Events Manager add a top level "Events" menu to your Wor
47
  * The *Locations* page lets you add, delete and edit locations directly. Locations are automatically added with events if not present, but this interface lets you customise your locations data and add a picture.
48
  * The *People* page serves as a gathering point for the information about the people who reserved a space in your events.
49
  * The *Settings* page allows a fine-grained control over the plugin. Here you can set the [format](#formatting-events) of events in the Events page.
 
50
 
51
  Events list and calendars can be added to your blogs through widgets, shortcodes and template tags. See the full documentation at the [Events Manager Support Page](http://davidebenini.it/wordpress-plugins/events-manager/).
52
 
53
  == Frequently Asked Questions ==
54
 
55
- = I enabled the Google Maps integration, but instead of the map there is a green background. What should I do? =
56
 
57
- I call that "the green screen of death", but it's quite easy to fix your issue. If you see that green background, your theme has a little problem that should be fixed. Open the `header.php` page of your theme; if your theme hasn't any `header.php` page, just open the `index.php page` and/or any page containing the `<head>` section of the html code. Make sure that the page contains a line like this:
58
 
59
  <?php wp_head(); ?>
60
 
@@ -217,4 +222,14 @@ Closed a critical security hole discovered by Danilo Massa (to be released on Ma
217
  newtweblogic fixed a bug in the install routine
218
 
219
  2.2.2
220
- small fix that stopped custom fields from showing up in events lists.
 
 
 
 
 
 
 
 
 
 
1
  === Events Manager ===
2
  Contributors: nutsmuggler, netweblogic
3
  Donate link: http://davidebenini.it
4
+ Tags: events, manager, calendar, gigs, concert, maps, geotagging, rsvp
5
  Requires at least: 2.7
6
+ Tested up to: 3.0.1
7
+ Stable tag: 3.0
8
 
9
  Manage events and display them in your blog. Includes recurring events, location management, calendar, Google map integration, RSVP.
10
 
11
  == Description ==
12
 
13
+ Events Manager 3.0 is a full-featured event management solution for Wordpress. Events Manager supports recurring events, venues data, RSVP and maps. With Events Manager you can plan and publish your tour, or let people reserve spaces for your weekly meetings. You can then add events list, calendars and description to your blog using a sidebar widget or shortcodes; if you’re web designer you can simply employ the template tags provided by Events Manager.
14
 
15
+ Events Manager integrates with Google Maps; thanks the geocoding, Events Manager can find the location of your events, and accordingly display a map. Now there's no need for Google Maps API keys, as we are now using their new v3 API.
16
 
17
  Events Manager provides also a RSS feed, to keep your subscribers updated about the events you're organising.
18
 
24
 
25
  == Installation ==
26
 
27
+ = Installing or Upgrading from 2.x =
28
+
29
+ 1. Back up your database if upgrading is recommended, as with any plugin or wordpress upgrade.
30
+ 2. Upload the `events-manager` folder to the `/wp-content/plugins/` directory
31
+ 3. Activate the plugin through the 'Plugins' menu in WordPress
32
+ 4. Add events list or calendars following the instructions in the Usage section.
33
+
34
+ = Upgrading from 1.* only =
35
 
36
  Events Manager 1.* adopters should:
37
 
38
  1. backup the Wordpress database.
39
  2. deactivate Events Manager 1.*
40
  3. delete Events Managers 1.* and upload Events Manager 2.* to the server
41
+ 4. activate Events Manager 2.*
42
+ 5. Download and activate Events Manager 3.*
43
+
 
44
  == Usage ==
45
 
46
  After the installation, Events Manager add a top level "Events" menu to your Wordpress Administration.
51
  * The *Locations* page lets you add, delete and edit locations directly. Locations are automatically added with events if not present, but this interface lets you customise your locations data and add a picture.
52
  * The *People* page serves as a gathering point for the information about the people who reserved a space in your events.
53
  * The *Settings* page allows a fine-grained control over the plugin. Here you can set the [format](#formatting-events) of events in the Events page.
54
+ * The *Help* page will provide you with information on troubleshooting and where to ask for support.
55
 
56
  Events list and calendars can be added to your blogs through widgets, shortcodes and template tags. See the full documentation at the [Events Manager Support Page](http://davidebenini.it/wordpress-plugins/events-manager/).
57
 
58
  == Frequently Asked Questions ==
59
 
60
+ = I enabled the Google Maps integration, but instead of the map there is a green/gray background. What should I do? =
61
 
62
+ If your event pages aren't loading maps properly, it may be that your theme is not set up correctly. Open the `header.php` page of your theme; if your theme hasn't any `header.php` page, just open the `index.php page` and/or any page containing the `<head>` section of the html code. Make sure that the page contains a line like this:
63
 
64
  <?php wp_head(); ?>
65
 
222
  newtweblogic fixed a bug in the install routine
223
 
224
  2.2.2
225
+ Small fix that stopped custom fields from showing up in events lists.
226
+
227
+ 3.0
228
+ Refactored all the underlying achitecture, to make it object oriented. Now classes and templates are separate.
229
+ Merged the events and recurrences tables
230
+ Tables migration from dbem to em (to provide a fallback in case the previous merge goes wrong)
231
+ Bugfix: 127 limit increased (got rid of tinyint types)
232
+ Bugfix: fixed all major php bugs preventing the use with Wordpress 3.0
233
+ Bugfix: fixed all major js bugs preventing the use with Wordpress 3.0
234
+ Restyling of the Settings page
235
+ Added a setting to revert to 2.2
rss.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ function dbem_rss() {
3
+ if (isset ( $_REQUEST ['dbem_rss'] ) && $_REQUEST ['dbem_rss'] == 'main') {
4
+ header ( "Content-type: text/xml" );
5
+ echo "<?xml version='1.0'?>\n";
6
+
7
+ $events_page_id = get_option ( 'dbem_events_page' );
8
+ $events_page_link = get_permalink ( $events_page_id );
9
+ if (stristr ( $events_page_link, "?" ))
10
+ $joiner = "&amp;";
11
+ else
12
+ $joiner = "?";
13
+
14
+ ?>
15
+ <rss version="2.0">
16
+ <channel>
17
+ <title><?php
18
+ echo get_option ( 'dbem_rss_main_title' );
19
+ ?></title>
20
+ <link><?php
21
+ echo $events_page_link;
22
+ ?></link>
23
+ <description><?php
24
+ echo get_option ( 'dbem_rss_main_description' );
25
+ ?></description>
26
+ <docs>
27
+ http://blogs.law.harvard.edu/tech/rss
28
+ </docs>
29
+ <generator>
30
+ Weblog Editor 2.0
31
+ </generator>
32
+ <?php
33
+ $title_format = get_option ( 'dbem_rss_title_format' );
34
+ $description_format = str_replace ( ">", "&gt;", str_replace ( "<", "&lt;", get_option ( 'dbem_rss_description_format' ) ) );
35
+ $events = EM_Events::get( array('limit'=>5) );
36
+ foreach ( $events as $event ) {
37
+ $title = $event->output( $title_format, "rss" );
38
+ $description = $event->output( $description_format, "rss");
39
+ echo "<item>";
40
+ echo "<title>$title</title>\n";
41
+ echo "<link>$events_page_link" . $joiner . "event_id=" . $event->id . "</link>\n ";
42
+ echo "<description>$description </description>\n";
43
+ echo "</item>";
44
+ }
45
+ ?>
46
+ </channel>
47
+ </rss>
48
+
49
+ <?php
50
+ die ();
51
+ }
52
+ }
53
+ add_action ( 'init', 'dbem_rss' );
54
+ ?>
shortcode.php ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ //TODO add a shortcode to link for a specific event, e.g. [event id=x]text[/event]
3
+
4
+ /**
5
+ * Returns the html of an events calendar.
6
+ * @param array $atts
7
+ * @return string
8
+ */
9
+ function em_get_calendar_shortcode($atts) {
10
+ $atts = shortcode_atts(array( 'full' => 0, 'month' => '', 'year' => '', 'long_events' => 0 ), $atts);
11
+ $return = '<div id="em-calendar-'.rand(100,200).'" class="em-calendar-wrapper">';
12
+ $return .= EM_Calendar::get($atts);
13
+ $return .= '</div>';
14
+ return $return;
15
+ }
16
+ add_shortcode('events_calendar', 'em_get_calendar_shortcode');
17
+
18
+ function em_get_locations_map_shortcode( $atts ){
19
+ $atts = shortcode_atts( array('eventful' => 0, 'scope' => 'all', 'width' => 450, 'height' => 300), $atts );
20
+ return EM_Map::get_global($atts);
21
+ }
22
+ add_shortcode('locations_map', 'em_get_locations_map_shortcode');
23
+ add_shortcode('locations-map', 'em_get_locations_map_shortcode'); //Depreciate this... confusing for wordpress
24
+
25
+ /**
26
+ * Shows a list of events according to given specifications
27
+ * @param array $atts
28
+ * @return string
29
+ */
30
+ function em_get_events_list_shortcode($atts) {
31
+ //TODO sort out attributes so it's consistent everywhere
32
+ $atts = shortcode_atts ( array ('limit' => 3, 'scope' => 'future', 'order' => 'ASC', 'format' => '', 'category' => '', 'location'=>'' ), $atts );
33
+ $result = EM_Events::output ( $atts );
34
+ return $result;
35
+ }
36
+ add_shortcode ( 'events_list', 'em_get_events_list_shortcode' );
37
+
38
+ /**
39
+ * DO NOT DOCUMENT! This should be replaced with shortcodes events-link and events_uri
40
+ * @param array $atts
41
+ * @return string
42
+ */
43
+ function em_get_events_page_shortcode($atts) {
44
+ $atts = shortcode_atts ( array ('justurl' => 0, 'text' => '' ), $atts );
45
+ if($atts['justurl']){
46
+ return EM_URI;
47
+ }else{
48
+ return em_get_link($atts['text']);
49
+ }
50
+ }
51
+ add_shortcode ( 'events_page', 'em_get_events_page_shortcode' );
52
+
53
+ /**
54
+ * Shortcode for a link to events page. Default will show events page title in link text, if you use [events_link]text[/events_link] 'text' will be the link text
55
+ * @param array $atts
56
+ * @param string $text
57
+ * @return string
58
+ */
59
+ function em_get_link_shortcode($atts, $text='') {
60
+ return em_get_link($text);
61
+ }
62
+ add_shortcode ( 'events_link', 'em_get_link_shortcode');
63
+
64
+ /**
65
+ * Returns the uri of the events page only
66
+ * @return string
67
+ */
68
+ function em_get_uri_shortcode(){
69
+ return EM_URI;
70
+ }
71
+ add_shortcode ( 'events_uri', 'em_get_uri_shortcode');
72
+
73
+ /**
74
+ * CHANGE DOCUMENTATION! if you just want the url you should use shortcode events_rss_uri
75
+ * @param array $atts
76
+ * @return string
77
+ */
78
+ function em_get_rss_link_shortcode($atts) {
79
+ $atts = shortcode_atts ( array ('justurl' => 0, 'text' => 'RSS' ), $atts );
80
+ if($atts['justurl']){
81
+ return EM_RSS_URI;
82
+ }else{
83
+ return em_get_rss_link($atts['text']);
84
+ }
85
+ }
86
+ add_shortcode ( 'events_rss_link', 'em_get_rss_link_shortcode' );
87
+
88
+ /**
89
+ * Returns the uri of the events rss page only, takes no attributes.
90
+ * @return string
91
+ */
92
+ function em_get_rss_uri_shortcode(){
93
+ return EM_RSS_URI;
94
+ }
95
+ add_shortcode ( 'events_rss_uri', 'em_get_rss_uri_shortcode');
template-tags-depreciated.php ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Template Tags
4
+ * These template tags were used up until EM 2.2 they have been modified to use the new OOP structure
5
+ * of EM, but still provide the same values as before for backward compatability.
6
+ * If you'd like to port over to the new template functions, check out the tag you want and see how we did it (or view the new docs)
7
+ */
8
+
9
+ /**
10
+ * TOTALLY DEPRECIATED (NOT ALTERNATIVE TAG) - Just use EM_Events::output, see below
11
+ * @param unknown_type $limit
12
+ * @param unknown_type $scope
13
+ * @param unknown_type $order
14
+ * @param unknown_type $format
15
+ * @param unknown_type $echo
16
+ * @param unknown_type $category
17
+ * @return unknown_type
18
+ */
19
+ function dbem_get_events_list($limit = "10", $scope = "future", $order = "ASC", $format = '', $echo = 1, $category = '') {
20
+ if (strpos ( $limit, "=" )) {
21
+ // allows the use of arguments without breaking the legacy code
22
+ $defaults = array ('limit' => 10, 'scope' => 'future', 'order' => 'ASC', 'format' => '', 'echo' => 1 , 'category' => '');
23
+
24
+ $r = wp_parse_args ( $limit, $defaults );
25
+ extract ( $r, EXTR_SKIP );
26
+ $limit = $r ['limit'];
27
+ $scope = $r ['scope'];
28
+ $order = $r ['order'];
29
+ $format = $r ['format'];
30
+ $echo = $r ['echo'];
31
+ $category = ( preg_match('/^([0-9],?)+$/', $r ['category'] ) ) ? $r ['category'] : '' ;
32
+ }
33
+ $return = EM_Events::output(array('limit'=>$limit, 'scope'=>$scope, 'order'=>$order, 'category'=>$category));
34
+ if( $echo ) echo $return;
35
+ return $return;
36
+ }
37
+
38
+ /**
39
+ * Use constant EM_URI for url and em_get_link($text) for html link
40
+ * @param unknown_type $justurl
41
+ * @param unknown_type $echo
42
+ * @param unknown_type $text
43
+ * @return string
44
+ */
45
+ function dbem_get_events_page($justurl = 0, $echo = 1, $text = '') {
46
+ if (strpos ( $justurl, "=" )) {
47
+ // allows the use of arguments without breaking the legacy code
48
+ $defaults = array ('justurl' => 0, 'text' => '', 'echo' => 1 );
49
+
50
+ $r = wp_parse_args ( $justurl, $defaults );
51
+ extract ( $r, EXTR_SKIP );
52
+ $justurl = $r ['justurl'];
53
+ $text = $r ['text'];
54
+ $echo = $r ['echo'];
55
+ }
56
+
57
+ $page_link = get_permalink ( get_option ( "dbem_events_page" ) );
58
+ if ($justurl) {
59
+ $result = $page_link;
60
+ } else {
61
+ if ($text == '')
62
+ $text = get_option ( "dbem_events_page_title" );
63
+ $result = "<a href='$page_link' title='$text'>$text</a>";
64
+ }
65
+ if ($echo)
66
+ echo $result;
67
+ else
68
+ return $result;
69
+
70
+ }
71
+
72
+ /**
73
+ * TOTALLY DEPRECIATED (NOT ALTERNATIVE TAG) - use EM_Calendar::get($args); for now (this will also change though)
74
+ * @param unknown_type $args
75
+ */
76
+ function dbem_get_calendar($args=""){
77
+ $defaults = array(
78
+ 'full' => 0,
79
+ 'month' => '',
80
+ 'echo' => 1,
81
+ 'long_events' => 0
82
+ );
83
+ $args_array = wp_parse_args( $args, $defaults );
84
+ $result = EM_Calendar::get($args_array);
85
+ if ( $args_array['echo'] )
86
+ echo $result;
87
+ else
88
+ return $result;
89
+ }
90
+
91
+ /**
92
+ *
93
+ * @param unknown_type $justurl
94
+ * @param unknown_type $echo
95
+ * @param unknown_type $text
96
+ * @return string
97
+ */
98
+ function dbem_rss_link($justurl = 0, $echo = 1, $text = "RSS") {
99
+ if (strpos ( $justurl, "=" )) {
100
+ // allows the use of arguments without breaking the legacy code
101
+ $defaults = array ('justurl' => 0, 'echo' => 1, 'text' => 'RSS' );
102
+
103
+ $r = wp_parse_args ( $justurl, $defaults );
104
+ extract ( $r, EXTR_SKIP );
105
+ $justurl = $r ['justurl'];
106
+ $echo = $r ['echo'];
107
+ $text = $r ['text'];
108
+ }
109
+ if ($text == '')
110
+ $text = "RSS";
111
+ $rss_title = get_option ( 'dbem_events_page_title' );
112
+ $url = get_bloginfo ( 'wpurl' ) . "/?dbem_rss=main";
113
+ $link = "<a href='$url'>$text</a>";
114
+
115
+ if ($justurl)
116
+ $result = $url;
117
+ else
118
+ $result = $link;
119
+ if ($echo)
120
+ echo $result;
121
+ else
122
+ return $result;
123
+ }
124
+
125
+ ?>
template-tags.php ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Template Tags
4
+ * These template tags were used up until EM 2.2 they have been modified to use the new OOP structure
5
+ * of EM, but still provide the same values as before for backward compatability.
6
+ * If you'd like to port over to the new template functions, check out the tag you want and see how we did it (or view the new docs)
7
+ */
8
+
9
+ /**
10
+ * Creates an html link to the events page.
11
+ * @param string $text
12
+ * @return string
13
+ */
14
+ function em_get_link( $text = '' ) {
15
+ $text = ($text == '') ? get_option ( "dbem_events_page_title" ) : $text;
16
+ $text = ($text == '') ? __('Events','dbem') : $text; //In case options aren't there....
17
+ return "<a href='".EM_URI."' title='$text'>$text</a>";
18
+ }
19
+
20
+ /**
21
+ * Creates an html link to the RSS feed
22
+ * @param string $text
23
+ * @return string
24
+ */
25
+ function em_get_rss_link($text = "RSS") {
26
+ $text = ($text == '') ? 'RSS' : $text;
27
+ return "<a href='".EM_RSS_URI."'>$text</a>";
28
+ }
29
+
30
+ /**
31
+ * Returns true if there are any events that exist in the given scope (default is future events).
32
+ * @param string $scope
33
+ * @return boolean
34
+ */
35
+ function em_are_events_available($scope = "future") {
36
+ $scope = ($scope == "") ? "future":$scope;
37
+ $events = EM_Events::get( array('limit'=>1, 'scope'=>$scope) );
38
+ return ( count($events) > 0 );
39
+ }
40
+ function dbem_are_events_available($scope = "future"){ em_are_events_available($scope); } //no biggie, we can remove these later, to avoid extra initial work for our plugin users!
41
+
42
+
43
+ /**
44
+ * Returns true if the page is the events page. This may be a locations page, single event, multiple events, etc. so be careful!
45
+ * @return boolean
46
+ */
47
+ function em_is_events_page() {
48
+ $events_page_id = get_option ( 'dbem_events_page' );
49
+ return is_page ( $events_page_id );
50
+ }
51
+ function dbem_is_events_page(){ em_is_events_page(); }
52
+
53
+
54
+ /**
55
+ * Returns true if this is a single event
56
+ * @return boolean
57
+ */
58
+ function em_is_single_event_page() {
59
+ return (em_is_events_page () && (isset ( $_REQUEST ['event_id'] ) && $_REQUEST ['event_id'] != ''));
60
+ }
61
+ function dbem_is_single_event_page(){ em_is_single_event_page(); }
62
+
63
+
64
+ /**
65
+ * If this is a page is a multiple events page
66
+ * @return boolean
67
+ */
68
+ function em_is_multiple_events_page() {
69
+ //FIXME this will also show true if it's not a locations page
70
+ return ( em_is_events_page () && !em_is_single_event_page() );
71
+ }
72
+ function dbem_is_multiple_events_page(){ em_is_multiple_events_page(); }
73
+
74
+
75
+ /**
76
+ * Returns true if this is a single events page and the event is RSVPable
77
+ * @return boolean
78
+ */
79
+ function em_is_event_rsvpable() {
80
+ //We assume that we're on a single event (or recurring event) page here, so $EM_Event must be loaded
81
+ global $EM_Event;
82
+ return ( em_is_single_event_page() && is_numeric($EM_Event->id) && $EM_Event->rsvp );
83
+ }
84
+ function dbem_is_event_rsvpable(){ em_is_event_rsvpable(); }
85
+
86
+ ?>
widgets/calendar.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author marcus
4
+ * Standard events calendar widget
5
+ */
6
+ class EM_Widget_Calendar extends WP_Widget {
7
+ /** constructor */
8
+ function EM_Widget_Calendar() {
9
+ $widget_ops = array('description' => __( "Display your events in a calendar widget.", 'dbem') );
10
+ parent::WP_Widget(false, $name = __('Events Calendar','dbem'), $widget_ops);
11
+ }
12
+
13
+ /** @see WP_Widget::widget */
14
+ function widget($args, $instance) {
15
+ echo $args['before_widget'];
16
+ echo $args['before_title'];
17
+ echo $instance['title'];
18
+ echo $args['after_title'];
19
+
20
+ //Our Widget Content
21
+ $instance['month'] = date("m");
22
+ echo '<div id="em-calendar-'.rand(100,200).'" class="em-calendar-wrapper">';
23
+ echo EM_Calendar::get($instance);
24
+ echo '</div>';
25
+
26
+ echo $args['after_widget'];
27
+ }
28
+
29
+ /** @see WP_Widget::update */
30
+ function update($new_instance, $old_instance) {
31
+ //filter the new instance and replace blanks with defaults
32
+ $new_instance['title'] = ($new_instance['title'] == '') ? __('Calendar','dbem'):$new_instance['title'];
33
+ $new_instance['long_events'] = ($new_instance['long_events'] == '') ? 0:$new_instance['long_events'];
34
+ return $new_instance;
35
+ }
36
+
37
+ /** @see WP_Widget::form */
38
+ function form($instance) {
39
+ ?>
40
+ <p>
41
+ <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title'); ?>: </label>
42
+ <input type="text" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo $instance['title']; ?>" />
43
+ </p>
44
+ <p>
45
+ <label for="<?php echo $this->get_field_id('long_events'); ?>"><?php _e('Show Long Events?', 'dbem'); ?>: </label>
46
+ <input type="checkbox" id="<?php echo $this->get_field_id('long_events'); ?>" name="<?php echo $this->get_field_name('long_events'); ?>" value="1" <?php echo ($instance['long_events'] == '1') ? 'checked="checked"':''; ?>/>
47
+ </p>
48
+ <?php
49
+ }
50
+
51
+ }
52
+ add_action('widgets_init', create_function('', 'return register_widget("EM_Widget_Calendar");'));
widgets/events.php ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author marcus
4
+ * Standard events list widget
5
+ */
6
+ class EM_Widget extends WP_Widget {
7
+ /** constructor */
8
+ function EM_Widget() {
9
+ $widget_ops = array('description' => __( "Create a list of events.", 'dbem') );
10
+ parent::WP_Widget(false, $name = 'Events', $widget_ops);
11
+ }
12
+
13
+ /** @see WP_Widget::widget */
14
+ function widget($args, $instance) {
15
+ echo $args['before_widget'];
16
+ echo $args['before_title'];
17
+ echo $instance['title'];
18
+ echo $args['after_title'];
19
+
20
+ $events = EM_Events::get($instance);
21
+ //FIXME Events in widget aren't loading location data
22
+ echo "<ul>";
23
+ if ( count($events) > 0 ){
24
+ foreach($events as $event){
25
+ echo $event->output($instance['format']);
26
+ }
27
+ }else{
28
+ _e('No events', 'dbem');
29
+ }
30
+ echo "</ul>";
31
+
32
+ echo $args['after_widget'];
33
+ }
34
+
35
+ /** @see WP_Widget::update */
36
+ function update($new_instance, $old_instance) {
37
+ //filter the new instance and replace blanks with defaults
38
+ $defaults = array(
39
+ 'title' => __('Events','dbem'),
40
+ 'scope' => 'future',
41
+ 'order' => 'ASC',
42
+ 'limit' => 5,
43
+ 'format' => DEFAULT_WIDGET_EVENT_LIST_ITEM_FORMAT
44
+ );
45
+ foreach($defaults as $key => $value){
46
+ if($new_instance[$key] == ''){
47
+ $new_instance[$key] = $value;
48
+ }
49
+ }
50
+ return $new_instance;
51
+ }
52
+
53
+ /** @see WP_Widget::form */
54
+ function form($instance) {
55
+ ?>
56
+ <p>
57
+ <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title'); ?>: </label>
58
+ <input type="text" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo $instance['title']; ?>" />
59
+ </p>
60
+ <p>
61
+ <label for="<?php echo $this->get_field_id('limit'); ?>"><?php _e('Number of events','dbem'); ?>: </label>
62
+ <input type="text" id="<?php echo $this->get_field_id('limit'); ?>" name="<?php echo $this->get_field_name('limit'); ?>" value="<?php echo $instance['limit']; ?>" />
63
+ </p>
64
+ <p>
65
+ <label for="<?php echo $this->get_field_id('scope'); ?>"><?php _e('Scope of the events','dbem'); ?>:</label><br/>
66
+ <select id="<?php echo $this->get_field_id('scope'); ?>" name="<?php echo $this->get_field_name('scope'); ?>" >
67
+ <option value="future" <?php echo ($instance['scope'] == 'future') ? 'selected="selected"':''; ?>><?php _e('Future events','dbem'); ?></option>
68
+ <option value="all" <?php echo ($instance['scope'] == 'all') ? 'selected="selected"':''; ?>><?php _e('All events','dbem'); ?></option>
69
+ <option value="past" <?php echo ($instance['scope'] == 'past') ? 'selected="selected"':''; ?>><?php _e('Past events','dbem'); ?></option>
70
+ </select>
71
+ </p>
72
+ <p>
73
+ <label for="<?php echo $this->get_field_id('order'); ?>"><?php _e('Order of the events','dbem'); ?>:</label><br/>
74
+ <select id="<?php echo $this->get_field_id('order'); ?>" name="<?php echo $this->get_field_name('order'); ?>" >
75
+ <option value="ASC" <?php echo ($instance['order'] == 'ASC') ? 'selected="selected"':''; ?>><?php _e('Ascendant','dbem'); ?></option>
76
+ <option value="DESC" <?php echo ($instance['order'] == 'DESC') ? 'selected="selected"':''; ?>><?php _e('Descendant','dbem'); ?></option>
77
+ </select>
78
+ </p>
79
+ <p>
80
+ <label for="<?php echo $this->get_field_id('format'); ?>"><?php _e('List item format','dbem'); ?>: </label>
81
+ <textarea rows="5" cols="24" id="<?php echo $this->get_field_id('format'); ?>" name="<?php echo $this->get_field_name('format'); ?>"><?php echo $instance['format']; ?></textarea>
82
+ </p>
83
+ <?php
84
+ }
85
+ }
86
+ add_action('widgets_init', create_function('', 'return register_widget("EM_Widget");'));
87
+ ?>