Merge branch 'devel' of dev.sourcefabric.org:airtime into devel

This commit is contained in:
Martin Konecny 2012-09-19 13:23:14 -04:00
commit f717efd7fb
12 changed files with 123 additions and 75 deletions

View file

@ -240,33 +240,6 @@ class Application_Model_StoredFile
}
}
/**
* Get one metadata value.
*
* @param string $p_category (MDATA_KEY_URL)
* @return string
*/
public function getMetadataValue($p_category)
{
// constant() was used because it gets quoted constant name value from
// api_client.py. This is the wrapper funtion
return $this->getDbColMetadataValue(constant($p_category));
}
/**
* Get one metadata value.
*
* @param string $p_category (url)
* @return string
*/
public function getDbColMetadataValue($p_category)
{
$propelColumn = $this->_dbMD[$p_category];
$method = "get$propelColumn";
return $this->_file->$method();
}
/**
* Get metadata as array, indexed by the column names in the database.
*
@ -423,7 +396,6 @@ SQL;
return $possible_ext;
}
// We fallback to guessing the extension from the mimetype if we
// cannot extract it from the file name
@ -1020,15 +992,18 @@ SQL;
/**
*
* Enter description here ...
* @param $dir_id - if this is not provided, it returns all files with full path constructed.
* @param $dir_id - if this is not provided, it returns all files with full
* path constructed.
*/
public static function listAllFiles($dir_id=null, $all)
{
$con = Propel::getConnection();
$sql = "SELECT filepath as fp"
." FROM CC_FILES as f"
." WHERE f.directory = :dir_id";
$sql = <<<SQL
SELECT filepath AS fp
FROM CC_FILES AS f
WHERE f.directory = :dir_id
SQL;
if (!$all) {
$sql .= " AND f.file_exists = 'TRUE'";

View file

@ -39,7 +39,7 @@
<?php if (count($watched_dirs) > 0): ?>
<?php foreach($watched_dirs as $watched_dir): ?>
<dd class="block-display selected-item">
<?php echo ($watched_dir->getExistsFlag())?"":"<span class='ui-icon-alert'><img src='/css/images/warning-icon.png'></span>"?><span id="folderPath"><?php echo $watched_dir->getDirectory();?></span></span>
<?php echo ($watched_dir->getExistsFlag())?"":"<span class='ui-icon-alert'><img src='/css/images/warning-icon.png'></span>"?><span id="folderPath" style="display:block; width:350px"><?php echo $watched_dir->getDirectory();?></span></span>
<span title="Rescan watched directory (This is useful if it is network mount and may be out of sync with Airtime)" class="ui-icon ui-icon-refresh"></span>
<span title="Remove watched directory" class="ui-icon ui-icon-close"></span>

View file

@ -1,7 +1,10 @@
<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" class="advanced_search form-horizontal"></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>
</div>
<div id="show_builder" class="sb-content ui-widget ui-widget-content block-shadow omega-block padded">

View file

@ -38,6 +38,7 @@ var AIRTIME = (function(AIRTIME) {
"track_num" : "n",
"year" : "n",
"owner_id" : "s",
"info_url" : "s",
"replay_gain" : "n"
};
@ -1041,6 +1042,7 @@ function addQtipToSCIcons(){
*/
function validateAdvancedSearch(divs) {
var valid = true,
allValid = true,
fieldName,
fields,
searchTerm = Array(),
@ -1053,7 +1055,6 @@ function validateAdvancedSearch(divs) {
searchTerm[0] = "";
searchTerm[1] = "";
$.each(divs, function(i, div){
fieldName = $(div).children(':nth-child(2)').attr('id');
fields = $(div).children().find('input');
@ -1085,6 +1086,7 @@ function validateAdvancedSearch(divs) {
//string fields do not need validation
if (searchTermType !== "s") {
valid = regExpr.test(searchTerm[i]);
if (!valid) allValid = false;
}
addRemoveValidationIcons(valid, $(field));
@ -1107,13 +1109,9 @@ function validateAdvancedSearch(divs) {
return false;
}
});
if (!valid) {
return false;
}
});
return valid;
return allValid;
}
function addRemoveValidationIcons(valid, field) {

View file

@ -428,6 +428,12 @@ var AIRTIME = (function(AIRTIME){
if (isStatic) {
$.each(data, function(index, ele){
if (ele.track_title !== undefined) {
if (ele.creator === null) {
ele.creator = "";
}
if (ele.track_title === null) {
ele.track_title = "";
}
$html += "<li>" +
"<span class='block-item-title'>"+ele.track_title+" - </span>" +
"<span class='block-item-author'>"+ele.creator+"</span>" +