From 750482474f56e889d94714ffa8223d0daaa69364 Mon Sep 17 00:00:00 2001 From: James Date: Tue, 13 Sep 2011 15:21:23 -0400 Subject: [PATCH 1/2] CC-2791: limiting length and numeric with javascript - done --- .../public/js/airtime/preferences/streamsetting.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/airtime_mvc/public/js/airtime/preferences/streamsetting.js b/airtime_mvc/public/js/airtime/preferences/streamsetting.js index 21bc50a88..a239dc0da 100644 --- a/airtime_mvc/public/js/airtime/preferences/streamsetting.js +++ b/airtime_mvc/public/js/airtime/preferences/streamsetting.js @@ -50,6 +50,16 @@ function hideForShoutcast(ele){ restrictOggBitrate(ele, false) } +function validate(ele,evt) { + var theEvent = evt || window.event; + var key = theEvent.keyCode || theEvent.which; + if ((ele.val().length >= 5 || (key < 48 || key > 57)) && !(key == 8 || key == 9 || key == 13 || key == 37 || key == 39 || key == 46)) { + theEvent.returnValue = false; + if(theEvent.preventDefault) theEvent.preventDefault(); + } + } + + function showForIcecast(ele){ var div = ele.closest("div") div.find("#outputMountpoint-label").show() @@ -69,6 +79,10 @@ $(document).ready(function() { rebuildStreamURL($(this)) }) + $("input:[id$=-port]").keypress(function(e){ + validate($(this),e) + }) + $("select:[id$=-output]").change(function(){ rebuildStreamURL($(this)) }) From ebf5c75af35b66cdebe4000402e31b525648c14b Mon Sep 17 00:00:00 2001 From: James Date: Tue, 13 Sep 2011 15:29:01 -0400 Subject: [PATCH 2/2] CC-1929: login page: username should get focus on loading - done --- .../controllers/LoginController.php | 25 +++++++++++-------- airtime_mvc/public/js/airtime/login/login.js | 3 +++ 2 files changed, 17 insertions(+), 11 deletions(-) create mode 100644 airtime_mvc/public/js/airtime/login/login.js diff --git a/airtime_mvc/application/controllers/LoginController.php b/airtime_mvc/application/controllers/LoginController.php index 1eab1be4f..7498a608b 100644 --- a/airtime_mvc/application/controllers/LoginController.php +++ b/airtime_mvc/application/controllers/LoginController.php @@ -10,20 +10,23 @@ class LoginController extends Zend_Controller_Action public function indexAction() { - if(Zend_Auth::getInstance()->hasIdentity()) - { - $this->_redirect('Nowplaying'); - } + if(Zend_Auth::getInstance()->hasIdentity()) + { + $this->_redirect('Nowplaying'); + } + + //uses separate layout without a navigation. + $this->_helper->layout->setLayout('login'); + + $request = $this->getRequest(); + $baseUrl = $request->getBaseUrl(); + + $this->view->headScript()->appendFile($baseUrl.'/js/airtime/login/login.js','text/javascript'); - //uses separate layout without a navigation. - $this->_helper->layout->setLayout('login'); - - $request = $this->getRequest(); - $form = new Application_Form_Login(); + + $message = "Please enter your user name and password"; - $message = "Please enter your user name and password"; - if($request->isPost()) { // if the post contains recaptcha field, which means form had recaptcha field. diff --git a/airtime_mvc/public/js/airtime/login/login.js b/airtime_mvc/public/js/airtime/login/login.js new file mode 100644 index 000000000..ad45c0a22 --- /dev/null +++ b/airtime_mvc/public/js/airtime/login/login.js @@ -0,0 +1,3 @@ +$(document).ready(function(){ + $("#username").focus() +}) \ No newline at end of file