CC-4285: Playlists-> Smart Block - displays that certain amount meets the criteria while no criteria is specified
-fixed
This commit is contained in:
parent
f84f611ab2
commit
69b61c4cfe
|
@ -64,7 +64,7 @@ class PlaylistController extends Zend_Controller_Action
|
||||||
unset($this->view->obj);
|
unset($this->view->obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function createFullResponse($obj = null, $isJson = false)
|
private function createFullResponse($obj = null, $isJson = false, $formIsValid = false)
|
||||||
{
|
{
|
||||||
$isBlock = false;
|
$isBlock = false;
|
||||||
$viewPath = 'playlist/playlist.phtml';
|
$viewPath = 'playlist/playlist.phtml';
|
||||||
|
@ -80,11 +80,12 @@ class PlaylistController extends Zend_Controller_Action
|
||||||
if ($isBlock) {
|
if ($isBlock) {
|
||||||
$form = new Application_Form_SmartBlockCriteria();
|
$form = new Application_Form_SmartBlockCriteria();
|
||||||
$form->removeDecorator('DtDdWrapper');
|
$form->removeDecorator('DtDdWrapper');
|
||||||
$form->startForm($obj->getId());
|
$form->startForm($obj->getId(), $formIsValid);
|
||||||
|
|
||||||
$this->view->form = $form;
|
$this->view->form = $form;
|
||||||
$this->view->obj = $obj;
|
$this->view->obj = $obj;
|
||||||
$this->view->id = $obj->getId();
|
$this->view->id = $obj->getId();
|
||||||
|
|
||||||
if ($isJson) {
|
if ($isJson) {
|
||||||
return $this->view->render($viewPath);
|
return $this->view->render($viewPath);
|
||||||
} else {
|
} else {
|
||||||
|
@ -460,7 +461,7 @@ class PlaylistController extends Zend_Controller_Action
|
||||||
$bl = new Application_Model_Block($params['obj_id']);
|
$bl = new Application_Model_Block($params['obj_id']);
|
||||||
if ($form->isValid($params)) {
|
if ($form->isValid($params)) {
|
||||||
$bl->saveSmartBlockCriteria($params['data']);
|
$bl->saveSmartBlockCriteria($params['data']);
|
||||||
$result['html'] = $this->createFullResponse($bl, true);
|
$result['html'] = $this->createFullResponse($bl, true, true);
|
||||||
$result['result'] = 0;
|
$result['result'] = 0;
|
||||||
} else {
|
} else {
|
||||||
$this->view->obj = $bl;
|
$this->view->obj = $bl;
|
||||||
|
@ -486,7 +487,7 @@ class PlaylistController extends Zend_Controller_Action
|
||||||
if ($form->isValid($params)) {
|
if ($form->isValid($params)) {
|
||||||
$result = $bl->generateSmartBlock($params['data']);
|
$result = $bl->generateSmartBlock($params['data']);
|
||||||
try {
|
try {
|
||||||
die(json_encode(array("result"=>0, "html"=>$this->createFullResponse($bl, true))));
|
die(json_encode(array("result"=>0, "html"=>$this->createFullResponse($bl, true, true))));
|
||||||
} catch (PlaylistNotFoundException $e) {
|
} catch (PlaylistNotFoundException $e) {
|
||||||
$this->playlistNotFound('block');
|
$this->playlistNotFound('block');
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
|
|
@ -88,7 +88,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function startForm($p_blockId)
|
public function startForm($p_blockId, $p_isValid = false)
|
||||||
{
|
{
|
||||||
// load type
|
// load type
|
||||||
$out = CcBlockQuery::create()->findPk($p_blockId);
|
$out = CcBlockQuery::create()->findPk($p_blockId);
|
||||||
|
@ -236,7 +236,13 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
|
||||||
|
|
||||||
//getting block content candidate count that meets criteria
|
//getting block content candidate count that meets criteria
|
||||||
$bl = new Application_Model_Block($p_blockId);
|
$bl = new Application_Model_Block($p_blockId);
|
||||||
$files = $bl->getListofFilesMeetCriteria();
|
if ($p_isValid) {
|
||||||
|
$files = $bl->getListofFilesMeetCriteria();
|
||||||
|
$showPoolCount = true;
|
||||||
|
} else {
|
||||||
|
$files = null;
|
||||||
|
$showPoolCount = false;
|
||||||
|
}
|
||||||
|
|
||||||
$generate = new Zend_Form_Element_Button('generate_button');
|
$generate = new Zend_Form_Element_Button('generate_button');
|
||||||
$generate->setAttrib('class', 'ui-button ui-state-default sp-button');
|
$generate->setAttrib('class', 'ui-button ui-state-default sp-button');
|
||||||
|
@ -256,7 +262,8 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
|
||||||
|
|
||||||
$this->setDecorators(array(
|
$this->setDecorators(array(
|
||||||
array('ViewScript', array('viewScript' => 'form/smart-block-criteria.phtml', "openOption"=> $openSmartBlockOption,
|
array('ViewScript', array('viewScript' => 'form/smart-block-criteria.phtml', "openOption"=> $openSmartBlockOption,
|
||||||
'criteriasLength' => count($this->criteriaOptions), 'poolCount' => $files['count'], 'modRowMap' => $modRowMap))
|
'criteriasLength' => count($this->criteriaOptions), 'poolCount' => $files['count'], 'modRowMap' => $modRowMap,
|
||||||
|
'showPoolCount' => $showPoolCount))
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -66,32 +66,35 @@
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<br />
|
<br />
|
||||||
</dd>
|
</dd>
|
||||||
<div class='sp_text_font sp_text_font_bold'>
|
|
||||||
<span id='sp_pool_count' class='sp_text_font sp_text_font_bold'>
|
<?php if ($this->showPoolCount) { ?>
|
||||||
<?php
|
<div class='sp_text_font sp_text_font_bold'>
|
||||||
if ($this->poolCount > 1) {
|
<span id='sp_pool_count' class='sp_text_font sp_text_font_bold'>
|
||||||
echo $this->poolCount;
|
<?php
|
||||||
?>
|
if ($this->poolCount > 1) {
|
||||||
files meet the criteria
|
echo $this->poolCount;
|
||||||
</span>
|
?>
|
||||||
<span class='checked-icon sp-checked-icon' id='sp_pool_count_icon'></span>
|
files meet the criteria
|
||||||
<?php
|
</span>
|
||||||
} else if ($this->poolCount == 1) {
|
<span class='checked-icon sp-checked-icon' id='sp_pool_count_icon'></span>
|
||||||
echo $this->poolCount;
|
<?php
|
||||||
?>
|
} else if ($this->poolCount == 1) {
|
||||||
file meets the criteria
|
echo $this->poolCount;
|
||||||
</span>
|
?>
|
||||||
<span class='checked-icon sp-checked-icon' id='sp_pool_count_icon'></span>
|
file meets the criteria
|
||||||
<?php
|
</span>
|
||||||
} else {
|
<span class='checked-icon sp-checked-icon' id='sp_pool_count_icon'></span>
|
||||||
?>
|
<?php
|
||||||
0 files meet the criteria
|
} else {
|
||||||
</span>
|
?>
|
||||||
<span class='sp-warning-icon' id='sp_pool_count_icon'></span>
|
0 files meet the criteria
|
||||||
<?php
|
</span>
|
||||||
}
|
<span class='sp-warning-icon' id='sp_pool_count_icon'></span>
|
||||||
?>
|
<?php
|
||||||
</div>
|
}
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
|
||||||
</dl>
|
</dl>
|
||||||
|
|
Loading…
Reference in New Issue