Php Exception: Set large number as year in tracks Metadata

fixed
This commit is contained in:
Martin Konecny 2013-06-06 17:02:01 -04:00
parent f7a6fec5eb
commit 6498f43dad
2 changed files with 22 additions and 9 deletions

View File

@ -426,6 +426,9 @@ class LibraryController extends Zend_Controller_Action
$request = $this->getRequest(); $request = $this->getRequest();
$file_id = $this->_getParam('id', null); $file_id = $this->_getParam('id', null);
$file = Application_Model_StoredFile::RecallById($file_id); $file = Application_Model_StoredFile::RecallById($file_id);
@ -438,7 +441,15 @@ class LibraryController extends Zend_Controller_Action
$form->populate($file->getDbColMetadata()); $form->populate($file->getDbColMetadata());
if ($request->isPost()) { if ($request->isPost()) {
if ($form->isValid($request->getPost())) {
$js = $this->_getParam('data');
$serialized = array();
//need to convert from serialized jQuery array.
foreach ($js as $j) {
$serialized[$j["name"]] = $j["value"];
}
if ($form->isValid($serialized)) {
$formValues = $this->_getParam('data', null); $formValues = $this->_getParam('data', null);
$formdata = array(); $formdata = array();

View File

@ -39,7 +39,7 @@ class Application_Form_EditAudioMD extends Zend_Form
$this->addElement('text', 'track_number', array( $this->addElement('text', 'track_number', array(
'label' => _('Track:'), 'label' => _('Track:'),
'class' => 'input_text', 'class' => 'input_text',
'filters' => array('StringTrim') 'filters' => array('StringTrim'),
)); ));
// Add genre field // Add genre field
@ -50,16 +50,18 @@ class Application_Form_EditAudioMD extends Zend_Form
)); ));
// Add year field // Add year field
$this->addElement('text', 'year', array( $year = new Zend_Form_Element_Text('year');
'label' => _('Year:'), $year->class = 'input_text';
'class' => 'input_text', $year->setLabel(_('Year:'))
'filters' => array('StringTrim'), ->setFilters(array('StringTrim'))
'validators' => array( ->setValidators(array(
new MyValidator(),
new Zend_Validate_StringLength(array('max' => 10)),
Application_Form_Helper_ValidationTypes::overrrideDateValidator("YYYY-MM-DD"), Application_Form_Helper_ValidationTypes::overrrideDateValidator("YYYY-MM-DD"),
Application_Form_Helper_ValidationTypes::overrrideDateValidator("YYYY-MM"), Application_Form_Helper_ValidationTypes::overrrideDateValidator("YYYY-MM"),
Application_Form_Helper_ValidationTypes::overrrideDateValidator("YYYY") Application_Form_Helper_ValidationTypes::overrrideDateValidator("YYYY")
)
)); ));
$this->addElement($year);
// Add label field // Add label field
$this->addElement('text', 'label', array( $this->addElement('text', 'label', array(