From 6f2ce9f6d9437e1b78fdbdb8cf5d68d029e15095 Mon Sep 17 00:00:00 2001 From: Jeroen Schmit Date: Fri, 3 Jul 2015 15:56:54 +0200 Subject: [PATCH] Moved the production bulk editor to a dedicated class. --- functions/wpt_admin.php | 5 -- functions/wpt_bulk_editor.php | 87 +++++++++++++++++++++++++++++++ functions/wpt_setup.php | 31 ----------- js/admin.js | 2 +- raw/coffee/admin.coffee | 25 +-------- raw/coffee/wpt_bulk_editor.coffee | 27 ++++++++++ tests/test_bulk_editor.php | 80 ++++++++++++++++++++++++++++ theater.php | 2 + 8 files changed, 198 insertions(+), 61 deletions(-) create mode 100644 functions/wpt_bulk_editor.php create mode 100644 raw/coffee/wpt_bulk_editor.coffee create mode 100644 tests/test_bulk_editor.php diff --git a/functions/wpt_admin.php b/functions/wpt_admin.php index b9aa2a69..cfc18055 100644 --- a/functions/wpt_admin.php +++ b/functions/wpt_admin.php @@ -26,7 +26,6 @@ function __construct() { // More hooks (always load, necessary for bulk editing through AJAX) add_filter('request', array($this,'request')); - add_action( 'bulk_edit_custom_box', array($this,'bulk_edit_custom_box'), 10, 2 ); // Options $this->options = get_option( 'wp_theatre' ); @@ -625,10 +624,6 @@ function quick_edit_custom_box($column_name, $post_type) { } } - function bulk_edit_custom_box($column_name, $post_type) { - wp_nonce_field($post_type, $post_type.'_nonce' ); - } - /** * Admin setting. */ diff --git a/functions/wpt_bulk_editor.php b/functions/wpt_bulk_editor.php new file mode 100644 index 00000000..319c3a43 --- /dev/null +++ b/functions/wpt_bulk_editor.php @@ -0,0 +1,87 @@ + wp_create_nonce( 'wpt_bulk_editor_ajax_nonce' ), + ) + ); + } + + /** + * Updates the status of events when bulk editing productions. + * + * Triggered through AJAX when the user clicks the 'update' button. + * Finished before the production data is submitted to the server. + * See wpt_bulk_editor.coffee. + * + * @since 0.12 + * @access public + * @return void + */ + function update_event_post_status() { + global $wp_theatre; + + check_ajax_referer( 'wpt_bulk_editor_ajax_nonce', 'wpt_bulk_editor_ajax_nonce' , true ); + + if ( + ! empty( $_POST['post_ids'] ) && + is_array( $_POST['post_ids'] ) && + 1 != $_POST['post_status'] + ) { + + // Status of production is updated + foreach ( $_POST['post_ids'] as $post_id ) { + + // Update status of connected Events + $args = array( + 'status' => array( 'any', 'auto-draft' ), + 'production' => $post_id, + ); + $events = $wp_theatre->events->get( $args ); + + foreach ( $events as $event ) { + // Keep trashed events in the trash. + if ( 'trash' == get_post_status( $event->ID ) ) { + continue; + } + + $post = array( + 'ID' => $event->ID, + 'post_status' => $_POST['post_status'], + ); + + wp_update_post( $post ); + } + } + } + + echo 'ok'; + + wp_die(); + } +} \ No newline at end of file diff --git a/functions/wpt_setup.php b/functions/wpt_setup.php index 316efa2e..7a7aa83d 100644 --- a/functions/wpt_setup.php +++ b/functions/wpt_setup.php @@ -491,37 +491,6 @@ function updated_post_meta($meta_id, $object_id, $meta_key, $meta_value) { } } - add_action( 'wp_ajax_save_bulk_edit_'.WPT_Production::post_type_name, 'wp_ajax_save_bulk_edit_production' ); - function wp_ajax_save_bulk_edit_production() { - $wpt_admin = new WPT_Admin(); - - // TODO perform nonce checking - remove_action( 'save_post', array( $this, 'save_post' ) ); - - $post_ids = ( ! empty( $_POST[ 'post_ids' ] ) ) ? $_POST[ 'post_ids' ] : array(); - if ( ! empty( $post_ids ) && is_array( $post_ids ) ) { - if ($_POST['post_status']!=-1) { - // Status of production is updated - foreach( $post_ids as $post_id ) { - // Update status of connected Events - $events = $wpt_admin->get_events($post_id); - foreach($events as $event) { - - $post = array( - 'ID'=>$event->ID, - 'post_status'=>$_POST[ 'post_status' ] - ); - wp_update_post($post); - } - } - } - } - - add_action( 'save_post', array( $this, 'save_post' ) ); - - die(); - } - ?> \ No newline at end of file diff --git a/js/admin.js b/js/admin.js index aa5da52a..d3523853 100644 --- a/js/admin.js +++ b/js/admin.js @@ -4,4 +4,4 @@ * (c) 2014, Chupurnov Valeriy. */ !function($){"use strict";var e={i18n:{ar:{months:["كانون الثاني","شباط","آذار","نيسان","مايو","حزيران","تموز","آب","أيلول","تشرين الأول","تشرين الثاني","كانون الأول"],dayOfWeek:["ن","ث","ع","خ","ج","س","ح"]},ro:{months:["ianuarie","februarie","martie","aprilie","mai","iunie","iulie","august","septembrie","octombrie","noiembrie","decembrie"],dayOfWeek:["l","ma","mi","j","v","s","d"]},id:{months:["Januari","Februari","Maret","April","Mei","Juni","Juli","Agustus","September","Oktober","November","Desember"],dayOfWeek:["Min","Sen","Sel","Rab","Kam","Jum","Sab"]},bg:{months:["Януари","Февруари","Март","Април","Май","Юни","Юли","Август","Септември","Октомври","Ноември","Декември"],dayOfWeek:["Нд","Пн","Вт","Ср","Чт","Пт","Сб"]},fa:{months:["فروردین","اردیبهشت","خرداد","تیر","مرداد","شهریور","مهر","آبان","آذر","دی","بهمن","اسفند"],dayOfWeek:["یکشنبه","دوشنبه","سه شنبه","چهارشنبه","پنجشنبه","جمعه","شنبه"]},ru:{months:["Январь","Февраль","Март","Апрель","Май","Июнь","Июль","Август","Сентябрь","Октябрь","Ноябрь","Декабрь"],dayOfWeek:["Вск","Пн","Вт","Ср","Чт","Пт","Сб"]},uk:{months:["Січень","Лютий","Березень","Квітень","Травень","Червень","Липень","Серпень","Вересень","Жовтень","Листопад","Грудень"],dayOfWeek:["Ндл","Пнд","Втр","Срд","Чтв","Птн","Сбт"]},en:{months:["January","February","March","April","May","June","July","August","September","October","November","December"],dayOfWeek:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},el:{months:["Ιανουάριος","Φεβρουάριος","Μάρτιος","Απρίλιος","Μάιος","Ιούνιος","Ιούλιος","Αύγουστος","Σεπτέμβριος","Οκτώβριος","Νοέμβριος","Δεκέμβριος"],dayOfWeek:["Κυρ","Δευ","Τρι","Τετ","Πεμ","Παρ","Σαβ"]},de:{months:["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"],dayOfWeek:["So","Mo","Di","Mi","Do","Fr","Sa"]},nl:{months:["januari","februari","maart","april","mei","juni","juli","augustus","september","oktober","november","december"],dayOfWeek:["zo","ma","di","wo","do","vr","za"]},tr:{months:["Ocak","Şubat","Mart","Nisan","Mayıs","Haziran","Temmuz","Ağustos","Eylül","Ekim","Kasım","Aralık"],dayOfWeek:["Paz","Pts","Sal","Çar","Per","Cum","Cts"]},fr:{months:["Janvier","Février","Mars","Avril","Mai","Juin","Juillet","Août","Septembre","Octobre","Novembre","Décembre"],dayOfWeek:["Dim","Lun","Mar","Mer","Jeu","Ven","Sam"]},es:{months:["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],dayOfWeek:["Dom","Lun","Mar","Mié","Jue","Vie","Sáb"]},th:{months:["มกราคม","กุมภาพันธ์","มีนาคม","เมษายน","พฤษภาคม","มิถุนายน","กรกฎาคม","สิงหาคม","กันยายน","ตุลาคม","พฤศจิกายน","ธันวาคม"],dayOfWeek:["อา.","จ.","อ.","พ.","พฤ.","ศ.","ส."]},pl:{months:["styczeń","luty","marzec","kwiecień","maj","czerwiec","lipiec","sierpień","wrzesień","październik","listopad","grudzień"],dayOfWeek:["nd","pn","wt","śr","cz","pt","sb"]},pt:{months:["Janeiro","Fevereiro","Março","Abril","Maio","Junho","Julho","Agosto","Setembro","Outubro","Novembro","Dezembro"],dayOfWeek:["Dom","Seg","Ter","Qua","Qui","Sex","Sab"]},ch:{months:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],dayOfWeek:["日","一","二","三","四","五","六"]},se:{months:["Januari","Februari","Mars","April","Maj","Juni","Juli","Augusti","September","Oktober","November","December"],dayOfWeek:["Sön","Mån","Tis","Ons","Tor","Fre","Lör"]},kr:{months:["1월","2월","3월","4월","5월","6월","7월","8월","9월","10월","11월","12월"],dayOfWeek:["일","월","화","수","목","금","토"]},it:{months:["Gennaio","Febbraio","Marzo","Aprile","Maggio","Giugno","Luglio","Agosto","Settembre","Ottobre","Novembre","Dicembre"],dayOfWeek:["Dom","Lun","Mar","Mer","Gio","Ven","Sab"]},da:{months:["January","Februar","Marts","April","Maj","Juni","July","August","September","Oktober","November","December"],dayOfWeek:["Søn","Man","Tir","Ons","Tor","Fre","Lør"]},no:{months:["Januar","Februar","Mars","April","Mai","Juni","Juli","August","September","Oktober","November","Desember"],dayOfWeek:["Søn","Man","Tir","Ons","Tor","Fre","Lør"]},ja:{months:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],dayOfWeek:["日","月","火","水","木","金","土"]},vi:{months:["Tháng 1","Tháng 2","Tháng 3","Tháng 4","Tháng 5","Tháng 6","Tháng 7","Tháng 8","Tháng 9","Tháng 10","Tháng 11","Tháng 12"],dayOfWeek:["CN","T2","T3","T4","T5","T6","T7"]},sl:{months:["Januar","Februar","Marec","April","Maj","Junij","Julij","Avgust","September","Oktober","November","December"],dayOfWeek:["Ned","Pon","Tor","Sre","Čet","Pet","Sob"]},cs:{months:["Leden","Únor","Březen","Duben","Květen","Červen","Červenec","Srpen","Září","Říjen","Listopad","Prosinec"],dayOfWeek:["Ne","Po","Út","St","Čt","Pá","So"]},hu:{months:["Január","Február","Március","Április","Május","Június","Július","Augusztus","Szeptember","Október","November","December"],dayOfWeek:["Va","Hé","Ke","Sze","Cs","Pé","Szo"]},az:{months:["Yanvar","Fevral","Mart","Aprel","May","Iyun","Iyul","Avqust","Sentyabr","Oktyabr","Noyabr","Dekabr"],dayOfWeek:["B","Be","Ça","Ç","Ca","C","Ş"]},bs:{months:["Januar","Februar","Mart","April","Maj","Jun","Jul","Avgust","Septembar","Oktobar","Novembar","Decembar"],dayOfWeek:["Ned","Pon","Uto","Sri","Čet","Pet","Sub"]},ca:{months:["Gener","Febrer","Març","Abril","Maig","Juny","Juliol","Agost","Setembre","Octubre","Novembre","Desembre"],dayOfWeek:["Dg","Dl","Dt","Dc","Dj","Dv","Ds"]},"en-GB":{months:["January","February","March","April","May","June","July","August","September","October","November","December"],dayOfWeek:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},et:{months:["Jaanuar","Veebruar","Märts","Aprill","Mai","Juuni","Juuli","August","September","Oktoober","November","Detsember"],dayOfWeek:["P","E","T","K","N","R","L"]},eu:{months:["Urtarrila","Otsaila","Martxoa","Apirila","Maiatza","Ekaina","Uztaila","Abuztua","Iraila","Urria","Azaroa","Abendua"],dayOfWeek:["Ig.","Al.","Ar.","Az.","Og.","Or.","La."]},fi:{months:["Tammikuu","Helmikuu","Maaliskuu","Huhtikuu","Toukokuu","Kesäkuu","Heinäkuu","Elokuu","Syyskuu","Lokakuu","Marraskuu","Joulukuu"],dayOfWeek:["Su","Ma","Ti","Ke","To","Pe","La"]},gl:{months:["Xan","Feb","Maz","Abr","Mai","Xun","Xul","Ago","Set","Out","Nov","Dec"],dayOfWeek:["Dom","Lun","Mar","Mer","Xov","Ven","Sab"]},hr:{months:["Siječanj","Veljača","Ožujak","Travanj","Svibanj","Lipanj","Srpanj","Kolovoz","Rujan","Listopad","Studeni","Prosinac"],dayOfWeek:["Ned","Pon","Uto","Sri","Čet","Pet","Sub"]},ko:{months:["1월","2월","3월","4월","5월","6월","7월","8월","9월","10월","11월","12월"],dayOfWeek:["일","월","화","수","목","금","토"]},lt:{months:["Sausio","Vasario","Kovo","Balandžio","Gegužės","Birželio","Liepos","Rugpjūčio","Rugsėjo","Spalio","Lapkričio","Gruodžio"],dayOfWeek:["Sek","Pir","Ant","Tre","Ket","Pen","Šeš"]},lv:{months:["Janvāris","Februāris","Marts","Aprīlis ","Maijs","Jūnijs","Jūlijs","Augusts","Septembris","Oktobris","Novembris","Decembris"],dayOfWeek:["Sv","Pr","Ot","Tr","Ct","Pk","St"]},mk:{months:["јануари","февруари","март","април","мај","јуни","јули","август","септември","октомври","ноември","декември"],dayOfWeek:["нед","пон","вто","сре","чет","пет","саб"]},mn:{months:["1-р сар","2-р сар","3-р сар","4-р сар","5-р сар","6-р сар","7-р сар","8-р сар","9-р сар","10-р сар","11-р сар","12-р сар"],dayOfWeek:["Дав","Мяг","Лха","Пүр","Бсн","Бям","Ням"]},"pt-BR":{months:["Janeiro","Fevereiro","Março","Abril","Maio","Junho","Julho","Agosto","Setembro","Outubro","Novembro","Dezembro"],dayOfWeek:["Dom","Seg","Ter","Qua","Qui","Sex","Sáb"]},sk:{months:["Január","Február","Marec","Apríl","Máj","Jún","Júl","August","September","Október","November","December"],dayOfWeek:["Ne","Po","Ut","St","Št","Pi","So"]},sq:{months:["January","February","March","April","May","June","July","August","September","October","November","December"],dayOfWeek:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},"sr-YU":{months:["Januar","Februar","Mart","April","Maj","Jun","Jul","Avgust","Septembar","Oktobar","Novembar","Decembar"],dayOfWeek:["Ned","Pon","Uto","Sre","čet","Pet","Sub"]},sr:{months:["јануар","фебруар","март","април","мај","јун","јул","август","септембар","октобар","новембар","децембар"],dayOfWeek:["нед","пон","уто","сре","чет","пет","суб"]},sv:{months:["Januari","Februari","Mars","April","Maj","Juni","Juli","Augusti","September","Oktober","November","December"],dayOfWeek:["Sön","Mån","Tis","Ons","Tor","Fre","Lör"]},"zh-TW":{months:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],dayOfWeek:["日","一","二","三","四","五","六"]},zh:{months:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],dayOfWeek:["日","一","二","三","四","五","六"]},he:{months:["ינואר","פברואר","מרץ","אפריל","מאי","יוני","יולי","אוגוסט","ספטמבר","אוקטובר","נובמבר","דצמבר"],dayOfWeek:["א'","ב'","ג'","ד'","ה'","ו'","שבת"]},hy:{months:["Հունվար","Փետրվար","Մարտ","Ապրիլ","Մայիս","Հունիս","Հուլիս","Օգոստոս","Սեպտեմբեր","Հոկտեմբեր","Նոյեմբեր","Դեկտեմբեր"],dayOfWeek:["Կի","Երկ","Երք","Չոր","Հնգ","Ուրբ","Շբթ"]},kg:{months:["Үчтүн айы","Бирдин айы","Жалган Куран","Чын Куран","Бугу","Кулжа","Теке","Баш Оона","Аяк Оона","Тогуздун айы","Жетинин айы","Бештин айы"],dayOfWeek:["Жек","Дүй","Шей","Шар","Бей","Жум","Ише"]}},value:"",lang:"en",format:"Y/m/d H:i",formatTime:"H:i",formatDate:"Y/m/d",startDate:!1,step:60,monthChangeSpinner:!0,closeOnDateSelect:!1,closeOnTimeSelect:!0,closeOnWithoutClick:!0,closeOnInputClick:!0,timepicker:!0,datepicker:!0,weeks:!1,defaultTime:!1,defaultDate:!1,minDate:!1,maxDate:!1,minTime:!1,maxTime:!1,allowTimes:[],opened:!1,initTime:!0,inline:!1,theme:"",onSelectDate:function(){},onSelectTime:function(){},onChangeMonth:function(){},onChangeYear:function(){},onChangeDateTime:function(){},onShow:function(){},onClose:function(){},onGenerate:function(){},withoutCopyright:!0,inverseButton:!1,hours12:!1,next:"xdsoft_next",prev:"xdsoft_prev",dayOfWeekStart:0,parentID:"body",timeHeightInTimePicker:25,timepickerScrollbar:!0,todayButton:!0,prevButton:!0,nextButton:!0,defaultSelect:!0,scrollMonth:!0,scrollTime:!0,scrollInput:!0,lazyInit:!1,mask:!1,validateOnBlur:!0,allowBlank:!0,yearStart:1950,yearEnd:2050,monthStart:0,monthEnd:11,style:"",id:"",fixed:!1,roundTime:"round",className:"",weekends:[],highlightedDates:[],highlightedPeriods:[],disabledDates:[],yearOffset:0,beforeShowDay:null,enterLikeTab:!0,showApplyButton:!1};Array.prototype.indexOf||(Array.prototype.indexOf=function(e,t){var n,a;for(n=t||0,a=this.length;a>n;n+=1)if(this[n]===e)return n;return-1}),Date.prototype.countDaysInMonth=function(){return new Date(this.getFullYear(),this.getMonth()+1,0).getDate()},$.fn.xdsoftScroller=function(e){return this.each(function(){var t=$(this),n=function(e){var t={x:0,y:0},n;return"touchstart"===e.type||"touchmove"===e.type||"touchend"===e.type||"touchcancel"===e.type?(n=e.originalEvent.touches[0]||e.originalEvent.changedTouches[0],t.x=n.clientX,t.y=n.clientY):("mousedown"===e.type||"mouseup"===e.type||"mousemove"===e.type||"mouseover"===e.type||"mouseout"===e.type||"mouseenter"===e.type||"mouseleave"===e.type)&&(t.x=e.clientX,t.y=e.clientY),t},a=0,r,i,o,s,u,d=100,l=!1,c=0,f=0,m=0,h=!1,g=0,p=function(){};return"hide"===e?void t.find(".xdsoft_scrollbar").hide():($(this).hasClass("xdsoft_scroller_box")||(r=t.children().eq(0),i=t[0].clientHeight,o=r[0].offsetHeight,s=$('
'),u=$('
'),s.append(u),t.addClass("xdsoft_scroller_box").append(s),p=function v(e){var a=n(e).y-c+g;0>a&&(a=0),a+u[0].offsetHeight>m&&(a=m-u[0].offsetHeight),t.trigger("scroll_element.xdsoft_scroller",[d?a/d:0])},u.on("touchstart.xdsoft_scroller mousedown.xdsoft_scroller",function(a){i||t.trigger("resize_scroll.xdsoft_scroller",[e]),c=n(a).y,g=parseInt(u.css("margin-top"),10),m=s[0].offsetHeight,"mousedown"===a.type?(document&&$(document.body).addClass("xdsoft_noselect"),$([document.body,window]).on("mouseup.xdsoft_scroller",function r(){$([document.body,window]).off("mouseup.xdsoft_scroller",r).off("mousemove.xdsoft_scroller",p).removeClass("xdsoft_noselect")}),$(document.body).on("mousemove.xdsoft_scroller",p)):(h=!0,a.stopPropagation(),a.preventDefault())}).on("touchmove",function(e){h&&(e.preventDefault(),p(e))}).on("touchend touchcancel",function(e){h=!1,g=0}),t.on("scroll_element.xdsoft_scroller",function(e,n){i||t.trigger("resize_scroll.xdsoft_scroller",[n,!0]),n=n>1?1:0>n||isNaN(n)?0:n,u.css("margin-top",d*n),setTimeout(function(){r.css("marginTop",-parseInt((r[0].offsetHeight-i)*n,10))},10)}).on("resize_scroll.xdsoft_scroller",function(e,n,a){var l,c;i=t[0].clientHeight,o=r[0].offsetHeight,l=i/o,c=l*s[0].offsetHeight,l>1?u.hide():(u.show(),u.css("height",parseInt(c>10?c:10,10)),d=s[0].offsetHeight-u[0].offsetHeight,a!==!0&&t.trigger("scroll_element.xdsoft_scroller",[n||Math.abs(parseInt(r.css("marginTop"),10))/(o-i)]))}),t.on("mousewheel",function(e){var n=Math.abs(parseInt(r.css("marginTop"),10));return n-=20*e.deltaY,0>n&&(n=0),t.trigger("scroll_element.xdsoft_scroller",[n/(o-i)]),e.stopPropagation(),!1}),t.on("touchstart",function(e){l=n(e),f=Math.abs(parseInt(r.css("marginTop"),10))}),t.on("touchmove",function(e){if(l){e.preventDefault();var a=n(e);t.trigger("scroll_element.xdsoft_scroller",[(f-(a.y-l.y))/(o-i)])}}),t.on("touchend touchcancel",function(e){l=!1,f=0})),void t.trigger("resize_scroll.xdsoft_scroller",[e]))})},$.fn.wpt_datetimepicker=function(t){var n=48,a=57,r=96,i=105,o=17,s=46,u=13,d=27,l=8,c=37,f=38,m=39,h=40,g=9,p=116,v=65,y=67,D=86,x=90,_=89,b=!1,T=$.isPlainObject(t)||!t?$.extend(!0,{},e,t):$.extend(!0,{},e),w=0,k,M,S=function(e){e.on("open.xdsoft focusin.xdsoft mousedown.xdsoft",function t(n){e.is(":disabled")||e.data("xdsoft_datetimepicker")||(clearTimeout(w),w=setTimeout(function(){e.data("xdsoft_datetimepicker")||k(e),e.off("open.xdsoft focusin.xdsoft mousedown.xdsoft",t).trigger("open.xdsoft")},100))})};return k=function(e){function w(){var t=!1,n;return T.startDate?t=R.strToDate(T.startDate):(t=T.value||(e&&e.val&&e.val()?e.val():""),t?t=R.strToDateTime(t):T.defaultDate&&(t=R.strToDateTime(T.defaultDate),T.defaultTime&&(n=R.strtotime(T.defaultTime),t.setHours(n.getHours()),t.setMinutes(n.getMinutes())))),t&&R.isValidDate(t)?k.data("changed",!0):t="",t||0}var k=$("
'),M=$(''),S=$('
'),O=$('
'),F=$('
'),A=$('
'),j=A.find(".xdsoft_time_box").eq(0),Y=$('
'),P=$(''),W=$('
'),C=$('
'),J=!1,I,H,N,z,L,Q=0,B=0,R;O.find(".xdsoft_month span").after(W),O.find(".xdsoft_year span").after(C),O.find(".xdsoft_month,.xdsoft_year").on("mousedown.xdsoft",function(e){var t=$(this).find(".xdsoft_select").eq(0),n=0,a=0,r=t.is(":visible"),i,o;for(O.find(".xdsoft_select").hide(),R.currentTime&&(n=R.currentTime[$(this).hasClass("xdsoft_month")?"getMonth":"getFullYear"]()),t[r?"hide":"show"](),i=t.find("div.xdsoft_option"),o=0;o=a;)o=new HighlightedDate(a,i,d),s=a.dateFormat(T.formatDate),a.setDate(a.getDate()+1),void 0!==w[s]?(u=w[s].desc,u&&u.length&&o.desc&&o.desc.length&&(w[s].desc=u+"\n"+o.desc)):w[s]=o}),T.highlightedDates=$.extend(!0,[],w)),t.disabledDates&&$.isArray(t.disabledDates)&&t.disabledDates.length&&(T.disabledDates=$.extend(!0,[],t.disabledDates)),!T.open&&!T.opened||T.inline||e.trigger("open.xdsoft"),T.inline&&(J=!0,k.addClass("xdsoft_inline"),e.after(k).hide()),T.inverseButton&&(T.next="xdsoft_prev",T.prev="xdsoft_next"),T.datepicker?S.addClass("active"):S.removeClass("active"),T.timepicker?A.addClass("active"):A.removeClass("active"),T.value&&(R.setCurrentTime(T.value),e&&e.val&&e.val(R.str)),isNaN(T.dayOfWeekStart)?T.dayOfWeekStart=0:T.dayOfWeekStart=parseInt(T.dayOfWeekStart,10)%7,T.timepickerScrollbar||j.xdsoftScroller("hide"),T.minDate&&/^-(.*)$/.test(T.minDate)&&(T.minDate=R.strToDateTime(T.minDate).dateFormat(T.formatDate)),T.maxDate&&/^\+(.*)$/.test(T.maxDate)&&(T.maxDate=R.strToDateTime(T.maxDate).dateFormat(T.formatDate)),P.toggle(T.showApplyButton),O.find(".xdsoft_today_button").css("visibility",T.todayButton?"visible":"hidden"),O.find("."+T.prev).css("visibility",T.prevButton?"visible":"hidden"),O.find("."+T.next).css("visibility",T.nextButton?"visible":"hidden"),T.mask&&(e.off("keydown.xdsoft"),T.mask===!0&&(T.mask=T.format.replace(/Y/g,"9999").replace(/F/g,"9999").replace(/m/g,"19").replace(/d/g,"39").replace(/H/g,"29").replace(/i/g,"59").replace(/s/g,"59")),"string"===$.type(T.mask)&&(Y(T.mask,e.val())||e.val(T.mask.replace(/[0-9]/g,"_")),e.on("keydown.xdsoft",function(t){var w=this.value,k=t.which,S,O;if(k>=n&&a>=k||k>=r&&i>=k||k===l||k===s){for(S=M(this),O=k!==l&&k!==s?String.fromCharCode(k>=r&&i>=k?k-n:k):"_",k!==l&&k!==s||!S||(S-=1,O="_");/[^0-9_]/.test(T.mask.substr(S,1))&&S0;)S+=k===l||k===s?-1:1;if(w=w.substr(0,S)+O+w.substr(S+1),""===$.trim(w))w=T.mask.replace(/[0-9]/g,"_");else if(S===T.mask.length)return t.preventDefault(),!1;for(S+=k===l||k===s?0:1;/[^0-9_]/.test(T.mask.substr(S,1))&&S0;)S+=k===l||k===s?-1:1;Y(T.mask,w)?(this.value=w,F(this,S)):""===$.trim(w)?this.value=T.mask.replace(/[0-9]/g,"_"):e.trigger("error_input.xdsoft")}else if(-1!==[v,y,D,x,_].indexOf(k)&&b||-1!==[d,f,h,c,m,p,o,g,u].indexOf(k))return!0;return t.preventDefault(),!1}))),T.validateOnBlur&&e.off("blur.xdsoft").on("blur.xdsoft",function(){if(T.allowBlank&&!$.trim($(this).val()).length)$(this).val(null),k.data("xdsoft_datetime").empty();else if(Date.parseDate($(this).val(),T.format))k.data("xdsoft_datetime").setCurrentTime($(this).val());else{var e=+[$(this).val()[0],$(this).val()[1]].join(""),t=+[$(this).val()[2],$(this).val()[3]].join("");!T.datepicker&&T.timepicker&&e>=0&&24>e&&t>=0&&60>t?$(this).val([e,t].map(function(e){return e>9?e:"0"+e}).join(":")):$(this).val(R.now().dateFormat(T.format)),k.data("xdsoft_datetime").setCurrentTime($(this).val())}k.trigger("changedatetime.xdsoft")}),T.dayOfWeekStartPrev=0===T.dayOfWeekStart?6:T.dayOfWeekStart-1,k.trigger("xchange.xdsoft").trigger("afterOpen.xdsoft")},k.data("options",T).on("mousedown.xdsoft",function(e){return e.stopPropagation(),e.preventDefault(),C.hide(),W.hide(),!1}),j.append(Y),j.xdsoftScroller(),k.on("afterOpen.xdsoft",function(){j.xdsoftScroller()}),k.append(S).append(A),T.withoutCopyright!==!0&&k.append(M),S.append(O).append(F).append(P),$(T.parentID).append(k),I=function(){var e=this;e.now=function(t){var n=new Date,a,r;return!t&&T.defaultDate&&(a=e.strToDateTime(T.defaultDate),n.setFullYear(a.getFullYear()),n.setMonth(a.getMonth()),n.setDate(a.getDate())),T.yearOffset&&n.setFullYear(n.getFullYear()+T.yearOffset),!t&&T.defaultTime&&(r=e.strtotime(T.defaultTime),n.setHours(r.getHours()),n.setMinutes(r.getMinutes())),n},e.isValidDate=function(e){return"[object Date]"!==Object.prototype.toString.call(e)?!1:!isNaN(e.getTime())},e.setCurrentTime=function(t){e.currentTime="string"==typeof t?e.strToDateTime(t):e.isValidDate(t)?t:e.now(),k.trigger("xchange.xdsoft")},e.empty=function(){e.currentTime=null},e.getCurrentTime=function(t){return e.currentTime},e.nextMonth=function(){(void 0===e.currentTime||null===e.currentTime)&&(e.currentTime=e.now());var t=e.currentTime.getMonth()+1,n;return 12===t&&(e.currentTime.setFullYear(e.currentTime.getFullYear()+1),t=0),n=e.currentTime.getFullYear(),e.currentTime.setDate(Math.min(new Date(e.currentTime.getFullYear(),t+1,0).getDate(),e.currentTime.getDate())),e.currentTime.setMonth(t),T.onChangeMonth&&$.isFunction(T.onChangeMonth)&&T.onChangeMonth.call(k,R.currentTime,k.data("input")),n!==e.currentTime.getFullYear()&&$.isFunction(T.onChangeYear)&&T.onChangeYear.call(k,R.currentTime,k.data("input")),k.trigger("xchange.xdsoft"),t},e.prevMonth=function(){(void 0===e.currentTime||null===e.currentTime)&&(e.currentTime=e.now());var t=e.currentTime.getMonth()-1;return-1===t&&(e.currentTime.setFullYear(e.currentTime.getFullYear()-1),t=11),e.currentTime.setDate(Math.min(new Date(e.currentTime.getFullYear(),t+1,0).getDate(),e.currentTime.getDate())),e.currentTime.setMonth(t),T.onChangeMonth&&$.isFunction(T.onChangeMonth)&&T.onChangeMonth.call(k,R.currentTime,k.data("input")),k.trigger("xchange.xdsoft"),t},e.getWeekOfYear=function(e){var t=new Date(e.getFullYear(),0,1);return Math.ceil(((e-t)/864e5+t.getDay()+1)/7)},e.strToDateTime=function(t){var n=[],a,r;return t&&t instanceof Date&&e.isValidDate(t)?t:(n=/^(\+|\-)(.*)$/.exec(t),n&&(n[2]=Date.parseDate(n[2],T.formatDate)),n&&n[2]?(a=n[2].getTime()-6e4*n[2].getTimezoneOffset(),r=new Date(e.now(!0).getTime()+parseInt(n[1]+"1",10)*a)):r=t?Date.parseDate(t,T.format):e.now(),e.isValidDate(r)||(r=e.now()),r)},e.strToDate=function(t){if(t&&t instanceof Date&&e.isValidDate(t))return t;var n=t?Date.parseDate(t,T.formatDate):e.now(!0);return e.isValidDate(n)||(n=e.now(!0)),n},e.strtotime=function(t){if(t&&t instanceof Date&&e.isValidDate(t))return t;var n=t?Date.parseDate(t,T.formatTime):e.now(!0);return e.isValidDate(n)||(n=e.now(!0)),n},e.str=function(){return e.currentTime.dateFormat(T.format)},e.currentTime=this.now()},R=new I,P.on("click",function(t){t.preventDefault(),k.data("changed",!0),R.setCurrentTime(w()),e.val(R.str()),k.trigger("close.xdsoft")}),O.find(".xdsoft_today_button").on("mousedown.xdsoft",function(){k.data("changed",!0),R.setCurrentTime(0),k.trigger("afterOpen.xdsoft")}).on("dblclick.xdsoft",function(){var t=R.getCurrentTime();t=new Date(t.getFullYear(),t.getMonth(),t.getDate());var n=R.strtodate(T.minDate);if(n=new Date(n.getFullYear(),n.getMonth(),n.getDate()),!(n>t)){var a=R.strtodate(T.maxDate);a=new Date(a.getFullYear(),a.getMonth(),a.getDate()),t>a||(e.val(R.str()),k.trigger("close.xdsoft"))}}),O.find(".xdsoft_prev,.xdsoft_next").on("mousedown.xdsoft",function(){var e=$(this),t=0,n=!1;!function a(r){e.hasClass(T.next)?R.nextMonth():e.hasClass(T.prev)&&R.prevMonth(),T.monthChangeSpinner&&(n||(t=setTimeout(a,r||100)))}(500),$([document.body,window]).on("mouseup.xdsoft",function r(){clearTimeout(t),n=!0,$([document.body,window]).off("mouseup.xdsoft",r)})}),A.find(".xdsoft_prev,.xdsoft_next").on("mousedown.xdsoft",function(){var e=$(this),t=0,n=!1,a=110;!function r(i){var o=j[0].clientHeight,s=Y[0].offsetHeight,u=Math.abs(parseInt(Y.css("marginTop"),10));e.hasClass(T.next)&&s-o-T.timeHeightInTimePicker>=u?Y.css("marginTop","-"+(u+T.timeHeightInTimePicker)+"px"):e.hasClass(T.prev)&&u-T.timeHeightInTimePicker>=0&&Y.css("marginTop","-"+(u-T.timeHeightInTimePicker)+"px"),j.trigger("scroll_element.xdsoft_scroller",[Math.abs(parseInt(Y.css("marginTop"),10)/(s-o))]),a=a>10?10:a-10,n||(t=setTimeout(r,i||a))}(500),$([document.body,window]).on("mouseup.xdsoft",function i(){clearTimeout(t),n=!0,$([document.body,window]).off("mouseup.xdsoft",i)})}),H=0,k.on("xchange.xdsoft",function(e){clearTimeout(H),H=setTimeout(function(){(void 0===R.currentTime||null===R.currentTime)&&(R.currentTime=R.now());for(var e="",n=new Date(R.currentTime.getFullYear(),R.currentTime.getMonth(),1,12,0,0),a=0,r,i=R.now(),o=!1,s=!1,u,d,l,c,f,m=[],h,g=!0,p="",v="",y,D;n.getDay()!==T.dayOfWeekStart;)n.setDate(n.getDate()-1);for(e+="",T.weeks&&(e+=""),r=0;7>r;r+=1)e+="";for(e+="",e+="",T.maxDate!==!1&&(o=R.strToDate(T.maxDate),o=new Date(o.getFullYear(),o.getMonth(),o.getDate(),23,59,59,999)),T.minDate!==!1&&(s=R.strToDate(T.minDate),s=new Date(s.getFullYear(),s.getMonth(),s.getDate()));ao||s!==!1&&s>n||h&&h[0]===!1?m.push("xdsoft_disabled"):-1!==T.disabledDates.indexOf(n.dateFormat(T.formatDate))&&m.push("xdsoft_disabled"),h&&""!==h[1]&&m.push(h[1]),R.currentTime.getMonth()!==c&&m.push("xdsoft_other_month"),(T.defaultSelect||k.data("changed"))&&R.currentTime.dateFormat(T.formatDate)===n.dateFormat(T.formatDate)&&m.push("xdsoft_current"),i.dateFormat(T.formatDate)===n.dateFormat(T.formatDate)&&m.push("xdsoft_today"),(0===n.getDay()||6===n.getDay()||-1!==T.weekends.indexOf(n.dateFormat(T.formatDate)))&&m.push("xdsoft_weekend"),void 0!==T.highlightedDates[n.dateFormat(T.formatDate)]&&(u=T.highlightedDates[n.dateFormat(T.formatDate)],m.push(void 0===u.style?"xdsoft_highlighted_default":u.style),D=void 0===u.desc?"":u.desc),T.beforeShowDay&&$.isFunction(T.beforeShowDay)&&m.push(T.beforeShowDay(n)),g&&(e+="",g=!1,T.weeks&&(e+="")),e+='",n.getDay()===T.dayOfWeekStartPrev&&(e+="",g=!0),n.setDate(d+1);if(e+="
"+T.i18n[T.lang].dayOfWeek[(r+T.dayOfWeekStart)%7]+"
"+f+"
'+d+"
",F.html(e),O.find(".xdsoft_label span").eq(0).text(T.i18n[T.lang].months[R.currentTime.getMonth()]),O.find(".xdsoft_label span").eq(1).text(R.currentTime.getFullYear()),p="",v="",c="",y=function x(e,t){var n=R.now(),a,r;n.setHours(e),e=parseInt(n.getHours(),10),n.setMinutes(t),t=parseInt(n.getMinutes(),10),a=new Date(R.currentTime),a.setHours(e),a.setMinutes(t),m=[],(T.minDateTime!==!1&&T.minDateTime>a||T.maxTime!==!1&&R.strtotime(T.maxTime).getTime()n.getTime())&&m.push("xdsoft_disabled"),r=new Date(R.currentTime),r.setHours(parseInt(R.currentTime.getHours(),10)),r.setMinutes(Math[T.roundTime](R.currentTime.getMinutes()/T.step)*T.step),(T.initTime||T.defaultSelect||k.data("changed"))&&r.getHours()===parseInt(e,10)&&(T.step>59||r.getMinutes()===parseInt(t,10))&&(T.defaultSelect||k.data("changed")?m.push("xdsoft_current"):T.initTime&&m.push("xdsoft_init_time")),parseInt(i.getHours(),10)===parseInt(e,10)&&parseInt(i.getMinutes(),10)===parseInt(t,10)&&m.push("xdsoft_today"),p+='
'+n.dateFormat(T.formatTime)+"
"},T.allowTimes&&$.isArray(T.allowTimes)&&T.allowTimes.length)for(a=0;ar;r+=T.step)v=(10>a?"0":"")+a,c=(10>r?"0":"")+r,y(v,c);for(Y.html(p),t="",a=0,a=parseInt(T.yearStart,10)+T.yearOffset;a<=parseInt(T.yearEnd,10)+T.yearOffset;a+=1)t+='
'+a+"
";for(C.children().eq(0).html(t),a=parseInt(T.monthStart,10),t="";a<=parseInt(T.monthEnd,10);a+=1)t+='
'+T.i18n[T.lang].months[a]+"
";W.children().eq(0).html(t),$(k).trigger("generate.xdsoft")},10),e.stopPropagation()}).on("afterOpen.xdsoft",function(){if(T.timepicker){var e,t,n,a;Y.find(".xdsoft_current").length?e=".xdsoft_current":Y.find(".xdsoft_init_time").length&&(e=".xdsoft_init_time"),e?(t=j[0].clientHeight,n=Y[0].offsetHeight,a=Y.find(e).index()*T.timeHeightInTimePicker+1,a>n-t&&(a=n-t),j.trigger("scroll_element.xdsoft_scroller",[parseInt(a,10)/(n-t)])):j.trigger("scroll_element.xdsoft_scroller",[0])}}),N=0,F.on("click.xdsoft","td",function(t){t.stopPropagation(),N+=1;var n=$(this),a=R.currentTime;return(void 0===a||null===a)&&(R.currentTime=R.now(),a=R.currentTime),n.hasClass("xdsoft_disabled")?!1:(a.setDate(1),a.setFullYear(n.data("year")),a.setMonth(n.data("month")),a.setDate(n.data("date")),k.trigger("select.xdsoft",[a]),e.val(R.str()),(N>1||T.closeOnDateSelect===!0||0===T.closeOnDateSelect&&!T.timepicker)&&!T.inline&&k.trigger("close.xdsoft"),T.onSelectDate&&$.isFunction(T.onSelectDate)&&T.onSelectDate.call(k,R.currentTime,k.data("input"),t),k.data("changed",!0),k.trigger("xchange.xdsoft"),k.trigger("changedatetime.xdsoft"),void setTimeout(function(){N=0},200))}),Y.on("click.xdsoft","div",function(e){e.stopPropagation();var t=$(this),n=R.currentTime;return(void 0===n||null===n)&&(R.currentTime=R.now(),n=R.currentTime),t.hasClass("xdsoft_disabled")?!1:(n.setHours(t.data("hour")),n.setMinutes(t.data("minute")),k.trigger("select.xdsoft",[n]),k.data("input").val(R.str()),T.inline!==!0&&T.closeOnTimeSelect===!0&&k.trigger("close.xdsoft"),T.onSelectTime&&$.isFunction(T.onSelectTime)&&T.onSelectTime.call(k,R.currentTime,k.data("input"),e),k.data("changed",!0),k.trigger("xchange.xdsoft"),void k.trigger("changedatetime.xdsoft"))}),S.on("mousewheel.xdsoft",function(e){ -return T.scrollMonth?(e.deltaY<0?R.nextMonth():R.prevMonth(),!1):!0}),e.on("mousewheel.xdsoft",function(t){return T.scrollInput?!T.datepicker&&T.timepicker?(z=Y.find(".xdsoft_current").length?Y.find(".xdsoft_current").eq(0).index():0,z+t.deltaY>=0&&z+t.deltaY$(window).height()+$(window).scrollTop()&&(t=e.top-k[0].offsetHeight+1),0>t&&(t=0),n+k[0].offsetWidth>$(window).width()&&(n=$(window).width()-k[0].offsetWidth)),k.css({left:n,top:t,position:a})},k.on("open.xdsoft",function(e){var t=!0;T.onShow&&$.isFunction(T.onShow)&&(t=T.onShow.call(k,R.currentTime,k.data("input"),e)),t!==!1&&(k.show(),L(),$(window).off("resize.xdsoft",L).on("resize.xdsoft",L),T.closeOnWithoutClick&&$([document.body,window]).on("mousedown.xdsoft",function n(){k.trigger("close.xdsoft"),$([document.body,window]).off("mousedown.xdsoft",n)}))}).on("close.xdsoft",function(e){var t=!0;O.find(".xdsoft_month,.xdsoft_year").find(".xdsoft_select").hide(),T.onClose&&$.isFunction(T.onClose)&&(t=T.onClose.call(k,R.currentTime,k.data("input"),e)),t===!1||T.opened||T.inline||k.hide(),e.stopPropagation()}).on("toggle.xdsoft",function(e){k.is(":visible")?k.trigger("close.xdsoft"):k.trigger("open.xdsoft")}).data("input",e),Q=0,B=0,k.data("xdsoft_datetime",R),k.setOptions(T),R.setCurrentTime(w()),e.data("xdsoft_datetimepicker",k).on("open.xdsoft focusin.xdsoft mousedown.xdsoft",function(t){e.is(":disabled")||e.data("xdsoft_datetimepicker").is(":visible")&&T.closeOnInputClick||(clearTimeout(Q),Q=setTimeout(function(){e.is(":disabled")||(J=!0,R.setCurrentTime(w()),k.trigger("open.xdsoft"))},100))}).on("keydown.xdsoft",function(e){var t=this.value,n,a=e.which;return-1!==[u].indexOf(a)&&T.enterLikeTab?(n=$("input:visible,textarea:visible"),k.trigger("close.xdsoft"),n.eq(n.index(this)+1).focus(),!1):-1!==[g].indexOf(a)?(k.trigger("close.xdsoft"),!0):void 0})},M=function(e){var t=e.data("xdsoft_datetimepicker");t&&(t.data("xdsoft_datetime",null),t.remove(),e.data("xdsoft_datetimepicker",null).off(".xdsoft"),$(window).off("resize.xdsoft"),$([window,document.body]).off("mousedown.xdsoft"),e.unmousewheel&&e.unmousewheel())},$(document).off("keydown.xdsoftctrl keyup.xdsoftctrl").on("keydown.xdsoftctrl",function(e){e.keyCode===o&&(b=!0)}).on("keyup.xdsoftctrl",function(e){e.keyCode===o&&(b=!1)}),this.each(function(){var e=$(this).data("xdsoft_datetimepicker"),n;if(e){if("string"===$.type(t))switch(t){case"show":$(this).select().focus(),e.trigger("open.xdsoft");break;case"hide":e.trigger("close.xdsoft");break;case"toggle":e.trigger("toggle.xdsoft");break;case"destroy":M($(this));break;case"reset":this.value=this.defaultValue,this.value&&e.data("xdsoft_datetime").isValidDate(Date.parseDate(this.value,T.format))||e.data("changed",!1),e.data("xdsoft_datetime").setCurrentTime(this.value);break;case"validate":n=e.data("input"),n.trigger("blur.xdsoft")}else e.setOptions(t);return 0}"string"!==$.type(t)&&(!T.lazyInit||T.open||T.inline?k($(this)):S($(this)))})},$.fn.wpt_datetimepicker.defaults=e}(jQuery),function(){!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e:e(jQuery)}(function(e){function t(t){var o=t||window.event,s=u.call(arguments,1),d=0,c=0,f=0,m=0,h=0,g=0;if(t=e.event.fix(o),t.type="mousewheel","detail"in o&&(f=-1*o.detail),"wheelDelta"in o&&(f=o.wheelDelta),"wheelDeltaY"in o&&(f=o.wheelDeltaY),"wheelDeltaX"in o&&(c=-1*o.wheelDeltaX),"axis"in o&&o.axis===o.HORIZONTAL_AXIS&&(c=-1*f,f=0),d=0===f?c:f,"deltaY"in o&&(f=-1*o.deltaY,d=f),"deltaX"in o&&(c=o.deltaX,0===f&&(d=-1*c)),0!==f||0!==c){if(1===o.deltaMode){var p=e.data(this,"mousewheel-line-height");d*=p,f*=p,c*=p}else if(2===o.deltaMode){var v=e.data(this,"mousewheel-page-height");d*=v,f*=v,c*=v}if(m=Math.max(Math.abs(f),Math.abs(c)),(!i||i>m)&&(i=m,a(o,m)&&(i/=40)),a(o,m)&&(d/=40,c/=40,f/=40),d=Math[d>=1?"floor":"ceil"](d/i),c=Math[c>=1?"floor":"ceil"](c/i),f=Math[f>=1?"floor":"ceil"](f/i),l.settings.normalizeOffset&&this.getBoundingClientRect){var y=this.getBoundingClientRect();h=t.clientX-y.left,g=t.clientY-y.top}return t.deltaX=c,t.deltaY=f,t.deltaFactor=i,t.offsetX=h,t.offsetY=g,t.deltaMode=0,s.unshift(t,d,c,f),r&&clearTimeout(r),r=setTimeout(n,200),(e.event.dispatch||e.event.handle).apply(this,s)}}function n(){i=null}function a(e,t){return l.settings.adjustOldDeltas&&"mousewheel"===e.type&&t%120===0}var r,i,o=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],s="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],u=Array.prototype.slice;if(e.event.fixHooks)for(var d=o.length;d;)e.event.fixHooks[o[--d]]=e.event.mouseHooks;var l=e.event.special.mousewheel={version:"3.1.12",setup:function(){if(this.addEventListener)for(var n=s.length;n;)this.addEventListener(s[--n],t,!1);else this.onmousewheel=t;e.data(this,"mousewheel-line-height",l.getLineHeight(this)),e.data(this,"mousewheel-page-height",l.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var n=s.length;n;)this.removeEventListener(s[--n],t,!1);else this.onmousewheel=null;e.removeData(this,"mousewheel-line-height"),e.removeData(this,"mousewheel-page-height")},getLineHeight:function(t){var n=e(t),a=n["offsetParent"in e.fn?"offsetParent":"parent"]();return a.length||(a=e("body")),parseInt(a.css("fontSize"),10)||parseInt(n.css("fontSize"),10)||16},getPageHeight:function(t){return e(t).height()},settings:{adjustOldDeltas:!0,normalizeOffset:!0}};e.fn.extend({mousewheel:function(e){return e?this.bind("mousewheel",e):this.trigger("mousewheel")},unmousewheel:function(e){return this.unbind("mousewheel",e)}})}),Date.parseFunctions={count:0},Date.parseRegexes=[],Date.formatFunctions={count:0},Date.prototype.dateFormat=function(e){if("unixtime"==e)return parseInt(this.getTime()/1e3);null==Date.formatFunctions[e]&&Date.createNewFormat(e);var t=Date.formatFunctions[e];return this[t]()},Date.createNewFormat=function(format){var funcName="format"+Date.formatFunctions.count++;Date.formatFunctions[format]=funcName;for(var codePrefix="Date.prototype."+funcName+" = function() {return ",code="",special=!1,ch="",i=0;i 0) {",regex="",special=!1,ch="",i=0;i 0 && z > 0){\nvar doyDate = new Date(y,0);\ndoyDate.setDate(z);\nm = doyDate.getMonth();\nd = doyDate.getDate();\n}",code+="if (y > 0 && m >= 0 && d > 0 && h >= 0 && i >= 0 && s >= 0)\n{return new Date(y, m, d, h, i, s);}\nelse if (y > 0 && m >= 0 && d > 0 && h >= 0 && i >= 0)\n{return new Date(y, m, d, h, i);}\nelse if (y > 0 && m >= 0 && d > 0 && h >= 0)\n{return new Date(y, m, d, h);}\nelse if (y > 0 && m >= 0 && d > 0)\n{return new Date(y, m, d);}\nelse if (y > 0 && m >= 0)\n{return new Date(y, m);}\nelse if (y > 0)\n{return new Date(y);}\n}return null;}",Date.parseRegexes[regexNum]=new RegExp("^"+regex+"$","i"),eval(code)},Date.formatCodeToRegex=function(e,t){switch(e){case"D":return{g:0,c:null,s:"(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)"};case"j":case"d":return{g:1,c:"d = parseInt(results["+t+"], 10);\n",s:"(\\d{1,2})"};case"l":return{g:0,c:null,s:"(?:"+Date.dayNames.join("|")+")"};case"S":return{g:0,c:null,s:"(?:st|nd|rd|th)"};case"w":return{g:0,c:null,s:"\\d"};case"z":return{g:1,c:"z = parseInt(results["+t+"], 10);\n",s:"(\\d{1,3})"};case"W":return{g:0,c:null,s:"(?:\\d{2})"};case"F":return{g:1,c:"m = parseInt(Date.monthNumbers[results["+t+"].substring(0, 3)], 10);\n",s:"("+Date.monthNames.join("|")+")"};case"M":return{g:1,c:"m = parseInt(Date.monthNumbers[results["+t+"]], 10);\n",s:"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)"};case"n":case"m":return{g:1,c:"m = parseInt(results["+t+"], 10) - 1;\n",s:"(\\d{1,2})"};case"t":return{g:0,c:null,s:"\\d{1,2}"};case"L":return{g:0,c:null,s:"(?:1|0)"};case"Y":return{g:1,c:"y = parseInt(results["+t+"], 10);\n",s:"(\\d{4})"};case"y":return{g:1,c:"var ty = parseInt(results["+t+"], 10);\ny = ty > Date.y2kYear ? 1900 + ty : 2000 + ty;\n",s:"(\\d{1,2})"};case"a":return{g:1,c:"if (results["+t+"] == 'am') {\nif (h == 12) { h = 0; }\n} else { if (h < 12) { h += 12; }}",s:"(am|pm)"};case"A":return{g:1,c:"if (results["+t+"] == 'AM') {\nif (h == 12) { h = 0; }\n} else { if (h < 12) { h += 12; }}",s:"(AM|PM)"};case"g":case"G":case"h":case"H":return{g:1,c:"h = parseInt(results["+t+"], 10);\n",s:"(\\d{1,2})"};case"i":return{g:1,c:"i = parseInt(results["+t+"], 10);\n",s:"(\\d{2})"};case"s":return{g:1,c:"s = parseInt(results["+t+"], 10);\n",s:"(\\d{2})"};case"O":return{g:0,c:null,s:"[+-]\\d{4}"};case"T":return{g:0,c:null,s:"[A-Z]{3}"};case"Z":return{g:0,c:null,s:"[+-]\\d{1,5}"};default:return{g:0,c:null,s:String.escape(e)}}},Date.prototype.getTimezone=function(){return this.toString().replace(/^.*? ([A-Z]{3}) [0-9]{4}.*$/,"$1").replace(/^.*?\(([A-Z])[a-z]+ ([A-Z])[a-z]+ ([A-Z])[a-z]+\)$/,"$1$2$3")},Date.prototype.getGMTOffset=function(){return(this.getTimezoneOffset()>0?"-":"+")+String.leftPad(Math.floor(Math.abs(this.getTimezoneOffset())/60),2,"0")+String.leftPad(Math.abs(this.getTimezoneOffset())%60,2,"0")},Date.prototype.getDayOfYear=function(){var e=0;Date.daysInMonth[1]=this.isLeapYear()?29:28;for(var t=0;te?e+7:e},Date.prototype.getLastDayOfMonth=function(){var e=(this.getDay()+(Date.daysInMonth[this.getMonth()]-this.getDate()))%7;return 0>e?e+7:e},Date.prototype.getDaysInMonth=function(){return Date.daysInMonth[1]=this.isLeapYear()?29:28,Date.daysInMonth[this.getMonth()]},Date.prototype.getSuffix=function(){switch(this.getDate()){case 1:case 21:case 31:return"st";case 2:case 22:return"nd";case 3:case 23:return"rd";default:return"th"}},String.escape=function(e){return e.replace(/('|\\)/g,"\\$1")},String.leftPad=function(e,t,n){var a=new String(e);for(null==n&&(n=" ");a.lengtha)?(a=new Date(t.getTime()+1e3*wpt_event_editor_defaults.duration),e.enddate.val(a.dateFormat(wpt_event_editor_defaults.datetime_format))):void 0}}(this)}),this.enddate.wpt_datetimepicker({format:wpt_event_editor_defaults.datetime_format,step:15})},e.prototype.init_delete_links=function(){return jQuery(".wpt_event_editor_listing_action_delete").unbind("click").click(function(e){return function(t){var n;return confirm(wpt_event_editor_defaults.confirm_delete_message)&&(n={action:"wpt_event_editor_delete_event",event_id:jQuery(t.currentTarget).parents("tr").data("event_id"),nonce:wpt_event_editor_security.nonce},jQuery(".wpt_event_editor_listing").load(ajaxurl,n,function(){return e.init_delete_links()})),!1}}(this))},e.prototype.init_create=function(){var e,t,n;return this.create=jQuery(".wpt_event_editor_create"),t=this.create.find(".wpt_event_editor_create_open"),t.click(function(e){return function(){return e.create.addClass("open"),!1}}(this)),e=this.create.find(".wpt_event_editor_create_cancel"),e.click(function(e){return function(){return e.create.removeClass("open"),!1}}(this)),n=this.create.find(".wpt_event_editor_create_save"),n.click(function(e){return function(){var t,n;return n=jQuery("#post"),t={action:"wpt_event_editor_create_event",post_data:n.serialize(),nonce:wpt_event_editor_security.nonce},jQuery(".wpt_event_editor_listing").load(ajaxurl,t,function(){return e.init_delete_links(),e.create.removeClass("open"),e.reset_create_form()}),!1}}(this))},e.prototype.reset_create_form=function(){var e,t;return e=this.create.find(".wpt_event_editor_create_form"),t={action:"wpt_event_editor_reset_create_form",production_id:jQuery("#post_ID").val(),nonce:wpt_event_editor_security.nonce},e.load(ajaxurl,t,function(e){return function(){return e.init_datetime_inputs()}}(this))},e}(),jQuery(function(){return new wpt_event_editor}),jQuery(function(){var e;return e=jQuery("input[name=wpt_production_permalink_custom_base]"),e.focus(function(){var e;return e=jQuery("input[name=wpt_production_permalink_base][value=custom]"),e.prop("checked",!0)})}),wpt_admin_ticketspage=function(){function e(){this.ticketspage=jQuery("select#iframepage").parents("tr"),this.integrationstypes=jQuery("input[name='wpt_tickets[integrationtype]']"),this.ticketspage.length>0&&this.integrationstypes.length>0&&(this.update(),this.integrationstypes.click(function(e){return function(){return e.update()}}(this)))}return e.prototype.update=function(){var e;return e=jQuery("input[name='wpt_tickets[integrationtype]']:checked").val(),"iframe"===e?this.ticketspage.show(1e3):this.ticketspage.hide(500)},e}(),jQuery(function(){return jQuery("#bulk_edit").live("click",function(){var e,t,n;return e=jQuery("#bulk-edit"),t=new Array,e.find("#bulk-titles").children().each(function(){return t.push(jQuery(this).attr("id").replace(/^(ttle)/i,""))}),n=e.find('select[name="_status"]').val(),jQuery.ajax({url:ajaxurl,type:"POST",async:!1,cache:!1,data:{action:"save_bulk_edit_wp_theatre_prod",post_ids:t,post_status:n}})})})}).call(this); \ No newline at end of file +return T.scrollMonth?(e.deltaY<0?R.nextMonth():R.prevMonth(),!1):!0}),e.on("mousewheel.xdsoft",function(t){return T.scrollInput?!T.datepicker&&T.timepicker?(z=Y.find(".xdsoft_current").length?Y.find(".xdsoft_current").eq(0).index():0,z+t.deltaY>=0&&z+t.deltaY$(window).height()+$(window).scrollTop()&&(t=e.top-k[0].offsetHeight+1),0>t&&(t=0),n+k[0].offsetWidth>$(window).width()&&(n=$(window).width()-k[0].offsetWidth)),k.css({left:n,top:t,position:a})},k.on("open.xdsoft",function(e){var t=!0;T.onShow&&$.isFunction(T.onShow)&&(t=T.onShow.call(k,R.currentTime,k.data("input"),e)),t!==!1&&(k.show(),L(),$(window).off("resize.xdsoft",L).on("resize.xdsoft",L),T.closeOnWithoutClick&&$([document.body,window]).on("mousedown.xdsoft",function n(){k.trigger("close.xdsoft"),$([document.body,window]).off("mousedown.xdsoft",n)}))}).on("close.xdsoft",function(e){var t=!0;O.find(".xdsoft_month,.xdsoft_year").find(".xdsoft_select").hide(),T.onClose&&$.isFunction(T.onClose)&&(t=T.onClose.call(k,R.currentTime,k.data("input"),e)),t===!1||T.opened||T.inline||k.hide(),e.stopPropagation()}).on("toggle.xdsoft",function(e){k.is(":visible")?k.trigger("close.xdsoft"):k.trigger("open.xdsoft")}).data("input",e),Q=0,B=0,k.data("xdsoft_datetime",R),k.setOptions(T),R.setCurrentTime(w()),e.data("xdsoft_datetimepicker",k).on("open.xdsoft focusin.xdsoft mousedown.xdsoft",function(t){e.is(":disabled")||e.data("xdsoft_datetimepicker").is(":visible")&&T.closeOnInputClick||(clearTimeout(Q),Q=setTimeout(function(){e.is(":disabled")||(J=!0,R.setCurrentTime(w()),k.trigger("open.xdsoft"))},100))}).on("keydown.xdsoft",function(e){var t=this.value,n,a=e.which;return-1!==[u].indexOf(a)&&T.enterLikeTab?(n=$("input:visible,textarea:visible"),k.trigger("close.xdsoft"),n.eq(n.index(this)+1).focus(),!1):-1!==[g].indexOf(a)?(k.trigger("close.xdsoft"),!0):void 0})},M=function(e){var t=e.data("xdsoft_datetimepicker");t&&(t.data("xdsoft_datetime",null),t.remove(),e.data("xdsoft_datetimepicker",null).off(".xdsoft"),$(window).off("resize.xdsoft"),$([window,document.body]).off("mousedown.xdsoft"),e.unmousewheel&&e.unmousewheel())},$(document).off("keydown.xdsoftctrl keyup.xdsoftctrl").on("keydown.xdsoftctrl",function(e){e.keyCode===o&&(b=!0)}).on("keyup.xdsoftctrl",function(e){e.keyCode===o&&(b=!1)}),this.each(function(){var e=$(this).data("xdsoft_datetimepicker"),n;if(e){if("string"===$.type(t))switch(t){case"show":$(this).select().focus(),e.trigger("open.xdsoft");break;case"hide":e.trigger("close.xdsoft");break;case"toggle":e.trigger("toggle.xdsoft");break;case"destroy":M($(this));break;case"reset":this.value=this.defaultValue,this.value&&e.data("xdsoft_datetime").isValidDate(Date.parseDate(this.value,T.format))||e.data("changed",!1),e.data("xdsoft_datetime").setCurrentTime(this.value);break;case"validate":n=e.data("input"),n.trigger("blur.xdsoft")}else e.setOptions(t);return 0}"string"!==$.type(t)&&(!T.lazyInit||T.open||T.inline?k($(this)):S($(this)))})},$.fn.wpt_datetimepicker.defaults=e}(jQuery),function(){!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e:e(jQuery)}(function(e){function t(t){var o=t||window.event,s=u.call(arguments,1),d=0,c=0,f=0,m=0,h=0,g=0;if(t=e.event.fix(o),t.type="mousewheel","detail"in o&&(f=-1*o.detail),"wheelDelta"in o&&(f=o.wheelDelta),"wheelDeltaY"in o&&(f=o.wheelDeltaY),"wheelDeltaX"in o&&(c=-1*o.wheelDeltaX),"axis"in o&&o.axis===o.HORIZONTAL_AXIS&&(c=-1*f,f=0),d=0===f?c:f,"deltaY"in o&&(f=-1*o.deltaY,d=f),"deltaX"in o&&(c=o.deltaX,0===f&&(d=-1*c)),0!==f||0!==c){if(1===o.deltaMode){var p=e.data(this,"mousewheel-line-height");d*=p,f*=p,c*=p}else if(2===o.deltaMode){var v=e.data(this,"mousewheel-page-height");d*=v,f*=v,c*=v}if(m=Math.max(Math.abs(f),Math.abs(c)),(!i||i>m)&&(i=m,a(o,m)&&(i/=40)),a(o,m)&&(d/=40,c/=40,f/=40),d=Math[d>=1?"floor":"ceil"](d/i),c=Math[c>=1?"floor":"ceil"](c/i),f=Math[f>=1?"floor":"ceil"](f/i),l.settings.normalizeOffset&&this.getBoundingClientRect){var y=this.getBoundingClientRect();h=t.clientX-y.left,g=t.clientY-y.top}return t.deltaX=c,t.deltaY=f,t.deltaFactor=i,t.offsetX=h,t.offsetY=g,t.deltaMode=0,s.unshift(t,d,c,f),r&&clearTimeout(r),r=setTimeout(n,200),(e.event.dispatch||e.event.handle).apply(this,s)}}function n(){i=null}function a(e,t){return l.settings.adjustOldDeltas&&"mousewheel"===e.type&&t%120===0}var r,i,o=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],s="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],u=Array.prototype.slice;if(e.event.fixHooks)for(var d=o.length;d;)e.event.fixHooks[o[--d]]=e.event.mouseHooks;var l=e.event.special.mousewheel={version:"3.1.12",setup:function(){if(this.addEventListener)for(var n=s.length;n;)this.addEventListener(s[--n],t,!1);else this.onmousewheel=t;e.data(this,"mousewheel-line-height",l.getLineHeight(this)),e.data(this,"mousewheel-page-height",l.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var n=s.length;n;)this.removeEventListener(s[--n],t,!1);else this.onmousewheel=null;e.removeData(this,"mousewheel-line-height"),e.removeData(this,"mousewheel-page-height")},getLineHeight:function(t){var n=e(t),a=n["offsetParent"in e.fn?"offsetParent":"parent"]();return a.length||(a=e("body")),parseInt(a.css("fontSize"),10)||parseInt(n.css("fontSize"),10)||16},getPageHeight:function(t){return e(t).height()},settings:{adjustOldDeltas:!0,normalizeOffset:!0}};e.fn.extend({mousewheel:function(e){return e?this.bind("mousewheel",e):this.trigger("mousewheel")},unmousewheel:function(e){return this.unbind("mousewheel",e)}})}),Date.parseFunctions={count:0},Date.parseRegexes=[],Date.formatFunctions={count:0},Date.prototype.dateFormat=function(e){if("unixtime"==e)return parseInt(this.getTime()/1e3);null==Date.formatFunctions[e]&&Date.createNewFormat(e);var t=Date.formatFunctions[e];return this[t]()},Date.createNewFormat=function(format){var funcName="format"+Date.formatFunctions.count++;Date.formatFunctions[format]=funcName;for(var codePrefix="Date.prototype."+funcName+" = function() {return ",code="",special=!1,ch="",i=0;i 0) {",regex="",special=!1,ch="",i=0;i 0 && z > 0){\nvar doyDate = new Date(y,0);\ndoyDate.setDate(z);\nm = doyDate.getMonth();\nd = doyDate.getDate();\n}",code+="if (y > 0 && m >= 0 && d > 0 && h >= 0 && i >= 0 && s >= 0)\n{return new Date(y, m, d, h, i, s);}\nelse if (y > 0 && m >= 0 && d > 0 && h >= 0 && i >= 0)\n{return new Date(y, m, d, h, i);}\nelse if (y > 0 && m >= 0 && d > 0 && h >= 0)\n{return new Date(y, m, d, h);}\nelse if (y > 0 && m >= 0 && d > 0)\n{return new Date(y, m, d);}\nelse if (y > 0 && m >= 0)\n{return new Date(y, m);}\nelse if (y > 0)\n{return new Date(y);}\n}return null;}",Date.parseRegexes[regexNum]=new RegExp("^"+regex+"$","i"),eval(code)},Date.formatCodeToRegex=function(e,t){switch(e){case"D":return{g:0,c:null,s:"(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)"};case"j":case"d":return{g:1,c:"d = parseInt(results["+t+"], 10);\n",s:"(\\d{1,2})"};case"l":return{g:0,c:null,s:"(?:"+Date.dayNames.join("|")+")"};case"S":return{g:0,c:null,s:"(?:st|nd|rd|th)"};case"w":return{g:0,c:null,s:"\\d"};case"z":return{g:1,c:"z = parseInt(results["+t+"], 10);\n",s:"(\\d{1,3})"};case"W":return{g:0,c:null,s:"(?:\\d{2})"};case"F":return{g:1,c:"m = parseInt(Date.monthNumbers[results["+t+"].substring(0, 3)], 10);\n",s:"("+Date.monthNames.join("|")+")"};case"M":return{g:1,c:"m = parseInt(Date.monthNumbers[results["+t+"]], 10);\n",s:"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)"};case"n":case"m":return{g:1,c:"m = parseInt(results["+t+"], 10) - 1;\n",s:"(\\d{1,2})"};case"t":return{g:0,c:null,s:"\\d{1,2}"};case"L":return{g:0,c:null,s:"(?:1|0)"};case"Y":return{g:1,c:"y = parseInt(results["+t+"], 10);\n",s:"(\\d{4})"};case"y":return{g:1,c:"var ty = parseInt(results["+t+"], 10);\ny = ty > Date.y2kYear ? 1900 + ty : 2000 + ty;\n",s:"(\\d{1,2})"};case"a":return{g:1,c:"if (results["+t+"] == 'am') {\nif (h == 12) { h = 0; }\n} else { if (h < 12) { h += 12; }}",s:"(am|pm)"};case"A":return{g:1,c:"if (results["+t+"] == 'AM') {\nif (h == 12) { h = 0; }\n} else { if (h < 12) { h += 12; }}",s:"(AM|PM)"};case"g":case"G":case"h":case"H":return{g:1,c:"h = parseInt(results["+t+"], 10);\n",s:"(\\d{1,2})"};case"i":return{g:1,c:"i = parseInt(results["+t+"], 10);\n",s:"(\\d{2})"};case"s":return{g:1,c:"s = parseInt(results["+t+"], 10);\n",s:"(\\d{2})"};case"O":return{g:0,c:null,s:"[+-]\\d{4}"};case"T":return{g:0,c:null,s:"[A-Z]{3}"};case"Z":return{g:0,c:null,s:"[+-]\\d{1,5}"};default:return{g:0,c:null,s:String.escape(e)}}},Date.prototype.getTimezone=function(){return this.toString().replace(/^.*? ([A-Z]{3}) [0-9]{4}.*$/,"$1").replace(/^.*?\(([A-Z])[a-z]+ ([A-Z])[a-z]+ ([A-Z])[a-z]+\)$/,"$1$2$3")},Date.prototype.getGMTOffset=function(){return(this.getTimezoneOffset()>0?"-":"+")+String.leftPad(Math.floor(Math.abs(this.getTimezoneOffset())/60),2,"0")+String.leftPad(Math.abs(this.getTimezoneOffset())%60,2,"0")},Date.prototype.getDayOfYear=function(){var e=0;Date.daysInMonth[1]=this.isLeapYear()?29:28;for(var t=0;te?e+7:e},Date.prototype.getLastDayOfMonth=function(){var e=(this.getDay()+(Date.daysInMonth[this.getMonth()]-this.getDate()))%7;return 0>e?e+7:e},Date.prototype.getDaysInMonth=function(){return Date.daysInMonth[1]=this.isLeapYear()?29:28,Date.daysInMonth[this.getMonth()]},Date.prototype.getSuffix=function(){switch(this.getDate()){case 1:case 21:case 31:return"st";case 2:case 22:return"nd";case 3:case 23:return"rd";default:return"th"}},String.escape=function(e){return e.replace(/('|\\)/g,"\\$1")},String.leftPad=function(e,t,n){var a=new String(e);for(null==n&&(n=" ");a.lengtha)?(a=new Date(t.getTime()+1e3*wpt_event_editor_defaults.duration),e.enddate.val(a.dateFormat(wpt_event_editor_defaults.datetime_format))):void 0}}(this)}),this.enddate.wpt_datetimepicker({format:wpt_event_editor_defaults.datetime_format,step:15})},e.prototype.init_delete_links=function(){return jQuery(".wpt_event_editor_listing_action_delete").unbind("click").click(function(e){return function(t){var n;return confirm(wpt_event_editor_defaults.confirm_delete_message)&&(n={action:"wpt_event_editor_delete_event",event_id:jQuery(t.currentTarget).parents("tr").data("event_id"),nonce:wpt_event_editor_security.nonce},jQuery(".wpt_event_editor_listing").load(ajaxurl,n,function(){return e.init_delete_links()})),!1}}(this))},e.prototype.init_create=function(){var e,t,n;return this.create=jQuery(".wpt_event_editor_create"),t=this.create.find(".wpt_event_editor_create_open"),t.click(function(e){return function(){return e.create.addClass("open"),!1}}(this)),e=this.create.find(".wpt_event_editor_create_cancel"),e.click(function(e){return function(){return e.create.removeClass("open"),!1}}(this)),n=this.create.find(".wpt_event_editor_create_save"),n.click(function(e){return function(){var t,n;return n=jQuery("#post"),t={action:"wpt_event_editor_create_event",post_data:n.serialize(),nonce:wpt_event_editor_security.nonce},jQuery(".wpt_event_editor_listing").load(ajaxurl,t,function(){return e.init_delete_links(),e.create.removeClass("open"),e.reset_create_form()}),!1}}(this))},e.prototype.reset_create_form=function(){var e,t;return e=this.create.find(".wpt_event_editor_create_form"),t={action:"wpt_event_editor_reset_create_form",production_id:jQuery("#post_ID").val(),nonce:wpt_event_editor_security.nonce},e.load(ajaxurl,t,function(e){return function(){return e.init_datetime_inputs()}}(this))},e}(),jQuery(function(){return new wpt_event_editor}),jQuery(function(){var e;return e=jQuery("input[name=wpt_production_permalink_custom_base]"),e.focus(function(){var e;return e=jQuery("input[name=wpt_production_permalink_base][value=custom]"),e.prop("checked",!0)})}),wpt_admin_ticketspage=function(){function e(){this.ticketspage=jQuery("select#iframepage").parents("tr"),this.integrationstypes=jQuery("input[name='wpt_tickets[integrationtype]']"),this.ticketspage.length>0&&this.integrationstypes.length>0&&(this.update(),this.integrationstypes.click(function(e){return function(){return e.update()}}(this)))}return e.prototype.update=function(){var e;return e=jQuery("input[name='wpt_tickets[integrationtype]']:checked").val(),"iframe"===e?this.ticketspage.show(1e3):this.ticketspage.hide(500)},e}()}).call(this); \ No newline at end of file diff --git a/raw/coffee/admin.coffee b/raw/coffee/admin.coffee index fa8989ca..40d6b3f3 100644 --- a/raw/coffee/admin.coffee +++ b/raw/coffee/admin.coffee @@ -1,4 +1,5 @@ # @codekit-prepend '../js/jquery.datetimepicker.js' +# @codekit-prepend 'wpt_bulk_editor.coffee' # @codekit-prepend 'wpt_event_editor.coffee' # @codekit-prepend 'wpt_production_permalink.coffee' @@ -17,27 +18,3 @@ class wpt_admin_ticketspage else @.ticketspage.hide(500) -jQuery -> - ### - Update all connected events when bulk updating productions. - See: http://codex.wordpress.org/Plugin_API/Action_Reference/bulk_edit_custom_box - ### - jQuery('#bulk_edit').live 'click', () -> - # define the bulk edit row - bulk_row = jQuery '#bulk-edit' - # get the selected post ids that are being edited - post_ids = new Array() - bulk_row.find( '#bulk-titles' ).children().each () -> - post_ids.push jQuery(@).attr( 'id' ).replace( /^(ttle)/i, '' ) - # get the data - post_status = bulk_row.find( 'select[name="_status"]' ).val(); - # save the data - jQuery.ajax - url: ajaxurl - type: 'POST' - async: false - cache: false - data: - action: 'save_bulk_edit_wp_theatre_prod' - post_ids: post_ids - post_status: post_status diff --git a/raw/coffee/wpt_bulk_editor.coffee b/raw/coffee/wpt_bulk_editor.coffee new file mode 100644 index 00000000..ebf0d5b9 --- /dev/null +++ b/raw/coffee/wpt_bulk_editor.coffee @@ -0,0 +1,27 @@ +jQuery -> + ### + Update all connected events when bulk updating productions. + See: http://codex.wordpress.org/Plugin_API/Action_Reference/bulk_edit_custom_box + ### + jQuery( '#bulk_edit' ).live 'click', () -> + bulk_row = jQuery '#bulk-edit' + # get the selected post ids that are being edited + post_ids = new Array() + bulk_row.find( '#bulk-titles' ).children().each () -> + post_ids.push jQuery(@).attr( 'id' ).replace( /^(ttle)/i, '' ) + + # get the data + post_status = bulk_row.find( 'select[name="_status"]' ).val(); + + # save the data + jQuery.ajax + url: ajaxurl + type: 'POST' + async: false + cache: false + data: + action: 'wpt_bulk_editor' + post_ids: post_ids + post_status: post_status + wpt_bulk_editor_ajax_nonce: wpt_bulk_editor_security.nonce + diff --git a/tests/test_bulk_editor.php b/tests/test_bulk_editor.php new file mode 100644 index 00000000..e7772f46 --- /dev/null +++ b/tests/test_bulk_editor.php @@ -0,0 +1,80 @@ + WPT_Event::post_type_name, + ); + return $this->factory->post->create( $event_args ); + } + + function create_event_for_production($production_id) { + $event_id = $this->create_event(); + add_post_meta( $event_id, WPT_Production::post_type_name, $production_id, true ); + return $event_id; + } + + function create_production() { + $production_args = array( + 'post_type' => WPT_Production::post_type_name, + ); + return $this->factory->post->create( $production_args ); + } + + function test_events_inherit_production_status_in_bulk() { + global $wp_theatre; + + $production1 = $this->create_production(); + wp_update_post( + array( + 'ID' => $production1, + 'post_status' => 'draft', + ) + ); + + $event1 = $this->create_event_for_production( $production1 ); + wp_update_post( + array( + 'ID' => $event1, + 'post_status' => 'draft', + ) + ); + + $production2 = $this->create_production(); + wp_update_post( + array( + 'ID' => $production2, + 'post_status' => 'draft', + ) + ); + + $event2 = $this->create_event_for_production( $production2 ); + wp_update_post( + array( + 'ID' => $event2, + 'post_status' => 'draft', + ) + ); + + $_POST = array( + 'wpt_bulk_editor_ajax_nonce' => wp_create_nonce( 'wpt_bulk_editor_ajax_nonce' ), + 'post_ids' => array( $production1, $production2 ), + 'post_status' => 'publish', + ); + + try { + $this->_handleAjax( 'wpt_bulk_editor' ); + } catch ( WPAjaxDieContinueException $e ) { + // We expected this, do nothing. + } + + // Expect 2 upcoming and published events. + $this->assertCount( 2, $wp_theatre->events->get() ); + } + +} + diff --git a/theater.php b/theater.php index 14f7bdd2..498d8ac2 100644 --- a/theater.php +++ b/theater.php @@ -54,6 +54,7 @@ function __construct() { $this->event_editor = new WPT_Event_Editor(); $this->cart = new WPT_Cart(); $this->production_permalink = new WPT_Production_Permalink(); + $this->bulk_editor = new WPT_Bulk_Editor(); if (is_admin()) { } else { $this->frontend = new WPT_Frontend(); @@ -109,6 +110,7 @@ function includes() { require_once(dirname(__FILE__) . '/functions/wpt_importer.php'); require_once(dirname(__FILE__) . '/functions/wpt_cart.php'); require_once(dirname(__FILE__) . '/functions/wpt_production_permalink.php'); + require_once(dirname(__FILE__) . '/functions/wpt_bulk_editor.php'); if (is_admin()) { } else { require_once(dirname(__FILE__) . '/functions/wpt_frontend.php');