diff --git a/livesupport/modules/htmlUI/var/conf.php b/livesupport/modules/htmlUI/var/conf.php index 28394563d..040940be7 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.20 $ + Version : $Revision: 1.21 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/htmlUI/var/Attic/conf.php,v $ ------------------------------------------------------------------------------*/ @@ -149,4 +149,5 @@ define('UI_BROWSE_SESSNAME', 'L_BROWSE'); define('UI_MDATA_KEY_TITLE', 'dc:title'); define('UI_MDATA_KEY_ARTIST', 'dc:creator'); define('UI_MDATA_KEY_DURATION', 'dcterms:extent'); +define('UI_MDATA_KEY_URL', 'ls:url'); ?> \ No newline at end of file diff --git a/livesupport/modules/htmlUI/var/formmask/general.inc.php b/livesupport/modules/htmlUI/var/formmask/general.inc.php index d48cc0104..d9caa5683 100755 --- a/livesupport/modules/htmlUI/var/formmask/general.inc.php +++ b/livesupport/modules/htmlUI/var/formmask/general.inc.php @@ -257,7 +257,7 @@ $ui_fmask = array( ) ), - 'uploadFile' => array( + 'file' => array( array( 'element' => 'act', 'type' => 'hidden' @@ -266,6 +266,10 @@ $ui_fmask = array( 'element' => 'id', 'type' => 'hidden' ), + array( + 'element' => 'folderId', + 'type' => 'hidden' + ), array( 'element' => 'mediafile', 'type' => 'file', @@ -280,7 +284,7 @@ $ui_fmask = array( ) ), - 'addWebstream' => array( + 'webstream' => array( array( 'element' => 'act', 'type' => 'hidden', @@ -290,17 +294,12 @@ $ui_fmask = array( 'type' => 'hidden' ), array( - 'element' => 'name', - 'type' => 'text', - 'label' => 'Name', - 'required' => TRUE, - 'rule' => 'alphanumeric', - 'rulemsg' => 'Name must be alphanumeric' + 'element' => 'folderId', + 'type' => 'hidden' ), array( 'element' => 'url', 'type' => 'text', - 'default' => 'http://', 'label' => 'Stream URL', 'required' => TRUE, 'requiredmsg'=> 'URL is missing', @@ -309,12 +308,10 @@ $ui_fmask = array( 'rulemsg' => 'URL seems invalid', ), array( - 'element' => 'duration', + 'element' => 'length', 'type' => 'date', - 'label' => 'Duration', - 'options' => array( - 'format' => 'His', - ) + 'label' => 'Length<br><small>Leave zero for Live Stream</small>', + 'options' => array('format' => 'His'), ), array( 'element' => 'Submit', diff --git a/livesupport/modules/htmlUI/var/html/styles.css b/livesupport/modules/htmlUI/var/html/styles.css index 9494a5964..ab6db92a2 100755 --- a/livesupport/modules/htmlUI/var/html/styles.css +++ b/livesupport/modules/htmlUI/var/html/styles.css @@ -86,13 +86,6 @@ margin-top: 10px; } -#uploadform { - width: 800px; - border-style : dotted; - padding : 5px; - margin-top: 10px; -} - #searchform { width: 800px; border-style : dotted; @@ -124,8 +117,15 @@ margin-top: 10px; } -#metadataform {; - width: 800px; +#uploadform { + width: 780px; + border-style : dotted; + padding : 5px; + margin-top: 10px; +} + +#metadataform { + width: 780px; border-style : dotted; padding : 5px; margin-top: 10px; diff --git a/livesupport/modules/htmlUI/var/html/ui_browser.php b/livesupport/modules/htmlUI/var/html/ui_browser.php index 71729dae5..5e4d2f670 100644 --- a/livesupport/modules/htmlUI/var/html/ui_browser.php +++ b/livesupport/modules/htmlUI/var/html/ui_browser.php @@ -56,10 +56,10 @@ if ($uiBrowser->userid) { #$Smarty->assign('PLid', $uiBrowser->PLAYLIST->activeId); switch ($_REQUEST['act']){ - case "fileBrowse": + case "fileList": $Smarty->assign('structure', $uiBrowser->getStructure($uiBrowser->fid)); - $Smarty->assign('fileBrowse', TRUE); + $Smarty->assign('fileList', TRUE); if ($_REQUEST['tree']=='Y') $Smarty->assign('showTree', TRUE); else @@ -71,7 +71,7 @@ if ($uiBrowser->userid) { $Smarty->assign('structure', $uiBrowser->getStructure($uiBrowser->id)); $Smarty->assign('permissions', $uiBrowser->permissions($uiBrowser->id)); - $Smarty->assign('fileBrowse', TRUE); + $Smarty->assign('fileList', TRUE); break; @@ -82,26 +82,15 @@ if ($uiBrowser->userid) { break; - case "uploadFile": + case "editFile": $Smarty->assign('structure', $uiBrowser->getStructure($uiBrowser->id)); - $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'])); + $Smarty->assign('editItem', array('type' => 'file', 'id' => $_REQUEST['id'], 'folderId' => $uiBrowser->fid)); break; - case "addWebstream": + case "editWebstream": $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; - - - case "editMetaData": - $Smarty->assign('structure', $uiBrowser->getStructure($uiBrowser->id)); - - $Smarty->assign('editMetaData', $uiBrowser->editMetaData($uiBrowser->id, TRUE)); + $Smarty->assign('editItem', array('type' => 'webstream', 'id' => $_REQUEST['id'], 'folderId' => $uiBrowser->fid)); break; @@ -161,11 +150,6 @@ if ($uiBrowser->userid) { break; case "PL.simpleManagement": - if ($uiBrowser->PLAYLIST->get() === FALSE) { - if (($ui_tmpid = $uiBrowser->PLAYLIST->create($_REQUEST['id'])) !== FALSE) { - $uiBrowser->SCRATCHPAD->addItem($ui_tmpid); - } - } $Smarty->assign('PL_simpleManagement', TRUE); break; } diff --git a/livesupport/modules/htmlUI/var/html/ui_handler.php b/livesupport/modules/htmlUI/var/html/ui_handler.php index 634e067eb..d5fe49b3c 100644 --- a/livesupport/modules/htmlUI/var/html/ui_handler.php +++ b/livesupport/modules/htmlUI/var/html/ui_handler.php @@ -4,8 +4,10 @@ require dirname(__FILE__).'/../ui_handler_init.php'; switch($_REQUEST['act']){ case "login": - if ($uiHandler->login($_REQUEST, $ui_fmask["login"]) === TRUE) + if ($uiHandler->login($_REQUEST, $ui_fmask["login"]) === TRUE) { + #$uiHandler->checkSystemPrefs(); $uiHandler->PLAYLIST->loadLookedFromPref(); + } break; case "logout": @@ -26,29 +28,24 @@ switch($_REQUEST['act']){ break; case "uploadFile": - if ($ui_tmpid = $uiHandler->uploadFile(array_merge($_REQUEST, $_FILES), $uiHandler->id, $ui_fmask["uploadFile"])) + if ($ui_tmpid = $uiHandler->uploadFile(array_merge($_REQUEST, $_FILES), $ui_fmask["file"])) $uiHandler->SCRATCHPAD->addItem($ui_tmpid); break; case "replaceFile": $ui_tmpgunid = $uiHandler->gb->_gunidFromId($uiHandler->id); if ($uiHandler->delete($uiHandler->id) === TRUE) { - $ui_tmpid = $uiHandler->uploadFile(array_merge($_REQUEST, $_FILES), $uiHandler->pid, $ui_fmask["uploadFile"], $ui_tmpgunid); + $ui_tmpid = $uiHandler->uploadFile(array_merge($_REQUEST, $_FILES), $uiHandler->pid, $ui_fmask["file"], $ui_tmpgunid); $uiHandler->SCRATCHPAD->removeItems($uiHandler->id); $uiHandler->SCRATCHPAD->addItem($ui_tmpid); } break; - case "addWebstream": - if ($ui_tmpid = $uiHandler->addWebstream($_REQUEST, $uiHandler->id, $ui_fmask['addWebstream'])) - $uiHandler->SCRATCHPAD->addItem($ui_tmpid); - break; - - case "replaceWebstream": - $ui_tmpgunid = $uiHandler->gb->_gunidFromId($uiHandler->id); - if ($uiHandler->delete($uiHandler->id) == TRUE) { - $ui_tmpid = $uiHandler->addWebstream($_REQUEST, $uiHandler->pid, $ui_fmask['addWebstream'], $ui_tmpgunid); - $uiHandler->SCRATCHPAD->removeItems($uiHandler->id); + case "editWebstream": + if ($_REQUEST['id']) { + $uiHandler->editWebstream($_REQUEST, $ui_fmask['webstream']); + } else { + $ui_tmpid = $uiHandler->addWebstream($_REQUEST, $ui_fmask['webstream']); $uiHandler->SCRATCHPAD->addItem($ui_tmpid); } break; diff --git a/livesupport/modules/htmlUI/var/templates/fileBrowse/edit.tpl b/livesupport/modules/htmlUI/var/templates/file/edit.tpl similarity index 100% rename from livesupport/modules/htmlUI/var/templates/fileBrowse/edit.tpl rename to livesupport/modules/htmlUI/var/templates/file/edit.tpl diff --git a/livesupport/modules/htmlUI/var/templates/file/fileform.tpl b/livesupport/modules/htmlUI/var/templates/file/fileform.tpl new file mode 100755 index 000000000..e781c3047 --- /dev/null +++ b/livesupport/modules/htmlUI/var/templates/file/fileform.tpl @@ -0,0 +1,9 @@ +{UIBROWSER->fileForm id=$editItem.id folderId=$editItem.folderId assign="_uploadform"} + +<div id="uploadform"> + <center> + {$_uploadform} + </center> +</div> + +{assign var="_uploadform" value=FALSE} diff --git a/livesupport/modules/htmlUI/var/templates/file/list.tpl b/livesupport/modules/htmlUI/var/templates/file/list.tpl new file mode 100755 index 000000000..2e95c4910 --- /dev/null +++ b/livesupport/modules/htmlUI/var/templates/file/list.tpl @@ -0,0 +1,10 @@ +{if $showTree} + {include file="file/tree.tpl"} +{/if} +{if $showObjects} + {include file="file/objects.tpl"} +{/if} + +{if $permissions} + {include file="file/permissions.tpl"} +{/if} diff --git a/livesupport/modules/htmlUI/var/templates/editMetaData.tpl b/livesupport/modules/htmlUI/var/templates/file/metadataform.tpl similarity index 93% rename from livesupport/modules/htmlUI/var/templates/editMetaData.tpl rename to livesupport/modules/htmlUI/var/templates/file/metadataform.tpl index 99c1a8ced..48f2c8086 100755 --- a/livesupport/modules/htmlUI/var/templates/editMetaData.tpl +++ b/livesupport/modules/htmlUI/var/templates/file/metadataform.tpl @@ -1,3 +1,5 @@ +{UIBROWSER->metaDataForm id=$editItem.id assign="_metadataform"} + {literal} <style type="text/css"> .dynformelement { @@ -8,11 +10,10 @@ {/literal} <div id="metadataform"> -{include file="sub/x.tpl"} <center> - {$editMetaData.tabs} - {$editMetaData.langswitch} - {foreach from=$editMetaData.pages key=key item=dynform} + {$_metadataform.tabs} + {$_metadataform.langswitch} + {foreach from=$_metadataform.pages key="key" item="dynform"} {include file="sub/dynForm_plain.tpl"} {/foreach} </center> diff --git a/livesupport/modules/htmlUI/var/templates/file/objects.tpl b/livesupport/modules/htmlUI/var/templates/file/objects.tpl new file mode 100755 index 000000000..eae82799e --- /dev/null +++ b/livesupport/modules/htmlUI/var/templates/file/objects.tpl @@ -0,0 +1,67 @@ +{PL->getActiveId assign=_PL_activeId} + +<div id="objects"> +{include file="sub/x.tpl"} + + +<table border="0" width="90%" align="center"> + <tr bgcolor="{cycle values='#eeeeee, #dadada"'}"> + <th>Title</th> + <th>Type</th> + <td align="right" width='70%'> + {if $START.pid}<a href="{$UI_BROWSER}?act=fileBrowse&id={$GLOBALS.pid}">[go up]</a>{/if} + </td> + </tr> + {if count($structure.listdata)} + {foreach from=$structure.listdata item=i} + <tr bgcolor="{cycle values='#eeeeee, #dadada"'}" {assign var="moreContextBefore" value=", 'SP.addItem'"}{include file="sub/contextmenu.tpl"}> + <td align="center"> + <span id="ID{$i.id}"> + {if $i.type eq 'Folder'} + <a href="{$UI_BROWSER}?act=fileBrowse&id={$i.id}" >[{$i.title|truncate:30}]</b> + {else} + {if $_PL_activeId == $i.id} + <b>{$i.title|truncate:30}</b> + {else} + {$i.title|truncate:30} + {/if} + {/if} + </span> + </td> + <td align="center">{$i.type}</td> + <td> + <!-- <a href="javascript:frename('{$i.name}', '{$i.id}')">[rename]</a> --> + <a href="javascript:fmove('{$i.id}', '.')">[move]</a> + <a href="javascript:fcopy('{$i.id}', '.')">[copy]</a> + <a href="{$UI_BROWSER}?act=permissions&id={$i.id}">[permissions]</a> + <!-- + {if ($delOverride eq $i.id)} + <a href="{$UI_HANDLER}?act=delete&id={$i.id}&delOverride={$i.id}" + onClick="return confirm('Really delete non empty Folder "{$i.name}" now?')">[DEL]</a> + {else} + <a href="{$UI_HANDLER}?act=delete&id={$i.id}" + onClick="return confirm('Delete "{$i.name}"?')">[DEL]</a> + {/if} --> + {if $i.type != 'Folder'} + <br> + <a href="{$UI_BROWSER}?act=getMData&id={$i.id}">[MDataXML]</a> + <!-- <a href="{$UI_BROWSER}?act=editMetaData&id={$i.id}">[MDataForm]</a> --> + {if $i.type eq 'webstream'} + <a href="{$UI_BROWSER}?act=editWebstream&id={$i.id}">[Edit]</a> + {elseif $i.type eq 'audioclip'} + <a href="{$UI_BROWSER}?act=editFile&id={$i.id}">[Edit]</a> + <a href="{$CONFIG.accessRawAudioUrl}?id={$i.gunid}&sessid={$START.sessid}">[Access]</a> + <a href="{$UI_BROWSER}?act=_analyzeFile&id={$i.id}">[RawAnalyze]</a> + {/if} + <!-- <a href="#" onclick="hpopup('{$UI_HANDLER}?act=SP.addItem&id={$i.id}', '2SP')">[SP]</a> --> + {/if} + + </td> + </tr> + {/foreach} + {else} + <tr><td align="center" width="400">No objects</td></tr> + {/if} +</table> + +</div> \ No newline at end of file diff --git a/livesupport/modules/htmlUI/var/templates/file/path.tpl b/livesupport/modules/htmlUI/var/templates/file/path.tpl new file mode 100755 index 000000000..9e2282b0a --- /dev/null +++ b/livesupport/modules/htmlUI/var/templates/file/path.tpl @@ -0,0 +1,12 @@ +{*Smarty template*} + +<div id="path"> + <a href="{$UI_BROWSER}?act=fileBrowse&id={$structure.id}&tree=Y" class="button">[Tree view]</a> | + {foreach from=$structure.pathdata item=o} + {if $o.type == 'Folder'} + <a href="{$UI_BROWSER}?act=fileBrowse&id={$o.id}">[{$o.name}]</a> / + {else} + {$o.name} + {/if} + {/foreach} +</div> \ No newline at end of file diff --git a/livesupport/modules/htmlUI/var/templates/file/permissions.tpl b/livesupport/modules/htmlUI/var/templates/file/permissions.tpl new file mode 100755 index 000000000..4aa0a7704 --- /dev/null +++ b/livesupport/modules/htmlUI/var/templates/file/permissions.tpl @@ -0,0 +1,68 @@ +<div id="permissions"> +{include file="sub/x.tpl"} + +<table id="tbl" border="0" cellpadding="5"> + <tr><td><b>Subject Name</b></td><td><b>Action</b></td><td><b>Permission</b></td><td></td></tr> + + {if (is_array($permissions.perms) && count($permissions.perms)>0)} + + {foreach from=$permissions.perms item=row} + {if $row.type eq 'A'} + {assign var='da' value='allow'} + {else} + {if $row.type eq 'D'} + {assign var='da' value='deny'} + {else} + {assign var='da' value=$row.type} + {/if} + {/if} + + <tr bgcolor="{cycle values='#eeeeee, #dadada'}"> + <td>{* <a <?php #href="alibExPList.php?id=<?php echo$row['subj']? >"?>> *}{$row.login}</a></td> + <td>{$row.action}</td> + <td>{$da}</td> + <td> + <a href="{$UI_HANDLER}?act=removePerm&permid={$row.permid}&oid={$permissions.id}&id={$permissions.id}" + onClick="return confirm('Delete permission "{$da} {$row.action}" for user {$row.login}?')">[remove]</a> + </td> + </tr> + {/foreach} + {else} + <tr><td colspan="4">No Permissions set.</td></tr> + {/if} +</table> + +<br> + +<form action="{$UI_HANDLER}" method="post"> + +Add Permission +<select name="allowDeny"> + <option value="A">Allow</option> + <option value="D">Deny</option> +</select> + +for Action +<select name="permAction"> + <option value="_all">all</option> + {if is_array($permissions.actions)} + {foreach from=$permissions.actions item='it'} + <option value="{$it}">{$it}</option> + {/foreach} + {/if} +</select> + +to Subject +<select name="subj"> + {if is_array($permissions.subjects)} + {foreach from=$permissions.subjects item='it'} + <option value="{$it.id}">{$it.login}</option> + {/foreach} + {/if} +</select> +<input type="hidden" name="act" value="addPerm"> +<input type="hidden" name="id" value="{$permissions.id}"> +<input type="submit" value="Do it!"> +</form> + +</div> \ No newline at end of file diff --git a/livesupport/modules/htmlUI/var/templates/file/tree.tpl b/livesupport/modules/htmlUI/var/templates/file/tree.tpl new file mode 100755 index 000000000..1b7070083 --- /dev/null +++ b/livesupport/modules/htmlUI/var/templates/file/tree.tpl @@ -0,0 +1,24 @@ +{*Smarty template*} + +<div id="tree"> + +{if is_array($structure.treedata)} + {foreach from=$structure.treedata item=o} + <div style="background-color: {cycle values="#eeeeee,#dadada"}"> + {$structure.treedata.type} + {if $structure.treedata.tree} + {str_repeat str=' ' count=3} + {else} + {str_repeat str=' ' count=$o.level} + {/if} + {if $o.type == 'Folder'} + <a href="{$UI_BROWSER}?act=fileBrowse&id={$o.id}">[{$o.name}]</a> + {else} + {$o.name} + {/if} + <br> + </div> + {/foreach} +{/if} + +</div> \ No newline at end of file diff --git a/livesupport/modules/htmlUI/var/templates/file/webstreamform.tpl b/livesupport/modules/htmlUI/var/templates/file/webstreamform.tpl new file mode 100755 index 000000000..a2d072fcb --- /dev/null +++ b/livesupport/modules/htmlUI/var/templates/file/webstreamform.tpl @@ -0,0 +1,10 @@ +{UIBROWSER->webstreamForm id=$editItem.id folderId=$editItem.folderId assign="_uploadform"} + +<div id="uploadform"> + <center> + {$_uploadform} + </center> +</div> + +{assign var="_uploadform" value=FALSE} + diff --git a/livesupport/modules/htmlUI/var/templates/masterpanel.tpl b/livesupport/modules/htmlUI/var/templates/masterpanel.tpl index 6b4b0b203..68ce2c877 100755 --- a/livesupport/modules/htmlUI/var/templates/masterpanel.tpl +++ b/livesupport/modules/htmlUI/var/templates/masterpanel.tpl @@ -13,11 +13,11 @@ {/if} {if $structure} - {include file="fileBrowse/path.tpl"} + {include file="file/path.tpl"} {/if} -{if $fileBrowse} - {include file="fileBrowse/fileBrowse.tpl"} +{if $fileList} + {include file="file/list.tpl"} {/if} {if $showLibrary} @@ -32,8 +32,8 @@ {include file="filedata.tpl"} {/if} -{if $uploadform} - {include file="uploadform.tpl"} +{if $editItem} + {include file="file/edit.tpl"} {/if} {if $editMetaData} diff --git a/livesupport/modules/htmlUI/var/templates/menu_top.tpl b/livesupport/modules/htmlUI/var/templates/menu_top.tpl index 9e8bd721b..9a5597359 100755 --- a/livesupport/modules/htmlUI/var/templates/menu_top.tpl +++ b/livesupport/modules/htmlUI/var/templates/menu_top.tpl @@ -1,8 +1,8 @@ <div id="menu_top"> - <a href="{$UI_BROWSER}?act=fileBrowse&id={$START.fid}">[File Browser]</a> + <a href="{$UI_BROWSER}?act=fileList&id={$START.fid}">[File List]</a> <!-- <a href="{$UI_BROWSER}?id={$START.fid}&act=uploadFileM">[UploadM]</a> --> - <a href="{$UI_BROWSER}?id={$START.fid}&act=uploadFile">[Upload]</a> - <a href="{$UI_BROWSER}?id={$START.fid}&act=addWebstream">[Stream]</a> + <a href="{$UI_BROWSER}?folderId={$START.fid}&act=editFile">[Upload]</a> + <a href="{$UI_BROWSER}?folderId={$START.fid}&act=editWebstream">[Stream]</a> <a href="{$UI_BROWSER}?id={$START.fid}&act=PL.simpleManagement">[PL Editor]</a> <a href="javascript:newFolder()">[Create new folder]</a> <a href="{$UI_BROWSER}?id={$START.id}&act=SEARCH">[Search]</a> diff --git a/livesupport/modules/htmlUI/var/templates/playlist/editor.tpl b/livesupport/modules/htmlUI/var/templates/playlist/editor.tpl index 4d8da6f86..6366fe34e 100755 --- a/livesupport/modules/htmlUI/var/templates/playlist/editor.tpl +++ b/livesupport/modules/htmlUI/var/templates/playlist/editor.tpl @@ -33,6 +33,7 @@ </tr> <tr> - <td colspan="2"><input type="button" value="Save Changes" onClick="hpopup('{$UI_HANDLER}?act=PL.save')"></td> + <td><input type="button" value="Save Changes" onClick="hpopup('{$UI_HANDLER}?act=PL.save')"></td> <td colspan="2"><input type="button" value="Revert all Changes" onClick="hpopup('{$UI_HANDLER}?act=PL.revert')"></td> + <td><input type="button" value="Delete" onClick="hpopup('{$UI_HANDLER}?act=PL.delete')"></td> </tr> diff --git a/livesupport/modules/htmlUI/var/templates/uploadform.tpl b/livesupport/modules/htmlUI/var/templates/uploadform.tpl deleted file mode 100755 index 110ad0dc9..000000000 --- a/livesupport/modules/htmlUI/var/templates/uploadform.tpl +++ /dev/null @@ -1,9 +0,0 @@ -{*Smarty template*} - -<div id="uploadform"> -{include file="sub/x.tpl"} - <center> - {$uploadform} - </center> -</div> - diff --git a/livesupport/modules/htmlUI/var/ui_base.inc.php b/livesupport/modules/htmlUI/var/ui_base.inc.php index b6ec8054e..4dc6fd29e 100644 --- a/livesupport/modules/htmlUI/var/ui_base.inc.php +++ b/livesupport/modules/htmlUI/var/ui_base.inc.php @@ -323,9 +323,10 @@ class uiBase } - function _niceTime($in) + function _niceTime($in, $all=FALSE) { if(is_array($in)) $in = current($in); + if (strpos($in, '.')) list ($in, $lost) = explode('.', $in); $in = str_replace(' ', '', $in); @@ -333,7 +334,7 @@ class uiBase elseif (preg_match('/^[0-9]{1,2}:[0-9]{1,2}$/', $in)) list($i, $s) = explode(':', $in); else $s = $in; - if ($h > 0) $H = $this->_twoDigits($h).':'; + if ($all || $h > 0) $H = $this->_twoDigits($h).':'; else $H = ' '; $I = $this->_twoDigits($i).':'; $S = $this->_twoDigits($s); diff --git a/livesupport/modules/htmlUI/var/ui_browser.class.php b/livesupport/modules/htmlUI/var/ui_browser.class.php index 629c17aad..02490fb76 100644 --- a/livesupport/modules/htmlUI/var/ui_browser.class.php +++ b/livesupport/modules/htmlUI/var/ui_browser.class.php @@ -171,12 +171,16 @@ class uiBrowser extends uiBase { * * @eturn string (html) */ - function uploadFile(&$mask, $id, $replace=FALSE) + function fileForm($parms) { + extract ($parms); + $mask =& $GLOBALS['ui_fmask']['file']; + $form = new HTML_QuickForm('uploadFile', UI_STANDARD_FORM_METHOD, UI_HANDLER); $form->setMaxFileSize($this->STATIONPREFS['stationMaxfilesize']); - $form->setConstants(array('id' => $id, - 'act' => $replace ? 'replaceFile' : 'uploadFile')); + $form->setConstants(array('folderId' => $folderId, + 'id' => $id, + 'act' => $id ? 'editFile' : 'uploadFile')); $this->_parseArr2Form($form, $mask); return $form->toHTML(); } @@ -191,11 +195,20 @@ class uiBrowser extends uiBase { * * @eturn string (html) */ - function addWebstream($mask, $id, $replace=FALSE) + function webstreamForm($parms) { + extract ($parms); + $mask =& $GLOBALS['ui_fmask']['webstream']; + $form = new HTML_QuickForm('addWebstream', UI_STANDARD_FORM_METHOD, UI_HANDLER); - $form->setConstants(array('id' => $id, - 'act' => $replace ? 'replaceWebstream' : 'addWebstream')); + $const = array('folderId' => $folderId, + 'id' => $id, + 'act' => 'editWebstream', + 'title' => $id ? $this->_getMDataValue($id, UI_MDATA_KEY_TITLE) : NULL, + 'url' => $id ? $this->_getMDataValue($id, UI_MDATA_KEY_URL) : 'http://', + 'length' => $id ? $this->_niceTime($this->_getMDataValue($id, UI_MDATA_KEY_DURATION), TRUE) : NULL + ); + $form->setConstants($const); $this->_parseArr2Form($form, $mask); return $form->toHTML(); } @@ -351,8 +364,10 @@ class uiBrowser extends uiBase { * @param id int * @return string (html) */ - function editMetaData($id, $get=FALSE, $data=NULL) - { + function metaDataForm($parms, $get=FALSE, $data=NULL) + { + extract ($parms); + include dirname(__FILE__).'/formmask/metadata.inc.php'; $form = new HTML_QuickForm('tabs', UI_STANDARD_FORM_METHOD, UI_BROWSER); diff --git a/livesupport/modules/htmlUI/var/ui_handler.class.php b/livesupport/modules/htmlUI/var/ui_handler.class.php index 99dece0f2..385c65a90 100644 --- a/livesupport/modules/htmlUI/var/ui_handler.class.php +++ b/livesupport/modules/htmlUI/var/ui_handler.class.php @@ -99,7 +99,7 @@ class uiHandler extends uiBase { { if (!$this->_isFolder($id)) { $this->_retMsg('Target is not Folder'); - $this->redirUrl = UI_BROWSER.'?act=fileBrowse&id='.$id; + $this->redirUrl = UI_BROWSER.'?act=fileList&id='.$id; return FALSE; } if (!$this->_validateForm($formdata, $mask)) { @@ -124,7 +124,7 @@ class uiHandler extends uiBase { $this->redirUrl = UI_BROWSER."?act=uploadFileM&id=".$id; return FALSE; } - $this->redirUrl = UI_BROWSER."?act=fileBrowse&id=".$id; + $this->redirUrl = UI_BROWSER."?act=fileList&id=".$id; return $r; } @@ -137,15 +137,18 @@ class uiHandler extends uiBase { * @param formdata array, submitted text and file * @param id int, destination folder id */ - function uploadFile(&$formdata, $id, &$mask, $replace=NULL) + function uploadFile(&$formdata, &$mask, $replace=NULL) { - if (!$replace && $this->type!='Folder') { + $id = $formdata['id']; + $folderId = $formdata['folderId']; + + if ($this->gb->getFileType($folderId) != 'Folder') { $this->_retMsg ('Target is not Folder'); - $this->redirUrl = UI_BROWSER."?act=fileBrowse&id=".$pid; + $this->redirUrl = UI_BROWSER."?act=fileList"; return FALSE; } if (!$this->_validateForm($formdata, $mask)) { - $this->redirUrl = UI_BROWSER."?act=uploadFile&id=".$id; + $this->redirUrl = UI_BROWSER."?act=editFile&id=".$id; return FALSE; } $tmpgunid = md5(microtime().$_SERVER['SERVER_ADD3R'].rand()."org.mdlf.livesupport"); @@ -153,17 +156,18 @@ class uiHandler extends uiBase { move_uploaded_file($formdata['mediafile']['tmp_name'], $ntmp); chmod($ntmp, 0664); - $r = $this->gb->putFile($id, $formdata['mediafile']['name'], $ntmp, NULL, $this->sessid, $replace); + $r = $this->gb->putFile($folderId, $formdata['mediafile']['name'], $ntmp, NULL, $this->sessid, $replace); @unlink($ntmp); if(PEAR::isError($r)) { $this->_retMsg($r->getMessage()); - $this->redirUrl = UI_BROWSER."?act=uploadFile&id=".$pid; + $this->redirUrl = UI_BROWSER."?act=editFile&id=".$id; return FALSE; } $this->transMData($r); - $this->redirUrl = UI_BROWSER."?act=editMetaData&id=$r"; + $this->redirUrl = UI_BROWSER."?act=editFile&id=$r"; + $this->_retMsg('File saved'); return $r; } @@ -196,31 +200,72 @@ class uiHandler extends uiBase { * @param formdata array, submitted text and file * @param id int, destination folder id */ - function addWebstream(&$formdata, $id, &$mask, $replace=NULL) + function addWebstream(&$formdata, &$mask) { - if (!$replace && $this->type != 'Folder') { + $id = $formdata['id']; + $folderId = $formdata['folderId']; + + if ($this->gb->getFileType($folderId) != 'Folder') { $this->_retMsg ('Target is not Folder'); - $this->redirUrl = UI_BROWSER."?act=fileBrowse&id=".$pid; + $this->redirUrl = UI_BROWSER."?act=fileList"; return FALSE; } if (!$this->_validateForm($formdata, $mask)) { - $this->redirUrl = UI_BROWSER."?act=addWebstream&id=".$id; + $this->redirUrl = UI_BROWSER."?act=editWebstream&id=".$id; return FALSE; } - $r = $this->gb->storeWebstream($id, $formdata['name'], NULL, $this->sessid, $replace, $formdata['url']); + $r = $this->gb->storeWebstream($folderId, date('Y-m-d H:i:s'), NULL, $this->sessid, NULL, $formdata['url']); if(PEAR::isError($r)) { $this->_retMsg($r->getMessage()); - $this->redirUrl = UI_BROWSER."?act=addWebstream&id=".$id; + $this->redirUrl = UI_BROWSER."?act=editWebstream&id=".$id; return FALSE; } - $data = $this->_dateArr2Str($formdata); - $this->gb->setMDataValue($r, 'dc:title', $this->sessid, $data['name']); - $this->gb->setMDataValue($r, 'dcterms:extent', $this->sessid, $data['duration']); - $this->redirUrl = UI_BROWSER."?act=editMetaData&id=$r"; + $length = $this->_twoDigits($formdata['length']['H']).':'.$this->_twoDigits($formdata['length']['i']).':'.$this->_twoDigits($formdata['length']['s']).'.000000'; + $this->gb->setMDataValue($r, UI_MDATA_KEY_TITLE, $this->sessid, $data['title']); + $this->gb->setMDataValue($r, UI_MDATA_KEY_DURATION, $this->sessid, $length); + $this->redirUrl = UI_BROWSER."?act=editWebstream&id=$r"; + $this->_retMsg('Stream saved'); return $r; } + function editWebstream(&$formdata, &$mask) + { + $id = $formdata['id']; + if (!$this->_validateForm($formdata, $mask)) { + $this->redirUrl = UI_BROWSER."?act=editWebstream&id=".$id; + return FALSE; + } + $length = $this->_twoDigits($formdata['length']['H']).':'.$this->_twoDigits($formdata['length']['i']).':'.$this->_twoDigits($formdata['length']['s']).'.000000'; + $this->gb->setMDataValue($id, UI_MDATA_KEY_URL, $this->sessid, $formdata['url']); + $this->gb->setMDataValue($id, UI_MDATA_KEY_DURATION, $this->sessid, $length); + $this->_retMsg('Stream changed'); + $this->redirUrl = UI_BROWSER.'?act=editWebstream&id='.$formdata['id']; + } + + + function editMetaData($id, &$formdata) + { + include dirname(__FILE__).'/formmask/metadata.inc.php'; + + ## first remove old entrys + #$this->gb->replaceMetaData($id, $this->_analyzeFile($id, 'xml'), 'string', $this->sessid); + + foreach ($mask['pages'] as $key=>$val) { + foreach ($mask['pages'][$key] as $k=>$v) { + $formdata[$key.'___'.$this->_formElementEncode($v['element'])] ? $mData[$this->_formElementDecode($v['element'])] = $formdata[$key.'___'.$this->_formElementEncode($v['element'])] : NULL; + } + } + $data = $this->_dateArr2Str($mData); + foreach ($data as $key=>$val) { + $this->gb->setMDataValue($id, $key, $this->sessid, $val); + } + $this->_retMsg('Metadata saved'); + $type = $this->gb->getFileType($id)=='webstream' ? 'Webstream' : 'File'; + $this->redirUrl = UI_BROWSER."?act=edit$type&id=$id"; + } + + /** * newFolder * @@ -234,7 +279,7 @@ class uiHandler extends uiBase { $r = $this->gb->createFolder($id, $name, $this->sessid); if(PEAR::isError($r)) $this->_retMsg($r->getMessage()); - $this->redirUrl = UI_BROWSER.'?act=fileBrowse&id='.$this->id; + $this->redirUrl = UI_BROWSER.'?act=fileList&id='.$this->id; } /** @@ -249,7 +294,7 @@ class uiHandler extends uiBase { { $r = $this->gb->renameFile($id, $newname, $this->sessid); if(PEAR::isError($r)) $this->_retMsg($r->getMessage()); - $this->redirUrl = UI_BROWSER."?act=fileBrowse&id=".$this->pid; + $this->redirUrl = UI_BROWSER."?act=fileList&id=".$this->pid; } /** @@ -268,9 +313,9 @@ class uiHandler extends uiBase { $r = $this->gb->moveFile($id, $did, $this->sessid); if(PEAR::isError($r)){ $this->_retMsg($r->getMessage()); - $this->redirUrl = UI_BROWSER."?act=fileBrowse&id=".$this->pid; + $this->redirUrl = UI_BROWSER."?act=fileList&id=".$this->pid; } - else $this->redirUrl = UI_BROWSER."?act=fileBrowse&id=".$did; + else $this->redirUrl = UI_BROWSER."?act=fileList&id=".$did; } /** @@ -289,9 +334,9 @@ class uiHandler extends uiBase { $r = $this->gb->copyFile($id, $did, $this->sessid); if(PEAR::isError($r)){ $this->_retMsg($r->getMessage()); - $this->redirUrl = UI_BROWSER."?act=fileBrowse&id=".$this->pid; + $this->redirUrl = UI_BROWSER."?act=fileList&id=".$this->pid; } - else $this->redirUrl = UI_BROWSER."?act=fileBrowse&id=".$did; + else $this->redirUrl = UI_BROWSER."?act=fileList&id=".$did; } /** @@ -304,12 +349,12 @@ class uiHandler extends uiBase { */ function delete($id, $delOverride=FALSE) { - $this->redirUrl = UI_BROWSER."?act=fileBrowse&id=".$this->pid; + $this->redirUrl = UI_BROWSER."?act=fileList&id=".$this->pid; if (!($delOverride==$id) && (count($this->gb->getObjType($id)=='Folder'? $this->gb->listFolder($id, $this->sessid):NULL))) { $this->_retMsg("Folder is not empty. You can override this protection by clicking DEL again"); - $this->redirUrl = UI_BROWSER."?act=fileBrowse&id=".$this->pid."&delOverride=$id"; + $this->redirUrl = UI_BROWSER."?act=fileList&id=".$this->pid."&delOverride=$id"; return FALSE; } @@ -520,27 +565,6 @@ class uiHandler extends uiBase { } - function editMetaData($id, &$formdata) - { - include dirname(__FILE__).'/formmask/metadata.inc.php'; - - $this->redirUrl = UI_BROWSER.'?act=fileBrowse&id='.$this->pid; - ## first remove old entrys - $this->gb->replaceMetaData($id, $this->_analyzeFile($id, 'xml'), 'string', $this->sessid); - - foreach ($mask['pages'] as $key=>$val) { - foreach ($mask['pages'][$key] as $k=>$v) { - $formdata[$key.'___'.$this->_formElementEncode($v['element'])] ? $mData[$this->_formElementDecode($v['element'])] = $formdata[$key.'___'.$this->_formElementEncode($v['element'])] : NULL; - } - } - $data = $this->_dateArr2Str($mData); - foreach ($data as $key=>$val) { - $this->gb->setMDataValue($id, $key, $this->sessid, $val); - } - $this->_retMsg('Metadata saved'); - } - - function _validateForm(&$formdata, &$mask) { $form = new HTML_QuickForm('validation', UI_STANDARD_FORM_METHOD, UI_HANDLER); diff --git a/livesupport/modules/htmlUI/var/ui_playlist.class.php b/livesupport/modules/htmlUI/var/ui_playlist.class.php index 1b660722b..42d8ca7dc 100755 --- a/livesupport/modules/htmlUI/var/ui_playlist.class.php +++ b/livesupport/modules/htmlUI/var/ui_playlist.class.php @@ -24,7 +24,7 @@ class uiPlaylist } function getActiveId() - { + { if (!$this->activeId) { return FALSE; } @@ -147,7 +147,7 @@ class uiPlaylist return TRUE; } - function create($id=FALSE) + function create($id) { # create PL # activate @@ -157,7 +157,8 @@ class uiPlaylist return FALSE; } $datetime = date('Y-m-d H:i:s'); - if (!$plid = $this->Base->gb->createPlaylist($this->Base->homeid, $datetime, $this->Base->sessid)) { + $plid = $this->Base->gb->createPlaylist($this->Base->homeid, $datetime, $this->Base->sessid); + if (!$plid) { $this->Base->_retMsg('Cannot create Playlist'); return FALSE; } @@ -165,11 +166,12 @@ class uiPlaylist if ($this->activate($plid)===FALSE) { return FALSE; } - if ($id!==FALSE) { + if ($id) { if ($this->addItem($id)!==TRUE) { return FALSE; } } + #$this->redirUrl = UI_BRWOSER.'?popup=_2PL.simpleManagement'; return $plid; }