From a11ec0815480e7d32a337e1777de26032391b1a7 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Thu, 30 Aug 2012 15:23:12 -0400 Subject: [PATCH 1/8] cc-4304: Implemented default behaviour to cascade delete all the files --- .../controllers/UserController.php | 33 ++++++++++++++++--- airtime_mvc/application/models/User.php | 3 ++ 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/airtime_mvc/application/controllers/UserController.php b/airtime_mvc/application/controllers/UserController.php index a6cc74ad0..47df3db99 100644 --- a/airtime_mvc/application/controllers/UserController.php +++ b/airtime_mvc/application/controllers/UserController.php @@ -97,14 +97,39 @@ class UserController extends Zend_Controller_Action // action body $delId = $this->_getParam('id'); + $valid_actions = array("delete_cascade", "reassign_to"); + + $files_action = $this->_getParam('deleted_files'); + + # TODO : remove this. we only use default for now not to break the UI. + if (!$files_action) { # set default action + $files_action = "delete_cascade"; + } + + # only delete when valid action is selected for the owned files + if (! in_array($files_action, $valid_actions) ) { + return; + } + $userInfo = Zend_Auth::getInstance()->getStorage()->read(); $userId = $userInfo->id; - if ($delId != $userId) { - $user = new Application_Model_User($delId); - $this->view->entries = $user->delete(); + # Don't let users delete themselves + if ($delId == $userId) { + return; } - } + $user = new Application_Model_User($delId); + # Take care of the user's files by either assigning them to somebody + # or deleting them all + if ($files_action == "delete_cascade") { + $user->deleteAllFiles(); + } elseif ($files_action == "reassign_to") { + $new_owner = $this->_getParam("new_owner"); + $user->reassignTo( $new_owner ); + } + # Finally delete the user + $this->view->entries = $user->delete(); + } } diff --git a/airtime_mvc/application/models/User.php b/airtime_mvc/application/models/User.php index 3e71eba91..85ff5ea64 100644 --- a/airtime_mvc/application/models/User.php +++ b/airtime_mvc/application/models/User.php @@ -249,6 +249,9 @@ class Application_Model_User public function deleteAllFiles() { $my_files = $this->getOwnedFiles(); + foreach ($files as $file) { + $file->delete(); + } } private function createUser() From a0a4094332a91eef80e3e37a1292c775fda15d72 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Thu, 30 Aug 2012 16:00:14 -0400 Subject: [PATCH 2/8] cc-4304: Small refactoring --- .../application/controllers/UserController.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/airtime_mvc/application/controllers/UserController.php b/airtime_mvc/application/controllers/UserController.php index 47df3db99..01f6bf704 100644 --- a/airtime_mvc/application/controllers/UserController.php +++ b/airtime_mvc/application/controllers/UserController.php @@ -24,9 +24,16 @@ class UserController extends Zend_Controller_Action $request = $this->getRequest(); $baseUrl = $request->getBaseUrl(); - $this->view->headScript()->appendFile($baseUrl.'/js/datatables/js/jquery.dataTables.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.pluginAPI.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/airtime/user/user.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $js_files = array( + '/js/datatables/js/jquery.dataTables.js?', + '/js/datatables/plugin/dataTables.pluginAPI.js?', + '/js/airtime/user/user.js?' + ); + + foreach ($js_files as $js) { + $this->view->headScript()->appendFile( + $baseUrl.$js.$CC_CONFIG['airtime_version'],'text/javascript'); + } $this->view->headLink()->appendStylesheet($baseUrl.'/css/users.css?'.$CC_CONFIG['airtime_version']); From 3911662cffd81371fa5e155d51b3dad0e2bcfc49 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Thu, 30 Aug 2012 16:30:49 -0400 Subject: [PATCH 3/8] Remove unused function --- .../views/scripts/user/add-user.phtml | 1 + .../js/airtime/dashboard/helperfunctions.js | 30 ------------------- 2 files changed, 1 insertion(+), 30 deletions(-) diff --git a/airtime_mvc/application/views/scripts/user/add-user.phtml b/airtime_mvc/application/views/scripts/user/add-user.phtml index c689a2262..023da880e 100644 --- a/airtime_mvc/application/views/scripts/user/add-user.phtml +++ b/airtime_mvc/application/views/scripts/user/add-user.phtml @@ -1,4 +1,5 @@
+

Manage Users

