*** empty log message ***

This commit is contained in:
sebastian 2005-03-02 19:15:55 +00:00
parent 36f6ca0b06
commit 06258d6b95
15 changed files with 205 additions and 87 deletions

View File

@ -1,5 +1,8 @@
<?php
$Smarty->register_object('uiBrowser', $uiBrowser);
$Smarty->register_object('UIBROWSER', $uiBrowser);
$Smarty->register_object('PL', $uiBrowser->PLAYLIST);
$Smarty->register_object('BROWSE', $uiBrowser->BROWSE);
$Smarty->register_object('SEARCH', $uiBrowser->SEARCH);
$Smarty->register_function('str_repeat', 'S_str_repeat');
$Smarty->register_function('urlencode', 'S_urlencode');

View File

@ -398,6 +398,7 @@ $ui_fmask = array(
array('group' => array('clear', 'addrow', 'submit')
),
),
'relations' => array(
'standard' => array(
'partial' => 'partial',
@ -409,13 +410,15 @@ $ui_fmask = array(
'>' => '>',
'>=' => '>='
),
1 => array(
1 => array(
'partial' => 'partial',
'full' => 'full',
'prefix' => 'prefix',
'=' => '='
),
),
),
'languages' => array(
array(
'element' => 'langid',
@ -429,7 +432,8 @@ $ui_fmask = array(
)
)
),
'browse' => array(
'browse_columns' => array(
array(
'element' => 'act',
'type' => 'hidden',
@ -457,15 +461,12 @@ $ui_fmask = array(
'STYLE' => 'width: 220px',
'onChange' => 'this.form.act.value="BROWSE.setValue"; this.form.submit()')
)
/*
),
'browse_global' => array(
array(
'element' => 'operator',
'type' => 'select',
'label' => 'Operator',
'options' => array(
'or' => 'Or',
'and' => 'And',
)
'element' => 'act',
'type' => 'hidden',
),
array(
'element' => 'filetype',
@ -476,44 +477,25 @@ $ui_fmask = array(
'audioclip' => 'Audioclip',
'webstream' => 'Webstream',
'playlist' => 'Playlist'
)
),
'attributes'=> array('onChange' => 'hpopup("'.UI_HANDLER.'?act=BROWSE.setFiletype&filetype=" + this.form.filetype.value)')
),
array(
'element' => 'limit',
'type' => 'select',
'label' => 'Rows per Page',
'options' => array(
1 => 1,
#1 => 1,
5 => 5,
10 => 10,
25 => 25,
50 => 50,
100 => 100
)
),
array(
'element' => 'clear',
'type' => 'button',
'label' => 'Clear',
'attributes' => array('onClick' => "this.form.reset(); hpopup('".UI_HANDLER."?act=SEARCH.clear', 'SF')"),
'groupit' => TRUE,
),
array(
'element' => 'addrow',
'type' => 'button',
'label' => 'One more Row',
'attributes' => array('onClick' => 'SearchForm_addRow()'),
'groupit' => TRUE,
),
array(
'element' => 'submit',
'type' => 'submit',
'label' => 'Submit',
'groupit' => TRUE,
),
array('group' => array('clear', 'addrow', 'submit')
), */
),
'attributes'=> array('onChange' => 'hpopup("'.UI_HANDLER.'?act=BROWSE.setLimit&limit=" + this.form.limit.value)')
)
),
'PL.changeTransition' => array(
'transition' => array(
array(

View File

@ -53,10 +53,7 @@ if (is_array($_REQUEST['popup'])){
if ($uiBrowser->userid) {
$Smarty->assign('showMenuTop', TRUE);
$Smarty->assign('SCRATCHPAD', $uiBrowser->SCRATCHPAD->get());
$Smarty->assign('PLid', $uiBrowser->PLAYLIST->activeId);
$Smarty->register_object('PL', $uiBrowser->PLAYLIST);
$Smarty->register_object('BROWSE', $uiBrowser->BROWSE);
$Smarty->register_object('SEARCH', $uiBrowser->SEARCH);
#$Smarty->assign('PLid', $uiBrowser->PLAYLIST->activeId);
switch ($_REQUEST['act']){
case "fileBrowse":
@ -87,15 +84,17 @@ if ($uiBrowser->userid) {
case "uploadFile":
$Smarty->assign('structure', $uiBrowser->getStructure($uiBrowser->id));
$Smarty->assign('uploadform', $uiBrowser->uploadFile($ui_fmask['uploadFile'], $uiBrowser->id, $_REQUEST['replace']));
$Smarty->assign('editMetaData', $uiBrowser->editMetaData($uiBrowser->id, TRUE));
# booth masks on one page
$Smarty->assign('uploadform', $uiBrowser->uploadFile($ui_fmask['uploadFile'], $uiBrowser->id, $_REQUEST['replace']));
break;
case "addWebstream":
$Smarty->assign('structure', $uiBrowser->getStructure($uiBrowser->id));
$Smarty->assign('uploadform', $uiBrowser->addWebstream($ui_fmask['addWebstream'], $uiBrowser->id, $_REQUEST['replace']));
# booth masks on one page
$Smarty->assign('editMetaData', $uiBrowser->editMetaData($uiBrowser->id, TRUE));
break;
@ -107,13 +106,13 @@ if ($uiBrowser->userid) {
case "SEARCH":
$Smarty->assign('searchForm', $uiBrowser->SEARCH->form($uiBrowser->id, $ui_fmask));
$Smarty->assign('searchForm', $uiBrowser->SEARCH->searchForm($uiBrowser->id, $ui_fmask));
$Smarty->assign('showLibrary', TRUE);
break;
case "BROWSE":
$Smarty->assign('browseForm', $uiBrowser->BROWSE->browseForm($uiBrowser->id, $ui_fmask['browse']));
$Smarty->assign('browseForm', $uiBrowser->BROWSE->browseForm($uiBrowser->id, $ui_fmask));
$Smarty->assign('showLibrary', TRUE);
break;

View File

@ -155,6 +155,26 @@ switch($_REQUEST['act']){
$uiHandler->BROWSE->setValue($_REQUEST);
break;
case "BROWSE.reOrder":
$uiHandler->BROWSE->reOrder($_REQUEST['by']);
break;
case "BROWSE.clear":
$uiHandler->BROWSE->clear();
break;
case "BROWSE.setOffset":
$uiHandler->BROWSE->setOffset($_REQUEST['page']);
break;
case "BROWSE.setLimit":
$uiHandler->BROWSE->setLimit($_REQUEST['limit']);
break;
case "BROWSE.setFiletype":
$uiHandler->BROWSE->setFiletype($_REQUEST['filetype']);
break;
case "PL.activate":
$uiHandler->PLAYLIST->setReload();
if ($uiHandler->PLAYLIST->activate($_REQUEST['id']) === TRUE) {

View File

@ -1,6 +1,9 @@
{PL->getActiveId assign=_PL_activeId}
<div id="objects">
{include file="sub/x.tpl"}
<table border="0" width="90%" align="center">
<tr bgcolor="{cycle values='#eeeeee, #dadada"'}">
<th>Title</th>
@ -17,7 +20,7 @@
{if $i.type eq 'Folder'}
<a href="{$UI_BROWSER}?act=fileBrowse&id={$i.id}" >[{$i.title|truncate:30}]</b>
{else}
{if $PLid == $i.id}
{if $_PL_activeId == $i.id}
<b>{$i.title|truncate:30}</b>
{else}
{$i.title|truncate:30}
@ -42,11 +45,11 @@
{if $i.type != 'Folder'}
<br>
&nbsp;<a href="{$UI_BROWSER}?act=getMData&id={$i.id}">[MDataXML]</a>
&nbsp;<a href="{$UI_BROWSER}?act=editMetaData&id={$i.id}">[MDataForm]</a>
<!-- &nbsp;<a href="{$UI_BROWSER}?act=editMetaData&id={$i.id}">[MDataForm]</a> -->
{if $i.type eq 'webstream'}
&nbsp;<a href="{$UI_BROWSER}?act=addWebstream&id={$i.id}&replace=1">[Replace]</a>
&nbsp;<a href="{$UI_BROWSER}?act=addWebstream&id={$i.id}&replace=1">[Edit]</a>
{elseif $i.type eq 'audioclip'}
&nbsp;<a href="{$UI_BROWSER}?act=uploadFile&id={$i.id}&replace=1">[Replace]</a>
&nbsp;<a href="{$UI_BROWSER}?act=uploadFile&id={$i.id}&replace=1">[Edit]</a>
&nbsp;<a href="{$CONFIG.accessRawAudioUrl}?id={$i.gunid}&sessid={$START.sessid}">[Access]</a>
&nbsp;<a href="{$UI_BROWSER}?act=_analyzeFile&id={$i.id}">[RawAnalyze]</a>
{/if}

View File

@ -15,15 +15,31 @@
<table>
<tr>
{foreach from=$browseForm item=form}
<td>
{foreach from=$form item=dynform}
<td>
{foreach from=$browseForm.col1 item=dynform}
{include file="sub/dynForm_plain.tpl"}
{/foreach}
</td>
{/foreach}
</td>
<td>
{foreach from=$browseForm.col2 item=dynform}
{include file="sub/dynForm_plain.tpl"}
{/foreach}
</td>
<td>
{foreach from=$browseForm.col3 item=dynform}
{include file="sub/dynForm_plain.tpl"}
{/foreach}
</td>
</tr>
<tr>
<td></td>
<td>
{foreach from=$browseForm.global item=dynform}
{include file="sub/dynForm_plain.tpl"}
{/foreach}
</td>
<td></td>
</tr>
</table>

View File

@ -1,11 +1,13 @@
{*Smarty template*}
{if $searchForm}
{assign var="_act_prefix" value="SEARCH"}
{include file="library/searchForm.tpl"}
{SEARCH->getResult assign=searchResults}
{/if}
{if $browseForm}
{assign var="_act_prefix" value="BROWSE"}
{include file="library/browseForm.tpl"}
{BROWSE->getResult assign=searchResults}
{/if}

View File

@ -1,14 +1,14 @@
{*Smarty template*}
<div id="searchres">
<center>
<center>
{if $searchResults.count > 0}
<table border="0" width="50%">
<tr style="background-color: {cycle values='#eeeeee, #dadada'}">
<td align="center"><a href="#" onClick="hpopup('{$UI_HANDLER}?act=SEARCH.reOrder&by=title', 'order');">{tra 0=Title}</a></td>
<td align="center"><a href="#" onClick="hpopup('{$UI_HANDLER}?act=SEARCH.reOrder&by=creator', 'order');">{tra 0=Creator}</a></td>
<td align="center"><a href="#" onClick="hpopup('{$UI_HANDLER}?act=SEARCH.reOrder&by=extent', 'order');">{tra 0=Duration}</a></td>
<td align="center"><a href="#" onClick="hpopup('{$UI_HANDLER}?act=SEARCH.reOrder&by=type', 'order');">{tra 0=Type}</a></td>
<td align="center"><a href="#" onClick="hpopup('{$UI_HANDLER}?act={$_act_prefix}.reOrder&by=title', 'order');">{tra 0=Title}</a></td>
<td align="center"><a href="#" onClick="hpopup('{$UI_HANDLER}?act={$_act_prefix}.reOrder&by=creator', 'order');">{tra 0=Creator}</a></td>
<td align="center"><a href="#" onClick="hpopup('{$UI_HANDLER}?act={$_act_prefix}.reOrder&by=extent', 'order');">{tra 0=Duration}</a></td>
<td align="center"><a href="#" onClick="hpopup('{$UI_HANDLER}?act={$_act_prefix}.reOrder&by=type', 'order');">{tra 0=Type}</a></td>
</tr>
{foreach from=$searchResults.items item=i}
<tr style="background-color: {cycle values='#eeeeee, #dadada'}" {assign var="moreContextBefore" value=", 'SP.addItem'"}{include file="sub/contextmenu.tpl"}>
@ -26,17 +26,17 @@
{/foreach}
<tr>
<td>
{if $searchResults.prev}<a href="#" onClick="hpopup('{$UI_HANDLER}?act=SEARCH.setOffset&page=prev', 'pager')">back</a>{/if}
{if $searchResults.prev}<a href="#" onClick="hpopup('{$UI_HANDLER}?act={$_act_prefix}.setOffset&page=prev', 'pager')">back</a>{/if}
</td>
<td>count: {$searchResults.count}</td>
<td>
go:
{foreach from=$searchResults.pages item=p key=k}
<a href="#" onClick="hpopup('{$UI_HANDLER}?act=SEARCH.setOffset&page={$k}', 'pager')">{$p}</a>
<a href="#" onClick="hpopup('{$UI_HANDLER}?act={$_act_prefix}.setOffset&page={$k}', 'pager')">{$p}</a>
{/foreach}
</td>
<td align="right">
{if $searchResults.next}<a href="#" onClick="hpopup('{$UI_HANDLER}?act=SEARCH.setOffset&page=next', 'pager')">forward</a>{/if}
{if $searchResults.next}<a href="#" onClick="hpopup('{$UI_HANDLER}?act={$_act_prefix}.setOffset&page=next', 'pager')">forward</a>{/if}
</td>
</tr>
<tr><td colspan="4">

View File

@ -18,11 +18,13 @@
<td>{$i.type}</td>
</tr>
{/foreach}
{if $n}
<tr onMouseOver="highlight()"
onMouseOut="darklight()"
onContextmenu="return menu('{$i.attrs.id}', 'PL.changeFadeOut')" style="background-color: lightblue">
<td colspan="4" align="center">{$i.fadeout_ms} ms</td>
</tr>
{/if}
<tr style="background-color: {cycle values='#eeeeee, #dadada'}">
<td><input type="checkbox" name="all" onClick="form_switchAll('PL')"></th>

View File

@ -1,4 +1,4 @@
{*Smarty template*}
{PL->getActiveId assign=_PL_activeId}
<div id="scratchpad">
<center><b>%%ScratchPad%%</b>
@ -18,7 +18,7 @@
<tr style="background-color: {cycle values='#eeeeee, #dadada'}" {assign var="moreContextBefore" value=", 'SP.removeItem'"} {include file="sub/contextmenu.tpl"}>
<td><input type="checkbox" name="{$i.id}"></td>
<td>
{if $PLid == $i.id}
{if $_PL_activeId == $i.id}
<b>{$i.title|truncate:30}</b>
{else}
{$i.title|truncate:30}

View File

@ -49,7 +49,7 @@
}
{/literal}
{uiBrowser->getAlertMsg assign='alertMsg'}
{UIBROWSER->getAlertMsg assign='alertMsg'}
{if $alertMsg}
alert('{$alertMsg}');
{/if}

View File

@ -1,9 +1,11 @@
{PL->getActiveId assign=_PL_activeId}
onMouseOver="highlight()"
onMouseOut="darklight()"
onContextmenu="return menu('{$i.id}'
{$moreContextBefore}
{if ($i.type == 'audioclip' || $i.type == 'webstream')}
{if $PLid}
{if $_PL_activeId}
, 'PL.addItem'
{else}
, 'PL.create'
@ -12,8 +14,8 @@ onContextmenu="return menu('{$i.id}'
{/if}
{if ($i.type == 'playlist')}
{if $PLid}
{if $PLid == $i.id}
{if $_PL_activeId}
{if $_PL_activeId == $i.id}
, 'PL.release'
{else}
, 'PL.addItem', 'delete'

View File

@ -5,13 +5,18 @@ class uiBrowse
{
$this->Base =& $uiBase;
$this->col =& $_SESSION[UI_BROWSE_SESSNAME]['col'];
$this->criteria =& $_SESSION[UI_BROWSE_SESSNAME]['criteria'];
$this->reloadUrl = UI_BROWSER.'?popup[]=_reload_parent&popup[]=_close';
$this->criteria['limit'] ? NULL : $this->criteria['limit'] = 5;
if (!is_array($this->col)) {
#$this->col[1]['category'] = 'dc:genre';
#$this->col[2]['category'] = 'dc:creator';
#$this->col[3]['category'] = 'dc:title';
#$this->setCategory(array('col' => 1, 'category' => $this->col[1]['category']));
$this->col[1]['category'] = 'ls:genre';
$this->col[2]['category'] = 'dc:creator';
$this->col[3]['category'] = 'dc:source';
for ($col=1; $col<=3; $col++) {
$this->setCategory(array('col' => $col, 'category' => $this->col[$col]['category']));
}
}
#print_r($this->col);
}
@ -26,25 +31,36 @@ class uiBrowse
function browseForm($id, $mask2)
{
include dirname(__FILE__).'/formmask/metadata.inc.php';
$mask2['category']['options'][0] = tra('Select a Value');
$mask2['browse_columns']['category']['options'][0] = tra('Select a Value');
foreach ($mask['pages'] as $key=>$val) {
foreach ($mask['pages'][$key] as $v){
if ($v['type']) $mask2['category']['options'][$this->Base->_formElementEncode($v['element'])] = tra($v['label']);
if ($v['type']) $mask2['browse_columns']['category']['options'][$this->Base->_formElementEncode($v['element'])] = 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' => $this->Base->_formElementEncode($this->col[$n]['category'])));
$mask2['value']['options'] = $this->_options($this->col[$n]['values']['results']);
$mask2['value']['default'] = $this->col[$n]['form_value'];
$this->Base->_parseArr2Form($form, $mask2);
$mask2['browse_columns']['value']['options'] = $this->options($this->col[$n]['values']['results']);
$mask2['browse_columns']['value']['default'] = $this->col[$n]['form_value'];
$this->Base->_parseArr2Form($form, $mask2['browse_columns']);
$form->validate();
$renderer =& new HTML_QuickForm_Renderer_Array(true, true);
$form->accept($renderer);
$output[$n]['dynform'] = $renderer->toArray();
$output['col'.$n]['dynform'] = $renderer->toArray();
}
#print_r($output);
## just to change limit and file-type
$form = new HTML_QuickForm('shitcher', UI_STANDARD_FORM_METHOD, UI_HANDLER);
#$mask2['browse_global']['limit']['default'] = $this->criteria['limit'];
#$mask2['browse_global']['filetype']['default'] = $this->criteria['filetype'];
$this->Base->_parseArr2Form($form, $mask2['browse_global']);
$form->setDefaults(array('limit' => $this->criteria['limit'],
'filetype' => $this->criteria['filetype']));
$renderer =& new HTML_QuickForm_Renderer_Array(true, true);
$form->accept($renderer);
$output['global']['dynform'] = $renderer->toArray();
return $output;
}
@ -93,7 +109,7 @@ class uiBrowse
}
function _options($arr)
function options($arr)
{ $ret['%%all%%'] = '---all---';
if (is_array($arr)) {
foreach ($arr as $val)
@ -117,20 +133,85 @@ class uiBrowse
function getResult()
{
$this->results = NULL;
for($col=4; $col>=1; $col--) {
if (is_array($this->col[$col]['criteria'])) {
#echo $col; print_r($this->col[$col]['criteria']);
$this->criteria = array_merge ($this->criteria, $this->col[$col]['criteria']);
break;
}
}
$results = $this->Base->gb->localSearch($this->col[$col]['criteria'], $this->Base->sessid);
$this->results['count'] = $results['cnt'];
$results = $this->Base->gb->localSearch($this->criteria, $this->Base->sessid);
#$this->results['count'] = $results['cnt'];
foreach ($results['results'] as $rec) {
$this->results['items'][] = $this->Base->_getMetaInfo($this->Base->gb->_idFromGunid($rec));
}
$this->pagination($results);
#print_r($this->results);
return $this->results;
}
function pagination(&$results)
{
if (sizeof($this->results) == 0) {
return FALSE;
}
$this->results['count'] = $results['cnt'];
$this->results['next'] = $results['cnt'] > $this->criteria['offset'] + $this->criteria['limit'] ? TRUE : FALSE;
$this->results['prev'] = $this->criteria['offset'] > 0 ? TRUE : FALSE;
$p = 1;
for ($n = 1; $n <= ceil($results['cnt'] / $this->criteria['limit']); $n = $n+$p) {
$p = bcpow(10, floor($n/10));
$this->results['pages'][$n-1] = $n;
}
array_pop($this->results['pages']);
$this->results['pages'][ceil($results['cnt'] / $this->criteria['limit'])-1] = '>>';
}
function reOrder($by)
{
$this->criteria['offset'] = NULL;
if ($this->criteria['orderby'] == $by && !$this->criteria['desc'])
$this->criteria['desc'] = TRUE;
else
$this->criteria['desc'] = FALSE;
$this->criteria['orderby'] = $by;
$this->setReload();
#$this->searchDB();
}
function setOffset($page)
{
$o =& $this->criteria['offset'];
$l =& $this->criteria['limit'];
if ($page == 'next') {
$o += $l;
} elseif ($page == 'prev') {
$o -= $l;
} elseif (is_numeric($page)) {
$o = $l * $page;
}
$this->setReload();
#$this->searchDB();
}
function setLimit($limit)
{
$this->criteria['limit'] = $limit;
$this->setReload();
}
function setFiletype($filetype)
{
$this->criteria['filetype'] = $filetype;
$this->setReload();
}
}
?>

View File

@ -23,6 +23,14 @@ class uiPlaylist
return $this->Base->gb->getPlaylistArray($this->activeId, $this->Base->sessid);
}
function getActiveId()
{
if (!$this->activeId) {
return FALSE;
}
return $this->activeId;
}
function activate($plid, $msg=TRUE)
{
# test if PL available

View File

@ -20,7 +20,7 @@ class uiSearch
return $this->results;
}
function form($id, &$mask2)
function searchForm($id, &$mask2)
{
include dirname(__FILE__).'/formmask/metadata.inc.php';
$form = new HTML_QuickForm('search', UI_STANDARD_FORM_METHOD, UI_HANDLER);