CRLF
This commit is contained in:
parent
a5a99da21e
commit
557b3f9c9b
|
@ -197,9 +197,9 @@ class PlayouthistoryController extends Zend_Controller_Action
|
|||
|
||||
public function templateAction()
|
||||
{
|
||||
$CC_CONFIG = Config::getConfig();
|
||||
$baseUrl = Application_Common_OsPath::getBaseDir();
|
||||
|
||||
$CC_CONFIG = Config::getConfig();
|
||||
$baseUrl = Application_Common_OsPath::getBaseDir();
|
||||
|
||||
$this->view->headScript()->appendFile($baseUrl.'js/airtime/playouthistory/template.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
|
||||
$historyService = new Application_Service_HistoryService();
|
||||
|
@ -284,25 +284,25 @@ class PlayouthistoryController extends Zend_Controller_Action
|
|||
|
||||
public function updateTemplateAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
$params = $request->getPost();
|
||||
Logging::info($params);
|
||||
|
||||
$request = $this->getRequest();
|
||||
$params = $request->getPost();
|
||||
Logging::info($params);
|
||||
|
||||
$template_id = $this->_getParam('id', null);
|
||||
$name = $this->_getParam('name', null);
|
||||
$fields = $this->_getParam('fields', array());
|
||||
|
||||
if (empty($template_id)) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
$historyService = new Application_Service_HistoryService();
|
||||
$historyService->updateItemTemplate($template_id, $name, $fields);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
Logging::info($e);
|
||||
Logging::info($e->getMessage());
|
||||
$fields = $this->_getParam('fields', array());
|
||||
|
||||
if (empty($template_id)) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
$historyService = new Application_Service_HistoryService();
|
||||
$historyService->updateItemTemplate($template_id, $name, $fields);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
Logging::info($e);
|
||||
Logging::info($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -310,13 +310,13 @@ class PlayouthistoryController extends Zend_Controller_Action
|
|||
{
|
||||
$template_id = $this->_getParam('id');
|
||||
|
||||
try {
|
||||
$historyService = new Application_Service_HistoryService();
|
||||
$historyService->deleteTemplate($template_id);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
Logging::info($e);
|
||||
Logging::info($e->getMessage());
|
||||
try {
|
||||
$historyService = new Application_Service_HistoryService();
|
||||
$historyService->deleteTemplate($template_id);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
Logging::info($e);
|
||||
Logging::info($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -556,19 +556,19 @@ class Application_Service_HistoryService
|
|||
return $fields;
|
||||
}
|
||||
|
||||
private function getSqlTypes() {
|
||||
|
||||
$fields = array(
|
||||
TEMPLATE_DATE => "date",
|
||||
TEMPLATE_TIME => "time",
|
||||
TEMPLATE_DATETIME => "datetime",
|
||||
TEMPLATE_STRING => "text",
|
||||
TEMPLATE_BOOLEAN => "boolean",
|
||||
TEMPLATE_INT => "integer",
|
||||
TEMPLATE_FLOAT => "float",
|
||||
);
|
||||
|
||||
return $fields;
|
||||
private function getSqlTypes() {
|
||||
|
||||
$fields = array(
|
||||
TEMPLATE_DATE => "date",
|
||||
TEMPLATE_TIME => "time",
|
||||
TEMPLATE_DATETIME => "datetime",
|
||||
TEMPLATE_STRING => "text",
|
||||
TEMPLATE_BOOLEAN => "boolean",
|
||||
TEMPLATE_INT => "integer",
|
||||
TEMPLATE_FLOAT => "float",
|
||||
);
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
public function getFileMetadataTypes() {
|
||||
|
@ -728,13 +728,13 @@ class Application_Service_HistoryService
|
|||
|
||||
public function getConfiguredTemplateIds() {
|
||||
|
||||
try {
|
||||
$id = Application_Model_Preference::GetHistoryItemTemplate();
|
||||
try {
|
||||
$id = Application_Model_Preference::GetHistoryItemTemplate();
|
||||
|
||||
return array($id);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
throw $e;
|
||||
return array($id);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -784,13 +784,13 @@ class Application_Service_HistoryService
|
|||
}
|
||||
}
|
||||
|
||||
public function updateItemTemplate($id, $name, $fields, $doSetDefault=false) {
|
||||
|
||||
$this->con->beginTransaction();
|
||||
|
||||
try {
|
||||
|
||||
$template = CcPlayoutHistoryTemplateQuery::create()->findPk($id, $this->con);
|
||||
public function updateItemTemplate($id, $name, $fields, $doSetDefault=false) {
|
||||
|
||||
$this->con->beginTransaction();
|
||||
|
||||
try {
|
||||
|
||||
$template = CcPlayoutHistoryTemplateQuery::create()->findPk($id, $this->con);
|
||||
$template->setDbName($name);
|
||||
|
||||
if (count($fields) === 0) {
|
||||
|
@ -798,33 +798,33 @@ class Application_Service_HistoryService
|
|||
$fields = $t["fields"];
|
||||
}
|
||||
|
||||
$template->getCcPlayoutHistoryTemplateFields()->delete($this->con);
|
||||
|
||||
foreach ($fields as $index=>$field) {
|
||||
|
||||
$isMd = ($field["isFileMd"] == 'true') ? true : false;
|
||||
|
||||
$templateField = new CcPlayoutHistoryTemplateField();
|
||||
$templateField->setDbName($field["name"]);
|
||||
$templateField->setDbType($field["type"]);
|
||||
$templateField->setDbIsFileMD($isMd);
|
||||
$templateField->setDbPosition($index);
|
||||
|
||||
$template->addCcPlayoutHistoryTemplateField($templateField);
|
||||
}
|
||||
|
||||
$template->save($this->con);
|
||||
|
||||
if ($doSetDefault) {
|
||||
$this->setConfiguredItemTemplate($template->getDbid());
|
||||
}
|
||||
|
||||
$this->con->commit();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$this->con->rollback();
|
||||
throw $e;
|
||||
}
|
||||
$template->getCcPlayoutHistoryTemplateFields()->delete($this->con);
|
||||
|
||||
foreach ($fields as $index=>$field) {
|
||||
|
||||
$isMd = ($field["isFileMd"] == 'true') ? true : false;
|
||||
|
||||
$templateField = new CcPlayoutHistoryTemplateField();
|
||||
$templateField->setDbName($field["name"]);
|
||||
$templateField->setDbType($field["type"]);
|
||||
$templateField->setDbIsFileMD($isMd);
|
||||
$templateField->setDbPosition($index);
|
||||
|
||||
$template->addCcPlayoutHistoryTemplateField($templateField);
|
||||
}
|
||||
|
||||
$template->save($this->con);
|
||||
|
||||
if ($doSetDefault) {
|
||||
$this->setConfiguredItemTemplate($template->getDbid());
|
||||
}
|
||||
|
||||
$this->con->commit();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$this->con->rollback();
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
public function deleteTemplate($id) {
|
||||
|
@ -836,11 +836,11 @@ class Application_Service_HistoryService
|
|||
$template = CcPlayoutHistoryTemplateQuery::create()->findPk($id, $this->con);
|
||||
$template->delete($this->con);
|
||||
|
||||
$this->con->commit();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$this->con->rollback();
|
||||
throw $e;
|
||||
$this->con->commit();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$this->con->rollback();
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue