From f1893cebe6f5d7cbb239676207ea981547db7cd3 Mon Sep 17 00:00:00 2001 From: Naomi Aro Date: Tue, 21 Jun 2011 11:57:56 +0200 Subject: [PATCH] CC-1799 Put Airtime Storage into a Human Readable File Naming Convention making separate js file for music dirs page. --- .../controllers/PreferenceController.php | 2 +- .../js/airtime/preferences/musicdirs.js | 57 +++++++++++ .../js/airtime/preferences/preferences.js | 97 ++++--------------- 3 files changed, 77 insertions(+), 79 deletions(-) create mode 100644 airtime_mvc/public/js/airtime/preferences/musicdirs.js diff --git a/airtime_mvc/application/controllers/PreferenceController.php b/airtime_mvc/application/controllers/PreferenceController.php index 6932a9deb..475f3917e 100644 --- a/airtime_mvc/application/controllers/PreferenceController.php +++ b/airtime_mvc/application/controllers/PreferenceController.php @@ -130,7 +130,7 @@ class PreferenceController extends Zend_Controller_Action $baseUrl = $request->getBaseUrl(); $this->view->headScript()->appendFile($baseUrl.'/js/serverbrowse/serverbrowser.js','text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/airtime/preferences/preferences.js','text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'/js/airtime/preferences/musicdirs.js','text/javascript'); $watched_dirs_pref = new Application_Form_WatchedDirPreferences(); $watched_dirs_pref->setWatchedDirs(); diff --git a/airtime_mvc/public/js/airtime/preferences/musicdirs.js b/airtime_mvc/public/js/airtime/preferences/musicdirs.js new file mode 100644 index 000000000..8d52c3c35 --- /dev/null +++ b/airtime_mvc/public/js/airtime/preferences/musicdirs.js @@ -0,0 +1,57 @@ +function setWatchedDirEvents() { + $('#watchedFolder-selection').serverBrowser({ + onSelect: function(path) { + $('#watchedFolder').val(path); + }, + onLoad: function() { + return $('#watchedFolder').val(); + }, + width: 500, + height: 250, + position: ['center', 'center'], + //knownPaths: [{text:'Desktop', image:'desktop.png', path:'/home'}], + knownPaths: [], + imageUrl: 'img/icons/', + systemImageUrl: 'img/browser/', + handlerUrl: '/Preference/server-browse/format/json', + title: 'Choose Folder to Watch', + basePath: '/home', + requestMethod: 'POST', + }); + + $('#watchedFolder-ok').click(function(){ + var url, chosen; + + url = "/Preference/reload-watch-directory"; + chosen = $('#watchedFolder').val(); + + $.post(url, + {format: "json", dir: chosen}, + + function(json) { + $("#watched-folder-section").empty(); + $("#watched-folder-section").append(json.subform); + setWatchedDirEvents(); + }); + }); + + $('#watchedFolder-table').find('.ui-icon-close').click(function(){ + var row = $(this).parent(); + var folder = $(this).prev().text(); + + url = "/Preference/remove-watch-directory"; + + $.post(url, + {format: "json", dir: folder}, + + function(json) { + row.remove(); + }); + }); +} + +$(document).ready(function() { + + setWatchedDirEvents(); + +}); diff --git a/airtime_mvc/public/js/airtime/preferences/preferences.js b/airtime_mvc/public/js/airtime/preferences/preferences.js index 00ab853b3..97a1cd876 100644 --- a/airtime_mvc/public/js/airtime/preferences/preferences.js +++ b/airtime_mvc/public/js/airtime/preferences/preferences.js @@ -1,79 +1,3 @@ -function setWatchedDirEvents() { - $('#watchedFolder-selection').serverBrowser({ - onSelect: function(path) { - $('#watchedFolder').val(path); - }, - onLoad: function() { - return $('#watchedFolder').val(); - }, - width: 500, - height: 250, - position: ['center', 'center'], - //knownPaths: [{text:'Desktop', image:'desktop.png', path:'/home'}], - knownPaths: [], - imageUrl: 'img/icons/', - systemImageUrl: 'img/browser/', - handlerUrl: '/Preference/server-browse/format/json', - title: 'Choose Folder to Watch', - basePath: '/home', - requestMethod: 'POST', - }); - - $('#watchedFolder-ok').click(function(){ - var url, chosen; - - url = "/Preference/reload-watch-directory"; - chosen = $('#watchedFolder').val(); - - $.post(url, - {format: "json", dir: chosen}, - - function(json) { - $("#watched-folder-section").empty(); - $("#watched-folder-section").append(json.subform); - setWatchedDirEvents(); - }); - }); - - $('#watchedFolder-table').find('.ui-icon-close').click(function(){ - var row = $(this).parent(); - var folder = $(this).prev().text(); - - url = "/Preference/remove-watch-directory"; - - $.post(url, - {format: "json", dir: folder}, - - function(json) { - row.remove(); - }); - }); -} - -$(document).ready(function() { - var form = $("form"); - - $('.collapsible-header').live('click',function() { - $(this).next().toggle('fast'); - $(this).toggleClass("close"); - return false; - }).next().hide(); - - $("#SupportFeedback").click( function(){ - var pub = $("#Publicise"); - if( !$(this).is(':checked') ){ - pub.removeAttr("checked"); - pub.attr("disabled", true); - }else{ - pub.removeAttr("disabled"); - } - }); - - showErrorSections(); - setWatchedDirEvents(); - -}); - function showErrorSections() { if($("soundcloud-settings .errors").length > 0) { @@ -111,7 +35,24 @@ function resizeImg(ele){ } +$(document).ready(function() { + var form = $("form"); + $('.collapsible-header').live('click',function() { + $(this).next().toggle('fast'); + $(this).toggleClass("close"); + return false; + }).next().hide(); + + $("#SupportFeedback").click( function(){ + var pub = $("#Publicise"); + if( !$(this).is(':checked') ){ + pub.removeAttr("checked"); + pub.attr("disabled", true); + }else{ + pub.removeAttr("disabled"); + } + }); + + showErrorSections(); }); - -