From fab7042ce6cd5908ce7ed5225ddedde2beb03da6 Mon Sep 17 00:00:00 2001
From: Rudi Grinberg <rudi.grinberg@sourcefabric.org>
Date: Mon, 17 Sep 2012 11:18:18 -0400
Subject: [PATCH 01/11] cc-4419: Added quick hack for now -- actual fix

---
 airtime_mvc/public/js/airtime/library/library.js | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/airtime_mvc/public/js/airtime/library/library.js b/airtime_mvc/public/js/airtime/library/library.js
index 0ae1494fd..c33284bc5 100644
--- a/airtime_mvc/public/js/airtime/library/library.js
+++ b/airtime_mvc/public/js/airtime/library/library.js
@@ -51,8 +51,6 @@ var AIRTIME = (function(AIRTIME) {
             $trs;
 
 
-        // TODO : hack, get rid of this crap library
-        if (!$libTable) { return ; }
         // Get visible items and check if any chosenItems are visible
         $trs = $libTable.find("tbody input:checkbox").parents("tr");
         $trs.each(function(i){
@@ -363,6 +361,8 @@ var AIRTIME = (function(AIRTIME) {
         var tableHeight = $libContent.height() - 130;
         
         function setColumnFilter(oTable){
+            // TODO : remove this dirty hack once js is refactored
+            if (!oTable.fnSettings()) { return ; }
             var aoCols = oTable.fnSettings().aoColumns;
             var colsForAdvancedSearch = new Array();
             var advanceSearchDiv = $("div#advanced_search");
@@ -647,7 +647,6 @@ var AIRTIME = (function(AIRTIME) {
             }
             
         });
-        setColumnFilter(oTable);
         oTable.fnSetFilteringDelay(350);
        
         $libContent.find(".dataTables_scrolling").css("max-height", tableHeight);

From 396b5291627156dc9120195db46bbb887390d35b Mon Sep 17 00:00:00 2001
From: James <james@sourcefabric-DX4840.(none)>
Date: Mon, 17 Sep 2012 11:23:38 -0400
Subject: [PATCH 02/11] - UI interation of advanced search

---
 .../views/scripts/library/library.phtml       |  5 +++-
 .../scripts/showbuilder/builderDialog.phtml   |  2 +-
 .../public/js/airtime/library/library.js      | 25 ++++++++++++++++---
 3 files changed, 26 insertions(+), 6 deletions(-)

diff --git a/airtime_mvc/application/views/scripts/library/library.phtml b/airtime_mvc/application/views/scripts/library/library.phtml
index d35eb7fa6..0b60020c5 100644
--- a/airtime_mvc/application/views/scripts/library/library.phtml
+++ b/airtime_mvc/application/views/scripts/library/library.phtml
@@ -1,4 +1,7 @@
 <div id="import_status" class="library_import" style="display:none">File import in progress... <img src="/css/images/file_import_loader.gif"></img></div>
-<div id="advanced_search"></div>
+<fieldset class="toggle" id="filter_options">
+    <legend style="cursor: pointer;"><span class="ui-icon ui-icon-triangle-2-n-s"></span>Advanced Search Options</legend>
+    <div id="advanced_search" class="advanced_search form-horizontal"></div>
+</fieldset>
 <table id="library_display" cellpadding="0" cellspacing="0" class="datatable">
 </table>
\ No newline at end of file
diff --git a/airtime_mvc/application/views/scripts/showbuilder/builderDialog.phtml b/airtime_mvc/application/views/scripts/showbuilder/builderDialog.phtml
index 3923cf182..42daa30da 100644
--- a/airtime_mvc/application/views/scripts/showbuilder/builderDialog.phtml
+++ b/airtime_mvc/application/views/scripts/showbuilder/builderDialog.phtml
@@ -1,7 +1,7 @@
 <div class="wrapper">
     <div id="library_content" class="lib-content tabs ui-widget ui-widget-content block-shadow alpha-block padded">
         <div id="import_status" style="display:none">File import in progress...</div>
-        <div id="advanced_search"></div>
+        <div id="advanced_search" class="advanced_search form-horizontal"></div>
         <table id="library_display" cellpadding="0" cellspacing="0" class="datatable"></table>
     </div>
     <div id="show_builder" class="sb-content ui-widget ui-widget-content block-shadow omega-block padded">
diff --git a/airtime_mvc/public/js/airtime/library/library.js b/airtime_mvc/public/js/airtime/library/library.js
index 0ae1494fd..8f546c615 100644
--- a/airtime_mvc/public/js/airtime/library/library.js
+++ b/airtime_mvc/public/js/airtime/library/library.js
@@ -381,11 +381,17 @@ var AIRTIME = (function(AIRTIME) {
                         label = " (Hz)";
                     }
                     
-                    if (ele.bVisible) {
-                        advanceSearchDiv.append("<div id='advanced_search_col_"+currentColId+"'><span>"+ele.sTitle+label+"</span> : <span id='"+ele.mDataProp+"'></span></div>");
-                    } else {
-                        advanceSearchDiv.append("<div id='advanced_search_col_"+currentColId+"' style='display:none;'><span>"+ele.sTitle+label+"</span> : <span id='"+ele.mDataProp+"'></span></div>");
+                    var inputClass = 'filter_column filter_number_text'; 
+                    if (criteriaTypes[ele.mDataProp] != "s") {
+                        inputClass = 'filterColumn filter_number_range';
                     }
+                    
+                    if (ele.bVisible) {
+                        advanceSearchDiv.append("<div id='advanced_search_col_"+currentColId+" class='control-group'><label class='control-label'>"+ele.sTitle+label+" : </label><div id='"+ele.mDataProp+"' class='controls "+inputClass+"'></div></div>");
+                    } else {
+                        advanceSearchDiv.append("<div id='advanced_search_col_"+currentColId+"' class='control-group' style='display:none;'><label class='control-label'>"+ele.sTitle+label+"</label><div id='"+ele.mDataProp+"' class='controls "+inputClass+"'></div></div>");
+                    }
+                    
                     if (criteriaTypes[ele.mDataProp] == "s") {
                         var obj = { sSelector: "#"+ele.mDataProp }
                     } else {
@@ -649,6 +655,17 @@ var AIRTIME = (function(AIRTIME) {
         });
         setColumnFilter(oTable);
         oTable.fnSetFilteringDelay(350);
+        
+        $libContent.on("click", "legend", function(){
+            var $fs = $(this).parents("fieldset");
+
+            if ($fs.hasClass("closed")) {
+                $fs.removeClass("closed");
+            }
+            else {
+                $fs.addClass("closed");
+            }
+        });
        
         $libContent.find(".dataTables_scrolling").css("max-height", tableHeight);
         

From c19030e8fbaeb1f80e54cb78c68ef412a1fdcd40 Mon Sep 17 00:00:00 2001
From: Vladimir <vladimir.stefanovic@sourcefabric.org>
Date: Mon, 17 Sep 2012 17:39:30 +0200
Subject: [PATCH 03/11] CC-4155: additional styling

---
 airtime_mvc/public/css/playlist_builder.css | 32 +++++++++++++++++----
 1 file changed, 27 insertions(+), 5 deletions(-)

diff --git a/airtime_mvc/public/css/playlist_builder.css b/airtime_mvc/public/css/playlist_builder.css
index 4614a3da1..2f99399aa 100644
--- a/airtime_mvc/public/css/playlist_builder.css
+++ b/airtime_mvc/public/css/playlist_builder.css
@@ -84,15 +84,27 @@
 	text-align:right;
 }
 
-.spl_block_expand {
+.spl_block_expand, .spl_block_expand.close {
 	float:right;
     font-size: 9px;
     height: 15px;
-    right: 35px;
-    width: 100px;
+    /*right: 35px;*/
+    width: 120px;
     margin-top:2px;
     cursor:pointer;
-}
+    color:#fff;
+    font-weight: normal;
+    text-shadow:none;
+    opacity:1;
+	}
+	.spl_block_expand:hover, .spl_block_expand.close:hover {
+	    color:#FF611F;
+	    text-shadow:none;
+	    opacity:1;
+		}
+	.spl_block_expand .ui-icon {
+		float:left;
+	}	
 
 .spl_artist {
 	font-size:12px;
@@ -495,11 +507,21 @@ li.spl_empty {
 		float: none;
 		margin-bottom: 4px;
 		width: 100%;
+		font-size: 13px;
 		}
-		.smart-block-info > li span {
+		.smart-block-info > li span.block-item-time {
 			text-align: right;
 			float: right;
 			color: #D5D5D5;
 			font-size: 12px;
 			}
+		.smart-block-info > li span.block-item-title {
+			font-weight: bold;
+			display: inline-block;
+			padding-right: 6px;
+			}
+		.smart-block-info > li span.block-item-author {
+			font-weight: normal;
+			display: inline-block;
+			}
 

From 99969ff19da4786cc6e018f6aee7cad71e09cb4b Mon Sep 17 00:00:00 2001
From: denise <denise@denise-DX4860sourcefabric.org>
Date: Mon, 17 Sep 2012 11:58:05 -0400
Subject: [PATCH 04/11] CC-4445: Timeline: 'Select' dropdown menu should be
 disabled if the button is disabled

-fixed
---
 .../public/js/airtime/showbuilder/builder.js  | 45 ++++++++++---------
 1 file changed, 23 insertions(+), 22 deletions(-)

diff --git a/airtime_mvc/public/js/airtime/showbuilder/builder.js b/airtime_mvc/public/js/airtime/showbuilder/builder.js
index 942bfbf0d..47484c2ce 100644
--- a/airtime_mvc/public/js/airtime/showbuilder/builder.js
+++ b/airtime_mvc/public/js/airtime/showbuilder/builder.js
@@ -330,28 +330,6 @@ var AIRTIME = (function(AIRTIME){
         $lib = $("#library_content"),
         $sbTable = $sbContent.find('table');
         
-        /*
-         * Icon hover states in the toolbar.
-         */
-        $sbContent.on("mouseenter", "#timeline-select .dropdown-toggle", function(ev) {
-            $el = $(this);
-            
-            if (!$el.hasClass("ui-state-disabled")) {
-                $el.addClass("ui-state-hover");
-                $("#timeline-select .caret").contextMenu(true);
-            }
-            else {
-                $("#timeline-select .caret").contextMenu(false);
-            }       
-        });
-        $sbContent.on("mouseleave", ".fg-toolbar ul li", function(ev) {
-            $el = $(this);
-            
-            if (!$el.hasClass("ui-state-disabled")) {
-                $el.removeClass("ui-state-hover");
-            } 
-        });
-        
         oSchedTable = $sbTable.dataTable( {
             "aoColumns": [
             /* checkbox */ {"mDataProp": "allowed", "sTitle": "", "sWidth": "15px", "sClass": "sb-checkbox"},
@@ -1090,6 +1068,29 @@ var AIRTIME = (function(AIRTIME){
             return false;
         });
         
+        /*
+         * Icon hover states in the toolbar.
+         */
+        $sbContent.on("mouseenter", ".btn-group #timeline-select", function(ev) {
+            $el = $(this).parent(),
+            $ch = $el.children('#timeline-select');
+            
+            if ($el.hasClass("ui-state-disabled")) {
+                $ch.attr("disabled", "disabled");
+            }
+            else {
+                $ch.removeAttr("disabled");
+            }       
+        });
+        $sbContent.on("mouseleave", ".btn-group #timeline-select", function(ev) {
+            $el = $(this).parent();
+            
+            if (!$el.hasClass("ui-state-disabled")) {
+                $el.removeClass("ui-state-hover");
+            } 
+        });
+        
+        
         //begin context menu initialization.
         $.contextMenu({
             selector: '.sb-content table tbody tr:not(.sb-empty, .sb-footer, .sb-header, .sb-record) td:not(.sb-checkbox, .sb-image)',

From b913b067c2a5a6bf456d78342baf3d8d355fd649 Mon Sep 17 00:00:00 2001
From: Rudi Grinberg <rudi.grinberg@sourcefabric.org>
Date: Mon, 17 Sep 2012 11:58:08 -0400
Subject: [PATCH 05/11] Added setColumnFilter(oTable)

---
 airtime_mvc/application/models/Soundcloud.php    | 14 +++++++++-----
 airtime_mvc/public/js/airtime/library/library.js |  2 ++
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/airtime_mvc/application/models/Soundcloud.php b/airtime_mvc/application/models/Soundcloud.php
index c993d3a1d..1c4b94f9f 100644
--- a/airtime_mvc/application/models/Soundcloud.php
+++ b/airtime_mvc/application/models/Soundcloud.php
@@ -8,8 +8,9 @@ class Application_Model_Soundcloud
     public function __construct()
     {
         global $CC_CONFIG;
-
-        $this->_soundcloud = new Services_Soundcloud($CC_CONFIG['soundcloud-client-id'], $CC_CONFIG['soundcloud-client-secret']);
+        $this->_soundcloud = new Services_Soundcloud(
+            $CC_CONFIG['soundcloud-client-id'],
+            $CC_CONFIG['soundcloud-client-secret']);
     }
 
     private function getToken()
@@ -51,9 +52,9 @@ class Application_Model_Soundcloud
                 //YYYY-MM-DD-HH-mm-SS
                 $release = explode("-", $release);
 
-                $track_data['track[release_year]'] = $release[0];
+                $track_data['track[release_year]']  = $release[0];
                 $track_data['track[release_month]'] = $release[1];
-                $track_data['track[release_day]'] = $release[2];
+                $track_data['track[release_day]']   = $release[2];
             }
 
             if (isset($genre) && $genre != "") {
@@ -81,7 +82,10 @@ class Application_Model_Soundcloud
             );
 
             return $response;
+        } else {
+            throw new NoSoundCloundToken();
         }
     }
-
 }
+
+class NoSoundCloundToken extends Exception {}
diff --git a/airtime_mvc/public/js/airtime/library/library.js b/airtime_mvc/public/js/airtime/library/library.js
index c33284bc5..8f9a3c33f 100644
--- a/airtime_mvc/public/js/airtime/library/library.js
+++ b/airtime_mvc/public/js/airtime/library/library.js
@@ -647,6 +647,8 @@ var AIRTIME = (function(AIRTIME) {
             }
             
         });
+
+        setColumnFilter(oTable);
         oTable.fnSetFilteringDelay(350);
        
         $libContent.find(".dataTables_scrolling").css("max-height", tableHeight);

From 3c3b39796dd2793b88b1f8bbc93084854cda6f48 Mon Sep 17 00:00:00 2001
From: denise <denise@denise-DX4860sourcefabric.org>
Date: Mon, 17 Sep 2012 12:10:23 -0400
Subject: [PATCH 06/11] CC-4445: Timeline: 'Select' dropdown menu should be
 disabled if the button is disabled

-fixed
---
 airtime_mvc/public/js/airtime/showbuilder/builder.js | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/airtime_mvc/public/js/airtime/showbuilder/builder.js b/airtime_mvc/public/js/airtime/showbuilder/builder.js
index 47484c2ce..444f10e6e 100644
--- a/airtime_mvc/public/js/airtime/showbuilder/builder.js
+++ b/airtime_mvc/public/js/airtime/showbuilder/builder.js
@@ -71,6 +71,11 @@ var AIRTIME = (function(AIRTIME){
         else {
             AIRTIME.button.disableButton("btn-group #timeline-select", true);
         }
+        
+        //need to check if the 'Select' button is disabled
+        if ($(".btn-group #timeline-select").is(":disabled")) {
+            $(".btn-group #timeline-select").removeAttr("disabled");
+        }
     };
     
     mod.checkTrimButton = function() {

From e30d3b770cdef550c12dd406b1429b65ef867dfc Mon Sep 17 00:00:00 2001
From: denise <denise@denise-DX4860sourcefabric.org>
Date: Mon, 17 Sep 2012 12:19:02 -0400
Subject: [PATCH 07/11] -removed unused code

---
 airtime_mvc/public/js/airtime/showbuilder/builder.js | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/airtime_mvc/public/js/airtime/showbuilder/builder.js b/airtime_mvc/public/js/airtime/showbuilder/builder.js
index 444f10e6e..b51a88ce7 100644
--- a/airtime_mvc/public/js/airtime/showbuilder/builder.js
+++ b/airtime_mvc/public/js/airtime/showbuilder/builder.js
@@ -1087,13 +1087,6 @@ var AIRTIME = (function(AIRTIME){
                 $ch.removeAttr("disabled");
             }       
         });
-        $sbContent.on("mouseleave", ".btn-group #timeline-select", function(ev) {
-            $el = $(this).parent();
-            
-            if (!$el.hasClass("ui-state-disabled")) {
-                $el.removeClass("ui-state-hover");
-            } 
-        });
         
         
         //begin context menu initialization.

From b8b3bfb495c3574fa9098255786ed66a9bd38349 Mon Sep 17 00:00:00 2001
From: denise <denise@denise-DX4860sourcefabric.org>
Date: Mon, 17 Sep 2012 12:23:49 -0400
Subject: [PATCH 08/11] CC-4450: Now Playing -> Can't remove overbooked tracks

-fixed
---
 airtime_mvc/public/js/airtime/showbuilder/builder.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/airtime_mvc/public/js/airtime/showbuilder/builder.js b/airtime_mvc/public/js/airtime/showbuilder/builder.js
index b51a88ce7..4b6f45b07 100644
--- a/airtime_mvc/public/js/airtime/showbuilder/builder.js
+++ b/airtime_mvc/public/js/airtime/showbuilder/builder.js
@@ -1023,7 +1023,7 @@ var AIRTIME = (function(AIRTIME){
             });
         
         //delete overbooked tracks.
-        $toolbar.find('.icon-cut')
+        $toolbar.find('.icon-cut').parent()
             .click(function() {
                 
                 if (AIRTIME.button.isDisabled('icon-cut') === true) {

From f02bf04a25e0acb87acd84ce4f131242bb27ac44 Mon Sep 17 00:00:00 2001
From: denise <denise@denise-DX4860sourcefabric.org>
Date: Mon, 17 Sep 2012 12:27:17 -0400
Subject: [PATCH 09/11] CC-4449: (Firefox) Now Playing -> Cancel currently
 playing track does not work

-fixed
---
 airtime_mvc/public/js/airtime/showbuilder/builder.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/airtime_mvc/public/js/airtime/showbuilder/builder.js b/airtime_mvc/public/js/airtime/showbuilder/builder.js
index 4b6f45b07..e18c61548 100644
--- a/airtime_mvc/public/js/airtime/showbuilder/builder.js
+++ b/airtime_mvc/public/js/airtime/showbuilder/builder.js
@@ -1043,7 +1043,7 @@ var AIRTIME = (function(AIRTIME){
             });
         
         //delete selected tracks
-        $toolbar.find('.icon-trash')
+        $toolbar.find('.icon-trash').parent()
             .click(function() {
                 
                 if (AIRTIME.button.isDisabled('icon-trash') === true) {

From d089d3fbf318c9d387d025f90cbda9363fb43e26 Mon Sep 17 00:00:00 2001
From: James <james@sourcefabric-DX4840.(none)>
Date: Mon, 17 Sep 2012 12:28:46 -0400
Subject: [PATCH 10/11] - putting scroll bar on library left pane

---
 airtime_mvc/public/css/media_library.css | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/airtime_mvc/public/css/media_library.css b/airtime_mvc/public/css/media_library.css
index 06120698d..ef078fd55 100644
--- a/airtime_mvc/public/css/media_library.css
+++ b/airtime_mvc/public/css/media_library.css
@@ -38,7 +38,7 @@
 #library_content {
 	float: left;
 	width: 50%;
-	overflow: hidden;
+	overflow: auto;
 }
 
 #library_display {

From f840a9b24aebc0786241926d141c86936f127cbc Mon Sep 17 00:00:00 2001
From: denise <denise@denise-DX4860sourcefabric.org>
Date: Mon, 17 Sep 2012 12:30:43 -0400
Subject: [PATCH 11/11] CC-4451: (Firefox) Now Playing -> Can't cancel Current
 Show

-fixed
---
 airtime_mvc/public/js/airtime/showbuilder/builder.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/airtime_mvc/public/js/airtime/showbuilder/builder.js b/airtime_mvc/public/js/airtime/showbuilder/builder.js
index e18c61548..26c472ec0 100644
--- a/airtime_mvc/public/js/airtime/showbuilder/builder.js
+++ b/airtime_mvc/public/js/airtime/showbuilder/builder.js
@@ -972,7 +972,7 @@ var AIRTIME = (function(AIRTIME){
         $('#timeline-sn').click(function(){mod.selectNone();});
         
         //cancel current show
-        $toolbar.find('.icon-ban-circle')
+        $toolbar.find('.icon-ban-circle').parent()
             .click(function() {
                 var $tr,
                     data,
@@ -1006,7 +1006,7 @@ var AIRTIME = (function(AIRTIME){
             });
         
         //jump to current
-        $toolbar.find('.icon-step-forward')
+        $toolbar.find('.icon-step-forward').parent()
             .click(function() {
                 
                 if (AIRTIME.button.isDisabled('icon-step-forward') === true) {