Completed smart block, playlist, and webstream editor form overhauls

* CC-6088: Smart Block form needs to have a form layout
* CC-6089: Editor view name fields must be made <input> fields
* CC-6103: Cannot create webstreams
* Reworked a big chunk of the smart block editor flow to send only the
  playlist contents back rather than the entire HTML fragment for the
  editor.
* Keep more of the playlist/smartblock editor view persistent across
  saves, generates, and shuffles.
This commit is contained in:
Albert Santoni 2015-08-27 19:00:23 -04:00
parent 98ac8fd851
commit b6f33f6083
13 changed files with 229 additions and 106 deletions

View file

@ -1,5 +1,6 @@
<?php
class PlaylistController extends Zend_Controller_Action
{
@ -534,8 +535,12 @@ class PlaylistController extends Zend_Controller_Action
if ($form->isValid($params)) {
$this->setPlaylistNameDescAction();
$bl->saveSmartBlockCriteria($params['data']);
$this->createUpdateResponse($bl);
$this->view->result = 0;
/*
$result['html'] = $this->createFullResponse($bl, true, true);
$result['result'] = 0;
*/
} else {
$this->view->form = $form;
$this->view->unsavedName = $params['name'];
@ -543,18 +548,21 @@ class PlaylistController extends Zend_Controller_Action
$viewPath = 'playlist/smart-block.phtml';
$this->view->obj = $bl;
$this->view->id = $bl->getId();
$result['html'] = $this->view->render($viewPath);
$result['result'] = 1;
$this->view->html = $this->view->render($viewPath);
$this->view->result = 1;
}
$result['type'] = "sb";
$result['id'] = $bl->getId();
$result["modified"] = $bl->getLastModified("U");
$this->view->name = $bl->getName();
$this->view->type = "sb";
$this->view->id = $bl->getId();
$this->view->modified = $bl->getLastModified("U");
} else if ($params['type'] == 'playlist') {
$this->setPlaylistNameDescAction();
$result["modified"] = $this->view->modified;
$this->view->modified = $this->view->modified;
$this->view->name = $params['name'];
}
$this->_helper->json->sendJson($result);
//$this->_helper->json->sendJson($result);
}
public function smartBlockGenerateAction()
@ -570,7 +578,9 @@ class PlaylistController extends Zend_Controller_Action
$form->startForm($params['obj_id']);
if ($form->isValid($params)) {
$result = $bl->generateSmartBlock($params['data']);
$this->_helper->json->sendJson(array("result"=>0, "html"=>$this->createFullResponse($bl, true, true)));
$this->view->result = $result['result'];
$this->createUpdateResponse($bl);
#$this->_helper->json->sendJson(array("result"=>0, "html"=>$this->createFullResponse($bl, true, true)));
} else {
$this->view->obj = $bl;
$this->view->id = $bl->getId();
@ -595,12 +605,20 @@ class PlaylistController extends Zend_Controller_Action
try {
$bl = new Application_Model_Block($params['obj_id']);
$result = $bl->shuffleSmartBlock();
$this->view->result = $result["result"];
$this->createUpdateResponse($bl);
/*
if ($result['result'] == 0) {
$this->_helper->json->sendJson(array("result"=>0, "html"=>$this->createFullResponse($bl, true)));
$this->_helper->json->sendJson(array(
"result"=>0,
"contents" => $bl->getContents());
///"html"=>$this->viwe));
} else {
$this->_helper->json->sendJson($result);
}
}*/
} catch (BlockNotFoundException $e) {
$this->playlistNotFound('block', true);
} catch (Exception $e) {
@ -615,12 +633,18 @@ class PlaylistController extends Zend_Controller_Action
try {
$pl = new Application_Model_Playlist($params['obj_id']);
$result = $pl->shuffle();
$this->view->result = $result["result"];
$this->createUpdateResponse($pl);
/*
if ($result['result'] == 0) {
$this->_helper->json->sendJson(array("result"=>0, "html"=>$this->createFullResponse($pl, true)));
$this->_helper->json->sendJson(array(
"result"=>0,
"contents" => $pl->getContents(),
"html"=>$this->createUpdateResponse($pl, true)));
} else {
$this->_helper->json->sendJson($result);
}
}*/
} catch (PlaylistNotFoundException $e) {
$this->playlistNotFound('block', true);
} catch (Exception $e) {