From 50af857cdaa6b56dfb3f2c8476cdf822dfd6a5ec Mon Sep 17 00:00:00 2001 From: csikosjanos Date: Mon, 20 Mar 2006 17:01:55 +0000 Subject: [PATCH] --- .../htmlUI/var/formmask/generic.inc.php | 43 +++++++++++++++++++ .../modules/htmlUI/var/html/ui_browser.php | 27 ++++++++++++ .../modules/htmlUI/var/html/ui_handler.php | 4 ++ .../lang/default_DEFAULT/templates.xml | 4 ++ .../popup/PLAYLIST.downloadExportedFile.tpl | 5 +++ .../var/templates/popup/PLAYLIST.export.tpl | 20 +++++++++ .../templates/scratchpad/actionhandler.tpl | 1 + .../var/templates/script/contextmenu.js.tpl | 4 ++ .../modules/htmlUI/var/ui_playlist.class.php | 12 ++++++ 9 files changed, 120 insertions(+) create mode 100755 livesupport/src/modules/htmlUI/var/templates/popup/PLAYLIST.downloadExportedFile.tpl create mode 100755 livesupport/src/modules/htmlUI/var/templates/popup/PLAYLIST.export.tpl diff --git a/livesupport/src/modules/htmlUI/var/formmask/generic.inc.php b/livesupport/src/modules/htmlUI/var/formmask/generic.inc.php index a9890a663..59f98a12d 100644 --- a/livesupport/src/modules/htmlUI/var/formmask/generic.inc.php +++ b/livesupport/src/modules/htmlUI/var/formmask/generic.inc.php @@ -769,5 +769,48 @@ $ui_fmask = array( array( 'group' => array('cancel', 'reset', 'submitter') ) + ), + 'PL.export' => array( + 'act' => array( + 'element' => 'act', + 'type' => 'hidden', + ), + 'id' => array( + 'element' => 'id', + 'type' => 'hidden' + ), + array( + 'element' => 'exporttype', + 'type' => 'select', + 'label' => 'Type', + 'options' => array('allComponents' => 'All components','playlistOnly' => 'Playlist only') + ), + array( + 'element' => 'playlisttype', + 'type' => 'select', + 'label' => 'File Format', + 'options' => array( + 'smil' => 'SMIL', + // 'xspf' => 'XSPF', + 'm3u' => 'M3U' + ) + ), + array( + 'element' => 'cancel', + 'type' => 'button', + 'label' => 'Cancel', + 'attributes'=> array('onClick' => 'window.close()'), + 'groupit' => TRUE + ), + array( + 'element' => 'submitter', + 'type' => 'button', + 'label' => 'OK', + 'attributes'=> array('onClick' => 'this.form.submit()'), + 'groupit' => TRUE + ), + array( + 'group' => array('cancel', 'submitter') + ) ) ); \ No newline at end of file diff --git a/livesupport/src/modules/htmlUI/var/html/ui_browser.php b/livesupport/src/modules/htmlUI/var/html/ui_browser.php index 4120059f3..d871dcb22 100644 --- a/livesupport/src/modules/htmlUI/var/html/ui_browser.php +++ b/livesupport/src/modules/htmlUI/var/html/ui_browser.php @@ -105,6 +105,33 @@ if (is_array($_REQUEST['popup'])){ $Smarty->assign('dynform', $uiBrowser->PLAYLIST->setItemPlaylengthForm($_REQUEST['id'], $_REQUEST['elemId'], $ui_fmask['PL.setItemPlaylength'])); $Smarty->display('popup/PLAYLIST.setItemPlaylength.tpl'); break; + + case "PL.export": + $Smarty->assign('dynform', $uiBrowser->PLAYLIST->exportForm($_REQUEST['id'], $ui_fmask['PL.export'])); + $Smarty->display('popup/PLAYLIST.export.tpl'); + break; + + case "PL.redirect2DownloadExportedFile": + $Smarty->assign('href', UI_BROWSER."?popup[]=PL.downloadExportedFile&id={$_REQUEST['id']}&playlisttype={$_REQUEST['playlisttype']}&exporttype={$_REQUEST['exporttype']}"); + $Smarty->display('popup/PLAYLIST.downloadExportedFile.tpl'); + break; + + case "PL.downloadExportedFile": + $exportedPlaylist = $uiBrowser->gb->exportPlaylistOpen($uiBrowser->sessid, + $uiBrowser->gb->_gunidFromId($_REQUEST['id']), + $_REQUEST['playlisttype'], + $_REQUEST['exporttype']=='playlistOnly'?true:false); + $fp=fopen($exportedPlaylist['fname'],'r'); + if (is_resource($fp)) { + header("Content-Type: application/octet-stream"); + header("Content-Length: " . filesize($exportedPlaylist['fname'])); + header('Content-Disposition: attachment; filename="playlist.tar"'); + header("Content-Transfer-Encoding: binary\n"); + fpassthru($fp); + $uiBrowser->gb->exportPlaylistClose($exportedPlaylist['token']); + } + //$Smarty->display('popup/PLAYLIST.downloadExportedFile.tpl'); + break; case "SCHEDULER.addItem": $Smarty->display('popup/SCHEDULER.addItem.tpl'); diff --git a/livesupport/src/modules/htmlUI/var/html/ui_handler.php b/livesupport/src/modules/htmlUI/var/html/ui_handler.php index 245b1635c..6fc186250 100644 --- a/livesupport/src/modules/htmlUI/var/html/ui_handler.php +++ b/livesupport/src/modules/htmlUI/var/html/ui_handler.php @@ -254,6 +254,10 @@ switch($_REQUEST['act']){ $uiHandler->SCRATCHPAD->removeItems($ui_tmpid); $uiHandler->PLAYLIST->setReload(); break; + + case "PL.export": + $uiHandler->redirUrl = UI_BROWSER."?popup[]=PL.redirect2DownloadExportedFile&id={$_REQUEST['id']}&playlisttype={$_REQUEST['playlisttype']}&exporttype={$_REQUEST['exporttype']}"; + break; case "SCHEDULER.set": $uiHandler->SCHEDULER->set($_REQUEST); diff --git a/livesupport/src/modules/htmlUI/var/localizer/lang/default_DEFAULT/templates.xml b/livesupport/src/modules/htmlUI/var/localizer/lang/default_DEFAULT/templates.xml index 142a2cd3f..2dfa651ed 100644 --- a/livesupport/src/modules/htmlUI/var/localizer/lang/default_DEFAULT/templates.xml +++ b/livesupport/src/modules/htmlUI/var/localizer/lang/default_DEFAULT/templates.xml @@ -797,4 +797,8 @@ yesterday yesterday + + Export Playlist + Export Playlist + \ No newline at end of file diff --git a/livesupport/src/modules/htmlUI/var/templates/popup/PLAYLIST.downloadExportedFile.tpl b/livesupport/src/modules/htmlUI/var/templates/popup/PLAYLIST.downloadExportedFile.tpl new file mode 100755 index 000000000..31018b693 --- /dev/null +++ b/livesupport/src/modules/htmlUI/var/templates/popup/PLAYLIST.downloadExportedFile.tpl @@ -0,0 +1,5 @@ + + diff --git a/livesupport/src/modules/htmlUI/var/templates/popup/PLAYLIST.export.tpl b/livesupport/src/modules/htmlUI/var/templates/popup/PLAYLIST.export.tpl new file mode 100755 index 000000000..553b49659 --- /dev/null +++ b/livesupport/src/modules/htmlUI/var/templates/popup/PLAYLIST.export.tpl @@ -0,0 +1,20 @@ +{include file="popup/header.tpl"} + + + + + + +
+
+ + +
+ {include file="sub/dynForm_plain.tpl} +
+
+
+ + + + diff --git a/livesupport/src/modules/htmlUI/var/templates/scratchpad/actionhandler.tpl b/livesupport/src/modules/htmlUI/var/templates/scratchpad/actionhandler.tpl index 784643e4c..28423ba5b 100644 --- a/livesupport/src/modules/htmlUI/var/templates/scratchpad/actionhandler.tpl +++ b/livesupport/src/modules/htmlUI/var/templates/scratchpad/actionhandler.tpl @@ -46,6 +46,7 @@ onClick="return contextmenu('{$i.id}' , 'PL.activate' , 'PL.create' , 'delete' + , 'PL.export' {/if} {/if} )" \ No newline at end of file diff --git a/livesupport/src/modules/htmlUI/var/templates/script/contextmenu.js.tpl b/livesupport/src/modules/htmlUI/var/templates/script/contextmenu.js.tpl index a480dfdb8..013f54d7c 100644 --- a/livesupport/src/modules/htmlUI/var/templates/script/contextmenu.js.tpl +++ b/livesupport/src/modules/htmlUI/var/templates/script/contextmenu.js.tpl @@ -66,6 +66,10 @@ function contextmenu(param) { contextmenuHtml = contextmenuHtml + "
  •  ##Change Fadeout## 
  • "; break; + case "PL.export": + contextmenuHtml = contextmenuHtml + "
  •  ##Export Playlist## 
  • "; + break; + case "SP.addItem": contextmenuHtml = contextmenuHtml + "
  •  ##Add to ScratchPad## 
  • "; break; diff --git a/livesupport/src/modules/htmlUI/var/ui_playlist.class.php b/livesupport/src/modules/htmlUI/var/ui_playlist.class.php index 915c60397..f8743f53d 100644 --- a/livesupport/src/modules/htmlUI/var/ui_playlist.class.php +++ b/livesupport/src/modules/htmlUI/var/ui_playlist.class.php @@ -604,4 +604,16 @@ class uiPlaylist return FALSE; } + + function exportForm($id,$mask) + { + $mask['act']['constant'] = 'PL.export'; + $mask['id']['constant'] = $id; + $form = new HTML_QuickForm('PL_exportForm', UI_STANDARD_FORM_METHOD, UI_HANDLER); + $this->Base->_parseArr2Form($form, $mask); + $renderer =& new HTML_QuickForm_Renderer_Array(true, true); + $form->accept($renderer); + return $renderer->toArray(); + } } +?> \ No newline at end of file