*** empty log message ***

This commit is contained in:
sebastian 2005-02-28 18:15:50 +00:00
parent 4ec5610702
commit f6f2374b23
11 changed files with 295 additions and 17 deletions

View File

@ -428,5 +428,95 @@ $ui_fmask = array(
'hu' => 'Hungarian',
)
)
),
'PL.changeTransition' => array(
'transition' => array(
array(
'element' => 'type',
'type' => 'radio',
'label' => 'Type',
'options' => array(
'fadeX' => 'Crossfade',
'pause' => 'Pause'
),
'default' => 'fadeX'
)
),
'fadeIn' => array(
array(
'element' => 'type',
'type' => 'radio',
'label' => 'Type',
'options' => array('fadeIn' => 'Fade in'),
'default' => 'fadeIn'
)
),
'fadeOut' => array(
array(
'element' => 'type',
'type' => 'radio',
'label' => 'Type',
'options' => array('fadeOut' => 'Fade out'),
'default' => 'fadeOut'
)
),
'all' => array(
array(
'element' => 'act',
'type' => 'hidden',
'constant' => 'PL.changeTransition'
),
array(
'element' => 'id',
'type' => 'hidden'
),
array(
'element' => 'duration',
'type' => 'text',
'rule' => 'numeric',
'attributes'=> array('size' => 4, 'maxlength' => 4),
'groupit' => TRUE
),
array(
'element' => 'switchdown',
'type' => 'button',
'label' => '-',
'attributes'=> array('onClick' => 'switchDown()'),
'groupit' => TRUE
),
array(
'element' => 'switchup',
'type' => 'button',
'label' => '+',
'attributes'=> array('onClick' => 'switchUp()'),
'groupit' => TRUE
),
array(
'group' => array('duration', 'switchdown', 'switchup'),
'label' => 'Duration'
),
array(
'element' => 'cancel',
'type' => 'button',
'label' => 'Cancel',
'attributes'=> array('onClick' => 'window.close()'),
'groupit' => TRUE,
),
array(
'element' => 'reset',
'type' => 'reset',
'label' => 'Reset',
'groupit' => TRUE,
),
array(
'element' => 'submit',
'type' => 'submit',
'label' => 'Submit',
'groupit' => TRUE,
),
array(
'group' => array('cancel', 'reset', 'submit')
)
)
)
);
);

View File

@ -40,6 +40,11 @@ if (is_array($_REQUEST['popup'])){
$Smarty->assign('target', 'PL.simpleManagement');
$Smarty->display('popup/_redirector.tpl');
break;
case "PL.changeTransition";
$Smarty->assign('dynform', $uiBrowser->PLAYLIST->changeTransitionForm($_REQUEST['id'], $_REQUEST['type'], $ui_fmask['PL.changeTransition']));
$Smarty->display('popup/PL.changeTransition.tpl');
break;
}
}
die();

View File