diff --git a/airtime_mvc/public/js/airtime/dashboard/helperfunctions.js b/airtime_mvc/public/js/airtime/dashboard/helperfunctions.js index 818aef04d..87a50796f 100644 --- a/airtime_mvc/public/js/airtime/dashboard/helperfunctions.js +++ b/airtime_mvc/public/js/airtime/dashboard/helperfunctions.js @@ -179,36 +179,6 @@ function getFileExt(filename){ return filename.split('.').pop(); } -function audioStream(){ - - if ($("#jquery_jplayer_1").data("jPlayer") && $("#jquery_jplayer_1").data("jPlayer").status.paused != true){ - $('#jquery_jplayer_1').jPlayer('clearMedia'); - $('#jquery_jplayer_1').jPlayer('destroy'); - return; - } - - var uri = "http://localhost:8000/airtime_128.ogg"; - var ext = getFileExt(uri); - - var media; - var supplied; - if (ext == "ogg"){ - media = {oga:uri}; - supplied = "oga"; - } else { - media = {mp3:uri}; - supplied = "mp3"; - } - - $("#jquery_jplayer_1").jPlayer({ - ready: function () { - $(this).jPlayer("setMedia", media).jPlayer("play"); - }, - swfPath: "/js/jplayer", - supplied: supplied - }); -} - function resizeImg(ele, targetWidth, targetHeight){ var img = $(ele); From 3571e2c691aab8b42e3501da25efa0605e548229 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Thu, 30 Aug 2012 16:50:10 -0400 Subject: [PATCH 4/8] cc-1710: switched bwf to wav --- airtime_mvc/public/js/airtime/library/plupload.js | 2 +- python_apps/media-monitor2/media/monitor/pure.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/airtime_mvc/public/js/airtime/library/plupload.js b/airtime_mvc/public/js/airtime/library/plupload.js index 949cce940..cd61be802 100644 --- a/airtime_mvc/public/js/airtime/library/plupload.js +++ b/airtime_mvc/public/js/airtime/library/plupload.js @@ -9,7 +9,7 @@ $(document).ready(function() { unique_names: 'true', multiple_queues : 'true', filters : [ - {title: "Audio Files", extensions: "ogg,mp3,oga,flac,aac,bwf"} + {title: "Audio Files", extensions: "ogg,mp3,oga,flac,aac,wav"} ] }); diff --git a/python_apps/media-monitor2/media/monitor/pure.py b/python_apps/media-monitor2/media/monitor/pure.py index 2a1d7e483..ac9fd127b 100644 --- a/python_apps/media-monitor2/media/monitor/pure.py +++ b/python_apps/media-monitor2/media/monitor/pure.py @@ -15,7 +15,7 @@ from configobj import ConfigObj from media.monitor.exceptions import FailedToSetLocale, FailedToCreateDir #supported_extensions = [u"mp3", u"ogg", u"oga"] -supported_extensions = [u"mp3", u"ogg", u"oga", u"flac", u"aac", u"bwf"] +supported_extensions = [u"mp3", u"ogg", u"oga", u"flac", u"aac", u"wav"] unicode_unknown = u'unknown' path_md = ['MDATA_KEY_TITLE', 'MDATA_KEY_CREATOR', 'MDATA_KEY_SOURCE', From 1fe5a0446f2c60738bba1fbd2fde2aed0ff1495b Mon Sep 17 00:00:00 2001 From: Daniel James Date: Fri, 31 Aug 2012 12:57:59 +0100 Subject: [PATCH 5/8] Fix lines disabling symlink installation --- gen-snapshot.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gen-snapshot.sh b/gen-snapshot.sh index d98899993..4fd667aa1 100755 --- a/gen-snapshot.sh +++ b/gen-snapshot.sh @@ -47,10 +47,10 @@ sed -i '91s:tr:#tr:g' airtime/python_apps/pypo/install/pypo-initialize.py sed -i '92s:os.unlink:#os.unlink:g' airtime/python_apps/pypo/install/pypo-initialize.py sed -i '93s:except:#except:g' airtime/python_apps/pypo/install/pypo-initialize.py sed -i '95s:pass:#pass:g' airtime/python_apps/pypo/install/pypo-initialize.py -sed -i '98s:os.symlink:#os.symlink:g' airtime/python_apps/pypo/install/pypo-initialize.py -sed -i '99s:else:#else:g' airtime/python_apps/pypo/install/pypo-initialize.py -sed -i '100s:print:#print:g' airtime/python_apps/pypo/install/pypo-initialize.py -sed -i '101s:sys.exit:#sys.exit:g' airtime/python_apps/pypo/install/pypo-initialize.py +sed -i '97s:os.symlink:#os.symlink:g' airtime/python_apps/pypo/install/pypo-initialize.py +sed -i '98s:else:#else:g' airtime/python_apps/pypo/install/pypo-initialize.py +sed -i '99s:print:#print:g' airtime/python_apps/pypo/install/pypo-initialize.py +sed -i '100s:sys.exit:#sys.exit:g' airtime/python_apps/pypo/install/pypo-initialize.py #Remove phing library rm -r airtime/airtime_mvc/library/phing/ From ea816a4310b1d8db8945ce723dae54dc47329ccb Mon Sep 17 00:00:00 2001 From: Daniel James Date: Fri, 31 Aug 2012 12:59:26 +0100 Subject: [PATCH 6/8] Don't upload by default, we have a script installed on the apt server now --- gen-snapshot.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gen-snapshot.sh b/gen-snapshot.sh index 4fd667aa1..ea791e2f5 100755 --- a/gen-snapshot.sh +++ b/gen-snapshot.sh @@ -71,7 +71,7 @@ echo "running the build..." debuild -b -uc -us $@ || exit # copy the new package to the public server -scp /tmp/airtime_${VERSION}_all.deb apt.sourcefabric.org:/var/www/apt/snapshots/ +# scp /tmp/airtime_${VERSION}_all.deb apt.sourcefabric.org:/var/www/apt/snapshots/ # copy the build log too -scp /tmp/airtime_${VERSION}_amd64.build apt.sourcefabric.org:/var/www/apt/snapshots/ +# scp /tmp/airtime_${VERSION}_amd64.build apt.sourcefabric.org:/var/www/apt/snapshots/ From 4ffbbfa164cd9c45a93a58ebc201115fce76d3f9 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Fri, 31 Aug 2012 14:36:05 +0100 Subject: [PATCH 7/8] Update the text sent to the console, since binary is no longer installed here --- python_apps/pypo/install/pypo-initialize.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python_apps/pypo/install/pypo-initialize.py b/python_apps/pypo/install/pypo-initialize.py index ebf49a65c..af12ff02e 100644 --- a/python_apps/pypo/install/pypo-initialize.py +++ b/python_apps/pypo/install/pypo-initialize.py @@ -81,7 +81,7 @@ try: (codename, fullname) = get_os_codename() print " Found %s (%s) on %s architecture" % (fullname, codename, arch) - print " * Installing Liquidsoap binary" + print " * Creating symlink to Liquidsoap binary" p = Popen("which liquidsoap", shell=True, stdout=PIPE) liq_path = p.communicate()[0].strip() From d02deac38d66e3c716b1c1a432368b2e279fc2fc Mon Sep 17 00:00:00 2001 From: Daniel James Date: Fri, 31 Aug 2012 14:38:42 +0100 Subject: [PATCH 8/8] We no longer need to comment out symlink creation --- gen-snapshot.sh | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/gen-snapshot.sh b/gen-snapshot.sh index ea791e2f5..5224daf53 100755 --- a/gen-snapshot.sh +++ b/gen-snapshot.sh @@ -37,21 +37,6 @@ rm airtime/airtime_mvc/library/soundcloud-api/README.md # Remove Liquidsoap binaries rm -r airtime/python_apps/pypo/liquidsoap_bin/ -# Disable installation of Liquidsoap symlink -sed -i '84s:print:#print:g' airtime/python_apps/pypo/install/pypo-initialize.py -sed -i '86s:p = Popen:#p = Popen:g' airtime/python_apps/pypo/install/pypo-initialize.py -sed -i '87s:liq_path:#liq_path:g' airtime/python_apps/pypo/install/pypo-initialize.py -sed -i '88s:symlink_path:#symlink_path:g' airtime/python_apps/pypo/install/pypo-initialize.py -sed -i '90s:if p.returncode:#if p.returncode:g' airtime/python_apps/pypo/install/pypo-initialize.py -sed -i '91s:tr:#tr:g' airtime/python_apps/pypo/install/pypo-initialize.py -sed -i '92s:os.unlink:#os.unlink:g' airtime/python_apps/pypo/install/pypo-initialize.py -sed -i '93s:except:#except:g' airtime/python_apps/pypo/install/pypo-initialize.py -sed -i '95s:pass:#pass:g' airtime/python_apps/pypo/install/pypo-initialize.py -sed -i '97s:os.symlink:#os.symlink:g' airtime/python_apps/pypo/install/pypo-initialize.py -sed -i '98s:else:#else:g' airtime/python_apps/pypo/install/pypo-initialize.py -sed -i '99s:print:#print:g' airtime/python_apps/pypo/install/pypo-initialize.py -sed -i '100s:sys.exit:#sys.exit:g' airtime/python_apps/pypo/install/pypo-initialize.py - #Remove phing library rm -r airtime/airtime_mvc/library/phing/