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 $stringCriteriaOptions;
private $numericCriteriaOptions; private $numericCriteriaOptions;
private $limitOptions; 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( private $criteriaTypes = array(
0 => "", 0 => "",
"album_title" => "s", "album_title" => "s",
@ -13,6 +18,8 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
"composer" => "s", "composer" => "s",
"conductor" => "s", "conductor" => "s",
"copyright" => "s", "copyright" => "s",
"cuein" => "n",
"cueout" => "n",
"artist_name" => "s", "artist_name" => "s",
"encoded_by" => "s", "encoded_by" => "s",
"utime" => "n", "utime" => "n",
@ -45,6 +52,8 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
"composer" => _("Composer"), "composer" => _("Composer"),
"conductor" => _("Conductor"), "conductor" => _("Conductor"),
"copyright" => _("Copyright"), "copyright" => _("Copyright"),
"cuein" => _("Cue In"),
"cueout" => _("Cue Out"),
"artist_name" => _("Creator"), "artist_name" => _("Creator"),
"encoded_by" => _("Encoded By"), "encoded_by" => _("Encoded By"),
"genre" => _("Genre"), "genre" => _("Genre"),
@ -424,6 +433,8 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
"composer" => "DbComposer", "composer" => "DbComposer",
"conductor" => "DbConductor", "conductor" => "DbConductor",
"copyright" => "DbCopyright", "copyright" => "DbCopyright",
"cuein" => "DbCuein",
"cueout" => "DbCueout",
"encoded_by" => "DbEncodedBy", "encoded_by" => "DbEncodedBy",
"utime" => "DbUtime", "utime" => "DbUtime",
"mtime" => "DbMtime", "mtime" => "DbMtime",
@ -492,7 +503,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
} else { } else {
$column = CcFilesPeer::getTableMap()->getColumnByPhpName($criteria2PeerMap[$d['sp_criteria_field']]); $column = CcFilesPeer::getTableMap()->getColumnByPhpName($criteria2PeerMap[$d['sp_criteria_field']]);
// validation on type of column // 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'])) { if (!preg_match("/^(\d{2}):(\d{2}):(\d{2})/", $d['sp_criteria_value'])) {
$element->addError(_("'Length' should be in '00:00:00' format")); $element->addError(_("'Length' should be in '00:00:00' format"));
$isValid = false; $isValid = false;

View file

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

View file

@ -559,7 +559,9 @@ function enableLoadingIcon() {
function disableLoadingIcon() { function disableLoadingIcon() {
$("#side_playlist").unblock() $("#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 = { var criteriaTypes = {
0 : "", 0 : "",
"album_title" : "s", "album_title" : "s",
@ -568,6 +570,8 @@ var criteriaTypes = {
"composer" : "s", "composer" : "s",
"conductor" : "s", "conductor" : "s",
"copyright" : "s", "copyright" : "s",
"cuein" : "n",
"cueout" : "n",
"artist_name" : "s", "artist_name" : "s",
"encoded_by" : "s", "encoded_by" : "s",
"utime" : "n", "utime" : "n",