CC-4963: Add cue in and cue out to smart block criteria list

Done
This commit is contained in:
denise 2013-02-19 16:38:58 -05:00
parent 959839e180
commit c8d7d23d62
3 changed files with 48 additions and 29 deletions

View file

@ -5,6 +5,11 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
private $stringCriteriaOptions;
private $numericCriteriaOptions;
private $limitOptions;
/* We need to know if the criteria value will be a string
* or numeric value in order to populate the modifier
* select list
*/
private $criteriaTypes = array(
0 => "",
"album_title" => "s",
@ -13,6 +18,8 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
"composer" => "s",
"conductor" => "s",
"copyright" => "s",
"cuein" => "n",
"cueout" => "n",
"artist_name" => "s",
"encoded_by" => "s",
"utime" => "n",
@ -45,6 +52,8 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
"composer" => _("Composer"),
"conductor" => _("Conductor"),
"copyright" => _("Copyright"),
"cuein" => _("Cue In"),
"cueout" => _("Cue Out"),
"artist_name" => _("Creator"),
"encoded_by" => _("Encoded By"),
"genre" => _("Genre"),
@ -424,6 +433,8 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
"composer" => "DbComposer",
"conductor" => "DbConductor",
"copyright" => "DbCopyright",
"cuein" => "DbCuein",
"cueout" => "DbCueout",
"encoded_by" => "DbEncodedBy",
"utime" => "DbUtime",
"mtime" => "DbMtime",
@ -492,7 +503,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
} else {
$column = CcFilesPeer::getTableMap()->getColumnByPhpName($criteria2PeerMap[$d['sp_criteria_field']]);
// validation on type of column
if ($d['sp_criteria_field'] == 'length') {
if (in_array($d['sp_criteria_field'], array('length', 'cuein', 'cueout'))) {
if (!preg_match("/^(\d{2}):(\d{2}):(\d{2})/", $d['sp_criteria_value'])) {
$element->addError(_("'Length' should be in '00:00:00' format"));
$isValid = false;

View file

@ -63,6 +63,8 @@ class Application_Model_Block implements Application_Model_LibraryEditable
"composer" => "DbComposer",
"conductor" => "DbConductor",
"copyright" => "DbCopyright",
"cuein" => "DbCuein",
"cueout" => "DbCueout",
"encoded_by" => "DbEncodedBy",
"utime" => "DbUtime",
"mtime" => "DbMtime",
@ -1278,6 +1280,8 @@ SQL;
"composer" => _("Composer"),
"conductor" => _("Conductor"),
"copyright" => _("Copyright"),
"cuein" => _("Cue In"),
"cueout" => _("Cue Out"),
"artist_name" => _("Creator"),
"encoded_by" => _("Encoded By"),
"genre" => _("Genre"),
@ -1370,7 +1374,7 @@ SQL;
* user only sees the rounded version (i.e. 4:02.7 is 4:02.761625
* in the database)
*/
} elseif ($spCriteria == 'length' && $spCriteriaModifier == "is") {
} elseif (in_array($spCriteria, array('length', 'cuein', 'cueout')) && $spCriteriaModifier == "is") {
$spCriteriaModifier = "starts with";
$spCriteria = $spCriteria.'::text';
$spCriteriaValue = $criteria['value'];

View file

@ -559,7 +559,9 @@ function enableLoadingIcon() {
function disableLoadingIcon() {
$("#side_playlist").unblock()
}
// We need to know if the criteria value will be a string
// or numeric value in order to populate the modifier
// select list
var criteriaTypes = {
0 : "",
"album_title" : "s",
@ -568,6 +570,8 @@ var criteriaTypes = {
"composer" : "s",
"conductor" : "s",
"copyright" : "s",
"cuein" : "n",
"cueout" : "n",
"artist_name" : "s",
"encoded_by" : "s",
"utime" : "n",