@ -182,6 +182,11 @@ switch($_REQUEST['act']){
$uiHandler->PLAYLIST->setReload();
break;
case "PL.changeTransition":
$uiHandler->PLAYLIST->changeTransition($_REQUEST['id'], $_REQUEST['type'], $_REQUEST['duration']);
$uiHandler->PLAYLIST->setReload();
break;
default:
$_SESSION["alertMsg"] = tra("Unknown method: $1", $_REQUEST["act"]);
header("Location: ".UI_BROWSER.'?popup[]=_reload_parent&popup[]=_close');

View File

@ -3,14 +3,27 @@
{PL->getFlat assign='FLAT'}
{foreach from=$FLAT item='i'}
{* {uiBrowser->_niceTime p1=$i.playlength assign='nicelength'} *}
<tr onMouseOver="highlight()" onMouseOut="darklight()" onContextmenu="return menu('{$i.attrs.id}', 'PL.removeItem')" style="background-color: {cycle values='#eeeeee, #dadada'}">
<!-- {$n++} -->
<tr onMouseOver="highlight()"
onMouseOut="darklight()"
onContextmenu="return menu('{$i.attrs.id}', {if $n == 1}'PL.changeFadeIn'{else}'PL.changeTransition'{/if})}" style="background-color: lightblue">
<td colspan="4" align="center">{$i.fadein_ms} ms</td>
</tr>
<tr onMouseOver="highlight()"
onMouseOut="darklight()"
onContextmenu="return menu('{$i.attrs.id}', 'PL.removeItem')" style="background-color: {cycle values='#eeeeee, #dadada'}">
<td><input type="checkbox" name="{$i.attrs.id}"></td>
<td>{$i.title}</td>
<td>{$i.duration}</td>
<td>{$i.type}</td>
</tr>
{/foreach}
<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>
<tr style="background-color: {cycle values='#eeeeee, #dadada'}">
<td><input type="checkbox" name="all" onClick="form_switchAll('PL')"></th>
<td align="center" colspan="2"><a href="#" onClick="form_submit('PL')">[Remove Selected]</a></th>

View File

@ -0,0 +1,9 @@
{*Smarty template*}
{include file="header.tpl"}
{include file="script/PL.changeTransition.js.tpl"}
{include file="sub/dynForm_plain.tpl"}
</body>
</html>

View File

@ -0,0 +1,3 @@
<script type="text/javascript">
opener.location.href = "{$UI_BRWOSER}?act={$target}";
</script>

View File

@ -0,0 +1,23 @@
<script type="text/javascript">
{literal}
function switchUp()
{
if (Number(document.forms['PL_changeTransition'].elements['duration'].value) < 5000) {
document.forms['PL_changeTransition'].elements['duration'].value = Number(document.forms['PL_changeTransition'].elements['duration'].value) + 100;
} else {
alert('Maximun reached');
}
}
function switchDown()
{
if (Number(document.forms['PL_changeTransition'].elements['duration'].value) > 99) {
document.forms['PL_changeTransition'].elements['duration'].value = Number(document.forms['PL_changeTransition'].elements['duration'].value) - 100;
}
/* else {
if (document.forms['PL_changeTransition'].elements['type'][0].checked) document.forms['PL_changeTransition'].elements['type'][1].checked = true;
else document.forms['PL_changeTransition'].elements['type'][0].checked = true;
} */
}
{/literal}
</script>

View File

@ -47,12 +47,27 @@ function menu(id) {
case "PL.create":
menuHtml = menuHtml + "<tr><td><a class='menu' href='#' onClick=\"hpopup('{/literal}{$UI_HANDLER}{literal}?act=PL.create&id="+id+"')\" "+oF+">&nbsp;New Playlist using Item&nbsp;</a></td></tr>";
break;
case "PL.changeFadeIn":
menuHtml = menuHtml + "<tr><td><a class='menu' href='#' onClick=\"popup('{/literal}{$UI_BROWSER}{literal}?popup[]=PL.changeTransition&type=fadeIn&id="+id+"', 'PL', '350', '100')\" "+oF+">&nbsp;Change Fadein&nbsp;</a></td></tr>";
break;
case "PL.changeTransition":
menuHtml = menuHtml + "<tr><td><a class='menu' href='#' onClick=\"popup('{/literal}{$UI_BROWSER}{literal}?popup[]=PL.changeTransition&type=transition&id="+id+"', 'PL', '350', '100')\" "+oF+">&nbsp;Change Transition&nbsp;</a></td></tr>";
break;
case "PL.changeFadeOut":
menuHtml = menuHtml + "<tr><td><a class='menu' href='#' onClick=\"popup('{/literal}{$UI_BROWSER}{literal}?popup[]=PL.changeTransition&type=fadeOut&id="+id+"', 'PL', '350', '100')\" "+oF+">&nbsp;Change Fadeout&nbsp;</a></td></tr>";
break;
case "SP.addItem":
menuHtml = menuHtml + "<tr><td><a class='menu' href='#' onClick=\"hpopup('{/literal}{$UI_HANDLER}{literal}?act=SP.addItem&id="+id+"')\" "+oF+">&nbsp;Add to ScratchPad&nbsp;</a></td></tr>";
break;
case "SP.removeItem":
menuHtml = menuHtml + "<tr><td><a class='menu' href='#' onClick=\"hpopup('{/literal}{$UI_HANDLER}{literal}?act=SP.removeItem&id="+id+"')\" "+oF+">&nbsp;Remove from Scratchpad&nbsp;</a></td></tr>";
break;
case "delete":
menuHtml = menuHtml + "<tr><td><a class='menu' href='{/literal}{$UI_HANDLER}{literal}?act=delete&id="+id+"'"+oF+">&nbsp;!Delete Item!&nbsp;</a></td></tr>";
break;

View File

@ -168,8 +168,8 @@ class uiBase
} elseif (isset($v['type'])) {
$elem[$v['element']] =& $form->createElement($v['type'], $v['element'], tra($v['label']),
($v[type]=='text' || $v['type']=='file' || $v['type']=='password') ? array_merge($v['attributes'], array('size'=>UI_INPUT_STANDARD_SIZE, 'maxlength'=>UI_INPUT_STANDARD_MAXLENGTH)) :
($v['type']=='textarea' ? array_merge($v['attributes'], array('rows'=>UI_TEXTAREA_STANDART_ROWS, 'cols'=>UI_TEXTAREA_STANDART_COLS)) : $v['attributes'])
($v[type]=='text' || $v['type']=='file' || $v['type']=='password') ? array_merge(array('size'=>UI_INPUT_STANDARD_SIZE, 'maxlength'=>UI_INPUT_STANDARD_MAXLENGTH), $v['attributes']) :
($v['type']=='textarea' ? array_merge(array('rows'=>UI_TEXTAREA_STANDART_ROWS, 'cols'=>UI_TEXTAREA_STANDART_COLS), $v['attributes']) : $v['attributes'])
);
if (!$v['groupit']) $form->addElement($elem[$v['element']]);
}

View File

@ -391,13 +391,10 @@ class uiBrowser extends uiBase {
$this->_parseArr2Form($form, $mask['buttons']);
$form->addElement('static', NULL, NULL, "</div id='div_$key'>");
}
## using Dynamic Smarty Renderer
$renderer =& new HTML_QuickForm_Renderer_Array(true, true);
$form->accept($renderer);
$output['pages'][] = $renderer->toArray();
#print_r($output);
return $output;
}
@ -406,18 +403,13 @@ class uiBrowser extends uiBase {
function changeStationPrefs(&$mask)
{
$form = new HTML_QuickForm('changeStationPrefs', UI_STANDARD_FORM_METHOD, UI_HANDLER);
foreach($mask as $key=>$val) {
$p = $this->gb->loadGroupPref($this->sessid, 'StationPrefs', $val['element']);
if (is_string($p)) $mask[$key]['default'] = $p;
};
$this->_parseArr2Form($form, $mask);
## using Dynamic Smarty Renderer
$renderer =& new HTML_QuickForm_Renderer_Array(true, true);
$form->accept($renderer);
return $renderer->toArray();
}
}

