Merge branch '2.1.x' of dev.sourcefabric.org:airtime into 2.1.x

This commit is contained in:
James 2012-06-26 16:56:01 -04:00
commit c2cc4253b3
5 changed files with 34 additions and 24 deletions

View file

@ -82,17 +82,9 @@ class Application_Model_MusicDir {
$show_instances = $con->query($sql)->fetchAll(); $show_instances = $con->query($sql)->fetchAll();
// get all the files on this dir // get all the files on this dir
$sql = "SELECT f.id FROM cc_music_dirs as md " $sql = "UPDATE cc_files SET file_exists = 'f' WHERE id IN (SELECT f.id FROM cc_music_dirs as md "
." LEFT JOIN cc_files as f on f.directory = md.id WHERE md.id = $music_dir_id"; ." LEFT JOIN cc_files as f on f.directory = md.id WHERE md.id = $music_dir_id)";
$files = $con->query($sql)->fetchAll(); $affected = $con->exec($sql);
// set file_exist flag to false
foreach ($files as $file_row) {
$temp_file = Application_Model_StoredFile::Recall($file_row['id']);
if($temp_file != null){
$temp_file->setFileExistsFlag(false);
}
}
// set RemovedFlag to true // set RemovedFlag to true
if ($userAddedWatchedDir) { if ($userAddedWatchedDir) {
@ -399,12 +391,14 @@ class Application_Model_MusicDir {
* otherwise, it will set "Exists" flag to true * otherwise, it will set "Exists" flag to true
**/ **/
public static function removeWatchedDir($p_dir, $userAddedWatchedDir=true){ public static function removeWatchedDir($p_dir, $userAddedWatchedDir=true){
//make sure that $p_dir has a trailing "/"
$real_path = Application_Common_OsPath::normpath($p_dir)."/"; $real_path = Application_Common_OsPath::normpath($p_dir)."/";
if($real_path != "/"){ if($real_path != "/"){
$p_dir = $real_path; $p_dir = $real_path;
} }
$dir = Application_Model_MusicDir::getDirByPath($p_dir); $dir = Application_Model_MusicDir::getDirByPath($p_dir);
if($dir == NULL){ if (is_null($dir)) {
return array("code"=>1, "error"=>"'$p_dir' doesn't exist in the watched list."); return array("code"=>1, "error"=>"'$p_dir' doesn't exist in the watched list.");
} else { } else {
$dir->remove($userAddedWatchedDir); $dir->remove($userAddedWatchedDir);

View file

@ -618,7 +618,7 @@ class Application_Model_Preference
if (defined('APPLICATION_ENV') && APPLICATION_ENV == "development" && function_exists('exec')){ if (defined('APPLICATION_ENV') && APPLICATION_ENV == "development" && function_exists('exec')){
$version = exec("git rev-parse --short HEAD 2>/dev/null", $out, $return_code); $version = exec("git rev-parse --short HEAD 2>/dev/null", $out, $return_code);
if ($return_code == 0){ if ($return_code == 0){
return self::GetValue("system_version")."+".$version; return self::GetValue("system_version")."+".$version.":".time();
} }
} }
return self::GetValue("system_version"); return self::GetValue("system_version");

View file

@ -890,8 +890,7 @@ Logging::log("getting media! - 2");
exec($command, $output, $rv); exec($command, $output, $rv);
if ($rv != 0 || (!empty($output) && $output[0] == 'TagLib: MPEG::Properties::read() -- Could not find a valid last MPEG frame in the stream.')) { if ($rv != 0 || (!empty($output) && $output[0] == 'TagLib: MPEG::Properties::read() -- Could not find a valid last MPEG frame in the stream.')) {
$result = array("code" => 110, "message" => "This file appears to be corrupted and will not be added to media library."); $result = array("code" => 110, "message" => "This file appears to be corrupted and will not be added to media library.");
} } else {
else {
//Martin K.: changed to rename: Much less load + quicker since this is an atomic operation //Martin K.: changed to rename: Much less load + quicker since this is an atomic operation
$r = @rename($audio_file, $audio_stor); $r = @rename($audio_file, $audio_stor);

View file

@ -8,7 +8,9 @@ var AIRTIME = (function(AIRTIME){
$sbTable, $sbTable,
$toolbar, $toolbar,
$ul, $ul,
$lib; $lib,
cursors = [],
cursorIds = [];
if (AIRTIME.showbuilder === undefined) { if (AIRTIME.showbuilder === undefined) {
AIRTIME.showbuilder = {}; AIRTIME.showbuilder = {};
@ -208,6 +210,11 @@ var AIRTIME = (function(AIRTIME){
mod.fnItemCallback = function(json) { mod.fnItemCallback = function(json) {
checkError(json); checkError(json);
cursors = $(".cursor-selected-row");
for (i = 0; i < cursors.length; i++) {
cursorIds.push(($(cursors.get(i)).attr("id")));
}
oSchedTable.fnDraw(); oSchedTable.fnDraw();
mod.enableUI(); mod.enableUI();
@ -401,7 +408,6 @@ var AIRTIME = (function(AIRTIME){
headerIcon; headerIcon;
fnPrepareSeparatorRow = function fnPrepareSeparatorRow(sRowContent, sClass, iNodeIndex) { fnPrepareSeparatorRow = function fnPrepareSeparatorRow(sRowContent, sClass, iNodeIndex) {
$node = $(nRow.children[iNodeIndex]); $node = $(nRow.children[iNodeIndex]);
$node.html(sRowContent); $node.html(sRowContent);
$node.attr('colspan',100); $node.attr('colspan',100);
@ -414,6 +420,8 @@ var AIRTIME = (function(AIRTIME){
$nRow.addClass(sClass); $nRow.addClass(sClass);
}; };
$nRow.attr("id", aData.id);
if (aData.header === true) { if (aData.header === true) {
//remove the column classes from all tds. //remove the column classes from all tds.
$nRow.find('td').removeClass(); $nRow.find('td').removeClass();
@ -615,6 +623,7 @@ var AIRTIME = (function(AIRTIME){
$cursorRows, $cursorRows,
$table = $(this), $table = $(this),
$parent = $table.parent(), $parent = $table.parent(),
$tr,
//use this array to cache DOM heights then we can detach the table to manipulate it to increase speed. //use this array to cache DOM heights then we can detach the table to manipulate it to increase speed.
heights = []; heights = [];
@ -653,8 +662,16 @@ var AIRTIME = (function(AIRTIME){
}); });
$td.append(markerDiv).wrapInner(wrapperDiv); $td.append(markerDiv).wrapInner(wrapperDiv);
} }
//re-highlight selected cursors before draw took place
for (i = 0; i < cursorIds.length; i++) {
$tr = $table.find("tr[id="+cursorIds[i]+"]");
mod.selectCursor($tr);
}
cursorIds = [];
//if there is only 1 cursor on the page highlight it by default. //if there is only 1 cursor on the page highlight it by default.
if ($cursorRows.length === 1) { if ($cursorRows.length === 1) {
$td = $cursorRows.find("td:first"); $td = $cursorRows.find("td:first");

View file

@ -30,7 +30,7 @@ AIRTIME = (function(AIRTIME) {
oBaseDatePickerSettings = { oBaseDatePickerSettings = {
dateFormat: 'yy-mm-dd', dateFormat: 'yy-mm-dd',
onSelect: function(sDate, oDatePicker) { onClick: function(sDate, oDatePicker) {
$(this).datepicker( "setDate", sDate ); $(this).datepicker( "setDate", sDate );
} }
}; };