CC-2436: Save pulldown settings

For week and day views under Calendar page, save the change to pref db table when
user updates the interval dropdown. Same thing goes for the "show XXX entries"
dropdown found under Playlist Builder page.

When visiting these pages, we retrieves the entry from database for current user
and use those values. Defaults to 30m for interval and 10 entries for "show xxx entries"
if values were never set.
This commit is contained in:
Yuchen Wang 2011-10-18 10:10:35 -04:00
parent 3e441dc72f
commit d2fe46baf0
6 changed files with 135 additions and 9 deletions

View file

@ -25,6 +25,7 @@ class ApiController extends Zend_Controller_Action
->addActionContext('register-component', 'json')
->addActionContext('update-liquidsoap-error', 'json')
->addActionContext('update-liquidsoap-connection', 'json')
->addActionContext('library-init', 'json')
->initContext();
}
@ -77,9 +78,10 @@ class ApiController extends Zend_Controller_Action
}
$this->view->calendarInit = array(
"timestamp"=>time(),
"timezoneOffset"=> date("Z"),
"timeScale"=>Application_Model_Preference::GetCalendarTimeScale()
"timestamp" => time(),
"timezoneOffset" => date("Z"),
"timeScale" => Application_Model_Preference::GetCalendarTimeScale(),
"timeInterval" => Application_Model_Preference::GetCalendarTimeInterval()
);
}
@ -731,5 +733,25 @@ class ApiController extends Zend_Controller_Action
// setting error_msg as "" when there is no error_msg
Application_Model_StreamSetting::setLiquidsoapError($stream_id, "");
}
/**
* Sets up and send init values used in the Library.
* This is being used by library.js
*/
public function libraryInitAction(){
$this->view->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
if(is_null(Zend_Auth::getInstance()->getStorage()->read())) {
header('HTTP/1.0 401 Unauthorized');
print 'You are not allowed to access this resource.';
return;
}
$this->view->libraryInit = array(
"numEntries"=>Application_Model_Preference::GetLibraryNumEntries()
);
}
}