View File

@ -19,7 +19,7 @@ class uiPlaylist
if (!$this->activeId) {
return FALSE;
}
print_r( $this->Base->gb->getPlaylistArray($this->activeId, $this->Base->sessid));
#echo '<pre><div align="left">'; print_r( $this->Base->gb->getPlaylistArray($this->activeId, $this->Base->sessid)); echo '</div></pre>';
return $this->Base->gb->getPlaylistArray($this->activeId, $this->Base->sessid);
}
@ -156,7 +156,7 @@ class uiPlaylist
function getFlat()
{
$this->plwalk($this->get());
#print_r($this->flat);
#echo '<pre><div align="left">'; print_r($this->flat); echo '</div></pre>';
return $this->flat;
}
@ -170,9 +170,132 @@ class uiPlaylist
if ($sub['elementname']=='audioclip') {
#$this->flat["$parent.$node"] = $sub['attrs'];
#$this->flat["$parent.$node"]['type'] = $sub['elementname'];
$this->flat["$parent.$node"] = $this->Base->_getMetaInfo($this->Base->gb->_idFromGunid($sub['attrs']['id']));
$this->flat["$parent.$node"]['attrs'] = $attrs;
$this->flat[$parent] = $this->Base->_getMetaInfo($this->Base->gb->_idFromGunid($sub['attrs']['id']));
$this->flat[$parent]['attrs'] = $attrs;
}
if ($sub['elementname']=='fadeinfo') {
$this->flat[$parent]['fadein'] = $this->_plTimeToSecs($sub['attrs']['fadein']);
$this->flat[$parent]['fadeout'] = $this->_plTimeToSecs($sub['attrs']['fadeout']);
$this->flat[$parent]['fadein_ms'] = $sub['attrs']['fadein'] ? $this->_plTimeToSecs($sub['attrs']['fadein']) * 1000 : 0;
$this->flat[$parent]['fadeout_ms'] = $sub['attrs']['fadeout'] ? $this->_plTimeToSecs($sub['attrs']['fadeout']) * 1000 : 0;
}
}
}
function changeTransition($id, $type, $duration)
{
$curr = $this->getCurrElement($id);
$prev = $this->getPrevElement($id);
$next = $this->getNextElement($id);
switch ($type) {
case "fadeX":
$item[$prev['attrs']['id']] =
array('fadeIn' => $this->_secsToPlTime($prev['fadein']),
'fadeOut' => $this->_secsToPlTime($duration/1000));
$item[$id] = array('fadeIn' => $this->_secsToPlTime($duration/1000),
'fadeOut' => $this->_secsToPlTime($curr['fadeout']));
break;
case "pause":
$item[$prev['attrs']['id']] =
array('fadeIn' => $this->_secsToPlTime($prev['fadein']),
'fadeOut' => $this->_secsToPlTime(-$duration/1000));
$item[$id] = array('fadeIn' => $this->_secsToPlTime(-$duration/1000),
'fadeOut' => $this->_secsToPlTime($curr['fadeout']));
break;
case "fadeIn":
$item[$id] = array('fadeIn' => $this->_secsToPlTime($duration/1000),
'fadeOut' => $this->_secsToPlTime($curr['fadeout']));
break;
case "fadeOut":
$item[$id] = array('fadeIn' => $this->_secsToPlTime($curr['fadein']),
'fadeOut' => $this->_secsToPlTime($duration/1000));
break;
}
#print_r($item);
foreach ($item as $i=>$val)
$this->Base->gb->changeFadeInfo($this->token, $i, $val['fadeIn'], $val['fadeOut'], $this->Base->sessid);
}
function getCurrElement($id)
{
$arr = $this->getFlat();
while ($val = current($arr)) {
if ($val['attrs']['id'] == $id) {
return current($arr);
}
next($arr);
}
}
function getPrevElement($id)
{
$arr = $this->getFlat();
while ($val = current($arr)) {
if ($val['attrs']['id'] == $id) {
return prev($arr);
}
next($arr);
}
}
function getNextElement($id)
{
$arr = $this->getFlat();
while ($val = current($arr)) {
if ($val['attrs']['id'] == $id) {
return next($arr);
}
next($arr);
}
}
function changeTransitionForm($id, $type, &$mask)
{
switch ($type) {
case "fadeIn":
$d = $this->getCurrElement($id);
$duration = $d['fadein_ms'];
break;
case "transition":
$d = $this->getPrevElement($id);
$duration = $d['fadein_ms'];
break;
case "fadeOut":
$d = $this->getCurrElement($id);
$duration = $d['fadeout_ms'];
break;
}
$form = new HTML_QuickForm('PL_changeTransition', UI_STANDARD_FORM_METHOD, UI_HANDLER);
$form->setConstants(array('id' => $id,
'duration' => $duration));
$this->Base->_parseArr2Form($form, $mask[$type]);
$this->Base->_parseArr2Form($form, $mask['all']);
$renderer =& new HTML_QuickForm_Renderer_Array(true, true);
$form->accept($renderer);
return $renderer->toArray();
}
function _plTimeToSecs($plt, $length=4)
{
$arr = split(':', $plt);
if(isset($arr[2])){ return ($arr[0]*60 + $arr[1])*60 + $arr[2]; }
if(isset($arr[1])){ return $arr[0]*60 + $arr[1]; }
return $arr[0];
}
function _secsToPlTime($s0)
{
$m = intval($s0 / 60);
$r = $s0 - $m*60;
$h = $m / 60;
$m = $m % 60;
return sprintf("%02d:%02d:%09.6f", $h, $m, $r);
}
}