CC-1152 added refresh button to refresh the meta data and rerun the search.
This commit is contained in:
parent
ffb47f021d
commit
8c6cddcd87
|
@ -429,7 +429,7 @@ class getid3_id3v2
|
|||
}
|
||||
}
|
||||
|
||||
if (!isset($thisfile_id3v2['comments']['year']) && ereg('^([0-9]{4})', trim(@$thisfile_id3v2['comments']['recording_time'][0]), $matches)) {
|
||||
if (!isset($thisfile_id3v2['comments']['year']) && preg_match('/^([0-9]{4})/', trim(@$thisfile_id3v2['comments']['recording_time'][0]), $matches)) {
|
||||
$thisfile_id3v2['comments']['year'] = array($matches[1]);
|
||||
}
|
||||
|
||||
|
@ -461,7 +461,7 @@ class getid3_id3v2
|
|||
$unprocessed = substr($unprocessed, $endpos + 1);
|
||||
}
|
||||
unset($unprocessed);
|
||||
} elseif (eregi('^([0-9]+|CR|RX)$', $genrestring)) {
|
||||
} elseif (preg_match('/^([0-9]+|CR|RX)$/', $genrestring)) {
|
||||
// some tagging program (including some that use TagLib) fail to include null byte after numeric genre
|
||||
$genrestring = '('.$genrestring.')';
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ $ui_fmask = array(
|
|||
'isPref' => TRUE,
|
||||
'type' => 'hidden',
|
||||
'label' => 'Station logo path',
|
||||
'default' => 'img/stationlogo.image',
|
||||
'default' => 'img/logo.png',
|
||||
'required' => TRUE,
|
||||
),
|
||||
array(
|
||||
|
@ -440,7 +440,7 @@ $ui_fmask = array(
|
|||
'attributes'=> array(
|
||||
'onChange' => 'this.form.act.value="'.$tmpAct.'.setCategory"; this.form.submit()',
|
||||
'style' => 'width: 180px;',
|
||||
'id' => 'category_1'
|
||||
'id' => 'category_'
|
||||
)
|
||||
),
|
||||
'value' => array(
|
||||
|
@ -450,6 +450,7 @@ $ui_fmask = array(
|
|||
'attributes'=> array(
|
||||
'size' => 10,
|
||||
'class' => 'area_browse',
|
||||
'id' => 'category_value_',
|
||||
'onChange' => 'this.form.act.value="'.$tmpAct.'.setValue"; this.form.submit()'
|
||||
)
|
||||
)
|
||||
|
|
|
@ -341,8 +341,6 @@ if ($uiBrowser->userid) {
|
|||
break;
|
||||
|
||||
case "HUBBROWSE":
|
||||
//$HUBBROWSE = new uiHubBrowse($uiBrowser);
|
||||
//$Smarty->assign('hubBrowseForm', $HUBBROWSE->browseForm($uiBrowser->id, $ui_fmask));
|
||||
$Smarty->assign('hubBrowseForm', $uiBrowser->HUBBROWSE->browseForm($uiBrowser->id, $ui_fmask));
|
||||
$Smarty->assign('showLibrary', TRUE);
|
||||
$Smarty->assign('isHub', TRUE);
|
||||
|
|
|
@ -144,6 +144,10 @@ switch ($_REQUEST['act']) {
|
|||
case "SEARCH.setOffset":
|
||||
$uiHandler->SEARCH->setOffset($_REQUEST['page']);
|
||||
break;
|
||||
|
||||
case "BROWSE.refresh":
|
||||
$uiHandler->BROWSE->refresh($_REQUEST);
|
||||
break;
|
||||
|
||||
case "BROWSE.setCategory":
|
||||
$uiHandler->BROWSE->setCategory($_REQUEST);
|
||||
|
|
|
@ -42,6 +42,41 @@
|
|||
<!-- start browsing -->
|
||||
<div class="container_elements" style="width: 607px;">
|
||||
<h1>##Browse##</h1>
|
||||
|
||||
{literal}
|
||||
<script language="javascript">
|
||||
function setRefresh(frm){
|
||||
|
||||
var selected_1 = document.getElementById("category_1");
|
||||
var selected_2 = document.getElementById("category_2");
|
||||
var selected_3 = document.getElementById("category_3");
|
||||
|
||||
var value_1 = document.getElementById("category_value_1");
|
||||
var value_2 = document.getElementById("category_value_2");
|
||||
var value_3 = document.getElementById("category_value_3");
|
||||
|
||||
frm.elements['cat1'].value = selected_1[selected_1.selectedIndex].value;
|
||||
frm.elements['cat2'].value = selected_2[selected_2.selectedIndex].value;
|
||||
frm.elements['cat3'].value = selected_3[selected_3.selectedIndex].value;
|
||||
|
||||
frm.elements['val1'].value = value_1[value_1.selectedIndex].value;
|
||||
frm.elements['val2'].value = value_2[value_2.selectedIndex].value;
|
||||
frm.elements['val3'].value = value_3[value_3.selectedIndex].value;
|
||||
}
|
||||
</script>
|
||||
{/literal}
|
||||
|
||||
<form action="ui_handler.php" method="post" name="browse_refresh" id="browse_refresh" onSubmit="setRefresh(this)">
|
||||
<input name="act" type="hidden" value="BROWSE.refresh" />
|
||||
<input name="cat1" type="hidden" value="" />
|
||||
<input name="val1" type="hidden" value="" />
|
||||
<input name="cat2" type="hidden" value="" />
|
||||
<input name="val2" type="hidden" value="" />
|
||||
<input name="cat3" type="hidden" value="" />
|
||||
<input name="val3" type="hidden" value="" />
|
||||
<input type="submit" value="Refresh metadata"/>
|
||||
</form>
|
||||
|
||||
{assign var="_act_prefix" value="BROWSE"}
|
||||
{include file="library/browseForm.tpl"}
|
||||
{BROWSE->getResult assign=_results}
|
||||
|
|
|
@ -117,8 +117,8 @@ class uiBrowse
|
|||
* @return array
|
||||
*/
|
||||
public function getCriteria()
|
||||
{
|
||||
return $this->criteria;
|
||||
{
|
||||
return $this->criteria;
|
||||
} // fn getCriteria
|
||||
|
||||
|
||||
|
@ -128,7 +128,7 @@ class uiBrowse
|
|||
public function getResult()
|
||||
{
|
||||
$this->searchDB();
|
||||
return $this->results;
|
||||
return $this->results;
|
||||
} // fn getResult
|
||||
|
||||
|
||||
|
@ -140,16 +140,21 @@ class uiBrowse
|
|||
if (isset($v['type']) && $v['type']) {
|
||||
$tmp = uiBase::formElementEncode($v['element']);
|
||||
$mask2['browse_columns']['category']['options'][$tmp] = tra($v['label']);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for ($n = 1; $n <= 3; $n++) {
|
||||
$form = new HTML_QuickForm('col'.$n, UI_STANDARD_FORM_METHOD, UI_HANDLER);
|
||||
$form->setConstants(array('id' => $id,
|
||||
'col' => $n,
|
||||
'category' => uiBase::formElementEncode($this->col[$n]['category'])));
|
||||
|
||||
$mask2['browse_columns']['value']['options'] = $this->options($this->col[$n]['values']['results']);
|
||||
$mask2['browse_columns']['category']['attributes']['id'] = "category_" . $n;
|
||||
$mask2['browse_columns']['value']['attributes']['id'] = "category_value_" . $n;
|
||||
|
||||
$mask2['browse_columns']['value']['default'] = $this->col[$n]['form_value'];
|
||||
uiBase::parseArrayToForm($form, $mask2['browse_columns']);
|
||||
$form->validate();
|
||||
|
@ -170,7 +175,6 @@ class uiBrowse
|
|||
return $output;
|
||||
} // fn browseForm
|
||||
|
||||
|
||||
/**
|
||||
* Set the category for audio file browser. There are three columns
|
||||
* you can set the category for. All columns greater than the current
|
||||
|
@ -182,7 +186,7 @@ class uiBrowse
|
|||
* string ['category'] - the category for the given column
|
||||
* @return void
|
||||
*/
|
||||
public function setCategory($p_param)
|
||||
public function setCategory($p_param, $redirect="true")
|
||||
{
|
||||
// input values
|
||||
$columnNumber = $p_param['col'];
|
||||
|
@ -205,7 +209,7 @@ class uiBrowse
|
|||
// way too many values.
|
||||
$tmpCriteria["limit"] = 1000;
|
||||
$tmpCriteria["offset"] = 0;
|
||||
|
||||
|
||||
// For this column and all columns above this one,
|
||||
// reload the values.
|
||||
for ($i = $columnNumber; $i <= 3; $i++) {
|
||||
|
@ -217,7 +221,9 @@ class uiBrowse
|
|||
$browseValues = null;
|
||||
}
|
||||
|
||||
$this->Base->redirUrl = UI_BROWSER.'?act='.$this->prefix;
|
||||
if($redirect) {
|
||||
$this->Base->redirUrl = UI_BROWSER.'?act='.$this->prefix;
|
||||
}
|
||||
} // fn setCategory
|
||||
|
||||
|
||||
|
@ -234,10 +240,10 @@ class uiBrowse
|
|||
* See the top of that file for a description of the search
|
||||
* criteria structure.
|
||||
*/
|
||||
public function setValue($p_param)
|
||||
public function setValue($p_param, $redirect="true")
|
||||
{
|
||||
$columnNumber = $p_param['col'];
|
||||
$value = $p_param['value'][0];
|
||||
$value = $p_param['value'][0];
|
||||
$category = $p_param['category'];
|
||||
|
||||
$this->criteria['offset'] = 0;
|
||||
|
@ -275,9 +281,60 @@ class uiBrowse
|
|||
$this->col[$tmpColNum]['values'] = $browseValues;
|
||||
}
|
||||
}
|
||||
$this->Base->redirUrl = UI_BROWSER.'?act='.$this->prefix;
|
||||
|
||||
if($redirect) {
|
||||
$this->Base->redirUrl = UI_BROWSER.'?act='.$this->prefix;
|
||||
}
|
||||
} // fn setValue
|
||||
|
||||
public function refresh($p_param){
|
||||
$category_1 = array(
|
||||
'col' => 1,
|
||||
'category' => $p_param['cat1']
|
||||
);
|
||||
|
||||
$value_1 = array(
|
||||
'col' => 1,
|
||||
'category' => $p_param['cat1'],
|
||||
'value' => array(
|
||||
0 => $p_param['val1']
|
||||
)
|
||||
);
|
||||
|
||||
$category_2 = array(
|
||||
'col' => 2,
|
||||
'category' => $p_param['cat2']
|
||||
);
|
||||
|
||||
$value_2 = array(
|
||||
'col' => 2,
|
||||
'category' => $p_param['cat2'],
|
||||
'value' => array(
|
||||
0 => $p_param['val2']
|
||||
)
|
||||
);
|
||||
|
||||
$category_3 = array(
|
||||
'col' => 3,
|
||||
'category' => $p_param['cat3']
|
||||
);
|
||||
|
||||
$value_3 = array(
|
||||
'col' => 3,
|
||||
'category' => $p_param['cat3'],
|
||||
'value' => array(
|
||||
0 => $p_param['val3']
|
||||
)
|
||||
);
|
||||
|
||||
$this->setCategory($category_1, false);
|
||||
$this->setCategory($category_2, false);
|
||||
$this->setCategory($category_3, false);
|
||||
|
||||
$this->setValue($value_1, false);
|
||||
$this->setValue($value_2, false);
|
||||
$this->setValue($value_3, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Given an array of category values, prepare the array for display:
|
||||
|
|
Loading…
Reference in New Issue