diff --git a/livesupport/modules/htmlUI/var/formmask/general.inc.php b/livesupport/modules/htmlUI/var/formmask/general.inc.php index e38dddcee..4a37d2857 100755 --- a/livesupport/modules/htmlUI/var/formmask/general.inc.php +++ b/livesupport/modules/htmlUI/var/formmask/general.inc.php @@ -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') + ) + ) ) -); +); diff --git a/livesupport/modules/htmlUI/var/html/ui_browser.php b/livesupport/modules/htmlUI/var/html/ui_browser.php index b911f5c1f..9531bcd08 100644 --- a/livesupport/modules/htmlUI/var/html/ui_browser.php +++ b/livesupport/modules/htmlUI/var/html/ui_browser.php @@ -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(); diff --git a/livesupport/modules/htmlUI/var/html/ui_handler.php b/livesupport/modules/htmlUI/var/html/ui_handler.php index bd413bd27..3a724ab6d 100644 --- a/livesupport/modules/htmlUI/var/html/ui_handler.php +++ b/livesupport/modules/htmlUI/var/html/ui_handler.php @@ -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'); diff --git a/livesupport/modules/htmlUI/var/templates/playlist/editor.tpl b/livesupport/modules/htmlUI/var/templates/playlist/editor.tpl index 868c20b5f..eeb4af445 100755 --- a/livesupport/modules/htmlUI/var/templates/playlist/editor.tpl +++ b/livesupport/modules/htmlUI/var/templates/playlist/editor.tpl @@ -3,14 +3,27 @@ {PL->getFlat assign='FLAT'} {foreach from=$FLAT item='i'} - {* {uiBrowser->_niceTime p1=$i.playlength assign='nicelength'} *} - + + + {$i.fadein_ms} ms + + {$i.title} {$i.duration} {$i.type} {/foreach} + + {$i.fadeout_ms} ms + + [Remove Selected] diff --git a/livesupport/modules/htmlUI/var/templates/popup/PL.changeTransition.tpl b/livesupport/modules/htmlUI/var/templates/popup/PL.changeTransition.tpl new file mode 100755 index 000000000..328e1ef1d --- /dev/null +++ b/livesupport/modules/htmlUI/var/templates/popup/PL.changeTransition.tpl @@ -0,0 +1,9 @@ +{*Smarty template*} + +{include file="header.tpl"} +{include file="script/PL.changeTransition.js.tpl"} +{include file="sub/dynForm_plain.tpl"} + + + + diff --git a/livesupport/modules/htmlUI/var/templates/popup/_redirector.tpl b/livesupport/modules/htmlUI/var/templates/popup/_redirector.tpl new file mode 100755 index 000000000..277531cd4 --- /dev/null +++ b/livesupport/modules/htmlUI/var/templates/popup/_redirector.tpl @@ -0,0 +1,3 @@ + diff --git a/livesupport/modules/htmlUI/var/templates/script/PL.changeTransition.js.tpl b/livesupport/modules/htmlUI/var/templates/script/PL.changeTransition.js.tpl new file mode 100755 index 000000000..66881f8aa --- /dev/null +++ b/livesupport/modules/htmlUI/var/templates/script/PL.changeTransition.js.tpl @@ -0,0 +1,23 @@ + diff --git a/livesupport/modules/htmlUI/var/templates/script/contextMenue.js.tpl b/livesupport/modules/htmlUI/var/templates/script/contextMenue.js.tpl index 2c712f903..51b1f887f 100755 --- a/livesupport/modules/htmlUI/var/templates/script/contextMenue.js.tpl +++ b/livesupport/modules/htmlUI/var/templates/script/contextMenue.js.tpl @@ -47,12 +47,27 @@ function menu(id) { case "PL.create": menuHtml = menuHtml + " New Playlist using Item "; break; + + case "PL.changeFadeIn": + menuHtml = menuHtml + " Change Fadein "; + break; + + case "PL.changeTransition": + menuHtml = menuHtml + " Change Transition "; + break; + + case "PL.changeFadeOut": + menuHtml = menuHtml + " Change Fadeout "; + break; + case "SP.addItem": menuHtml = menuHtml + " Add to ScratchPad "; break; + case "SP.removeItem": menuHtml = menuHtml + " Remove from Scratchpad "; break; + case "delete": menuHtml = menuHtml + " !Delete Item! "; break; diff --git a/livesupport/modules/htmlUI/var/ui_base.inc.php b/livesupport/modules/htmlUI/var/ui_base.inc.php index a22a1b687..c636f5c7f 100644 --- a/livesupport/modules/htmlUI/var/ui_base.inc.php +++ b/livesupport/modules/htmlUI/var/ui_base.inc.php @@ -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']]); } diff --git a/livesupport/modules/htmlUI/var/ui_browser.class.php b/livesupport/modules/htmlUI/var/ui_browser.class.php index bd72deced..629c17aad 100644 --- a/livesupport/modules/htmlUI/var/ui_browser.class.php +++ b/livesupport/modules/htmlUI/var/ui_browser.class.php @@ -391,13 +391,10 @@ class uiBrowser extends uiBase { $this->_parseArr2Form($form, $mask['buttons']); $form->addElement('static', NULL, NULL, ""); } - - ## 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(); } } diff --git a/livesupport/modules/htmlUI/var/ui_playlist.class.php b/livesupport/modules/htmlUI/var/ui_playlist.class.php index 2b2d20cf2..271cb8d12 100755 --- a/livesupport/modules/htmlUI/var/ui_playlist.class.php +++ b/livesupport/modules/htmlUI/var/ui_playlist.class.php @@ -19,7 +19,7 @@ class uiPlaylist if (!$this->activeId) { return FALSE; } - print_r( $this->Base->gb->getPlaylistArray($this->activeId, $this->Base->sessid)); + #echo '
'; print_r( $this->Base->gb->getPlaylistArray($this->activeId, $this->Base->sessid)); echo '
'; 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 '
'; print_r($this->flat); echo '
'; 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); + } }