CC-4192: Smart Playlist Builder: make save button save title, description, and criteria

-done
This commit is contained in:
denise 2012-08-09 17:23:52 -04:00
parent bad418062e
commit e674654cb1
6 changed files with 65 additions and 63 deletions

View file

@ -24,7 +24,7 @@ class PlaylistController extends Zend_Controller_Action
->addActionContext('set-playlist-description', 'json')
->addActionContext('playlist-preview', 'json')
->addActionContext('get-playlist', 'json')
->addActionContext('smart-block-criteria-save', 'json')
->addActionContext('save', 'json')
->addActionContext('smart-block-generate', 'json')
->addActionContext('smart-block-shuffle', 'json')
->addActionContext('get-block-info', 'json')
@ -478,14 +478,17 @@ class PlaylistController extends Zend_Controller_Action
}
}
public function setPlaylistNameAction()
public function setPlaylistNameDescAction()
{
$name = $this->_getParam('name', 'Unknown Playlist');
$description = $this->_getParam('description', "");
$type = $this->_getParam('type');
try {
$obj = $this->getPlaylist($type);
$obj->setName($name);
$obj->setDescription($description);
$this->view->description = $obj->getDescription();
$this->view->playlistName = $name;
$this->view->modified = $obj->getLastModified("U");
} catch (PlaylistOutDatedException $e) {
@ -497,6 +500,7 @@ class PlaylistController extends Zend_Controller_Action
}
}
/*
public function setPlaylistDescriptionAction()
{
$description = $this->_getParam('description', "");
@ -515,13 +519,22 @@ class PlaylistController extends Zend_Controller_Action
$this->playlistUnknownError($e);
}
}
*/
public function smartBlockCriteriaSaveAction()
public function saveAction()
{
$request = $this->getRequest();
$params = $request->getPost();
$bl = new Application_Model_Block($params['obj_id']);
$result = $bl->saveSmartBlockCriteria($params['data']);
$result = array();
$this->setPlaylistNameDescAction();
if ($params['type'] == 'block') {
$bl = new Application_Model_Block($params['obj_id']);
$result = $bl->saveSmartBlockCriteria($params['criteria']);
}
$result["modified"] = $this->view->modified;
die(json_encode($result));
}

View file

@ -18,7 +18,6 @@
<?php $i = $i + 1; ?>
<?php endforeach; ?>
<?php echo $this->element->getElement('save_button') ?>
<?php echo $this->element->getElement('generate_button') ?>
<?php echo $this->element->getElement('shuffle_button') ?>
</dd>
@ -96,10 +95,5 @@
</dl>
<?php /*
for($i=0; $i<$this->numOfSubForm; $i++){
echo $this->parent_form->getSubform('sp_set_'.$i);
}*/
?>
</fieldset>
</form>

View file

@ -12,6 +12,8 @@ if (isset($this->obj)) {
</a>
<?php endif; ?>
<button class="ui-button ui-state-default sp-button" type="button" id="save_button">Save</button>
<?php if (isset($this->obj)) : ?>
<input id="obj_id" type="hidden" value="<?php echo $this->obj->getId(); ?>"></input>
<input id="obj_lastMod" type="hidden" value="<?php echo $this->obj->getLastModified('U'); ?>"></input>
@ -22,6 +24,7 @@ if (isset($this->obj)) {
</h3>
<h4 id="spl_length"><?php echo $this->length; ?></h4>
</div>
<div id='sp-success' class='success' style='display:none'></div>
<fieldset class="toggle closed" id="fieldset-metadate_change">
<legend style="cursor: pointer;"><span class="ui-icon ui-icon-triangle-2-n-s"></span>View / edit description</legend>
@ -30,11 +33,6 @@ if (isset($this->obj)) {
<dd id="description-element">
<textarea cols="80" rows="24" id="description" name="description"><?php echo $this->obj->getDescription(); ?></textarea>
</dd>
<dt id="submit-label" style="display: none;">&nbsp;</dt>
<dd id="submit-element" class="buttons">
<input class="ui-button ui-state-default" type="submit" value="Cancel" id="description_cancel" name="cancel">
<input class="ui-button ui-state-default" type="submit" value="Save" id="description_save" name="submit">
</dd>
</dl>
</fieldset>

View file

@ -12,6 +12,8 @@ if (isset($this->obj)) {
</a>
<?php endif; ?>
<?php echo $this->form->getElement('save_button');?>
<?php if (isset($this->obj)) : ?>
<input id="obj_id" type="hidden" value="<?php echo $this->obj->getId(); ?>"></input>
<input id="obj_lastMod" type="hidden" value="<?php echo $this->obj->getLastModified('U'); ?>"></input>
@ -30,11 +32,6 @@ if (isset($this->obj)) {
<dd id="description-element">
<textarea cols="80" rows="24" id="description" name="description"><?php echo $this->obj->getDescription(); ?></textarea>
</dd>
<dt id="submit-label" style="display: none;">&nbsp;</dt>
<dd id="submit-element" class="buttons">
<input class="ui-button ui-state-default" type="submit" value="Cancel" id="description_cancel" name="cancel">
<input class="ui-button ui-state-default" type="submit" value="Save" id="description_save" name="submit">
</dd>
</dl>
</fieldset>