diff --git a/livesupport/modules/htmlUI/var/SmartyExtensions.inc.php b/livesupport/modules/htmlUI/var/SmartyExtensions.inc.php
index ee7dd23ca..336cbadb3 100644
--- a/livesupport/modules/htmlUI/var/SmartyExtensions.inc.php
+++ b/livesupport/modules/htmlUI/var/SmartyExtensions.inc.php
@@ -1,5 +1,8 @@
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');
diff --git a/livesupport/modules/htmlUI/var/formmask/general.inc.php b/livesupport/modules/htmlUI/var/formmask/general.inc.php
index c826b2e4e..d48cc0104 100755
--- a/livesupport/modules/htmlUI/var/formmask/general.inc.php
+++ b/livesupport/modules/htmlUI/var/formmask/general.inc.php
@@ -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(
diff --git a/livesupport/modules/htmlUI/var/html/ui_browser.php b/livesupport/modules/htmlUI/var/html/ui_browser.php
index a0d3e1c55..71729dae5 100644
--- a/livesupport/modules/htmlUI/var/html/ui_browser.php
+++ b/livesupport/modules/htmlUI/var/html/ui_browser.php
@@ -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;
diff --git a/livesupport/modules/htmlUI/var/html/ui_handler.php b/livesupport/modules/htmlUI/var/html/ui_handler.php
index 5e77a936d..634e067eb 100644
--- a/livesupport/modules/htmlUI/var/html/ui_handler.php
+++ b/livesupport/modules/htmlUI/var/html/ui_handler.php
@@ -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) {
diff --git a/livesupport/modules/htmlUI/var/templates/fileBrowse/objects.tpl b/livesupport/modules/htmlUI/var/templates/fileBrowse/objects.tpl
index c8b76f384..7f325f17b 100755
--- a/livesupport/modules/htmlUI/var/templates/fileBrowse/objects.tpl
+++ b/livesupport/modules/htmlUI/var/templates/fileBrowse/objects.tpl
@@ -1,6 +1,9 @@
+{PL->getActiveId assign=_PL_activeId}
+
{include file="sub/x.tpl"}
+
Title |
@@ -17,7 +20,7 @@
{if $i.type eq 'Folder'}
[{$i.title|truncate:30}]
{else}
- {if $PLid == $i.id}
+ {if $_PL_activeId == $i.id}
{$i.title|truncate:30}
{else}
{$i.title|truncate:30}
@@ -42,11 +45,11 @@
{if $i.type != 'Folder'}
[MDataXML]
- [MDataForm]
+
{if $i.type eq 'webstream'}
- [Replace]
+ [Edit]
{elseif $i.type eq 'audioclip'}
- [Replace]
+ [Edit]
[Access]
[RawAnalyze]
{/if}
diff --git a/livesupport/modules/htmlUI/var/templates/library/browseForm.tpl b/livesupport/modules/htmlUI/var/templates/library/browseForm.tpl
index 3f230a277..28c675b25 100755
--- a/livesupport/modules/htmlUI/var/templates/library/browseForm.tpl
+++ b/livesupport/modules/htmlUI/var/templates/library/browseForm.tpl
@@ -15,15 +15,31 @@
-
- {foreach from=$browseForm item=form}
-
- {foreach from=$form item=dynform}
+ |
+ {foreach from=$browseForm.col1 item=dynform}
{include file="sub/dynForm_plain.tpl"}
{/foreach}
- |
- {/foreach}
+
+
+ {foreach from=$browseForm.col2 item=dynform}
+ {include file="sub/dynForm_plain.tpl"}
+ {/foreach}
+ |
+
+ {foreach from=$browseForm.col3 item=dynform}
+ {include file="sub/dynForm_plain.tpl"}
+ {/foreach}
+ |
+
+
+ |
+
+ {foreach from=$browseForm.global item=dynform}
+ {include file="sub/dynForm_plain.tpl"}
+ {/foreach}
+ |
+ |
diff --git a/livesupport/modules/htmlUI/var/templates/library/main.tpl b/livesupport/modules/htmlUI/var/templates/library/main.tpl
index 718480cd6..d4804361c 100755
--- a/livesupport/modules/htmlUI/var/templates/library/main.tpl
+++ b/livesupport/modules/htmlUI/var/templates/library/main.tpl
@@ -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}
diff --git a/livesupport/modules/htmlUI/var/templates/library/results.tpl b/livesupport/modules/htmlUI/var/templates/library/results.tpl
index c64859f02..ac84c8685 100755
--- a/livesupport/modules/htmlUI/var/templates/library/results.tpl
+++ b/livesupport/modules/htmlUI/var/templates/library/results.tpl
@@ -1,14 +1,14 @@
{*Smarty template*}
-
+
{if $searchResults.count > 0}
- {tra 0=Title} |
- {tra 0=Creator} |
- {tra 0=Duration} |
- {tra 0=Type} |
+ {tra 0=Title} |
+ {tra 0=Creator} |
+ {tra 0=Duration} |
+ {tra 0=Type} |
{foreach from=$searchResults.items item=i}
@@ -26,17 +26,17 @@
{/foreach}
- {if $searchResults.prev}back{/if}
+ {if $searchResults.prev}back{/if}
|
count: {$searchResults.count} |
go:
{foreach from=$searchResults.pages item=p key=k}
- {$p}
+ {$p}
{/foreach}
|
- {if $searchResults.next}forward{/if}
+ {if $searchResults.next}forward{/if}
|
diff --git a/livesupport/modules/htmlUI/var/templates/playlist/editor.tpl b/livesupport/modules/htmlUI/var/templates/playlist/editor.tpl
index ee950187d..4d8da6f86 100755
--- a/livesupport/modules/htmlUI/var/templates/playlist/editor.tpl
+++ b/livesupport/modules/htmlUI/var/templates/playlist/editor.tpl
@@ -18,11 +18,13 @@
| {$i.type} |
{/foreach}
+ {if $n}
{$i.fadeout_ms} ms |
+ {/if}
diff --git a/livesupport/modules/htmlUI/var/templates/scratchPad.tpl b/livesupport/modules/htmlUI/var/templates/scratchPad.tpl
index 7d27580ce..38ef6d4ff 100755
--- a/livesupport/modules/htmlUI/var/templates/scratchPad.tpl
+++ b/livesupport/modules/htmlUI/var/templates/scratchPad.tpl
@@ -1,4 +1,4 @@
-{*Smarty template*}
+{PL->getActiveId assign=_PL_activeId}
%%ScratchPad%%
@@ -18,7 +18,7 @@
|
- {if $PLid == $i.id}
+ {if $_PL_activeId == $i.id}
{$i.title|truncate:30}
{else}
{$i.title|truncate:30}
diff --git a/livesupport/modules/htmlUI/var/templates/script/basics.js.tpl b/livesupport/modules/htmlUI/var/templates/script/basics.js.tpl
index 0f62ce7b0..6b0322eb1 100755
--- a/livesupport/modules/htmlUI/var/templates/script/basics.js.tpl
+++ b/livesupport/modules/htmlUI/var/templates/script/basics.js.tpl
@@ -49,7 +49,7 @@
}
{/literal}
- {uiBrowser->getAlertMsg assign='alertMsg'}
+ {UIBROWSER->getAlertMsg assign='alertMsg'}
{if $alertMsg}
alert('{$alertMsg}');
{/if}
diff --git a/livesupport/modules/htmlUI/var/templates/sub/contextmenu.tpl b/livesupport/modules/htmlUI/var/templates/sub/contextmenu.tpl
index db0e9de99..7576ebc64 100755
--- a/livesupport/modules/htmlUI/var/templates/sub/contextmenu.tpl
+++ b/livesupport/modules/htmlUI/var/templates/sub/contextmenu.tpl
@@ -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'
diff --git a/livesupport/modules/htmlUI/var/ui_browse.class.php b/livesupport/modules/htmlUI/var/ui_browse.class.php
index 8b3bd66c8..0e15e9c94 100755
--- a/livesupport/modules/htmlUI/var/ui_browse.class.php
+++ b/livesupport/modules/htmlUI/var/ui_browse.class.php
@@ -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();
+ }
}
?>
diff --git a/livesupport/modules/htmlUI/var/ui_playlist.class.php b/livesupport/modules/htmlUI/var/ui_playlist.class.php
index 38973b6e0..1b660722b 100755
--- a/livesupport/modules/htmlUI/var/ui_playlist.class.php
+++ b/livesupport/modules/htmlUI/var/ui_playlist.class.php
@@ -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
diff --git a/livesupport/modules/htmlUI/var/ui_search.class.php b/livesupport/modules/htmlUI/var/ui_search.class.php
index 09b905267..421ed1d81 100755
--- a/livesupport/modules/htmlUI/var/ui_search.class.php
+++ b/livesupport/modules/htmlUI/var/ui_search.class.php
@@ -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);
| |