From c683356fd0b1aa13c236f493361dc5a3d9440f4e Mon Sep 17 00:00:00 2001 From: sebastian Date: Thu, 24 Feb 2005 19:51:06 +0000 Subject: [PATCH] *** empty log message *** --- .../modules/htmlUI/var/Smarty/ChangeLog | 2 +- .../var/Smarty/libs/Config_File.class.php | 2 +- .../htmlUI/var/Smarty/libs/Smarty.class.php | 2 +- .../var/Smarty/libs/Smarty_Compiler.class.php | 2 +- livesupport/modules/htmlUI/var/conf.php | 3 +- .../htmlUI/var/formmask/general.inc.php | 6 +- .../modules/htmlUI/var/html/ui_browser.php | 2 +- .../modules/htmlUI/var/html/ui_handler.php | 17 +++++- .../examples/smarty-dynamic-fancygroup.tpl | 2 +- .../examples/smarty-dynamic-green.tpl | 2 +- .../var/templates/examples/smarty-dynamic.tpl | 2 +- .../var/templates/fileBrowse/objects.tpl | 10 ++- .../htmlUI/var/templates/scratchPad.tpl | 10 ++- .../templates/script/myKontextMenue.js.tpl | 41 +++++++++---- .../modules/htmlUI/var/ui_base.inc.php | 5 ++ .../modules/htmlUI/var/ui_handler.class.php | 6 +- .../modules/htmlUI/var/ui_playlist.class.php | 61 +++++++++++++++++-- 17 files changed, 141 insertions(+), 34 deletions(-) diff --git a/livesupport/modules/htmlUI/var/Smarty/ChangeLog b/livesupport/modules/htmlUI/var/Smarty/ChangeLog index a84378d67..d78d5f972 100644 --- a/livesupport/modules/htmlUI/var/Smarty/ChangeLog +++ b/livesupport/modules/htmlUI/var/Smarty/ChangeLog @@ -2979,7 +2979,7 @@ * libs/Smarty.class.php libs/Smarty_Compiler.class.php: - added CVS $Id: ChangeLog,v 1.3 2005/02/24 14:00:15 sebastian Exp $ + added CVS $Id: ChangeLog,v 1.4 2005/02/24 19:51:06 sebastian Exp $ 2003-03-31 Messju Mohr diff --git a/livesupport/modules/htmlUI/var/Smarty/libs/Config_File.class.php b/livesupport/modules/htmlUI/var/Smarty/libs/Config_File.class.php index 140d4f176..74161a3f7 100644 --- a/livesupport/modules/htmlUI/var/Smarty/libs/Config_File.class.php +++ b/livesupport/modules/htmlUI/var/Smarty/libs/Config_File.class.php @@ -25,7 +25,7 @@ * @package Smarty */ -/* $Id: Config_File.class.php,v 1.3 2005/02/24 14:00:15 sebastian Exp $ */ +/* $Id: Config_File.class.php,v 1.4 2005/02/24 19:51:06 sebastian Exp $ */ /** * Config file reading class diff --git a/livesupport/modules/htmlUI/var/Smarty/libs/Smarty.class.php b/livesupport/modules/htmlUI/var/Smarty/libs/Smarty.class.php index 4a25b9028..c9d47df7e 100755 --- a/livesupport/modules/htmlUI/var/Smarty/libs/Smarty.class.php +++ b/livesupport/modules/htmlUI/var/Smarty/libs/Smarty.class.php @@ -30,7 +30,7 @@ * @version 2.6.6 */ -/* $Id: Smarty.class.php,v 1.3 2005/02/24 14:00:15 sebastian Exp $ */ +/* $Id: Smarty.class.php,v 1.4 2005/02/24 19:51:06 sebastian Exp $ */ /** * DIR_SEP isn't used anymore, but third party apps might diff --git a/livesupport/modules/htmlUI/var/Smarty/libs/Smarty_Compiler.class.php b/livesupport/modules/htmlUI/var/Smarty/libs/Smarty_Compiler.class.php index 5ad55d8b7..3185250bf 100644 --- a/livesupport/modules/htmlUI/var/Smarty/libs/Smarty_Compiler.class.php +++ b/livesupport/modules/htmlUI/var/Smarty/libs/Smarty_Compiler.class.php @@ -26,7 +26,7 @@ * @package Smarty */ -/* $Id: Smarty_Compiler.class.php,v 1.3 2005/02/24 14:00:15 sebastian Exp $ */ +/* $Id: Smarty_Compiler.class.php,v 1.4 2005/02/24 19:51:06 sebastian Exp $ */ /** * Template compiling class diff --git a/livesupport/modules/htmlUI/var/conf.php b/livesupport/modules/htmlUI/var/conf.php index 0c3e04894..87f438386 100644 --- a/livesupport/modules/htmlUI/var/conf.php +++ b/livesupport/modules/htmlUI/var/conf.php @@ -23,7 +23,7 @@ Author : $Author: sebastian $ - Version : $Revision: 1.15 $ + Version : $Revision: 1.16 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/htmlUI/var/Attic/conf.php,v $ ------------------------------------------------------------------------------*/ @@ -134,6 +134,7 @@ define('UI_QFORM_ERROR', '../templates/sub/form_error.tpl'); define('UI_SEARCH_MAX_ROWS', 8); define('UI_SEARCH_MIN_ROWS', 2); define('UI_REGEX_URL', '/^(ht|f)tps?:\/\/[^ ]+$/'); +define('UI_PL_ACCESSTOKEN_KEY', 'playlistToken'); define('UI_SCRATCHPAD_KEY', 'djBagContents'); define('UI_SCRATCHPAD_MAXLENGTH_KEY', 'djBagMaxlength'); #define('UI_SCRATCHPAD_REGEX', '/^[0-9a-f]{16}:[0-9]{4}-[0-9]{2}-[0-9]{2}$/'); diff --git a/livesupport/modules/htmlUI/var/formmask/general.inc.php b/livesupport/modules/htmlUI/var/formmask/general.inc.php index 046cbc4fa..0c83feed6 100755 --- a/livesupport/modules/htmlUI/var/formmask/general.inc.php +++ b/livesupport/modules/htmlUI/var/formmask/general.inc.php @@ -16,14 +16,14 @@ $ui_fmask = array( 'element' => 'stationMaxfilesize', 'isPref' => TRUE, 'type' => 'text', - 'label' => 'Maximum File Size for Upload', - 'required' => TRUE, + 'label' => 'Reduce Upload Filesize
(must be smaller than ' .ini_get('upload_max_filesize').')', 'rule' => 'numeric', + /* 'attributes' => array( 'onClick' => 'alert ("Note: System Maximum is set to '. strtr(ini_get('upload_max_filesize'), array('M'=>'000000', 'k'=>'000')) .' in php.ini\n You cannot override this here.")' - ) + ) */ ), array( 'rule' => 'nopunctuation', diff --git a/livesupport/modules/htmlUI/var/html/ui_browser.php b/livesupport/modules/htmlUI/var/html/ui_browser.php index 1607ef121..c03bc787f 100644 --- a/livesupport/modules/htmlUI/var/html/ui_browser.php +++ b/livesupport/modules/htmlUI/var/html/ui_browser.php @@ -43,7 +43,7 @@ if (is_array($_REQUEST['popup'])){ if ($uiBrowser->userid) { $Smarty->assign('showMenuTop', TRUE); $Smarty->assign('SCRATCHPAD', $uiBrowser->SCRATCHPAD->get()); - $Smarty->assign('PLAYLIST', $uiBrowser->PLAYLIST->get()); + $Smarty->assign('PLAYLIST', $uiBrowser->PLAYLIST->get()); switch ($_REQUEST['act']){ case "fileBrowse": diff --git a/livesupport/modules/htmlUI/var/html/ui_handler.php b/livesupport/modules/htmlUI/var/html/ui_handler.php index bf63f65e6..cca91ed0c 100644 --- a/livesupport/modules/htmlUI/var/html/ui_handler.php +++ b/livesupport/modules/htmlUI/var/html/ui_handler.php @@ -144,11 +144,26 @@ switch($_REQUEST['act']){ $uiHandler->SEARCH->setOffset($_REQUEST['page']); break; - case "activatePL": + case "PL.activate": $uiHandler->PLAYLIST->activate($_REQUEST['id']); $uiHandler->PLAYLIST->setReload(); break; + case "PL.newUsingItem": + $uiHandler->PLAYLIST->newUsingItem($_REQUEST['id']); + $uiHandler->PLAYLIST->setReload(); + break; + + case "PL.addItem": + $uiHandler->PLAYLIST->addItem($_REQUEST['id']); + $uiHandler->PLAYLIST->setReload(); + break; + + case "PL.release": + $uiHandler->PLAYLIST->release(); + $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/examples/smarty-dynamic-fancygroup.tpl b/livesupport/modules/htmlUI/var/templates/examples/smarty-dynamic-fancygroup.tpl index 7384f8fd2..66d608704 100644 --- a/livesupport/modules/htmlUI/var/templates/examples/smarty-dynamic-fancygroup.tpl +++ b/livesupport/modules/htmlUI/var/templates/examples/smarty-dynamic-fancygroup.tpl @@ -1,4 +1,4 @@ - + diff --git a/livesupport/modules/htmlUI/var/templates/examples/smarty-dynamic-green.tpl b/livesupport/modules/htmlUI/var/templates/examples/smarty-dynamic-green.tpl index 6788dcaa8..2552c3c1b 100644 --- a/livesupport/modules/htmlUI/var/templates/examples/smarty-dynamic-green.tpl +++ b/livesupport/modules/htmlUI/var/templates/examples/smarty-dynamic-green.tpl @@ -1,4 +1,4 @@ - + {$element.label}: diff --git a/livesupport/modules/htmlUI/var/templates/examples/smarty-dynamic.tpl b/livesupport/modules/htmlUI/var/templates/examples/smarty-dynamic.tpl index 862eb90cd..2ee8762fc 100644 --- a/livesupport/modules/htmlUI/var/templates/examples/smarty-dynamic.tpl +++ b/livesupport/modules/htmlUI/var/templates/examples/smarty-dynamic.tpl @@ -1,5 +1,5 @@ - + Smarty template for Array renderer diff --git a/livesupport/modules/htmlUI/var/templates/fileBrowse/objects.tpl b/livesupport/modules/htmlUI/var/templates/fileBrowse/objects.tpl index 69dc413e1..54fefc009 100755 --- a/livesupport/modules/htmlUI/var/templates/fileBrowse/objects.tpl +++ b/livesupport/modules/htmlUI/var/templates/fileBrowse/objects.tpl @@ -14,9 +14,17 @@ diff --git a/livesupport/modules/htmlUI/var/templates/scratchPad.tpl b/livesupport/modules/htmlUI/var/templates/scratchPad.tpl index b520d0a22..1a18bca68 100755 --- a/livesupport/modules/htmlUI/var/templates/scratchPad.tpl +++ b/livesupport/modules/htmlUI/var/templates/scratchPad.tpl @@ -20,9 +20,17 @@ diff --git a/livesupport/modules/htmlUI/var/templates/script/myKontextMenue.js.tpl b/livesupport/modules/htmlUI/var/templates/script/myKontextMenue.js.tpl index aa83763f0..67130ac69 100755 --- a/livesupport/modules/htmlUI/var/templates/script/myKontextMenue.js.tpl +++ b/livesupport/modules/htmlUI/var/templates/script/myKontextMenue.js.tpl @@ -8,7 +8,7 @@ nn6=(document.getElementById && !document.all)?1:0; menuStatus = 0; document.onmouseup = hideMenu; document.write(''); -menuWidth = 160, +menuWidth = 180, menuHeight = 0; function menu(id) { @@ -24,26 +24,43 @@ function menu(id) { for (var i = 1; i < menu.arguments.length; ++i) { switch (menu.arguments[i]) { - case "PL.activate": - menuHtml = menuHtml + "  Activate this Playlist  "; - break; case "PL.display": - menuHtml = menuHtml + "  Display this Playlist  "; - break; - case "PL.addItem": - menuHtml = menuHtml + "  Add File to Playlist  "; + menuHtml = menuHtml + " Display this Playlist "; break; + {/literal} + {if $PLAYLIST.id} + + {literal} + case "PL.release": + menuHtml = menuHtml + " Release Playlist "; + break; + {/literal} + + {literal} + case "PL.addItem": + menuHtml = menuHtml + " Add Item to active Playlist "; + break; + {/literal} + + {else} + {literal} + case "PL.activate": + menuHtml = menuHtml + " Activate this Playlist "; + break; + {/literal} + {/if} + {literal} case "PL.newUsingItem": - menuHtml = menuHtml + "  New Playlist using File  "; + menuHtml = menuHtml + " New Playlist using Item "; break; case "SP.addItem": - menuHtml = menuHtml + "  Add File to ScratchPad  "; + menuHtml = menuHtml + " Add Item to ScratchPad "; break; case "SP.removeItem": - menuHtml = menuHtml + "  Remove  "; + menuHtml = menuHtml + " Remove "; break; case "delete": - menuHtml = menuHtml + "  !Delete File!  "; + 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 d708e78f1..397e9a70f 100644 --- a/livesupport/modules/htmlUI/var/ui_base.inc.php +++ b/livesupport/modules/htmlUI/var/ui_base.inc.php @@ -91,6 +91,7 @@ class uiBase $this->pid = $this->gb->getparent($this->id) != 1 ? $this->gb->getparent($this->id) : FALSE; $this->type = $this->gb->getFileType($this->id); $this->fid = $this->type=='Folder' ? $this->id : $this->pid; + $this->homeid = $this->gb->getObjId($this->login, $this->gb->storId); $this->InputTextStandardAttrib = array('size' =>UI_INPUT_STANDARD_SIZE, 'maxlength'=>UI_INPUT_STANDARD_MAXLENGTH); $this->STATIONPREFS =& $_SESSION[UI_STATIONINFO_SESSNAME]; @@ -113,9 +114,13 @@ class uiBase } } } + if (!$this->STATIONPREFS['stationMaxfilesize']) + $this->STATIONPREFS['stationMaxfilesize'] = strtr(ini_get('upload_max_filesize'), array('M'=>'000000', 'k'=>'000')); + /* if ($miss && $this->login) { $this->_retMsg('Note: Station Preferences not setup.'); } + */ } } diff --git a/livesupport/modules/htmlUI/var/ui_handler.class.php b/livesupport/modules/htmlUI/var/ui_handler.class.php index 9fbeacc34..692187f49 100644 --- a/livesupport/modules/htmlUI/var/ui_handler.class.php +++ b/livesupport/modules/htmlUI/var/ui_handler.class.php @@ -280,7 +280,11 @@ class uiHandler extends uiBase { return FALSE; } - $r = $this->gb->deleteFile($id, $this->sessid); + if ($this->gb->getFileType($id)=='playlist') { + $r = $this->gb->deletePlaylist($id, $this->sessid); + } else { + $r = $this->gb->deleteFile($id, $this->sessid); + } if(PEAR::isError($r)) { $this->_retMsg($r->getMessage()); return FALSE; diff --git a/livesupport/modules/htmlUI/var/ui_playlist.class.php b/livesupport/modules/htmlUI/var/ui_playlist.class.php index d624b99cc..79d31a3e2 100755 --- a/livesupport/modules/htmlUI/var/ui_playlist.class.php +++ b/livesupport/modules/htmlUI/var/ui_playlist.class.php @@ -3,8 +3,8 @@ class uiPlaylist { function uiPlaylist(&$uiBase) { - $this->Base =& $uiBase; - $this->items =& $_SESSION[UI_PLAYLIST_SESSNAME]['content']; + $this->Base =& $uiBase; + $this->active =& $_SESSION[UI_PLAYLIST_SESSNAME]['active']; $this->reloadUrl = UI_BROWSER.'?popup[]=_reload_parent&popup[]=_close'; } @@ -15,13 +15,45 @@ class uiPlaylist function get() { #print_r($this->items); - return $this->items; + return is_array($this->active) ? $this->active : FALSE; } - function activate($id) + function activate($plid) { - $this->items = $this->Base->gb->getPlaylistArray($id, $this->Base->sessid); - $this->Base->_retMsg('Playlist $1 activated', $this->Base->_getMDataValue($id, 'title')); + # test if PL available + # look PL + # store access token to ls_pref + # load PL into session + if(is_string($this->Base->gb->loadPref($this->Base->sessid, UI_PL_ACCESSTOKEN_KEY))) { + $this->Base->_retMsg('You have an Playlist already activated,\n first close it'); + return FALSE; + } + if($this->Base->gb->playlistIsAvailable($plid, $this->Base->sessid) !== TRUE) { + $this->Base->_retMsg('Playlist is looked'); + return FALSE; + } + $token = $this->Base->gb->lockPlaylistForEdit($plid, $this->Base->sessid); + $this->Base->gb->savePref($this->Base->sessid, UI_PL_ACCESSTOKEN_KEY, $token); + $this->active = $this->Base->gb->getPlaylistArray($plid, $this->Base->sessid); + $this->active['id'] = $plid; + $this->Base->_retMsg('Playlist "$1" activated', $this->Base->_getMDataValue($plid, 'title')); + } + + function release() + { + # get token from ls_pref + # release PL + # delete PL from session + # remove token from ls_pref + if(!is_string($token = $this->Base->gb->loadPref($this->Base->sessid, UI_PL_ACCESSTOKEN_KEY))) { + $this->Base->_retMsg('No Playlist is looked by You'); + return FALSE; + } + $plgunid = $this->Base->gb->releaseLockedPlaylist($token, $this->Base->sessid); + $this->Base->_retMsg('Playlist "$1" released', $this->Base->_getMDataValue($this->Base->gb->_idFromGunid($plgunid), 'title')); + $this->active = NULL; + $this->Base->gb->delPref($this->Base->sessid, UI_PL_ACCESSTOKEN_KEY); + return TRUE; } function addItem($id) @@ -35,4 +67,21 @@ class uiPlaylist } + + function newUsingItem($id) + { + # create PL + # activate + # add clip + if (!$plid = $this->Base->gb->createPlaylist($this->Base->homeid, date('Y-M-D H-i-s'), $this->Base->sessid)) { + $this->Base->_retMsg('Cannot create Playlist'); + return FALSE; + } + $this->activate($plid); + if (!$this->Base->gb->addAudioClipToPlaylist($token, $id, $this->Base->sessid)) { + $this->Base_retMsg('Cannot add File to Playlist'); + return FALSE; + } + return TRUE; + } }