From 01ec7ce7979194e0075e49b3fa321704a36c919b Mon Sep 17 00:00:00 2001 From: Robb Ebright Date: Tue, 28 Nov 2017 15:12:27 -0500 Subject: [PATCH 1/6] inital attempt to add autoplaylist icon to calendar --- airtime_mvc/application/models/Show.php | 8 ++++ .../application/models/ShowInstance.php | 24 +++++++++++ .../schedule/full-calendar-functions.js | 40 +++++++++++++++---- 3 files changed, 65 insertions(+), 7 deletions(-) diff --git a/airtime_mvc/application/models/Show.php b/airtime_mvc/application/models/Show.php index d36949953..45100eb66 100644 --- a/airtime_mvc/application/models/Show.php +++ b/airtime_mvc/application/models/Show.php @@ -1023,6 +1023,8 @@ SQL; $content_count = Application_Model_ShowInstance::getContentCount( $p_start, $p_end); $isFull = Application_Model_ShowInstance::getIsFull($p_start, $p_end); + $hasAutoPlaylist = Application_Model_ShowInstance::getShowHasAutoplaylist($p_start, $p_end); + $displayTimezone = new DateTimeZone(Application_Model_Preference::GetUserTimezone()); $utcTimezone = new DateTimeZone("UTC"); @@ -1055,6 +1057,7 @@ SQL; $startsDT->setTimezone($displayTimezone); $endsDT->setTimezone($displayTimezone); + xdebug_break(); $options["show_empty"] = (array_key_exists($show['instance_id'], $content_count)) ? 0 : 1; @@ -1064,6 +1067,11 @@ SQL; } else { $options["show_partial_filled"] = true; } + if (array_key_exists($show['instance_id'], $hasAutoPlaylist)) { + $options["show_has_auto_playlist"] = !$hasAutoPlaylist[$show['instance_id']]; + } else { + $options["show_has_auto_playlist"] = true; + } $event = array(); diff --git a/airtime_mvc/application/models/ShowInstance.php b/airtime_mvc/application/models/ShowInstance.php index bd6f8862e..313c2b059 100644 --- a/airtime_mvc/application/models/ShowInstance.php +++ b/airtime_mvc/application/models/ShowInstance.php @@ -238,6 +238,7 @@ SQL; $id = $this->_showInstance->getDbId(); $lastid = $this->getLastAudioItemId(); // Logging::info("The last id is $lastid"); + xdebug_break(); $scheduler = new Application_Model_Scheduler($checkUserPerm); $scheduler->scheduleAfter( @@ -290,7 +291,9 @@ SQL; } private function checkToDeleteShow($showId) + { + xdebug_break(); //UTC DateTime object $showsPopUntil = Application_Model_Preference::GetShowsPopulatedUntil(); @@ -556,6 +559,27 @@ SQL; return $isFilled; } + public static function getShowHasAutoplaylist($p_start, $p_end) + { + $sql = << :p_start::TIMESTAMP +AND starts < :p_end::TIMESTAMP +SQL; + $res = Application_Common_Database::prepareAndExecute($sql, array( + ':p_start' => $p_start->format("Y-m-d G:i:s"), + ':p_end' => $p_end->format("Y-m-d G:i:s")) + , 'all'); + $hasAutoplaylist = array(); + foreach ($res as $r) { + $hasAutoplaylist[$r['id']] = $r['has_autoplaylist']; + } + + return $hasAutoplaylist; + } + public function showEmpty() { $sql = <<'); - } else { + // in theory a linked show shouldn't have an automatic playlist so adding this here + } else if (event.show_has_auto_playlist === true) { + $(element) + .find(".fc-event-time") + .before(''); + } + else { $(element) .find(".fc-event-time") .before(''); @@ -224,7 +230,11 @@ function eventRender(event, element, view) { $(element) .find(".fc-event-time") .before(''); - } else { + } else if (event.show_has_auto_playlist === true) { + $(element) + .find(".fc-event-time") + .before(''); + } else { $(element) .find(".fc-event-time") .before(''); @@ -234,26 +244,38 @@ function eventRender(event, element, view) { $(element) .find(".fc-event-time") .before(''); + } else if (event.show_has_auto_playlist === true) { + $(element) + .find(".fc-event-time") + .before(''); } } } else if (view.name === 'month') { if (event.show_empty === 1) { if (event.linked) { - $(element) + $(element) .find(".fc-event-title") .after(''); + } else if (event.show_has_auto_playlist === true) { + $(element) + .find(".fc-event-title") + .after(''); } else { - $(element) + $(element) .find(".fc-event-title") .after(''); } } else if (event.show_partial_filled === true) { if (event.linked) { $(element) - .find(".fc-event-title") - .after(''); + .find(".fc-event-title") + .after(''); + } else if (event.show_has_auto_playlist === true) { + $(element) + .find(".fc-event-title") + .after(''); } else { - $(element) + $(element) .find(".fc-event-title") .after(''); } @@ -262,6 +284,10 @@ function eventRender(event, element, view) { $(element) .find(".fc-event-title") .after(''); + } else if (event.show_has_auto_playlist === true) { + $(element) + .find(".fc-event-title") + .after(''); } } } From a294d663834605f685ae55cfa176d716515f0c76 Mon Sep 17 00:00:00 2001 From: Robb Ebright Date: Wed, 29 Nov 2017 07:10:25 -0500 Subject: [PATCH 2/6] adding autoplaylist icon --- .../css/images/icon_alert_cal_autoplaylist.png | Bin 0 -> 568 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 airtime_mvc/public/css/images/icon_alert_cal_autoplaylist.png diff --git a/airtime_mvc/public/css/images/icon_alert_cal_autoplaylist.png b/airtime_mvc/public/css/images/icon_alert_cal_autoplaylist.png new file mode 100644 index 0000000000000000000000000000000000000000..44e56e0d3aa6b0c2a712fef3c58779231b66c053 GIT binary patch literal 568 zcmV-80>}M{P)2rnYWKB31(`idyJUj^IVy0shDcK*@)ezry*~>!qGC6Q#ACadJhG6YpoxxWh zx9(#dPQO29oOmwR7i-F#NWO7f-hwcNHGVlIq@^KZfDY1>guPIub7nP~3g@rHuLq)1 zsl;@l$A5**)KaVPsOdJY@jq%RKK<-!_U408l8)W&jQ<8WH_j_5SJbQk0000 Date: Sun, 17 Dec 2017 10:47:38 -0500 Subject: [PATCH 3/6] Removed debug code and rewrote SQL as ORM query and readded icon image file --- airtime_mvc/application/models/Show.php | 1 - .../application/models/ShowInstance.php | 35 ++++++++---------- .../images/icon_alert_cal_autoplaylist.png | Bin 568 -> 571 bytes 3 files changed, 15 insertions(+), 21 deletions(-) diff --git a/airtime_mvc/application/models/Show.php b/airtime_mvc/application/models/Show.php index 45100eb66..692a6b387 100644 --- a/airtime_mvc/application/models/Show.php +++ b/airtime_mvc/application/models/Show.php @@ -1057,7 +1057,6 @@ SQL; $startsDT->setTimezone($displayTimezone); $endsDT->setTimezone($displayTimezone); - xdebug_break(); $options["show_empty"] = (array_key_exists($show['instance_id'], $content_count)) ? 0 : 1; diff --git a/airtime_mvc/application/models/ShowInstance.php b/airtime_mvc/application/models/ShowInstance.php index 313c2b059..c219637fa 100644 --- a/airtime_mvc/application/models/ShowInstance.php +++ b/airtime_mvc/application/models/ShowInstance.php @@ -237,9 +237,6 @@ SQL; $ts = intval($this->_showInstance->getDbLastScheduled("U")) ? : 0; $id = $this->_showInstance->getDbId(); $lastid = $this->getLastAudioItemId(); -// Logging::info("The last id is $lastid"); - xdebug_break(); - $scheduler = new Application_Model_Scheduler($checkUserPerm); $scheduler->scheduleAfter( array(array("id" => $lastid, "instance" => $id, "timestamp" => $ts)), @@ -293,7 +290,6 @@ SQL; private function checkToDeleteShow($showId) { - xdebug_break(); //UTC DateTime object $showsPopUntil = Application_Model_Preference::GetShowsPopulatedUntil(); @@ -561,23 +557,22 @@ SQL; public static function getShowHasAutoplaylist($p_start, $p_end) { - $sql = << :p_start::TIMESTAMP -AND starts < :p_end::TIMESTAMP -SQL; - $res = Application_Common_Database::prepareAndExecute($sql, array( - ':p_start' => $p_start->format("Y-m-d G:i:s"), - ':p_end' => $p_end->format("Y-m-d G:i:s")) - , 'all'); - $hasAutoplaylist = array(); - foreach ($res as $r) { - $hasAutoplaylist[$r['id']] = $r['has_autoplaylist']; + $con = Propel::getConnection(CcShowInstancesPeer::DATABASE_NAME); + $con->beginTransaction(); + try { + // query the show instances to find whether a show instance has an autoplaylist + $showInstances = CcShowInstancesQuery::create() + ->filterByDbEnds($p_end->format(DEFAULT_TIMESTAMP_FORMAT), Criteria::LESS_THAN) + ->filterByDbStarts($p_start->format(DEFAULT_TIMESTAMP_FORMAT), Criteria::GREATER_THAN) + ->leftJoinCcShow() + ->find($con); + return $showInstances; + } + catch (Exception $e) { + $con->rollback(); + Logging::info("Couldn't query show instances for calendar to find which had autoplaylists"); + Logging::info($e->getMessage()); } - - return $hasAutoplaylist; } public function showEmpty() diff --git a/airtime_mvc/public/css/images/icon_alert_cal_autoplaylist.png b/airtime_mvc/public/css/images/icon_alert_cal_autoplaylist.png index 44e56e0d3aa6b0c2a712fef3c58779231b66c053..5398cb9c5ab1558dfb092ac27ab89a4827199b5f 100644 GIT binary patch delta 500 zcmVRsB00GHKL_t(2&sEDmXcJKY$MN5Lmy373e@U+u zktU*;>QFE)I#jWgDqS30)Tu%jp^Hl=@eg&$;4J9k;OdeNl29@zl?pD=!T+F5rD}U= z{#@^Jxp#N(xx|3q^~;A~(8`-Tw9;7B59<@BT0!%I7kODt)_>el#eU1;a3g2r_aDza zH;V6Wk!vq5AOGC`_$}r!1Q+0; zfTU6YK(NWscz?J9-s3p=BoCSH-2rQ3X{9y!Qb!nF9$%*}l zmJ)Okr-BqMLQxO}BRc3%6$PDK#90LY04HZR2gL@2iim9p)XC@)B%8JlrcKo(rfu%> zad)}9*TsrH^ADaMkKiBjuTIN$qkZK2yT+ZNA7nF!QeXBTw|@$giR|a4i^UM2R4Pdw z;L_`}qSbGl+pxbq8SHww&BZ1F+mkkOMm=VRq@oGi>%5(ParEwhek9MloXhNZ+aLBW)*d&B=L|A)N&0IZk*i40 zCIIjwFK-&=ihtG{_AV$C0G)CVLWoTpjOEkFq=xgUPvk`aC>2rnYWKB31(`idyJUj^ zIVy0shDcK*@)ezry*~>!qGC6Q#ACadJhG6YpoxxWhw`%TV9ZtVLW}J8~*B5KboJhWL zTi${&g*ARTC8VVxVt@|Pl!U!drE_LAnhNKy#IFaUQmMprp~ruP&D2t>@TloFuJJ!= nDn9+}YWC)XQId|`?Tr5hI5*BKDOc3200000NkvXXu0mjfc53TM From 7584f07d481e7949831690605bd45046f8c2c742 Mon Sep 17 00:00:00 2001 From: Robb Ebright Date: Wed, 20 Dec 2017 08:52:33 -0500 Subject: [PATCH 4/6] fixed icon --- .../css/images/icon_alert_cal_autoplaylist.png | Bin 571 -> 477 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/airtime_mvc/public/css/images/icon_alert_cal_autoplaylist.png b/airtime_mvc/public/css/images/icon_alert_cal_autoplaylist.png index 5398cb9c5ab1558dfb092ac27ab89a4827199b5f..472739399a0f72dc37f6e05d197829823779aab9 100644 GIT binary patch literal 477 zcmeAS@N?(olHy`uVBq!ia0vp@K+MI#3?w5ARK5YJ+W|fyu7Zp}76T(QBNHnl69*GB zKNE`pGpisFv9O7OR%y_vT`c1bE&a&YjJREbMP2&@ECIP8gcR&a|u{+3)t}p zx$;Ux2};HZNhJwOrwPksi^$}O$mWU47K+Lhiz!r!D>X?fw*irqN{6&cr<7`^v}%{M zYPXcmWF?JhvKq5wwdTqh&DPMGFQ>gwUTcw@_9A(m#q!!qn&F@T&8NYOkH=S zg2{4q-PH=_%e75cXj!h%cUW%bzS=f$wTJ&2SED^DK^r}TH+cqc@l0JGo3t%b@O=LX zkl#vz{DK)Ap4~_Tagw~Fdh=kVk~q z*y8>-#?3&XYEKu(5RU7~2@K59Y!(-Sr%as~zOAX?jEF?!3`xtSXWul)1Ph0X#xi@l z+2txLoWI}^@8{Dpf1>;46O9LtT?m>oG1jGFV)We;^BNDHn9=HaD6(r}^x+GgK*?Ft zCpP!@PV_#@l(KARpTg=5lP2sCJHk~SZZ7T~&ac4D@ckN3{I)px5}-2}JYD@<);T3K F0RZSyhI#-1 literal 571 zcmV-B0>u4^P)<{A$w@>( zR4C6?%RgunQ2@vB-+PyfcfEf}uN9FdqL}JXFfKY&v6L!Z99-0?LKmTnODFLUb;;l? z=;Gk&k`9tkGANY_F44jNpiQM}duje$?{c|!ckj8xfZz4YhhWgkn>)19Sk({f6Q^21 z^MV(7Sxwg5QN@1C;&3Bp#`n%^(19y>cb}YkzCO4|{i=dNUvVU`Tupst}A! zDzK+4M;|dtv-wMprn|ElGG9I?`K))l6Sf~PmtnKC3#w8`8b!as5VsR#=X6Zm7>6#K zPdAG1Zjoy*E+7Bg{`f8CF$5Rjp@5`P06?(G(0I55-s3p=BoCSH-2rQ3X{9y!QbIsu(4t~ei+)Hn5xyhW<_%9+X+4?eLTr3?$p%IF{{TIG7&E@D Date: Wed, 20 Dec 2017 09:08:23 -0500 Subject: [PATCH 5/6] Replaced lower case a icon with A and fixed transparency --- .../css/images/icon_alert_cal_autoplaylist.png | Bin 477 -> 595 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/airtime_mvc/public/css/images/icon_alert_cal_autoplaylist.png b/airtime_mvc/public/css/images/icon_alert_cal_autoplaylist.png index 472739399a0f72dc37f6e05d197829823779aab9..5b20f90c23d7b052d150cc8f5f5d788032599585 100644 GIT binary patch delta 581 zcmV-L0=oU(1JeYM8Gi-<009{3}O9cH7MFbr>SYZddg_jV5x_<<%b?FuIWaL2tGw9GI z@Sp~(wIM6M&+P2ZGf$_W&qvCYVy2MozOD@E=#QDDDMntNzBTjlLyo?O1+zaN=NNr6 zcn2`b6LazPx$oA%bm?Zs&D<}Iu**)}L%F1{Rtu>adhNWC74k}S+qd9%T?{-5unl2}4 z^4#`pZ!t_lR;H^M4aX`y_?G`jg-OWnLP+~?fE6fAYzTFT65!XfO}6Lv(fcXuPwQa7 zwoHcX(Kgd_yHfzFlN-j%_@AX*DUOQBoTD6+D7M#jSbrX?0pR3q`X{?_Ef*1?rCXm) zx@RWTVXrH&u!wa`lte7wtKs!JbY5vN4juyz9z#xEBThbJE&(fU0XrTcS6+!ILCH8FsU%_P zG+~)+5t%#@**sC%LQ%P5F@;KTr6x(`HXxF!SLu*e>6B9KlveGMR_&J3nXIHSO;%%; ztkzsPquCl-^X0S`%4;o>(_SR6vshkxiM;+2WxeG}hRalqmZ|HmR4`etuDe>ne7Uyi z3N6bO`VPy@+*jKMuJ-U><7%`=C1|5(@FvgTEuN|CW0ST;3ZCyj0rFf)kY6x^!?PP{ z3=G^1j7i?^E({&4vK|wS73+D8E$)9~+zeDz?djqe!f`!0fq^-i&Ei7vl&KTLw>1@< z5s`?TA!)hv?3)IeVBt{FSY}T*yIf_3^A|kg{d`*HPjtV0qVeFd3qeyR#=102jJ|tf zUgN_lMRrY$K764QC^>8T#OD6qiQZ?KQkL!PQ&_!W(u5siN4Uzv&85ZN!}%4s Z8NOfRiQg6{UjlRogQu&X%Q~loCIA4^g75$U From 968dcfa6adcda0fe8b2fb7becc4c7419e4b9fa70 Mon Sep 17 00:00:00 2001 From: Robb Ebright Date: Tue, 2 Jan 2018 10:07:33 -0500 Subject: [PATCH 6/6] added CSS for autoplaylist icon --- airtime_mvc/public/css/styles.css | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/airtime_mvc/public/css/styles.css b/airtime_mvc/public/css/styles.css index 32fb73bd9..70641a0cb 100644 --- a/airtime_mvc/public/css/styles.css +++ b/airtime_mvc/public/css/styles.css @@ -2275,6 +2275,11 @@ span.errors.sp-errors{ background:url(images/icon_link.png) no-repeat 0 0; margin-top: 0px !important; } +.small-icon.autoplaylist { + background:url(images/icon_alert_cal_autoplaylist.png) no-repeat 0 0; + margin-top: 0px !important; +} + .small-icon.recording { background:url(images/icon_record.png) no-repeat 0 0; margin-top: 0px !important;